/* ==========================================================================
   lebroniames.wtf — engineer's drawing plate
   ========================================================================== */

:root {
  /* palette */
  --plate:        #17090F;
  --plate-raise:  #23111A;
  --wine:         #4C1D33;
  --cream:        #F2E9DC;
  --cream-dim:    #B3A29C;
  --amber:        #D9A24B;

  /* type */
  --display: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --sans:    "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "Consolas", monospace;

  /* metrics */
  --inset: clamp(14px, 3vw, 34px);   /* plate frame inset */
  --pad:   clamp(22px, 6vw, 92px);   /* content gutter */
  --rule:  color-mix(in srgb, var(--cream) 13%, transparent);

  /* driven by main.js */
  --rot: 0;
  --par: 0px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--plate);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  position: relative;              /* containing block for the plate frame */
  margin: 0;
  /* real padding, not a footer margin: a bottom margin can collapse out of
     the body box and drag the plate frame up through the title block */
  padding-bottom: calc(var(--inset) + 26px);
  font-family: var(--sans);
  font-size: clamp(15px, 0.6vw + 13.4px, 17px);
  line-height: 1.6;
  color: var(--cream);
  overflow-x: hidden;

  /* wine glow sits BEHIND the content, so it never washes over text */
  background-color: var(--plate);
  background-image:
    radial-gradient(78% 48% at 8% 4%,   rgba(76, 29, 51, .40), transparent 68%),
    radial-gradient(64% 42% at 96% 88%, rgba(76, 29, 51, .26), transparent 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* atmosphere: grain + vignette, zero extra requests ---------------------- */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}
body::before {                                    /* film grain */
  opacity: .045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
body::after {                                     /* corner vignette, kept light */
  background: radial-gradient(125% 105% at 50% 42%, transparent 52%, rgba(8, 3, 5, .58) 100%);
}

::selection { background: var(--amber); color: var(--plate); }

a { color: inherit; }

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

/* --------------------------------------------------------------------------
   Drawing plate: fixed hairline frame + corner registration ticks
   -------------------------------------------------------------------------- */
/* Absolute, not fixed: the frame wraps the whole drawing, so content never
   scrolls across it the way it would past a viewport-pinned border. */
.plate {
  position: absolute;
  inset: var(--inset);
  border: 1px solid var(--rule);
  pointer-events: none;
  z-index: 1;
}
.tick {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 0 solid var(--amber);
}
.tick--tl { top: -1px;    left: -1px;  border-top-width: 1px;    border-left-width: 1px;  }
.tick--tr { top: -1px;    right: -1px; border-top-width: 1px;    border-right-width: 1px; }
.tick--bl { bottom: -1px; left: -1px;  border-bottom-width: 1px; border-left-width: 1px;  }
.tick--br { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

/* --------------------------------------------------------------------------
   Shared type roles
   -------------------------------------------------------------------------- */
.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: .69rem;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-optical-sizing: auto;
  line-height: .96;
  letter-spacing: -.015em;
  color: var(--cream);
  font-size: clamp(3.1rem, 9.4vw, 8.2rem);
}
.display em {
  font-style: italic;
  color: var(--amber);
}
.display--sm { font-size: clamp(2.2rem, 6vw, 4.1rem); }

/* dimension line: hairline, label, arrow terminator ---------------------- */
/* line runs into its terminator tick, then the measurement is called out */
.dim {
  display: flex;
  align-items: center;
}
.dim__line {
  flex: 0 0 auto;
  width: clamp(48px, 12vw, 132px);
  height: 1px;
  background: var(--amber);
  transform-origin: left center;
}
.dim--wide .dim__line { flex: 1 1 auto; width: auto; background: var(--rule); }
.dim__label {
  margin-left: .9em;
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .2em;
  color: var(--amber);
  white-space: nowrap;
}
.dim__cap {                                       /* terminator tick */
  flex: 0 0 auto;
  width: 1px;
  height: 11px;
  background: var(--amber);
}
.dim--wide .dim__cap { background: var(--rule); }

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(var(--inset) + 22px) var(--pad) 0;
}
.wordmark {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .26em;
  text-decoration: none;
  color: var(--cream);
}
.wordmark__tld { color: var(--amber); }
.topbar__spec {
  margin: 0;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .2em;
  color: var(--cream-dim);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  padding: clamp(52px, 11vh, 118px) var(--pad) clamp(70px, 13vh, 140px);
}
.hero__text > * + * { margin-top: clamp(18px, 2.6vh, 30px); }
.hero__text .lede { margin-top: clamp(20px, 3vh, 34px); }

