/* Karn website — tokens mirror Karn/Shared/Theme/AppTheme.swift (KarnTheme). */

@font-face { font-family: "Karn Horizon"; src: url("/assets/fonts/karn-horizon.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/assets/fonts/fraunces.woff2") format("woff2"); font-weight: 300 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/assets/fonts/fraunces-italic.woff2") format("woff2"); font-weight: 300 600; font-style: italic; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dmsans-300.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dmsans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dmsans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "DM Mono"; src: url("/assets/fonts/dmmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  /* brand, constant */
  --forest: #2D3B2A;
  --moss: #4A5E40;
  --sage: #7B9070;
  --sand: #C8B99A;
  --terracotta: #B85C38;
  --night: #111410;
  --night-card: #191C16;
  --cream: #F5F0E8;
  --parchment: #FAF7F2;
  --warm-white: #F8F6F2;

  /* semantic, light */
  --bg: var(--cream);
  --surface: var(--parchment);
  --muted: #EDE6D8;
  --text: #1C1A16;
  --text-2: #7A6F5E;
  --border: rgba(44, 38, 28, .12);
  --stone: #2F3530;
  --accent: var(--terracotta);

  --f-mark: "Karn Horizon", "Fraunces", Georgia, serif;
  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "DM Mono", ui-monospace, Menlo, monospace;

  --gutter: clamp(16px, 5vw, 64px);
  --radius: 28px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--night);
    --surface: var(--night-card);
    --muted: #1E2119;
    --text: #EDE6D8;
    --text-2: #8A7E6E;
    --border: rgba(237, 230, 216, .10);
    --stone: #B9B8B2;
    --accent: #D07A55;
  }
}
:root[data-theme="dark"] {
  --bg: var(--night); --surface: var(--night-card); --muted: #1E2119; --text: #EDE6D8;
  --text-2: #8A7E6E; --border: rgba(237, 230, 216, .10); --stone: #B9B8B2; --accent: #D07A55;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--terracotta); color: var(--cream); }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--cream); color: var(--forest); padding: 8px 14px; border-radius: 999px; }
.skip:focus { left: 16px; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 820px; }

.kicker {
  font: 500 12px/1.4 var(--f-mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 20px;
}
.display {
  font: 400 clamp(40px, 6.2vw, 84px)/1.02 var(--f-display);
  letter-spacing: -.02em;
  margin: 0 0 24px;
  text-wrap: balance;
}
.display em { font-style: italic; font-weight: 300; color: var(--accent); }
.display em { display: block; }
.body-lg { font-size: clamp(17px, 1.5vw, 20px); line-height: 1.65; color: var(--text-2); margin: 0 0 16px; max-width: 46ch; text-wrap: pretty; }
.body-md { color: var(--text-2); max-width: 56ch; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px; border-radius: 999px;
  font: 500 16px/1 var(--f-body); text-decoration: none; letter-spacing: .01em;
  transition: transform .4s var(--ease), background-color .3s, color .3s, border-color .3s;
}
.btn:hover { transform: translateY(-2px); }
.btn-light { background: var(--warm-white); color: var(--forest); }
.btn-light:hover { background: #fff; }
.btn-ghost { color: var(--warm-white); border: 1px solid rgba(248, 246, 242, .4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--warm-white); }
.btn-dark { background: var(--forest); color: var(--cream); }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  color: var(--warm-white);
  transition: background-color .4s, color .4s, box-shadow .4s, backdrop-filter .4s;
}
.nav.scrolled, .plain .nav {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; display: block; }
.brand-mark .cairn { width: 100%; height: 100%; }
.brand-word { font: 400 22px/1 var(--f-mark); letter-spacing: -.01em; margin: 0; }
.nav-links { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-size: 15px; }
.nav-links > a:not(.pill) { text-decoration: none; opacity: .85; }
.nav-links > a:not(.pill):hover { opacity: 1; }
.pill { text-decoration: none; padding: 9px 18px; border-radius: 999px; border: 1px solid currentColor; font-weight: 500; }
.nav.scrolled .pill, .plain .nav .pill { background: var(--forest); color: var(--cream); border-color: var(--forest); }

.lang { position: relative; }
.lang summary { list-style: none; cursor: pointer; font: 500 13px/1 var(--f-mono); letter-spacing: .12em; opacity: .85; padding: 8px 2px; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: translateY(-3px) rotate(45deg); }
.lang ul {
  position: absolute; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; min-width: 150px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .35);
}
.lang li a { display: block; padding: 9px 14px; border-radius: 10px; text-decoration: none; font-size: 15px; }
.lang li a:hover { background: var(--muted); }
.lang li a[aria-current] { color: var(--accent); }

@media (max-width: 560px) {
  .nav-links > a:first-child { display: none; }
}

/* ---------- hero: what the app is, with the app itself beside it ---------- */
.hero {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  color: var(--warm-white); overflow: hidden; isolation: isolate; background: #000;
}
.hero-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%;
  z-index: -2; animation: drift 24s var(--ease) both;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.45) 55%, rgba(0,0,0,.25) 100%),
    linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.55) 100%);
}
.hero-inner {
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 120px var(--gutter) 96px;
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 80px); align-items: center;
}
.hero-kicker { color: #E2A285; animation: rise .9s .1s var(--ease) both; }
.hero-title {
  font: 400 clamp(44px, 6vw, 88px)/1.0 var(--f-display); letter-spacing: -.025em; margin: 0 0 24px;
  text-wrap: balance; animation: rise .9s .2s var(--ease) both;
}
.hero-title em { display: block; font-style: italic; font-weight: 300; color: #F0C8B2; }
.hero-lead {
  font-size: clamp(17px, 1.45vw, 20px); line-height: 1.6; color: rgba(248, 246, 242, .82);
  max-width: 50ch; margin: 0 0 36px; text-wrap: pretty; animation: rise .9s .35s var(--ease) both;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; animation: rise .9s .5s var(--ease) both; }

.hero-phones { position: relative; justify-self: center; width: min(420px, 100%); aspect-ratio: 420 / 640; }
.hero-phone { position: absolute; width: 66%; margin: 0; }
.hero-phone-front { left: 0; bottom: 0; z-index: 2; animation: phone-in 1.1s .4s var(--ease) both; }
.hero-phone-back { right: 0; top: 0; rotate: 6deg; animation: phone-in 1.1s .6s var(--ease) both; }
.hero-phone .phone-screen { box-shadow: 0 0 0 1.5px #3A3D36, 0 60px 100px -30px rgba(0, 0, 0, .8); }

.scroll-cue { position: absolute; bottom: 24px; left: 50%; translate: -50% 0; width: 24px; height: 38px; border: 1.5px solid rgba(248,246,242,.5); border-radius: 12px; animation: rise .9s 1s var(--ease) both; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--warm-white); animation: cue 2.2s 1.6s infinite; }

@media (max-width: 860px) {
  .hero { min-height: 0; }
  .hero::before { background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.45) 50%, rgba(0,0,0,.8) 100%); }
  .hero-inner { grid-template-columns: 1fr; padding-top: 112px; padding-bottom: 72px; }
  .hero-phones { width: min(340px, 86%); }
  .scroll-cue { display: none; }
}

