/* METROPOL — Components
   Base styles for the patterns proven in V7 (Scroll Departure) and
   V10 (Drop Cinematic). All classes are `m-` prefixed so they don't
   collide with framework utilities (Tailwind, etc.) when ported.

   Import order:
     1. fonts.css
     2. tokens.css
     3. components.css   ← this file
     4. <page>.css       ← page-specific overrides
*/

/* ───── Base reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--m-bg); color: var(--m-fg);
  font-family: var(--m-font-mono);
  font-size: var(--m-text-body);
  line-height: var(--m-leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
em { font-style: italic; }

/* ───── Layout primitives ─────────────────────────────── */
.m-container { max-width: var(--m-content-max); margin: 0 auto; padding: 0 var(--m-gutter); }
.m-container--tight { padding: 0 var(--m-gutter-tight); }
.m-stack > * + * { margin-top: var(--m-s-4); }
.m-row-flex { display: flex; align-items: center; gap: var(--m-s-6); }

/* ───── NAV ─────────────────────────────────────────────
   Slim top bar — logo left, links right. Used identically by V7 and V10.
*/
.m-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--m-s-5) var(--m-gutter-tight);
  border-bottom: 1px solid var(--m-border);
}
/* logo-wordmark.png is the trimmed grey wordmark — force it to pure white
   so it reads on the dark nav. Trimmed aspect ≈ 9:1, so height drives size. */
.m-nav__logo {
  height: 26px; width: auto; opacity: 1;
  filter: brightness(0) invert(1);
}
.m-nav__links { display: flex; gap: var(--m-s-8);
  font-size: var(--m-text-meta); letter-spacing: var(--m-track-label); }
.m-nav__link { color: var(--m-fg); text-decoration: none; cursor: pointer; }
.m-nav__link[aria-current="page"] { color: var(--m-fg-muted); }
.m-nav__link--dim { opacity: 0.5; }
.m-nav__link--cta {
  border: 1px solid rgba(255,255,255,0.25);
  padding: 5px 12px;
  letter-spacing: 0.14em;
  transition: border-color var(--m-t-fast), opacity var(--m-t-fast);
}
.m-nav__link--cta:hover { border-color: var(--m-fg); }

/* Mobile: the 26px wordmark is ~236px wide and the link row is long — without
   this they overflow the viewport and links get clipped. Shrink the logo, tighten
   the links, and let both wrap instead of overflowing. */
@media (max-width: 600px) {
  /* one row: logo hard-left, links hard-right (space-between). Shrink the
     wordmark + tighten the links so everything fits without wrapping. */
  .m-nav { flex-wrap: nowrap; align-items: center; gap: 8px; padding: 14px 16px; }
  .m-nav__logo { height: 14px; flex: 0 0 auto; }
  .m-nav__links { flex-wrap: nowrap; white-space: nowrap;
    gap: 9px; font-size: 8px; letter-spacing: 0.08em; }
  .m-nav__link--cta { padding: 4px 8px; }
}

/* ───── STATUS STRIP ─────────────────────────────────────
   Tight row of meta — live indicator, location, time, weather.
*/
.m-status {
  display: flex; gap: var(--m-s-6);
  padding: 10px var(--m-gutter-tight);
  border-bottom: 1px solid var(--m-border);
  font-size: var(--m-text-label); letter-spacing: 0.15em;
  color: var(--m-fg-muted);
}
.m-status__item { display: inline-flex; align-items: center; gap: var(--m-s-2);
  white-space: nowrap; }
.m-status__dot {
  width: 7px; height: 7px; background: var(--m-fg); border-radius: 50%;
  display: inline-block;
  animation: m-blink 1.4s steps(1) infinite;
}

/* ───── DEPARTURE BOARD / ROW ────────────────────────────
   The signature pattern. A grid row with line / time / destination /
   gate / status. Same skeleton works for train departures (V7) and
   garment manifests (V9).
*/
.m-board { padding: var(--m-s-5) var(--m-gutter-tight); }
.m-board__header {
  display: flex; align-items: center;
  font-size: var(--m-text-meta); letter-spacing: 0.2em;
  color: var(--m-fg-muted); margin-bottom: var(--m-s-4);
}
.m-board__rule {
  flex: 1; border-bottom: 1px dashed var(--m-border-subtle);
  margin: 0 var(--m-s-4); transform: translateY(-6px);
}

