/* Merga marketing site v2 — tokens mirror MergaTheme.swift (light values) */
:root {
  --bg: #FAF8F2;
  --bg-warm: #F5F2E9;
  --ink: #0E0D0B;
  --ink-sub: #6F6B62;
  --ink-faint: #A39E92;
  --hair: #ECE9E0;
  --highlight: #FCEFC0;
  --band: #12110E;
  --band-ink: #F5F2E9;
  --band-sub: #A8A294;
  --shadow-device:
    0 60px 120px -30px rgba(14, 13, 11, 0.28),
    0 24px 48px -24px rgba(14, 13, 11, 0.22);
  --shadow-window:
    0 50px 100px -28px rgba(14, 13, 11, 0.22),
    0 12px 28px -14px rgba(14, 13, 11, 0.14);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Sans 3", sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

.inner {
  max-width: 1140px;
  margin: 0 auto;
  padding-left: clamp(20px, 4vw, 40px);
  padding-right: clamp(20px, 4vw, 40px);
}

.inner-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding-left: clamp(20px, 4vw, 40px);
  padding-right: clamp(20px, 4vw, 40px);
}

a { color: var(--ink); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--highlight); }

/* ---------- Type helpers ---------- */

.kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-sub);
  margin: 0 0 22px;
}

.serif { font-family: "Source Serif 4", serif; font-weight: 400; }

.mono-link {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.mono-link:hover { text-decoration-thickness: 2px; }

em.hl {
  font-style: italic;
  background: linear-gradient(transparent 62%, var(--highlight) 62%);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 242, 0.85);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s ease;
}

.site-header.scrolled { border-bottom-color: var(--hair); }

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}

.site-header .logo img { height: 23px; width: auto; display: block; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 26px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--ink-sub);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active { color: var(--ink); }

.nav-toggle { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: clip;
}

.hero .inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(40px, 6vw, 80px);
  padding-top: clamp(48px, 7vw, 96px);
  padding-bottom: clamp(64px, 9vw, 130px);
}

.hero h1 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(42px, 5.4vw, 68px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
}

.hero .sub {
  font-size: clamp(16.5px, 1.5vw, 18.5px);
  color: var(--ink-sub);
  max-width: 460px;
  margin: 0 0 34px;
}

.badges {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  background: var(--bg);
}

.badge.solid {
  background: var(--ink);
  color: var(--bg);
}

.badge small { font-size: 10px; opacity: 0.72; }
.badge b { font-weight: 600; }

.soon {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Hero device composition */

.hero-stage {
  position: relative;
  min-height: clamp(380px, 42vw, 560px);
}

.hero-mac {
  position: absolute;
  top: 6%;
  left: 12%;
  width: 118%;
  max-width: none;
  will-change: transform;
}

.hero-mac img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-window);
}

.hero-phone {
  position: absolute;
  bottom: -7%;
  left: -2%;
  --w: clamp(190px, 21vw, 250px);
  will-change: transform;
}

/* ---------- iPhone frame ---------- */

.iphone {
  /* --w (phone width) is a pure length set per context (often on the parent);
     it drives width, bezel thickness and both corner radii so the frame stays
     concentric. Don't declare --w here — that would block inheritance from a
     parent like .hero-phone; use the fallback in var(--w, …) instead. */
  --bezel: calc(var(--w, 300px) * 0.03);
  --radius: calc(var(--w, 300px) * 0.135);
  width: var(--w, 300px);
  background: #0B0B0C;
  border-radius: var(--radius);
  padding: var(--bezel);
  box-shadow: var(--shadow-device), inset 0 0 0 1.5px rgba(255, 255, 255, 0.09);
}

.iphone-screen {
  position: relative;
  overflow: hidden;
  /* concentric with the bezel: outer radius − bezel thickness */
  border-radius: calc(var(--radius) - var(--bezel));
  background: #0B0B0C;
}

.iphone-screen img { display: block; width: 100%; height: auto; }

.iphone-screen::after {
  /* Dynamic Island */
  content: "";
  position: absolute;
  top: 1.6%;
  left: 50%;
  transform: translateX(-50%);
  width: 27%;
  aspect-ratio: 125 / 37;
  background: #0B0B0C;
  border-radius: 999px;
}

/* ---------- iPad frame ---------- */

