/* ========= BASE STYLES & CSS VARIABLES ========== */

html {
  scrollbar-gutter: stable;
}

:root {
  --cfg: #ffffff;
  --cbg: #0f172a;
  --cdark: #9ca3af;
  --clight: #1e293b;
  --cmed: #334155;
  --clink: #3b82f6;
  --cemph: #3b82f6;
  --cemphbg: rgba(59, 130, 246, 0.1);
  --ornament: "";
  --navpos: fixed;
}

/* Monochrome emoji icons for landing page features */
#features article h4 {
  filter: grayscale(100%) brightness(1.5);
}

h1 {
  margin-top: 0;
  padding-top: 0;
}

h2::before,
h3::before {
  /* remove default number indexing from classless.css */
  content: none !important;
}

/* ==============LINKS========= */

a {
  text-decoration: none !important;
  color: var(--clink);
  transition: color 0.2s ease;
}

a:hover {
  text-decoration: underline !important;
}

:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.copy-trigger {
  display: inline-block;
  width: 18px;
  text-align: center;
  white-space: nowrap;
}

/* ===============HEADER / NAVIGATION ====== */

header img,
nav img {
  filter: invert(1);
}

header,
nav {
  margin-bottom: 0;
}

nav ul:first-child {
  max-width: var(--width);
  margin: 0 auto;
}

/* ==============HERO=========== */

.hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.hero h1 {
  font-weight: 800;
  font-size: 3.5rem;
  margin: 0;
}

.hero img {
  height: 8rem;
}

/* ===============LAYOUT / GRID======== */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* ============CARDS / ARTICLES======= */

article {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
  padding: 2rem;
  border: 1px solid var(--cmed);
  border-radius: 8px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  background-color: var(--cbg);
  position: relative;
  min-width: 0;
  box-sizing: border-box;
}

article:hover {
  transform: translateY(-1px);
  border-color: var(--cemph);
}

/* ===============METRICS / DASHBOARD==== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.metrics-grid details {
  border: 1px solid var(--cmed);
  padding: 0.5rem;
  border-radius: 4px;
  min-width: 0;
}

.metrics-grid details:first-child {
  grid-column: 1 / -1;
}

/* =============STATUS / FEEDBACK====== */

#status.feedback {
  min-height: 2.5rem;
}

.loading-indicator {
  display: none;
  font-weight: 500;
  animation: pulse 1.5s ease-in-out infinite;
}

#status.htmx-request .loading-indicator {
  display: inline-block;
}

#status.htmx-request #status-message {
  display: none;
}

#status-message:not(:empty) {
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

tr.htmx-swapping {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* =============== ANALYTICS ELEMENTS ==== */

.analytics-cards {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.analytics-cards article {
  flex: 1;
  text-align: center;
}

.analytics-cards h3 {
  margin: 0;
}

.analytics-cards article:nth-child(1) h3 {
  color: var(--cemph);
}

.analytics-cards article:nth-child(2) h3 {
  color: var(--clink);
}

.analytics-cards article:nth-child(3) h3 {
  color: var(--cfg);
}

.analytics-trend {
  margin: 1.5rem 0 1rem 0;
  width: 100%;
  box-sizing: border-box;
}

.analytics-trend h4 {
  margin: 0 0 0.5rem 0;
}

.analytics-trend p {
  display: flex;
  gap: 1rem;
  margin: 0 0 1rem 0;
  font-size: 0.75rem;
  justify-content: flex-start;
}

.analytics-trend p span {
  display: flex;
  align-items: center;
  height: auto;
  width: auto;
}

.analytics-trend p span b,
.analytics-trend p span i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
}

.analytics-trend p span b {
  background: var(--cdark);
}

.analytics-trend p span i {
  background: var(--clink);
}

.analytics-trend section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
  border-bottom: none;
  padding-bottom: 0;
  width: 100%;
  box-sizing: border-box;
}

.analytics-trend section div {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
  padding-right: 45px;
}

.analytics-trend time {
  width: 120px;
  flex-shrink: 0;
  text-align: right;
  color: var(--cdark);
  margin-top: 0;
  line-height: 1;
}

.analytics-trend section span {
  flex: 1;
  display: flex;
  height: 12px;
  background: var(--clight);
  border-radius: 4px;
  overflow: hidden;
  gap: 0;
  justify-content: flex-start;
  min-width: 0;
}

.analytics-trend section span b {
  background: var(--cdark);
  height: 100%;
  border-radius: 0;
}

.analytics-trend section span i {
  background: var(--clink);
  height: 100%;
  border-radius: 0;
}

.analytics-trend strong {
  width: 35px;
  text-align: right;
  flex-shrink: 0;
  font-weight: bold;
}

.analytics-breakdown {
  margin-bottom: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.analytics-breakdown h4 {
  margin: 0 0 0.5rem 0;
}

.analytics-breakdown dl {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  margin: 0.4rem 0;
  padding: 0;
  font-size: 0.85rem;
  width: 100%;
  overflow: hidden !important;
  box-sizing: border-box;
}

.analytics-breakdown dt {
  width: 120px;
  flex-shrink: 0;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}

.analytics-breakdown dd {
  flex: 1;
  background: var(--clight);
  height: 12px;
  border-radius: 4px;
  margin: 0;
  min-width: 0;
}

.analytics-breakdown dd div {
  background: var(--cemph);
  height: 100%;
  border-radius: 4px;
}

.analytics-breakdown b {
  width: 35px;
  text-align: right;
  flex-shrink: 0;
  font-weight: bold;
}

.analytics-breakdown i {
  width: 45px;
  text-align: right;
  color: var(--cdark);
  font-style: normal;
  flex-shrink: 0;
}

/* =============== ANIMATIONS ============ */

@keyframes treeReveal {
  0% {
    clip-path: inset(0 0 100% 0);
  }

  100% {
    clip-path: inset(0 0 0 0);
  }
}

.journey-tree {
  animation: treeReveal 2s ease-out 2;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 1;
  }
}

@keyframes fadeAndVanish {

  0%,
  70% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* ===========RESPONSIVE / MOBILE======= */

@media (max-width: 600px) {
  article {
    padding: 1rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  table thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    padding: 1rem;
    border: 2px solid var(--cmed);
    border-radius: 12px;
    margin-bottom: 1rem;
    box-sizing: border-box;
  }

  td {
    padding: 0.25rem 0;
    border: none !important;
    text-align: left;
  }

  td:first-child {
    font-size: 1.2rem;
    font-weight: bold;
  }

  td:last-child {
    display: flex;
    gap: 0.5rem;
  }

  td:last-child button {
    margin: 0;
    flex: 1;
  }

  .analytics-cards {
    flex-direction: column;
  }

  .analytics-trend section div,
  .analytics-breakdown dl {
    gap: 0.4rem;
  }

  .analytics-trend time,
  .analytics-breakdown dt {
    width: 85px;
  }

  .analytics-trend strong,
  .analytics-breakdown b {
    width: 35px;
  }

  .analytics-breakdown i {
    width: 40px;
  }
}