.lede {
  max-width: 27ch;
  font-size: 1.06rem;
  color: var(--cream-dim);
}

/* copy-address control: the address IS the button ----------------------- */
.copy {
  display: inline-flex;
  align-items: center;
  gap: .85em;
  padding: .78em 1.15em;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: color-mix(in srgb, var(--plate-raise) 70%, transparent);
  color: var(--cream);
  font-family: var(--mono);
  font-size: .92rem;
  letter-spacing: .02em;
  cursor: pointer;
  transition: border-color .3s, background .3s, color .3s;
}
.copy:hover { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 9%, var(--plate-raise)); }
.copy__addr { color: var(--cream); }
.copy:hover .copy__addr { color: var(--amber); }
.copy__state {
  padding-left: .9em;
  border-left: 1px solid var(--rule);
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.copy.is-copied { border-color: var(--amber); }
.copy.is-copied .copy__state { color: var(--amber); }
.copy__icon { flex: 0 0 auto; color: var(--cream-dim); }
.copy:hover .copy__icon { color: var(--amber); }

/* --------------------------------------------------------------------------
   SIGNATURE: scroll-driven drivetrain + goggle readout
   -------------------------------------------------------------------------- */
/* drivetrain and readout share one width, so they read as one instrument */
.rig {
  display: grid;
  gap: 16px;
  width: clamp(212px, 25vw, 292px);
}
.drivetrain {
  width: 100%;
  height: auto;
  overflow: visible;
  transform: translateY(var(--par));   /* machine drifts, readout stays put */
  will-change: transform;
}
.shaft {
  stroke: var(--wine);
  stroke-width: 7;
  stroke-linecap: round;
}
/* Each cog sits inside a <g> that carries its position; the cog art is
   symmetric about its own origin, so fill-box centre IS the hub. Using
   fill-box avoids the view-box reference-box ambiguity entirely. */
.cog {
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform;
}
/* 8 teeth driving 5 teeth: B turns 8/5 as fast, and backwards.
   C is on B's shaft, so it matches B exactly. */
.cog--a { transform: rotate(calc(var(--rot) *  1deg)); }
.cog--b { transform: rotate(calc(var(--rot) * -1.6deg)); }
.cog--c { transform: rotate(calc(var(--rot) * -1.6deg)); }

.goggle {
  padding: 11px 13px 13px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: color-mix(in srgb, var(--plate-raise) 82%, transparent);
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .1em;
}
.goggle__row {
  display: flex;
  justify-content: space-between;
  margin: 0 0 5px;
}
.goggle__k { color: var(--cream-dim); text-transform: uppercase; letter-spacing: .18em; }
.goggle__v { color: var(--amber); font-variant-numeric: tabular-nums; }
.goggle__bar {
  height: 3px;
  margin-top: 9px;
  background: color-mix(in srgb, var(--cream) 9%, transparent);
  overflow: hidden;
}
.goggle__fill {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--amber);
  transition: width .28s linear;
}

/* --------------------------------------------------------------------------
   The pack
   -------------------------------------------------------------------------- */
.pack {
  position: relative;
  z-index: 2;
  padding: clamp(58px, 9vh, 112px) var(--pad);
}
/* inset rule, not a full-bleed border — it must not cross the plate frame */
.pack::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--pad);
  right: var(--pad);
  height: 1px;
  background: var(--rule);
}
.section-head {
  display: grid;
  gap: 14px;
  margin-bottom: clamp(34px, 5vh, 58px);
}

