/* ============================================================
   creegs.com — Instrument Panel
   Colors sampled from the logo (lime #48e448 on charcoal).
   ============================================================ */

:root {
  /* — ground — */
  --void:      #14140f;
  --panel:     #1c1c17;
  --panel-2:   #26261f;
  --rule:      #3a3a31;
  --rule-soft: #2b2b23;

  /* — ink — */
  --ink:       #e8e6dc;
  --ink-dim:   #a8a697;   /* 7.0:1 on --void, passes AA for small text */
  --ink-faint: #8b897a;   /* 4.6:1 on --void, passes AA — captions must stay legible */

  /* — accent: logo lime, used sparingly — */
  --lime:      #48e448;
  --lime-lo:   #2e9e2e;
  --lime-hi:   #8ff08a;

  /* — type — */
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* — metrics — */
  --rail: 208px;
  --gutter: clamp(20px, 5vw, 72px);
  --measure: 64ch;
}

/* ============================================================
   reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  /* No scroll-behavior:smooth here. In this browser it blocks anchor
     navigation outright — clicking a nav link left scrollY at 0 — and a
     dead nav is far worse than a jump instead of a glide. */
  scroll-padding-top: 24px;
}

body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(16px, 0.55vw + 14px, 17.5px);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, video { display: block; max-width: 100%; height: auto; }
a { color: var(--ink); text-decoration: none; }

::selection { background: var(--lime); color: var(--void); }

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

/* ============================================================
   type scale
   ============================================================ */
.display {
  font-size: clamp(52px, 11vw, 132px);
  line-height: 0.88;
  letter-spacing: -0.045em;
  font-weight: 700;
}

