/* Theme (ships with the live site). Single source of truth for live
   pages: variables, base, header, hero, cards, store, footer. */

:root {
  --bg: hsl(0 0% 3%);
  --surface: hsl(0 0% 7%);
  --text: hsl(0 6% 93%);
  --muted: hsl(217 18% 60%);
  --accent: hsl(35 78% 67%);
  --on-accent: hsl(35 15% 10%);
  --border: hsl(35 50% 41%);
  --font: "Atkinson Hyperlegible", system-ui, sans-serif;
  --fs: 18px;
  --card-radius: 0px;
  --card-border-w: 2px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  transition: background 120ms linear;
}

main {
  padding: 2rem 6rem 6rem;
  margin: 0 auto;
}


body > header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg);
  padding: 0;
}

header .demo-nav {
  margin: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: var(--card-border-w) solid var(--border);
  border-top: 0;
  border-radius: 0;
  padding: 0 2rem;
}

.ticker {
  min-height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 0 1rem;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  color: var(--muted);
}

.wallet {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.wallet img { image-rendering: pixelated; }

.theme-cycle {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}


.chev {
  width: 0.6em;
  height: 0.9em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  vertical-align: -0.1em;
}

/* B: solid accent button */
.tbtn-b {
  width: 14ch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  border: 0;
  border-radius: var(--card-radius);
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.4rem 0.5rem;
  font-weight: 700;
}

header .demo-nav { border-top: 0; }

footer { padding: 1rem 2rem; color: var(--muted); font-size: 1rem; }

.col-footer {
  padding: 2rem 0 0 1rem;
  font-size: 1rem;
  text-align: right;
}
.col-footer h5 { margin: 0 0 0.5rem; }


h1 { font-size: 2.5rem; margin: 0 0 0.5rem; }

.hero-bio { font-size: 1.25rem; line-height: 1.6; margin: 0; max-width: 66%; }


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.5rem;
}

/* author display:flex beats the UA [hidden] rule without this */
.card[hidden] { display: none; }

/* fixed card footprint: 326 wide, 480 tall minimum everywhere
   (min-height so long copy grows instead of clipping) */


.card img {
  width: calc(100% + 3rem);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  margin: -1.5rem -1.5rem 1rem;
}

.tech { color: var(--muted); font-size: 0.85rem; }

/* detail pages (projects now, blog posts later) */
.detail { display: grid; gap: 1.25rem; align-content: start; max-width: 44rem; }
.detail-meta { display: flex; gap: 0.75rem; align-items: center; margin: 0; color: var(--muted); }
.badge {
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 0.1rem 0.6rem;
  font-size: 0.8rem;
  border-radius: var(--card-radius);
}
.detail-lede { font-size: 1.25rem; line-height: 1.5; color: var(--muted); margin: 0; }
.detail-thumb { width: 100%; display: block; border: var(--card-border-w) solid var(--border); margin-bottom: 1em; }
.detail-links { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0; }
.incoming { color: var(--muted); font-style: italic; }

/* article shell: narrow reading column left, meta rail docked right */
.article-wrap { display: flex; gap: 1.5rem; align-items: stretch; }
.article-wrap .detail { flex: 1 1 auto; min-width: 0; }
.article-side { flex: none; width: 326px; }

.meta-box {
  background: var(--surface);
  border: 2px solid var(--muted);
  padding: 1.5rem;
}

.meta-box h2 { margin: 0 0 1rem; font-size: 1.25rem; }

.meta-box dl { margin: 0; display: grid; gap: 1rem; }
.meta-box dl > div { display: grid; grid-template-columns: 45px 1fr; gap: 0.25rem 1rem; align-items: baseline; }
.meta-box dt { color: var(--muted); font-size: 0.85rem; }
.meta-box dd { margin: 0; }
.meta-box .detail-links { margin-top: 1rem; gap: 0.5rem; flex-wrap: nowrap; }
.meta-box .detail-links .btn { white-space: nowrap; }

.article-head { max-width: 44rem; margin-bottom: 2rem; }

.detail > footer { padding: 1rem 0; }
body:has(.article-wrap) > footer { display: none; }

@media (max-width: 1100px) {
  main { padding: 2rem 4rem 6rem; }
  .article-wrap { flex-direction: column; gap: 1rem; }
  .article-side { width: auto; order: -1; max-width: 44rem; }
  .article-head { margin-bottom: 1rem; }
  .article-wrap .detail { gap: 0.75rem; }
  .article-wrap .detail p,
  .article-wrap .detail h2,
  .article-wrap .detail h3 { margin-top: 0; margin-bottom: 0.5rem; }
  .detail-thumb { margin-bottom: 0.5rem; }
  .meta-box { padding: 1rem; }
  .meta-box h2 { margin: 0 0 0.5rem; }
  .meta-box dl { gap: 0.5rem; }
  .meta-box .detail-links { margin-top: 0.5rem; flex-wrap: wrap; }
  .detail > footer { padding: 1.5rem 0 0; }

  .ticker .wallet,
  .ticker .theme-cycle {
    visibility: hidden;
  }
}