.plates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--rule);            /* hairline gaps between plates */
  border: 1px solid var(--rule);
}
.plate-card {
  padding: clamp(22px, 3vw, 34px);
  background: var(--plate);
  transition: background .45s;
}
.plate-card:hover { background: var(--plate-raise); }
.plate-card__k {
  margin: 0 0 1.4em;
  font-family: var(--mono);
  font-size: .63rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--amber);
}
.plate-card__h {
  margin: 0 0 .5em;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.plate-card__p {
  margin: 0;
  max-width: 32ch;
  font-size: .95rem;
  color: var(--cream-dim);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 26px clamp(20px, 4vw, 60px);
  margin: clamp(38px, 5vh, 62px) 0 0;
  padding: 0;
  list-style: none;
}
.stats__i { display: grid; gap: 4px; }
.stats__n {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1;
  color: var(--cream);
}
.stats__l {
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* --------------------------------------------------------------------------
   Title block (footer) — reads like a real drawing's title block
   -------------------------------------------------------------------------- */
.titleblock {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 1px;
  margin: 0 var(--pad);
  background: var(--rule);
  border: 1px solid var(--rule);
}
.tb__cell {
  padding: 15px 17px 17px;
  background: var(--plate);
}
.tb__k {
  margin: 0 0 7px;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.tb__v {
  margin: 0;
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--cream);
}
.tb__v--mark { color: var(--amber); }

/* credit strip: full-width bar under the cells, centre mark optically centred
   because the two stamps sit in equal 1fr tracks */
.tb__cell--credit {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 17px;
  background: var(--plate-raise);
}
.tb__stamp {
  margin: 0;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cream-dim);
  white-space: nowrap;
}
.tb__stamp--status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.tb__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent);
}

.tb__host {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  text-align: center;
}
.tb__k--inline { margin: 0; }

.tb__link {
  font-family: var(--mono);
  font-size: .82rem;
  letter-spacing: .04em;
  color: var(--cream);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  padding-bottom: 2px;
  transition: color .25s ease, border-color .25s ease;
}
.tb__link:hover,
.tb__link:focus-visible { color: var(--amber); border-bottom-color: var(--amber); }
.tb__link-sep { margin: 0 .5em; color: var(--amber); }
.tb__link-sub {
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.tb__link:hover .tb__link-sub,
.tb__link:focus-visible .tb__link-sub { color: var(--cream); }

/* --------------------------------------------------------------------------
   Scroll reveals
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity .78s cubic-bezier(.22,.61,.36,1),
    transform .78s cubic-bezier(.22,.61,.36,1);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* dimension line draws itself, terminator lands last */
.dim.reveal .dim__line { transform: scaleX(0); transition: transform .9s cubic-bezier(.22,.61,.36,1) .1s; }
.dim.reveal.is-in .dim__line { transform: scaleX(1); }
.dim.reveal .dim__cap  { opacity: 0; transition: opacity .3s .95s; }
.dim.reveal.is-in .dim__cap { opacity: 1; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    justify-items: start;
    padding-bottom: clamp(56px, 9vh, 100px);
  }
  .rig { margin-top: 16px; width: clamp(196px, 46vw, 264px); }
  .titleblock { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  /* stamps drop away, credit becomes a single centred line */
  .tb__cell--credit { grid-template-columns: 1fr; padding: 14px 17px; }
  .tb__stamp { display: none; }
  .tb__host { flex-wrap: wrap; gap: 6px 10px; }
}

@media (max-width: 520px) {
  .display { font-size: clamp(2.7rem, 14vw, 4rem); }
  .titleblock { grid-template-columns: 1fr; }
  .copy { width: 100%; justify-content: space-between; }
  .rig { width: min(100%, 250px); }
}

/* --------------------------------------------------------------------------
   Reduced motion: static machine, instant content
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal,
  .dim.reveal .dim__line,
  .dim.reveal .dim__cap,
  .plate-card,
  .copy {
    transition: none !important;
  }
  .reveal { opacity: 1; transform: none; }
  .dim.reveal .dim__line { transform: scaleX(1); }
  .dim.reveal .dim__cap  { opacity: 1; }
  .drivetrain { transform: none; }
  .cog--a { transform: rotate(0deg); }
  .cog--b { transform: rotate(0deg); }
  .cog--c { transform: rotate(0deg); }
}