h2.section-title {
  font-size: clamp(30px, 4.2vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 600;
}

h3 {
  font-size: clamp(19px, 1.6vw, 23px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

h4 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* mono metadata — the old site shouted these in Courier */
.meta {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-dim);
  letter-spacing: 0.01em;
}
.meta a { color: var(--ink-dim); }
.meta a:hover { color: var(--lime); }

.prose { max-width: var(--measure); color: var(--ink); }
.prose + .prose { margin-top: 1.1em; }
.prose--dim { color: var(--ink-dim); }

/* ============================================================
   layout shell
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  border-right: 1px solid var(--rule);
  background: var(--void);
  display: flex;
  flex-direction: column;
  padding: 28px 0 24px;
  z-index: 40;
}

.rail__mark { padding: 0 24px 26px; }

.rail__mark img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
}

.rail__mark span {
  display: block;
  margin-top: 11px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.rail__nav { display: flex; flex-direction: column; }

.rail__nav a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 11px 24px 11px 22px;
  border-left: 2px solid transparent;
  display: flex;
  gap: 12px;
  align-items: baseline;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.rail__nav a .n {
  font-size: 10px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  min-width: 15px;
}
.rail__nav a:hover { color: var(--ink); background: var(--panel); }
.rail__nav a.is-active {
  color: var(--lime);
  border-left-color: var(--lime);
  background: var(--panel);
}
.rail__nav a.is-active .n { color: var(--lime); }

.rail__foot {
  margin-top: auto;
  padding: 20px 24px 30px;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.main {
  margin-left: var(--rail);
  flex: 1;
  min-width: 0; /* let grids shrink instead of overflowing */
}

.wrap {
  max-width: 1180px;
  padding: 0 var(--gutter);
}

/* ============================================================
   hero
   ============================================================ */
.hero {
  position: relative;
  min-height: min(100svh, 940px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 9vh, 110px) var(--gutter) 56px;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

/* the hairline instrument grid, at very low opacity */
.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--rule-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rule-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.5;
  mask-image: radial-gradient(120% 90% at 18% 30%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 18% 30%, #000 20%, transparent 78%);
  pointer-events: none;
}

/* the hero is a single column now — no right-hand readout */
.hero__inner { position: relative; max-width: 1180px; }

/* ============================================================
   hero status — the green terminal lines, now below the name
   ============================================================ */
.hero__status {
  font-family: var(--mono);
  font-size: clamp(13px, 1.05vw, 16px);
  line-height: 1.8;
  color: var(--lime);
  /* reserve the final height (3 lines + caret) so nothing shifts as the
     lines type in — the reserved box is what the settled state occupies */
  min-height: calc(3 * 1.8em + 1.2em);
  margin-top: clamp(26px, 4.5vh, 48px);
  margin-bottom: 0;
}
.hero__status .line { display: block; white-space: pre-wrap; }
.hero__status .caret {
  display: inline-block;
  width: 0.5em;
  height: 0.9em;
  background: var(--lime);
  /* the caret is a separate block, so tighten its line box and pull it up
     onto the text's x-height instead of letting it drift down a full line */
  margin-top: 0.34em;
  vertical-align: -0.1em;
}
.hero__status .caret.is-blinking { animation: blink 1.06s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero__title { margin-bottom: clamp(24px, 4vh, 40px); }
.hero__title .display { color: var(--ink); }
.hero__title .display em {
  font-style: normal;
  color: var(--lime);
}

.hero__links {
  margin-top: clamp(22px, 3.2vh, 34px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

/* ============================================================
   sections
   ============================================================ */
.section {
  padding: clamp(72px, 11vh, 132px) 0;
  border-bottom: 1px solid var(--rule);
}
.section:last-of-type { border-bottom: 0; }

.section__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: clamp(36px, 5vh, 60px);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-soft);
}
.section__num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}
.section__label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.section__rule {
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
}

/* asymmetric two-column: prose left, media bleeding right */
.split {
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(0, 38fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}

/* grid items default to min-width:auto, so a long unbreakable string inside a
   column (the Monero address, the parts list) forces the track wider than the
   viewport. Every grid/flex child that holds text must be allowed to shrink. */
.split > *,
.roles > *,
.hero__inner > * { min-width: 0; }

.stack > * + * { margin-top: clamp(20px, 2.6vh, 30px); }
.stack--tight > * + * { margin-top: 14px; }
/* give the readouts room to breathe inside a stack */
.stack .terminal { margin-top: 22px; }

/* ============================================================
   media
   ============================================================ */
figure { margin: 0; }

figure img,
figure video {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--panel);
}

figcaption {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  overflow-wrap: anywhere; /* the Monero address is 95 chars of unbroken text */
}

/* an address this long has to break or it pushes the page wide */
figcaption {
  overflow-wrap: anywhere;
}

/* ============================================================
   contact — one column now that the QR is gone; the two buttons
   at the bottom give the page somewhere to end
   ============================================================ */
.contact { max-width: 640px; }
.contact .section-title { margin-bottom: clamp(26px, 4vh, 40px); }
.contact__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: clamp(24px, 3.5vh, 38px);
}

/* the one dark readout — a real terminal, not decoration */
.terminal {
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--lime);
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre;
}
.terminal .k { color: var(--lime); }
.terminal .c { color: var(--ink-faint); }

/* ============================================================
   link + button treatments
   ============================================================ */
.link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
  transition: color 140ms ease, border-color 140ms ease;
}
.link:hover { color: var(--lime); border-color: var(--lime); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 12px 19px;
  border: 1px solid var(--rule);
  color: var(--ink);
  background: var(--panel);
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
  cursor: pointer;
}
.btn:hover { border-color: var(--lime); color: var(--lime); }
.btn--primary { border-color: var(--lime-lo); color: var(--lime); }
.btn--primary:hover { background: var(--lime); color: var(--void); border-color: var(--lime); }

/* ============================================================
   data list — the tabular parts list
   ============================================================ */
.dl {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr;
  border-top: 1px solid var(--rule-soft);
}
.dl > div {
  display: contents;
}
.dl dt,
.dl dd {
  padding: 11px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.dl dt {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-right: 20px;
}
.dl dd {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   merit badge gallery — click-through pamphlets with descriptions.
   Hairlines and mono labels only; lime marks the active thumb.
   ============================================================ */
.gallery {
  margin-top: clamp(44px, 6vh, 72px);
  border-top: 1px solid var(--rule-soft);
  padding-top: 24px;
}

.gallery__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: clamp(22px, 3vh, 32px);
}
.gallery__num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--lime);
}
.gallery__label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.gallery__rule { flex: 1; height: 1px; background: var(--rule-soft); }
.gallery__count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.gallery__stage {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(24px, 3.5vw, 48px);
  align-items: start;
}

