/* ============================================================
   MIRAI LABO — SITE V2 DESIGN SYSTEM
   Palette: prototype (paper/ink)   Type: CI (Bebas + Sora + DM Mono)
   ============================================================ */

/* ── 1 · TOKENS ─────────────────────────────────────────── */
:root {
  /* Surface */
  --paper:      #f5f4ef;   /* page background */
  --white:      #fbfaf6;   /* raised surface / cards */
  --sink:       #edece6;   /* recessed panels */

  /* Ink */
  --ink:        #11120f;   /* primary text */
  --muted:      #65675f;   /* secondary text */
  --faint:      #9a9b94;   /* tertiary / meta */
  --line:       #d9d8d1;   /* borders */
  --line-soft:  #e6e5df;

  /* Accent */
  --gold:       #a77d34;
  --gold-soft:  rgba(167,125,52,0.10);
  --gold-line:  rgba(167,125,52,0.35);

  /* Originals — Blue Horizon identity ONLY. Never use elsewhere. */
  --blue:       #2567d5;
  --blue-deep:  #071d49;
  --blue-soft:  rgba(37,103,213,0.08);

  /* Signal */
  --verified:   #3f7d4e;

  /* Type — CI locked */
  --display: 'Bebas Neue', 'Arial Narrow', Arial, sans-serif;
  --body:    'Sora', -apple-system, 'Segoe UI', sans-serif;
  --mono:    'DM Mono', 'SF Mono', Menlo, monospace;

  /* Editorial voice (Ziga lines, pull-quotes).
     Currently Sora italic — three-face system.
     To restore Cormorant, swap the line below and add the font link. */
  --voice: 'Sora', -apple-system, sans-serif;
  /* --voice: 'Cormorant Garamond', Georgia, serif; */

  /* Rhythm */
  --gutter:     clamp(20px, 5vw, 64px);
  --section-y:  clamp(72px, 10vw, 140px);
  --max:        1240px;
  --max-read:   680px;

  --speed: 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── 2 · RESET + BASE ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--gold); color: var(--paper); }

/* ── 3 · TYPOGRAPHY ─────────────────────────────────────── */
/* Bebas is uppercase-only and condensed — it needs looser tracking
   and tighter leading than a normal display face. */
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 0.94;
  margin: 0;
  color: var(--ink);
}

h1, .h1 { font-size: clamp(46px, 8vw, 104px); }
h2, .h2 { font-size: clamp(32px, 5.2vw, 66px); }
h3, .h3 { font-size: clamp(21px, 2.6vw, 30px); line-height: 1.05; }

h4, .h4 {
  font-family: var(--body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  margin: 0;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.lead {
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.75;
  color: var(--muted);
  max-width: var(--max-read);
}

.body-muted { color: var(--muted); }
.measure    { max-width: var(--max-read); }

strong, b { font-weight: 500; color: var(--ink); }
em { font-style: italic; }

/* Eyebrow — the small mono label above every section */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 18px;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--gold);
  flex-shrink: 0;
}
.eyebrow.bare::before { display: none; }

/* Editorial voice */
.voice {
  font-family: var(--voice);
  font-style: italic;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
}

.pull {
  font-family: var(--voice);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.5;
  color: var(--ink);
  border-left: 2px solid var(--gold);
  padding-left: 24px;
  margin: 0;
}

/* Ziga speaks */
.ziga {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  max-width: var(--max-read);
  padding: 16px 20px;
  background: var(--gold-soft);
  border-left: 2px solid var(--gold);
  margin: 24px 0;
}
.ziga-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
  padding-top: 4px;
  flex-shrink: 0;
}
.ziga p { font-family: var(--voice); font-style: italic; color: var(--muted); margin: 0; }

/* ── 4 · LAYOUT ─────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }
.section-sm { padding-block: clamp(48px, 6vw, 80px); }
.section + .section { border-top: 1px solid var(--line-soft); }

.stack   { display: flex; flex-direction: column; gap: 24px; }
.row     { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.between { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; }

.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid > * { background: var(--paper); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.cards { display: grid; gap: 24px; }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.cards-3 { grid-template-columns: repeat(3, 1fr); }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Section heading block */
.head { margin-bottom: clamp(32px, 5vw, 56px); }
.head h2 { margin-bottom: 16px; }
.head.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: end; }
.head.split p { color: var(--muted); margin: 0; }

