/* ==========================================================================
   STOXVAULT — shell, header, tab bar, panel layouts, responsive rules
   Breakpoints: 375 (base / small phone) → 768 (tablet) → 1024 → 1280 (desk)
   Mobile-first: the base rules ARE the 375px layout.
   ========================================================================== */

/* ---- shell -------------------------------------------------------------- */
.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell--flush { padding-inline: 0; }

/* ==========================================================================
   Header — brand left · centred pill tab bar · tools right
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: var(--hairline) solid var(--rule-soft);
}
.nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--nav-h);
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--ink);
  min-width: 0;
}
/* The mark is a raster PNG with a transparent ground, so it sits on both
   themes without a plate behind it. */
.nav__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}
.nav__wordmark {
  font-size: 1.0625rem;
  font-weight: var(--fw-bold);
  letter-spacing: -0.015em;
  white-space: nowrap;
}

/* The tab bar is the only navigation. It is centred in the header on desk,
   and becomes a horizontal scroller on a phone. */
.tabbar-wrap {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.tabbar {
  display: flex;
  align-items: center;
  gap: var(--s-05);
  width: max-content;
  margin-inline: auto;
  padding: 3px;
}
.tabbar__tab {
  flex: 0 0 auto;
  padding: var(--s-1) var(--s-2);
  border-radius: var(--radius-pill);
  border: var(--hairline) solid transparent;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  letter-spacing: 0.005em;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.tabbar__tab:hover { color: var(--ink-2); }
.tabbar__tab[aria-selected="true"] {
  background: var(--gold-wash);
  border-color: var(--gold-line);
  color: var(--gold-bright);
  font-weight: var(--fw-semi);
}

.nav__tools {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  justify-self: end;
}

/* The contract-address button: the ticker in mono, an outline, no fill. */
.nav__coin {
  gap: 6px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  color: var(--ink-2);
}
.nav__coin:hover:not(:disabled) { color: var(--ink); }
.nav__coin-ticker { font-size: var(--fs-xs); font-weight: var(--fw-semi); }

/* ==========================================================================
   Main + tab panels
   ========================================================================== */
.main {
  padding-block: var(--s-3) var(--s-6);
}
.view {
  display: grid;
  gap: var(--s-3);
  align-content: start;
}
.view:focus-visible { outline-offset: 4px; }

.view__head {
  display: grid;
  gap: var(--s-1);
}
.idstrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-15);
  font-size: var(--fs-sm);
  min-width: 0;
}
.idstrip__name { color: var(--ink-2); }
.idstrip__sep  { color: var(--ink-4); }
.idstrip__sym  { color: var(--ink-3); }

/* ---- overview: two cards across, stacking on a phone -------------------- */
.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
  align-items: start;
}

/* ---- two-column panels (basket, demand, rounds) ------------------------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
  align-items: start;
}

/* ---- how it works ------------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

/* ---- footer ------------------------------------------------------------- */
.site-footer {
  border-top: var(--hairline) solid var(--rule);
  background: var(--paper-sunk);
  padding-block: var(--s-5) var(--s-5);
  margin-top: var(--s-6);
}
.foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}
.foot__disclaimers { display: grid; gap: var(--s-15); max-width: 76ch; }
.foot__disclaimer {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  line-height: 1.5;
}
.foot__tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}
.foot__bottom {
  margin-top: var(--s-4);
  padding-top: var(--s-2);
  border-top: var(--hairline) solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  align-items: center;
  font-size: var(--fs-xs);
  color: var(--ink-4);
}

/* ==========================================================================
   >= 768px — tablet
   ========================================================================== */