.ipad {
  background: #0B0B0C;
  border-radius: 5.2% / 4%;
  padding: 2.6%;
  box-shadow: var(--shadow-device), inset 0 0 0 2px rgba(255, 255, 255, 0.09);
}

.ipad-screen {
  overflow: hidden;
  border-radius: 3.4% / 2.6%;
  background: #0B0B0C;
}

.ipad-screen img { display: block; width: 100%; height: auto; }

/* ---------- Mac window ---------- */

.mac-window img,
img.mac-shot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-window);
}

/* ---------- Trust strip ---------- */

.strip {
  overflow: hidden;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background: var(--bg);
}

.strip-track {
  display: flex;
  align-items: center;
  gap: 56px;
  width: max-content;
  padding: 16px 28px;
  animation: marquee 36s linear infinite;
}

.strip:hover .strip-track { animation-play-state: paused; }

.strip-track span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-sub);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 56px;
}

.strip-track span::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-faint);
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- Feature sections ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(44px, 8vw, 120px);
  padding-top: clamp(64px, 9vw, 130px);
  padding-bottom: clamp(64px, 9vw, 130px);
}

.feature + .feature { border-top: 1px solid var(--hair); }

.feature-copy .fnum {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 14px;
}

.feature-copy h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.18;
  margin: 0 0 18px;
  letter-spacing: -0.005em;
}

.feature-copy p {
  font-size: 16.5px;
  color: var(--ink-sub);
  max-width: 440px;
  margin: 0 0 14px;
}

.feature-copy p:last-of-type { margin-bottom: 0; }

.feature-copy .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  padding: 0;
  list-style: none;
}

.feature-copy .chips li {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 6px 13px;
}

.feature-copy .chips li.inverse {
  background: var(--ink);
  color: var(--bg);
}

.feature-media { display: flex; justify-content: center; }

.feature-media .iphone { --w: clamp(220px, 33vw, 300px); }

.feature.media-left .feature-media { order: -1; }

/* phone tilt accents */
.tilt-l { transform: rotate(-1.6deg); }
.tilt-r { transform: rotate(1.6deg); }

/* ---------- Map band ---------- */

.map-band {
  background: var(--bg-warm);
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  padding: clamp(64px, 9vw, 120px) 0 0;
  overflow: clip;
}

.map-band .band-head {
  text-align: center;
  max-width: 620px;
  margin: 0 auto clamp(40px, 6vw, 72px);
  padding: 0 24px;
}

.map-band h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.16;
  margin: 0 0 16px;
}

.map-band .band-head p {
  color: var(--ink-sub);
  margin: 0;
}

.map-band .map-shot {
  max-width: min(1020px, 90%);
  margin: 0 auto;
  transform: translateY(clamp(24px, 4vw, 48px));
}

/* ---------- Devices / everywhere ---------- */

.devices {
  padding-top: clamp(80px, 11vw, 150px);
  padding-bottom: clamp(64px, 9vw, 120px);
  text-align: center;
}

.devices h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.16;
  margin: 0 0 16px;
}

.devices > .inner > p {
  color: var(--ink-sub);
  max-width: 540px;
  margin: 0 auto;
}

.devices-stage {
  position: relative;
  max-width: 980px;
  margin: clamp(44px, 6vw, 72px) auto 0;
  padding-bottom: clamp(16px, 3vw, 40px);
}

.devices-mac { width: 82%; }

.devices-ipad {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 30%;
}

/* ---------- Small features grid ---------- */

.grid-section {
  border-top: 1px solid var(--hair);
  padding-top: clamp(64px, 9vw, 110px);
  padding-bottom: clamp(72px, 10vw, 130px);
}

.section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

.grid-section .grid-head h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(28px, 3.2vw, 38px);
  margin: 0 0 44px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--hair);
}

.card {
  background: var(--bg);
  padding: clamp(24px, 3vw, 36px);
  transition: background 0.3s ease;
}

.card:hover { background: var(--bg-warm); }

.card svg {
  width: 26px;
  height: 26px;
  display: block;
  margin-bottom: 18px;
  color: var(--ink);
}

.card h3 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: 20px;
  margin: 0 0 8px;
}

.card p {
  font-size: 15px;
  color: var(--ink-sub);
  margin: 0;
}

/* ---------- Privacy band ---------- */

.privacy-band {
  background: var(--band);
  color: var(--band-ink);
  padding: clamp(72px, 10vw, 130px) 0;
}