/* ── 5 · HEADER + NAV ───────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--speed), border-color var(--speed), padding var(--speed);
}
.site-header.scrolled {
  background: rgba(245,244,239,0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--line);
  padding-block: 12px;
}

/* Both marks, then the full name. The link carries the accessible
   name via aria-label, so the marks stay decorative. */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-marks { display: flex; align-items: center; gap: 9px; }
.brand-marks img { height: 26px; width: auto; display: block; }
/* The Ronin mark is a filled tile; the MIRAI mark is open line-work,
   so the tile is set slightly smaller to balance optical weight. */
.brand-marks .mark-ronin { height: 22px; }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name b {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.11em;
  color: var(--ink);
}
.brand-name i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 5px;
}

.nav { display: flex; align-items: center; gap: 30px; }
.nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
  position: relative;
  padding-block: 4px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--gold);
}

.nav .nav-cta {
  color: var(--paper);
  background: var(--ink);
  padding: 10px 18px;
  transition: background 0.2s;
}
.nav .nav-cta:hover { background: var(--gold); color: var(--paper); }
.nav .nav-cta::after { display: none; }

.nav-lang { color: var(--faint) !important; }

.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  padding: 8px 14px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ── 6 · BUTTONS + ACTIONS ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 15px 28px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-dark  { background: var(--ink);  color: var(--paper); }
.btn-dark:hover { background: var(--gold); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-gold  { background: var(--gold); color: var(--paper); }
.btn-gold:hover { background: var(--ink); }

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1px solid var(--gold-line);
  padding-bottom: 3px;
  transition: border-color 0.2s, gap 0.2s;
}
.link-action:hover { border-bottom-color: var(--gold); gap: 12px; }

/* ── 7 · COMPONENTS ─────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 32px;
  transition: border-color 0.25s, transform 0.25s;
}
a.card:hover, .card.interactive:hover { border-color: var(--gold-line); transform: translateY(-2px); }

.card-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-bottom: 14px;
  display: block;
}

/* Chip / tag */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"], .chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip-verified { color: var(--verified); border-color: rgba(63,125,78,0.35); cursor: default; }
.chip-gold { color: var(--gold); border-color: var(--gold-line); cursor: default; }

/* Search field */
.search {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 0 18px;
  transition: border-color 0.2s;
}
.search:focus-within { border-color: var(--gold); }
.search input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  padding: 15px 0;
  font-size: 14px;
  font-weight: 300;
}
.search input::placeholder { color: var(--faint); }
.search-icon { color: var(--faint); flex-shrink: 0; }
.search-clear {
  border: 0; background: none; cursor: pointer; color: var(--faint);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
}
.search-clear:hover { color: var(--ink); }

.result-count {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.empty-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
}

/* Media / play affordance */
.media {
  position: relative;
  overflow: hidden;
  background: var(--sink);
  aspect-ratio: 16 / 9;
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 100%;
  display: block;
}
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--speed); }
.media:hover img { transform: scale(1.03); }
.media-play {
  position: absolute;
  inset: auto auto 16px 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper);
  background: rgba(17,18,15,0.75);
  padding: 8px 14px;
  backdrop-filter: blur(6px);
}
.media-meta {
  position: absolute;
  inset: 16px 16px auto auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--paper);
  background: rgba(17,18,15,0.6);
  padding: 5px 10px;
}
.media-slot {
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  background: var(--sink);
  border: 1px dashed var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  aspect-ratio: 16 / 9;
}

/* Numbered process list */
.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.steps li { border-bottom: 1px solid var(--line); }
.steps button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 22px 0;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.steps .n { font-family: var(--mono); font-size: 11px; color: var(--gold); letter-spacing: 0.16em; }
.steps .t { font-family: var(--display); font-size: 26px; letter-spacing: 0.03em; }
.steps .s { font-size: 13px; color: var(--muted); margin-left: auto; }
.steps .detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--speed), padding var(--speed);
  color: var(--muted);
  max-width: var(--max-read);
}
.steps li.open .detail { max-height: 220px; padding-bottom: 24px; }