@keyframes phone-in { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* ---------- open data ---------- */
.sources { background: var(--night); color: #EDE6D8; padding: 0 0 clamp(96px, 12vw, 160px); text-align: center; --accent: #D07A55; --text-2: #A0957F; }
.sources .wrap { border-top: 1px solid rgba(237, 230, 216, .10); padding-top: clamp(64px, 8vw, 96px); }
.source-list { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 36px; }
.source-list li { font: 400 clamp(22px, 2.6vw, 34px)/1.2 var(--f-display); color: #EDE6D8; opacity: .8; }

/* ---------- download ---------- */
.download { position: relative; background: var(--forest); color: var(--cream); padding: clamp(96px, 12vw, 160px) 0; overflow: hidden; isolation: isolate; --accent: #E2A285; --text-2: rgba(245, 240, 232, .72); }
.download-bg {
  position: absolute; inset: 0; z-index: -1; opacity: .16;
  background: url("/assets/img/onboarding-8-720.webp") center / cover no-repeat;
  mask-image: linear-gradient(90deg, transparent 0%, #000 70%); -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
}
.download-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(40px, 6vw, 96px); align-items: center; }
.app-icon { width: 88px; height: 88px; border-radius: 22px; margin-bottom: 32px; box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .6); }
.note { font: italic 300 18px/1.5 var(--f-display); color: var(--cream); opacity: .85; margin: 28px 0 0; }

.stores { display: flex; gap: 20px; }
.store-card {
  width: 236px; background: var(--cream); color: var(--forest); border-radius: var(--radius); padding: 22px 22px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .6);
  transition: transform .6s var(--ease);
}
.store-card:hover { transform: translateY(-6px) rotate(-.5deg); }
.qr { width: 100%; aspect-ratio: 1; color: var(--forest); }
.qr svg { width: 100%; height: 100%; }
.store-scan { font: 400 11px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: #7A6F5E; margin: 10px 0 14px; }
.store-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center;
  background: var(--night); color: var(--warm-white); text-decoration: none; border-radius: 14px; padding: 10px 14px;
  font: 500 18px/1.05 var(--f-body); text-align: left;
}
.store-btn svg { width: 24px; height: 24px; flex: none; }
.store-btn small { display: block; font-size: 10.5px; font-weight: 400; opacity: .8; letter-spacing: .02em; }

/* On a phone, a QR code is useless: show the matching store first, big buttons only. */
.is-mobile .qr, .is-mobile .store-scan { display: none; }
.is-mobile .store-card { width: auto; flex: 1; padding: 0; background: none; box-shadow: none; }
.is-mobile .store-card:hover { transform: none; }
.is-mobile .store-btn { min-height: 60px; background: var(--cream); color: var(--night); }
.is-ios [data-platform="android"], .is-android [data-platform="ios"] { order: 2; }

@media (max-width: 900px) {
  .download-inner { grid-template-columns: 1fr; }
  .stores { flex-wrap: wrap; }
}
@media (max-width: 540px) {
  .stores { flex-direction: column; }
  .store-card { width: 100%; }
  .qr { max-width: 220px; }
}

/* ---------- footer ---------- */
.footer { background: var(--night); color: #A0957F; padding: 56px var(--gutter) max(32px, env(safe-area-inset-bottom)); font-size: 15px; }
.footer-inner { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap; padding-bottom: 32px; border-bottom: 1px solid rgba(237, 230, 216, .10); }
.footer-brand { display: flex; align-items: center; gap: 14px; color: #EDE6D8; }
.footer-brand .brand-mark { width: 40px; height: 40px; color: #A9ACAB; }
.footer-tag { margin: 4px 0 0; font: italic 300 15px/1.3 var(--f-display); color: #A0957F; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: #EDE6D8; }
.footer-langs { display: flex; gap: 12px; font: 400 12px/1 var(--f-mono); letter-spacing: .1em; }
.footer-langs a[aria-current] { color: #D07A55; }
.footer-fine { max-width: 1240px; margin: 24px auto 0; font-size: 13px; line-height: 1.6; opacity: .75; }

/* ---------- plain pages: privacy, 404, /get ---------- */
.plain main { padding-top: 120px; }
.doc { padding: 40px 0 120px; }
.doc-date { font: 400 13px/1 var(--f-mono); color: var(--text-2); letter-spacing: .06em; margin: 0 0 48px; }
.prose { font-size: 17px; line-height: 1.75; }
.prose h2 { font: 400 28px/1.2 var(--f-display); margin: 48px 0 12px; }
.prose p { margin: 0 0 16px; color: var(--text); }
.prose a { color: var(--accent); }
.nf { min-height: 70svh; display: grid; place-items: center; text-align: center; padding: 40px 0 120px; }
.nf .body-lg { margin: 0 auto 32px; }
.nf-cairn { width: 96px; margin: 0 auto 32px; color: var(--stone); }
.get-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.stores.reveal { transition-delay: .15s; }
.extra:nth-child(3n+2) { transition-delay: .08s; }
.extra:nth-child(3n) { transition-delay: .16s; }

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

/* ---------- feature tour: screenshot + copy rows ---------- */
.tour { padding: clamp(96px, 12vw, 160px) 0 clamp(80px, 10vw, 140px); }
.tour .section-head { text-align: center; margin: 0 auto clamp(56px, 7vw, 96px); }
.t-row {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 8vw, 128px);
  align-items: center; max-width: 1040px; margin: 0 auto clamp(72px, 10vw, 136px);
}
.t-flip .t-media, .t-flip .t-photo { order: 2; }
.t-photo { margin: 0; justify-self: center; width: min(420px, 100%); aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--muted); box-shadow: 0 50px 90px -40px rgba(28, 26, 22, .55); }
.t-photo img { width: 100%; height: 100%; object-fit: cover; }
.t-photo-wide { width: min(520px, 100%); aspect-ratio: 3 / 2; }
.t-media { justify-self: center; width: min(300px, 100%); }
.t-media .phone { margin: 0; }
.t-pair { display: flex; gap: 18px; width: min(460px, 100%); }
.t-pair .phone { flex: 1; }
.t-pair .phone:last-child { translate: 0 40px; }
.t-title { font: 400 clamp(32px, 3.8vw, 52px)/1.06 var(--f-display); letter-spacing: -.015em; margin: 0 0 18px; text-wrap: balance; }
.t-points { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
.t-points li { position: relative; padding-left: 28px; font-size: 16px; line-height: 1.5; }
.t-points li::before {
  content: ""; position: absolute; left: 2px; top: .55em; width: 14px; height: 8px;
  border-left: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: translateY(-50%) rotate(-45deg);
}
.phone-screen {
  /* The bezel is padding around the image, so the screenshot keeps its 1320x2868 shape. */
  padding: clamp(6px, .7vw, 9px); border-radius: clamp(34px, 3.4vw, 46px);
  background: #1A1C18;
  box-shadow: 0 0 0 1.5px #3A3D36, 0 50px 90px -40px rgba(28, 26, 22, .55);
}
.phone-screen img {
  width: 100%; height: auto; aspect-ratio: 1320 / 2868;
  border-radius: clamp(28px, 2.8vw, 38px); background: var(--night);
}
.extra-head { font: 500 12px/1.4 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); text-align: center; margin: 0 0 32px; }
.extras { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 22px); }
.extra { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 26px 26px 28px; }
.extra svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 18px; }
.extra h4 { font: 400 22px/1.2 var(--f-display); margin: 0 0 8px; }
.extra p { margin: 0; color: var(--text-2); font-size: 15.5px; line-height: 1.55; }

@media (max-width: 860px) {
  .extras { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .t-row { grid-template-columns: 1fr; gap: 36px; }
  .t-flip .t-media, .t-flip .t-photo { order: 0; }
  .t-photo { width: 100%; aspect-ratio: 4 / 3.6; }
  .t-photo-wide { aspect-ratio: 3 / 2; }
  .t-media { width: 64vw; max-width: 280px; }
  .t-pair { width: 100%; max-width: 420px; }
}
@media (max-width: 520px) {
  .extras { grid-template-columns: 1fr; }
}

/* the open-data band now follows a cream section */
.sources { border-radius: clamp(28px, 4vw, 48px) clamp(28px, 4vw, 48px) 0 0; padding-top: clamp(80px, 10vw, 120px); }
.sources .wrap { border-top: 0; padding-top: 0; }