.m-row {
  display: grid;
  grid-template-columns: 120px 110px 1fr 110px 140px;
  gap: var(--m-s-4);
  padding: var(--m-s-3) 0;
  border-top: 1px solid var(--m-border-bright);
  align-items: center;
}
.m-row__line   { font-size: var(--m-text-meta); letter-spacing: 0.2em; color: var(--m-fg-muted); }
.m-row__time   { font-size: 36px; font-weight: var(--m-w-bold);
  letter-spacing: var(--m-track-display); line-height: 1; }
.m-row__dest   { font-size: var(--m-h4, 18px); letter-spacing: var(--m-track-body);
  text-transform: uppercase; display: flex; align-items: baseline; gap: var(--m-s-2); }
.m-row__sub    { font-style: normal; color: var(--m-fg-faint);
  font-size: var(--m-text-meta); letter-spacing: 0.15em; }
.m-row__gate   { font-size: var(--m-text-meta); letter-spacing: 0.2em;
  color: var(--m-fg-muted); text-align: right; }
.m-row__status { font-size: var(--m-text-small); letter-spacing: 0.2em;
  text-align: right; font-weight: var(--m-w-semibold);
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.m-row__status::before {
  content: "●"; animation: m-blink 1.4s steps(1) infinite;
}

/* ───── SPLIT FLAP ───────────────────────────────────────
   One character per cell. Used for animated destination text.
   Wrap text in a .m-flap-row and render each char as <span class="m-flap">X</span>.
*/
.m-flap-row { display: inline-flex; }
.m-flap {
  display: inline-block;
  padding: 8px 5px;
  background: var(--m-surface);
  border: 1px solid var(--m-border-subtle);
  font-size: 13px;
  font-weight: var(--m-w-bold);
  min-width: 14px;
  text-align: center;
  margin-right: 2px;
}
.m-flap--lg { font-size: 22px; padding: 10px 7px; min-width: 22px; }

/* ───── KICKER + HEADLINE ────────────────────────────────
   The hero treatment used by both V7 (mono) and V10 (display).
*/
.m-kicker {
  font-size: var(--m-text-meta);
  letter-spacing: var(--m-track-label);
  color: var(--m-fg-muted);
}
.m-kicker--wide { letter-spacing: var(--m-track-wide); color: var(--m-fg-dim); }

.m-headline {
  font-family: var(--m-font-mono);
  font-size: var(--m-text-hero);
  line-height: var(--m-leading-hero);
  letter-spacing: var(--m-track-tight);
  font-weight: var(--m-w-bold);
  margin: 0;
  text-shadow: 0 0 60px rgba(0,0,0,0.6);
}
.m-headline--cinematic {
  font-family: var(--m-font-display);
  font-weight: var(--m-w-regular);
  letter-spacing: var(--m-track-display);
}
.m-headline em { font-style: italic; font-weight: var(--m-w-regular); }

/* ───── CINEMATIC PLATE ──────────────────────────────────
   Used by V10. A vertical compositional unit with chrome top + bottom,
   credits column right, and the subject in the centre.
*/
.m-plate {
  position: relative;
  padding: var(--m-s-8) 36px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(180deg, #0a0a0a 0%, #050505 100%);
  color: var(--m-fg);
  overflow: hidden;
}
.m-plate--light {
  background: linear-gradient(180deg, var(--m-light) 0%, var(--m-light-2) 100%);
  color: var(--m-fg-invert);
}
.m-plate__chrome {
  display: flex; justify-content: space-between;
  font-size: var(--m-text-label); letter-spacing: 0.25em;
  color: currentColor; opacity: 0.6;
}
.m-plate__subject {
  flex: 1; display: flex; align-items: center; justify-content: center;
  transform-style: preserve-3d;
  margin: 10px 0;
}
.m-plate__subject img {
  max-width: 92%; max-height: 92%; object-fit: contain;
  filter: drop-shadow(var(--m-shadow-plate));
}
.m-plate__bottom {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: var(--m-s-4); border-top: 1px solid var(--m-border-bright);
}
.m-plate__title { font-family: var(--m-font-display); font-size: var(--m-text-h3);
  letter-spacing: var(--m-track-display); font-weight: var(--m-w-medium); }
.m-plate__price { font-size: 18px; font-weight: var(--m-w-medium); letter-spacing: 0.05em; }

.m-plate__credits {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  border-left: 1px solid var(--m-border-bright); padding-left: var(--m-s-3);
  font-size: var(--m-text-label); letter-spacing: 0.15em;
  display: flex; flex-direction: column; gap: var(--m-s-1);
  color: currentColor; opacity: 0.8;
}
.m-plate__credit { display: flex; justify-content: space-between; gap: 18px; }
.m-plate__credit > :last-child { opacity: 1.25; }

/* ───── CTA BUTTON ───────────────────────────────────────
   Hard white-on-black slab. No radius. Big letter-spacing.
*/
.m-cta {
  background: var(--m-fg); color: var(--m-fg-invert);
  border: none; padding: 14px 28px;
  font-family: inherit;
  font-size: var(--m-text-small); letter-spacing: 0.3em;
  font-weight: var(--m-w-semibold);
  display: inline-flex; gap: 14px; align-items: center;
  transition: background var(--m-t-fast) var(--m-ease-out);
}
.m-cta:hover { background: var(--m-fg-dim); }
.m-cta--ghost {
  background: transparent; color: var(--m-fg);
  border: 1px solid var(--m-fg);
}
.m-cta--ghost:hover { background: var(--m-fg); color: var(--m-fg-invert); }
.m-cta__arrow { font-size: 16px; }

/* ───── INPUT / EMAIL CAPTURE ────────────────────────────
   Inline-style form used by the waitlist block.
*/
.m-input {
  display: flex; align-items: center; gap: var(--m-s-3);
  border: 1px solid var(--m-border-subtle);
  padding: 12px 14px;
}
.m-input__prompt { color: var(--m-fg-disabled); }
.m-input__field {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--m-fg); font-family: inherit;
  font-size: 13px; letter-spacing: 0.05em;
}
.m-input__btn {
  background: var(--m-fg); color: var(--m-fg-invert);
  border: none; padding: 6px 12px;
  font-family: inherit; font-size: var(--m-text-meta);
  letter-spacing: var(--m-track-label); font-weight: var(--m-w-semibold);
}

/* ───── TICKER ───────────────────────────────────────────
   Bottom marquee — meta items separated by em-dashes. Use
   `m-ticker--marquee` to opt into a CSS marquee scroll.
*/
.m-ticker {
  display: flex; gap: var(--m-s-6);
  padding: 12px var(--m-gutter-tight);
  border-top: 1px solid var(--m-border);
  font-size: var(--m-text-label); letter-spacing: var(--m-track-mono);
  color: var(--m-fg-muted);
  white-space: nowrap; overflow: hidden;
}
.m-ticker--marquee > * {
  animation: m-marquee 60s linear infinite;
}
.m-ticker a {
  color: var(--m-fg-dim); text-decoration: none;
  transition: color var(--m-t-fast);
}
.m-ticker a:hover { color: var(--m-fg); }

/* ───── CORNER CROPS ─────────────────────────────────────
   ┌ ┐ └ ┘ on a poster. Visual punctuation.
*/
.m-corner {
  position: absolute; color: rgba(255,255,255,0.7);
  font-family: monospace; font-size: 18px; z-index: 5;
  pointer-events: none;
}
.m-corner--tl { top: 24px; left: 24px; }
.m-corner--tr { top: 24px; right: 24px; }
.m-corner--bl { bottom: 24px; left: 24px; }
.m-corner--br { bottom: 24px; right: 24px; }

/* ───── ATMOSPHERE LAYERS ────────────────────────────────
   Photographic grain + vignette as standalone div overlays.
*/
.m-grain {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.45; mix-blend-mode: screen;
  background: var(--m-grain-svg);
}
.m-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.75) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.55) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.9) 100%);
}

/* ───── KEYFRAMES ────────────────────────────────────────
   The two everywhere-used animations. Page-specific motion lives in
   the page CSS (see /starters).
*/
@keyframes m-blink { 50% { opacity: 0; } }
@keyframes m-pulse { 50% { opacity: 0.3; } }
@keyframes m-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ───── UTILITIES ────────────────────────────────────────
   Type-family switches + size escapes. Resist piling these up — most
   of the system should come from components.
*/
.m-mono     { font-family: var(--m-font-mono); }
.m-display  { font-family: var(--m-font-display); }
.m-caps     { text-transform: uppercase; }
.m-muted    { color: var(--m-fg-muted); }
.m-faint    { color: var(--m-fg-faint); }