@media (max-width: 768px) {
  main { padding-bottom: 6rem; }
}

.card.invert {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--on-accent);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}


.nowline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  font-size: 1.3rem;
  font-weight: 700;
}

.status {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface);
  color: var(--accent);
  font-size: var(--fs);
  font-weight: 400;
}

@keyframes breathe {
  0%, 100% { opacity: 0.45; box-shadow: none; }
  50% { opacity: 1; box-shadow: 0 0 0.5em var(--accent), 0 0 1.5em var(--accent); }
}

/* ---- nav studies (THEME CANDIDATE — ships with the real bar) ---- */
.demo-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0 2rem;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
}

.demo-nav ul {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.demo-nav a { color: var(--text); text-decoration: none; }

/* A: tally — lit dot on the live page, dim dots elsewhere */
.tally a::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  margin-left: 0.45em;
  vertical-align: baseline;
  background: var(--muted);
  opacity: 0.35;
}

.tally a[aria-current="page"]::after {
  background: var(--accent);
  opacity: 1;
  box-shadow: 0 0 0.4em var(--accent);
}

/* real bar: links fill their cells; internal labels centered with tally
   docked top-right corner; externals stay centered at original width */
header .strip .segs a { width: 100%; }
header .strip .tally a { position: relative; justify-content: center; padding-inline: 2rem; }
header .strip .tally a::after {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  margin-left: 0;
}
header .strip .segs.right a { justify-content: center; }

/* D: one continuous bar — outer border belongs to the bar, dividers inside */
.strip {
  padding: 0;
  align-items: stretch;
  gap: 0;
  border-width: var(--card-border-w);
}

.strip ul { gap: 0; }

/* equal-width link boxes across both groups; stretch (not the leaked
   demo-nav center) so every cell divider spans the full row height */
.strip .segs { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: max-content; align-items: stretch; }
.strip .segs a { justify-content: center; }
.strip .spacer { flex: 1; min-width: 2rem; }

.strip .segs a {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 1rem 1rem;
}

.strip .segs li + li, .strip .spacer, .strip .segs.right li:first-child { border-left: var(--card-border-w) solid var(--border); }
.strip .segs:not(.right) li:first-child { border-left: var(--card-border-w) solid var(--border); }
.strip .segs.right li:last-child { border-right: var(--card-border-w) solid var(--border); }

.strip .segs a[aria-current="page"] { font-weight: 700; }

/* ---- tablet sprint A: nav social icons (Stream A owns this block) ---- */
.strip .segs.right a { gap: 0.5em; }
.soc {
  width: 1.3em;
  height: 1.3em;
  fill: currentColor;
  vertical-align: middle;
  flex: none;
  /* keep the in-flow strut at 1em so the taller 1.3em glyph never adds
     nav-bar height vs the text-only baseline (desktop stays byte-identical
     below the nav); the glyph itself still paints at full 1.3em. */
  margin-block: calc((1em - 1.3em) / 2);
}
@media (max-width: 1100px) {
  .strip .segs.right a { padding-left: 0.9rem; padding-right: 0.9rem; }
  .strip .segs.right .soc-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
/* ---- end tablet sprint A nav social icons ---- */

.card {
  background: var(--surface);
  border: var(--card-border-w) solid var(--border);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

.card p.card-ctas { margin-top: auto; margin-bottom: 0; padding-top: 0.75rem; }
.card p.card-summary { margin-bottom: 0.5rem; }
.card p.tech { margin-top: 0; }
.card .more-link { margin-top: auto; align-self: flex-start; }

.card h2 { margin: 0 0 0.5rem; }
.card p { margin: 0 0 1rem; line-height: 1.5; }

.btn {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  border-radius: 0.5rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  margin-right: 1.4rem;
}

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--accent); padding-left: 0; padding-right: 0; margin: 0; }

/* breathing dot (live status chip) */
.status .dot {
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background: var(--accent);
  animation: breathe 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .status .dot { animation: none; }
}

/* ---- phone sprint H: collapsible nav + narrow main padding ---- */
/* Menu toggle controls: inert on desktop (no layout, no paint). */
.nav-toggle,
.nav-menu-btn { display: none; }