@media (min-width: 768px) {
  :root { --gutter: var(--s-3); }

  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .split { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: var(--s-3); }
  .split--even   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split--ledger { grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); }

  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot  { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

/* ==========================================================================
   >= 1024px — the overview keeps its two cards side by side
   The vault card was removed at the founder's request, so this is a pair, not
   a three-across grid with a hole in it: equal halves, full width.
   ========================================================================== */
@media (min-width: 1024px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ==========================================================================
   >= 1280px — full desk
   ========================================================================== */
@media (min-width: 1280px) {
  :root { --gutter: var(--s-4); }
  .main { padding-block: var(--s-4) var(--s-8); }
  .view { gap: var(--s-4); }
  .cards, .split { gap: var(--s-3); }
}

/* ==========================================================================
   <= 767px — table→cards, dense-mode trims
   The stock picker, holdings and rounds tables carry .table--cards in the
   markup; the transformation is pure CSS and needs no JS.
   ========================================================================== */
@media (max-width: 767px) {
  .nav {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "brand tools"
      "tabs  tabs";
    row-gap: var(--s-1);
    padding-block: var(--s-1);
  }
  .nav__brand  { grid-area: brand; }
  .nav__tools  { grid-area: tools; }
  .tabbar-wrap { grid-area: tabs; }
  .tabbar { margin-inline: 0; padding-inline: 0; }

  .nav__wordmark { font-size: 0.9375rem; }
  .nav__tools .btn { height: 30px; }
  .nav__tools .btn--icon { width: 30px; }
  .nav__tools #btn-connect { padding-inline: var(--s-15); font-size: var(--fs-xs); }
  .nav__coin .btn__icon { display: none; }
  .nav__tools .nav__coin { padding-inline: var(--s-1); }

  /* Selectors are doubled (.table.table--cards) so they outrank the plain
     .table rules in components.css, which is loaded after this file. */
  .table.table--cards { min-width: 0; display: block; width: auto; }

  .table.table--cards tr,
  .table.table--cards th,
  .table.table--cards td { display: block; width: auto; }

  .table.table--cards thead { display: none; }
  .table.table--cards tbody { border: 0; }

  /* tbody visibility still belongs to the pane state machine — never set
     `display` on a tbody here, only tell the machine what "shown" means. */
  .table.table--cards .pane-as-tbody { --pane-display: block; }

  .table.table--cards tbody tr {
    position: relative;
    border: var(--hairline) solid var(--rule);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: var(--s-15);
    margin-bottom: var(--s-1);
  }
  .table.table--cards tbody tr:hover { background: var(--surface-2); }

  .table.table--cards tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-2);
    padding: var(--s-05) 0;
    border: 0;
    text-align: left;
    height: auto;
  }
  .table.table--cards tbody td::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semi);
    letter-spacing: var(--ls-eyebrow);
    text-transform: uppercase;
    color: var(--ink-3);
    flex: 0 0 auto;
  }
  .table.table--cards tbody td[data-label=""]::before,
  .table.table--cards tbody td:not([data-label])::before { content: none; }

  /* The identity cell becomes the card header: no label, full width. */
  .table.table--cards tbody td[data-cell="identity"] {
    justify-content: flex-start;
    padding-bottom: var(--s-1);
    margin-bottom: var(--s-1);
    border-bottom: var(--hairline) solid var(--rule-soft);
  }
  .table.table--cards tbody td[data-cell="identity"]::before { content: none; }

  /* The tick sits in the card's top-right corner instead of its own row. */
  .table.table--cards tbody td[data-cell="select"] {
    position: absolute;
    top: var(--s-15);
    right: var(--s-15);
    padding: 0;
    width: auto;
  }
  .table.table--cards tbody td[data-cell="identity"] { padding-right: 34px; }

  .table.table--cards tbody td[data-cell="expand"] { justify-content: flex-end; }

  /* Skeleton rows keep the card silhouette. */
  .table.table--cards tbody tr.skel-row td { padding: var(--s-05) 0; }

  /* A full-width empty/error cell is not a card: it drops the card chrome
     and stays block-level so the copy can wrap normally. */
  .table.table--cards tbody tr.state-row {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    margin: 0;
  }
  .table.table--cards tbody td[data-cell="state"] {
    display: block;
    padding: 0;
  }
  .table.table--cards tbody td[data-cell="state"]::before { content: none; }
}
