/* ═══════════════════════════════════════════════════════════════════════════
   MIKSIR — marketing site foundation
   Tokens, nav, footer, buttons, reveal system. Shared by every marketing page.
   Type: Fraunces (display) · IBM Plex Sans (body) · IBM Plex Mono (labels)
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Cross-document view transitions (native, progressive) ──────────────────
   Supporting browsers fade/slide between pages; others navigate normally. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.4s; }
/* The nav brand mark morphs across pages (name must be unique per document,
   so scope to the nav — the footer also uses .brand-mark). */
.site-nav .brand-mark { view-transition-name: miksir-brand; }

/* ── Native scroll-driven motion (progressive; ignored where unsupported) ─── */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* Section eyebrows wipe their leading rule as they enter (no JS touches this,
       so it can't conflict with the pointer-driven card tilt). */
    .eyebrow::before {
      animation: sd-rule linear both;
      animation-timeline: view();
      animation-range: entry 10% entry 90%;
    }
    @keyframes sd-rule { from { width: 0; opacity: 0; } to { width: 22px; opacity: 1; } }
    /* The standards strip fades its edges in as the band enters view */
    .standards {
      animation: sd-fade linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
    @keyframes sd-fade { from { opacity: 0.3; } to { opacity: 1; } }
  }
}

:root {
  /* Core */
  --paper:   #F7F6F2;
  --ink:     #16201E;
  --ink-2:   #1E2A27;   /* raised dark surface */
  --surface: #FFFFFF;
  --border:  #E3E1D8;
  --border-dark: rgba(247, 246, 242, 0.12);
  --muted:   #6B7770;
  --muted-dark: #9AA69F; /* muted on ink */

  /* Studio spectrum — the only accents on the site */
  --clay:  #C2703D;  --clay-soft:  #F3E6DC;
  --moss:  #2E5D4E;  --moss-soft:  #E7EEEA;
  --soil:  #8B6B4A;  --soil-soft:  #EFE7DC;
  --steel: #3E5C76;  --steel-soft: #E3EAF1;

  /* Page accent — studio pages override; scroll script animates on landing */
  --accent: var(--clay);
  --accent-soft: var(--clay-soft);

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Scale (base-8) */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px;
  --s6: 64px; --s7: 96px; --s8: 128px;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-lift: 0 12px 32px rgba(22, 32, 30, 0.10);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
img, svg, canvas { max-width: 100%; display: block; }

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

/* ── Typography ────────────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 22px; height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.display-xl {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(2.6rem, 7.2vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
}
.display-lg {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.display-md {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.display-xl em, .display-lg em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.lede {
  font-size: clamp(1.02rem, 1.4vw, 1.18rem);
  line-height: 1.7;
  color: var(--muted);
  max-width: 56ch;
}
.on-ink .lede { color: var(--muted-dark); }

.mono-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }
.section { padding: clamp(64px, 10vw, 128px) 0; }
.on-ink { background: var(--ink); color: var(--paper); }
.on-ink .eyebrow { color: var(--accent); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 26px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out),
              background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn .arrow { transition: transform 0.25s var(--ease-out); }
.btn:hover .arrow { transform: translateX(4px); }

.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn-paper { background: var(--paper); color: var(--ink); }
.btn-paper:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,0.25); }
.btn-line { border: 1.5px solid var(--border); color: var(--ink); background: transparent; }
.btn-line:hover { border-color: var(--ink); }
.on-ink .btn-line { border-color: var(--border-dark); color: var(--paper); }
.on-ink .btn-line:hover { border-color: var(--paper); }

/* ── Site nav ──────────────────────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
  border-bottom: 1px solid transparent;
}
.site-nav.scrolled {
  background: rgba(247, 246, 242, 0.86);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.site-nav.nav-dark:not(.scrolled) { color: var(--paper); }
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav-links { display: none; align-items: center; gap: 4px; }
.nav-links a {
  position: relative;
  padding: 10px 14px;
  font-size: 14.5px;
  font-weight: 450;
  color: inherit;
  opacity: 0.75;
  transition: opacity 0.2s ease;
  border-radius: 8px;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 6px;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease-out);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { opacity: 1; }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.nav-cta { display: none; align-items: center; gap: 10px; }
.nav-cta .btn { min-height: 42px; padding: 9px 20px; font-size: 14px; }

.nav-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  align-items: center;
  border-radius: 8px;
}
.nav-burger span {
  display: block;
  width: 20px; height: 1.6px;
  background: currentColor;
  transition: transform 0.3s var(--ease-out), opacity 0.2s ease;
}
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.6px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.6px) rotate(-45deg); }

.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.nav-drawer.open { opacity: 1; pointer-events: auto; }
.nav-drawer a {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out), color 0.2s ease;
}
.nav-drawer.open a { opacity: 1; transform: none; }
.nav-drawer a:hover { color: var(--accent); }
.nav-drawer .drawer-cta {
  margin-top: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s var(--ease-out) 0.2s, transform 0.4s var(--ease-out) 0.2s;
}
.nav-drawer.open .drawer-cta { opacity: 1; transform: none; }
.nav-drawer .mono-label { color: var(--muted-dark); padding: 0 12px; margin-bottom: 8px; }

@media (min-width: 900px) {
  .nav-links, .nav-cta { display: flex; }
  .nav-burger, .nav-drawer { display: none; }
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(56px, 8vw, 96px) 0 36px;
  position: relative;
  overflow: hidden;
}
.footer-strata {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  display: flex;
}
.footer-strata span { flex: 1; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  margin-bottom: 56px;
}
.footer-brand p {
  color: var(--muted-dark);
  font-size: 14px;
  max-width: 34ch;
  margin-top: 14px;
}
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dark);
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 14.5px;
  padding: 5px 0;
  color: rgba(247, 246, 242, 0.78);
  transition: color 0.2s ease, transform 0.2s var(--ease-out);
}
.footer-col a:hover { color: #fff; transform: translateX(3px); }
.footer-bottom {
  border-top: 1px solid var(--border-dark);
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted-dark);
}
@media (min-width: 720px) {
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
}

/* ── Reveal system ─────────────────────────────────────────────────────────── */
.rv {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
  transition-delay: calc(var(--rv-d, 0) * 90ms);
}
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  .btn, .footer-col a { transition: none; }
}

/* ── Shared card ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }

/* ── Studio color helpers ──────────────────────────────────────────────────── */
.acc-clay  { --accent: var(--clay);  --accent-soft: var(--clay-soft); }
.acc-moss  { --accent: var(--moss);  --accent-soft: var(--moss-soft); }
.acc-soil  { --accent: var(--soil);  --accent-soft: var(--soil-soft); }
.acc-steel { --accent: var(--steel); --accent-soft: var(--steel-soft); }