/* ---- round-3 W: collapsible nav from tablet-portrait down ---- */
/* Externals never collapse: only internals hide; the spacer stays to
   right-align the icons in the bar. The expanded panel is internals-only,
   full width below the bar (order keeps it after spacer + externals so the
   bar never shifts between states). The 390 block below refines this. */
@media (max-width: 768px) {
  header .demo-nav { flex-wrap: wrap; }

  /* Visually hidden but focusable: label click + keyboard both toggle. */
  .nav-toggle {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }
  .nav-toggle:focus-visible + .nav-menu-btn {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
  .nav-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    width: auto;
    cursor: pointer;
    padding: 1rem;
    font-weight: 700;
  }
  /* round-7: the row must read identically when open and closed, so in the
     hamburger range (<=768) it is flush, frameless, and unshifted in BOTH
     states — the look the 390 block already shipped. The expanded panel
     below keeps its own top + bottom borders as its frame; desktop
     (769–1100 icon bar) keeps its endcap frame; only this block changes. */
  header .demo-nav { padding-left: 0; padding-right: 0; }
  .nav-menu-btn { border-left: 0; }
  .strip .segs.right li:last-child { border-right: 0; }
  .menu-icon {
    width: 1.2em;
    height: 1.2em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    flex: none;
  }
  /* Hamburger/X swap, same pattern as the filter chevrons. */
  .nav-menu-btn .icon-close { display: none; }
  .nav-toggle:checked + .nav-menu-btn .icon-open { display: none; }
  .nav-toggle:checked + .nav-menu-btn .icon-close { display: inline; }

  /* Collapsed: internals hidden; externals + spacer stay in the bar.
     The spacer keeps its flex slot (right-aligns icons) but has no left
     border in either state — round 7: the row stays frameless open and
     closed (matches 390; the 390 block no longer restates it). */
  .nav-toggle:not(:checked) ~ .tally.segs { display: none; }
  .strip .spacer { border-left: 0; }

  /* Expanded panel: internals only, vertical stack, full width. */
  .nav-toggle:checked ~ .tally.segs {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    order: 5;
    border-top: var(--card-border-w) solid var(--border);
  }
  .nav-toggle:checked ~ .tally.segs li + li { border-top: 0; }

  /* Stacked internals lose their vertical dividers. */
  header .strip .tally.segs li:first-child,
  header .strip .tally.segs li + li { border-left: 0; border-right: 0; }

  /* K4 (hoisted from the 390 block): tally marker inline with text
     whenever the dropdown shows. */
  header .strip .tally a::after {
    position: static;
    top: auto;
    right: auto;
    margin-left: 0.9em;
  }
}

@media (max-width: 390px) {
  main { padding: 2rem 2rem 6rem; }

  /* K1: strip side padding → 0 so the button row spans full width. */
  header .demo-nav.strip { padding-left: 0; padding-right: 0; }

  /* round-6: at mobile the bar sits flush with the container edges, so the
     endcap ticks at x=0 and x=right read as an extra boxed border — remove
     them unconditionally (collapsed and expanded; same reasoning as the
     expanded-only removal in the 768 block). Tablet/desktop keep theirs. */
  .nav-menu-btn { border-left: 0; }
  .strip .segs.right li:last-child { border-right: 0; }

  /* Visually hidden but focusable: label click + keyboard both toggle. */
  .nav-toggle {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }
  .nav-toggle:focus-visible + .nav-menu-btn {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
  .nav-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    width: auto;
    cursor: pointer;
    padding: 1rem;
    font-weight: 700;
  }
  .menu-icon {
    width: 1.2em;
    height: 1.2em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    flex: none;
  }
  /* Hamburger/X swap, same pattern as the filter chevrons. */
  .nav-menu-btn .icon-close { display: none; }
  .nav-toggle:checked + .nav-menu-btn .icon-open { display: none; }
  .nav-toggle:checked + .nav-menu-btn .icon-close { display: inline; }

  /* Collapsed: internals hidden; externals + spacer stay in the bar. */
  .nav-toggle:not(:checked) ~ .tally.segs { display: none; }

  /* Stacked internals lose their vertical dividers (externals keep
     their bar dividers). The collapsed spacer tick is already handled
     by the collapsed-scoped rule in the 768 block above. */
  header .strip .tally.segs li:first-child,
  header .strip .tally.segs li + li { border-left: 0; border-right: 0; }

  /* Internal links first, vertical stack. */
  .nav-toggle:checked ~ .tally.segs {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-top: var(--card-border-w) solid var(--border);
  }
  .nav-toggle:checked ~ .tally.segs li + li { border-top: 0; }
  /* K4: tally marker back to inline-with-text (undo desktop corner-dock). */
  header .strip .tally a::after {
    position: static;
    top: auto;
    right: auto;
    margin-left: 0.9em;
  }
}