/* ── 8 · FOOTER ─────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: clamp(48px, 7vw, 80px) var(--gutter) 40px;
  background: var(--white);
}
.footer-grid {
  max-width: var(--max);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
}
.footer-head {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--muted);
  padding: 5px 0;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--ink); }

.footer-legal {
  max-width: var(--max);
  margin-inline: auto;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--faint);
  line-height: 1.9;
}

/* ── 9 · DIALOG ─────────────────────────────────────────── */
dialog.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(1100px, 92vw);
  width: 100%;
}
dialog.modal::backdrop { background: rgba(17,18,15,0.86); backdrop-filter: blur(6px); }
.modal-close {
  margin-left: auto;
  display: block;
  background: none;
  border: 0;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 12px 0;
}
.modal-frame { aspect-ratio: 16 / 9; width: 100%; background: #000; }
.modal-frame iframe { width: 100%; height: 100%; border: 0; }
body.locked { overflow: hidden; }

/* ── 10 · REVEAL ────────────────────────────────────────────
   Scoped to .js so content is fully visible when JavaScript is
   unavailable. Never hide content behind a script. */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22,1,0.36,1); }
.js .reveal.in { opacity: 1; transform: none; }

.hidden { display: none !important; }

/* ── 11 · ACCESSIBILITY ─────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 12px 20px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ── 12 · RESPONSIVE ────────────────────────────────────── */
@media (max-width: 1000px) {
  .head.split { grid-template-columns: 1fr; gap: 24px; align-items: start; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .menu-btn { display: block; }
  .nav {
    position: fixed;
    inset: 0 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 88px var(--gutter) 32px;
    transform: translateY(-102%);
    transition: transform var(--speed);
    z-index: -1;
  }
  .nav.open { transform: none; }
  .nav a { font-size: 13px; padding-block: 12px; letter-spacing: 0.2em; }
  .nav .nav-cta { margin-top: 12px; }

  .grid-2, .grid-3, .grid-4,
  .cards-2, .cards-3 { grid-template-columns: 1fr; }

  .steps button { flex-wrap: wrap; gap: 10px; }
  .steps .s { margin-left: 0; width: 100%; }

  .footer-grid { grid-template-columns: 1fr; }
}

/* ── FOUNDER BAND ───────────────────────────────────────────
   The founder portrait is a wide frame with the subject held to
   the right and clean negative space on the left, so it runs
   full-bleed with the copy set into that space — not cropped
   square into a column. Its own ground is close to --paper, so
   the wash below extends the photo rather than sitting on it. */
.founder-band {
  position: relative;
  background: var(--paper);
  overflow: hidden;
  isolation: isolate;
}
.founder-band > img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  /* Held right of centre so he stays in frame as the band narrows. */
  object-position: 76% 42%;
}
.founder-band::before {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg,
    var(--paper) 0%, var(--paper) 26%,
    rgba(245,244,239,0.88) 42%,
    rgba(245,244,239,0) 64%);
}
.founder-band .container {
  min-height: min(52vw, 600px);
  display: flex;
  align-items: center;
  padding-block: clamp(56px, 7vw, 100px);
}
.founder-copy { max-width: 460px; }
.founder-copy .pull { margin-top: 30px; }

@media (max-width: 900px) {
  /* Overlaying copy would sit on his face at this width, so the
     photo goes above the text and keeps its full frame. */
  .founder-band > img {
    position: relative;
    z-index: 0;
    height: auto;
    aspect-ratio: 16 / 10;
    object-position: 70% 42%;
  }
  .founder-band::before { display: none; }
  .founder-band .container {
    min-height: 0;
    padding-block: clamp(32px, 6vw, 56px);
  }
  .founder-copy { max-width: none; }
}

/* Founder photo not yet supplied. Must read as an empty slot, never
   as a finished design — a stand-in image here got mistaken for the
   real thing once already. Flipped automatically by build/b8_founder.py.
   The slot is a sibling of .container, exactly where the <img> sits, so
   it is placed the same way the photo is rather than laid out in flow. */
.founder-band.pending { background: var(--paper); }
.founder-band.pending::before { display: none; }
.founder-slot {
  position: absolute;
  top: clamp(24px, 3vw, 40px);
  bottom: clamp(24px, 3vw, 40px);
  right: clamp(24px, 3vw, 40px);
  width: min(48%, 620px);
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  padding: 24px;
  background: var(--sink);
  border: 1px dashed var(--gold);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.founder-slot small {
  display: block;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: none;
  font-size: 11px;
}
@media (max-width: 900px) {
  /* Stack: slot on top at a sane height, copy beneath. */
  .founder-slot {
    position: relative;
    inset: auto;
    width: auto;
    aspect-ratio: 16 / 9;
    margin: 0 0 clamp(24px, 4vw, 40px);
  }
  .founder-band.pending { display: flex; flex-direction: column; }
}