.gallery__fig { margin: 0; min-width: 0; }
.gallery__fig img {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--panel);
  aspect-ratio: 225 / 332;
  object-fit: cover;
}

.gallery__meta { min-width: 0; }
.gallery__meta h3 {
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.gallery__meta p {
  color: var(--ink-dim);
  max-width: 52ch;
  font-size: 15px;
  line-height: 1.65;
}

/* the fade when a pamphlet changes — motion that answers a click */
.gallery__stage.is-swapping .gallery__fig img,
.gallery__stage.is-swapping .gallery__meta {
  opacity: 0;
}
.gallery__fig img,
.gallery__meta { transition: opacity 130ms ease; }

.gallery__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(22px, 3vh, 32px);
}
.gallery__thumb {
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--panel);
  cursor: pointer;
  line-height: 0;
  transition: border-color 140ms ease;
}
.gallery__thumb img {
  width: 56px;
  aspect-ratio: 225 / 332;
  object-fit: cover;
}
.gallery__thumb:hover { border-color: var(--ink-dim); }
.gallery__thumb.is-active { border-color: var(--lime); }
.gallery__thumb:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* photo variant: natural aspect ratios, square thumbs */
.gallery--photos .gallery__stage { grid-template-columns: minmax(0, 470px) minmax(0, 1fr); }
.gallery--photos .gallery__fig img { max-height: 580px; object-fit: contain; }
.gallery--photos .gallery__thumb img { width: 76px; height: 76px; aspect-ratio: 1; }

@media (max-width: 760px) {
  /* the photo modifier outranks this rule on specificity, so restate it */
  .gallery__stage,
  .gallery--photos .gallery__stage { grid-template-columns: 1fr; }
}

/* ============================================================
   nav strip under the hero — the four identities
   ============================================================ */
.roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.roles a {
  padding: 22px 20px 24px;
  border-right: 1px solid var(--rule-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 150ms ease;
}
.roles a:last-child { border-right: 0; }
.roles a:hover { background: var(--panel); }
.roles .n {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--lime);
  letter-spacing: 0.1em;
}
.roles .t {
  font-size: clamp(16px, 1.4vw, 19px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.roles .d {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-faint);
}

/* ============================================================
   footer
   ============================================================ */
.foot {
  padding: 40px 0 56px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 18px 32px;
  justify-content: space-between;
  align-items: flex-end;
}

/* ============================================================
   responsive — rail collapses to a top tab bar
   ============================================================ */
.topbar { display: none; }

@media (max-width: 1080px) {
  .rail { display: none; }

  .topbar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--void) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rule);
  }
  .topbar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--gutter);
  }
  .topbar__mark { display: flex; align-items: center; gap: 11px; }
  .topbar__mark img { width: 34px; height: 34px; border-radius: 7px; }
  .topbar__mark span {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--ink-dim);
  }
  .topbar__nav {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--rule-soft);
    padding: 0 var(--gutter);
  }
  .topbar__nav::-webkit-scrollbar { display: none; }
  .topbar__nav a {
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-dim);
    padding: 11px 14px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
  }
  .topbar__nav a:hover { color: var(--ink); }
  .topbar__nav a.is-active { color: var(--lime); border-bottom-color: var(--lime); }

  .main { margin-left: 0; }
  html { scroll-padding-top: 92px; }

  .hero { min-height: auto; padding-top: clamp(40px, 8vh, 72px); }
  /* three identity cards still fit side by side with the rail gone; a
     2-column intermediate would leave a lone card in the second row */
}

@media (max-width: 760px) {
  .split,
  .roles { grid-template-columns: 1fr; }
  .roles a { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .roles a:last-child { border-bottom: 0; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { padding-bottom: 0; border-bottom: 0; }
  .dl dd { padding-top: 4px; }
  .hero__status { min-height: 7.5em; }
}

/* ============================================================
   reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero__status .caret.is-blinking { animation: none; opacity: 1; }
}