.privacy-band .inner {
  max-width: 860px;
  text-align: center;
}

.privacy-band .kicker { color: var(--band-sub); }

.privacy-band h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.22;
  margin: 0 0 22px;
}

.privacy-band h2 em {
  font-style: italic;
  color: var(--highlight);
}

.privacy-band p {
  color: var(--band-sub);
  font-size: 16.5px;
  max-width: 580px;
  margin: 0 auto 30px;
}

.privacy-band .mono-link { color: var(--band-ink); }

/* ---------- Closing CTA ---------- */

.cta {
  text-align: center;
  padding-top: clamp(80px, 11vw, 140px);
  padding-bottom: clamp(80px, 11vw, 150px);
}

.cta h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1.12;
  margin: 0 0 18px;
}

.cta p {
  color: var(--ink-sub);
  max-width: 460px;
  margin: 0 auto 34px;
}

.cta .badges { justify-content: center; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--hair); }

.site-footer .inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 30px;
  padding-bottom: 36px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink-sub);
}

.site-footer a { color: var(--ink-sub); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- Subpages (support, privacy) ---------- */

.page { padding-top: clamp(56px, 8vw, 88px); padding-bottom: clamp(64px, 9vw, 110px); }

.page h1 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: clamp(36px, 4.6vw, 52px);
  margin: 0 0 16px;
}

.page .sub {
  font-size: 17px;
  color: var(--ink-sub);
  max-width: 520px;
  margin: 0 0 28px;
}

.updated {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-sub);
  margin: 0 0 44px;
}

.page h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: 24px;
  margin: 44px 0 10px;
}

.page p, .page ul {
  font-size: 16px;
  color: var(--ink-sub);
  max-width: 640px;
  margin: 0 0 14px;
}

.page ul { padding-left: 20px; }
.page li { margin-bottom: 6px; }

.faq .section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  margin: 52px 0 8px;
}

.qa {
  padding: 26px 0;
  border-bottom: 1px solid var(--hair);
}

.qa:last-of-type { border-bottom: none; }

.qa h3 {
  font-family: "Source Serif 4", serif;
  font-weight: 400;
  font-size: 21px;
  margin: 0 0 8px;
}

.qa p { margin: 0; }

.faq-footer { margin-top: 44px; }

/* ---------- Reveal animations (JS-gated) ---------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s ease, transform 0.9s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

html.js .reveal.in {
  opacity: 1;
  transform: none;
}

html.js .tilt-l.reveal.in { transform: rotate(-1.6deg); }
html.js .tilt-r.reveal.in { transform: rotate(1.6deg); }

/* ---------- Reduced motion ---------- */

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

  html.js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html.js .tilt-l { transform: rotate(-1.6deg); }
  html.js .tilt-r { transform: rotate(1.6deg); }

  .strip-track {
    animation: none;
    width: auto;
    flex-wrap: wrap;
    justify-content: center;
  }

  .strip-track span:last-child::after { display: none; }

  .hero-mac, .hero-phone { will-change: auto; }
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
  .hero .inner {
    grid-template-columns: 1fr;
    padding-bottom: clamp(48px, 8vw, 80px);
  }

  .hero-stage {
    min-height: 0;
    margin-top: 24px;
  }

  .hero-mac {
    top: 6%;
    left: auto;
    right: -20%;
    width: 102%;
  }

  .hero-phone {
    position: relative;
    bottom: auto;
    left: 2px;
    --w: clamp(170px, 30vw, 230px);
    z-index: 1;
  }

  .feature {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .feature.media-left .feature-media { order: 0; }

  .feature-media .iphone { --w: clamp(180px, 52vw, 280px); }

  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .devices-mac { width: 90%; margin-right: 10%; }
  .devices-ipad { width: 34%; }
}

@media (max-width: 560px) {
  .card-grid { grid-template-columns: 1fr; }

  .site-header .inner { flex-wrap: wrap; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px 2px;
    background: none;
    border: 0;
    cursor: pointer;
  }

  .nav-toggle-bar { width: 22px; height: 2px; background: var(--ink); }

  .site-nav { display: none; }

  body.nav-open .site-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-basis: 100%;
    padding-top: 18px;
    gap: 14px;
  }

  .hero-phone { --w: clamp(160px, 46vw, 200px); }

  .badges { gap: 10px; }
}
