:root {
  --bg: #f7f6f2;
  --bg-alt: #efede6;
  --surface: #ffffff;
  --ink: #141a26;
  --ink-soft: #4a5263;
  --line: #dcd9cf;
  --brand: #c4562b;        /* kestrel rust */
  --brand-ink: #ffffff;
  --sky: #13213a;          /* midnight */
  --teal: #0e5e63;
  --glint: #7cf0d6;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(20, 26, 38, .06), 0 12px 32px -12px rgba(20, 26, 38, .18);
  --max: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1017;
    --bg-alt: #131824;
    --surface: #171d2b;
    --ink: #eef0f5;
    --ink-soft: #a3abbd;
    --line: #283044;
    --brand: #ea7a4c;
    --brand-ink: #1a0d06;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 .4em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 600; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); font-weight: 600; }
h3 { font-size: 1.35rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-soft); }
.hidden { display: none !important; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.logo svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 22px; align-items: center; font-size: .95rem; }
.nav a { white-space: nowrap; }
@media (max-width: 1100px) { .nav { gap: 16px; font-size: .9rem; } .nav a[href^="#"]:not(.btn) { display: none; } }
.nav a { text-decoration: none; color: var(--ink-soft); }
.nav a:hover { color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: 999px;
  font-weight: 600; font-size: 1rem; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 8px 24px -10px var(--brand); }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn svg { width: 18px; height: 18px; }
.btn-sm { padding: 9px 16px; font-size: .9rem; }

/* Hero */
.hero { padding: 96px 0 72px; position: relative; overflow: hidden; }
.hero p.lead { font-size: 1.25rem; max-width: 620px; color: var(--ink-soft); }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }
.hero-flight { position: absolute; right: -60px; top: 40px; width: 520px; opacity: .9; pointer-events: none; }
@media (max-width: 900px) { .hero-flight { display: none; } }

/* ---------- Home hero ---------- */
.home-hero { min-height: min(760px, 92vh); display: flex; align-items: center; }
.home-hero .wrap { position: relative; z-index: 1; width: 100%; }

/* Headline lines rise in one after another. */
.js .rise { display: inline-block; opacity: 0; transform: translateY(18px); animation: rise .9s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--d) * 110ms + 100ms); }
.js .rise.actions { display: flex; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* Things that slide in as you scroll to them. */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .8s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 80ms); }
.js .reveal.in { opacity: 1; transform: none; }

/* Product cards tilt toward the cursor. */
.products { perspective: 1200px; }
.card { transform-style: preserve-3d; will-change: transform; }
.card .icon { transition: transform .4s cubic-bezier(.2,.7,.2,1); }
.card:hover .icon { transform: translateZ(30px) rotate(-6deg) scale(1.08); }
.card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.18), transparent 45%); }
.card:hover::after { opacity: 1; }

/* ---------- Home: data-flow diagram ---------- */
.flow-section { padding-top: 96px; }
.flow-card { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 24px; box-shadow: var(--shadow); overflow: hidden; }
.flow { width: 100%; height: auto; display: block; font-family: inherit; }
.flow .route { fill: none; stroke: url(#lineGrad); stroke-width: 3; stroke-dasharray: 2 10; stroke-linecap: round; animation: dash 1.2s linear infinite; }
.flow .route-bad { fill: none; stroke: var(--danger, #c0392b); stroke-opacity: .35; stroke-width: 2; stroke-dasharray: 6 8; }
@keyframes dash { to { stroke-dashoffset: -24; } }
.flow .device rect, .flow .device path { fill: var(--bg-alt); stroke: var(--ink-soft); stroke-width: 2; }
.flow .device circle { fill: var(--ink-soft); }
.flow text { fill: var(--ink-soft); font-size: 15px; font-weight: 600; }
.flow .hub rect { fill: var(--sky); }
.flow .hub-line { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; }
.flow .egg { fill: #f3e9ff; }
.flow .hub-label { fill: var(--ink); font-size: 20px; font-weight: 700; }
.flow .hub-sub { font-size: 13px; font-weight: 500; }
.flow .hub-glow { transform-origin: 860px 235px; animation: glow 3s ease-in-out infinite; }
@keyframes glow { 50% { transform: scale(1.12); opacity: .7; } }
.flow .hub.pulse rect { animation: hubPulse .45s ease; transform-box: fill-box; transform-origin: center; }
@keyframes hubPulse { 40% { transform: scale(1.06); } }
.flow .lock rect:first-child { fill: var(--surface); stroke: var(--teal); stroke-width: 1.5; }
.flow .lock text { fill: var(--teal); font-size: 14px; }
.flow .lock-shackle { fill: none; stroke: var(--teal); stroke-width: 2.5; }
.flow .lock-body { fill: var(--teal); }
.flow .shield-bg { fill: var(--surface); stroke: var(--danger, #c0392b); stroke-width: 2; }
.flow .shield-icon { fill: var(--danger, #c0392b); fill-opacity: .15; stroke: var(--danger, #c0392b); stroke-width: 2; }
.flow .shield-check { fill: none; stroke: var(--danger, #c0392b); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.flow .shield.hit { animation: shake .35s ease; }
@keyframes shake { 0%, 100% { transform: translate(470px, 47px); } 25% { transform: translate(465px, 47px); } 75% { transform: translate(475px, 47px); } }
.flow .tracker rect { fill: var(--bg-alt); stroke: var(--line); stroke-dasharray: 4 4; }
.flow .tracker text { font-size: 14px; text-decoration: line-through; opacity: .7; }
.flow .packet { fill: var(--teal); }
.flow .packet.photo { fill: var(--brand); }
.flow .packet.bad { fill: var(--danger, #c0392b); }
.flow .burst { fill: none; stroke: var(--danger, #c0392b); stroke-width: 2; }
.flow-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; text-align: center; }
.flow-stats b { display: block; font-family: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif; font-size: 2rem; color: var(--teal); font-variant-numeric: tabular-nums; }
.flow-stats b.bad { color: var(--danger, #c0392b); }
.flow-stats span { font-size: .85rem; color: var(--ink-soft); }
@media (prefers-color-scheme: dark) {
  .flow-stats b { color: var(--glint); }
  .flow .lock text { fill: var(--glint); }
  .flow .lock rect:first-child, .flow .lock-shackle { stroke: var(--glint); }
  .flow .lock-body, .flow .packet { fill: var(--glint); }
  .flow .hub rect { fill: #0e5e63; }
}
@media (max-width: 640px) { .flow-card { padding: 12px; border-radius: 20px; } .flow-stats b { font-size: 1.4rem; } }

@media (prefers-reduced-motion: reduce) {
  .js .rise, .js .reveal { opacity: 1; transform: none; animation: none; transition: none; }
  .flow .route, .flow .hub-glow { animation: none; }
}

/* ---------- Legal pages ---------- */
.legal .wrap { max-width: 820px; }
.legal h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.legal h2 { font-size: 1.4rem; margin-top: 2em; }
.legal p, .legal li { color: var(--ink-soft); }
.legal strong { color: var(--ink); }
.legal a { color: var(--brand); }
.legal .table-wrap { overflow-x: auto; margin: 1em 0; }
.legal table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.legal th, .legal td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.legal th { background: var(--bg-alt); }

/* Manifesto strip */
.strip { background: var(--sky); color: #e8ecf5; padding: 64px 0; }
.strip .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.strip h3 { color: #fff; }
.strip p { color: #b7c1d6; margin: 0; }
.strip .num { font-family: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif; font-size: 2.4rem; color: var(--glint); line-height: 1; margin-bottom: 10px; }
@media (max-width: 760px) { .strip .grid3 { grid-template-columns: 1fr; } }

/* Products */
section { padding: 88px 0; }
.section-head { max-width: 640px; margin-bottom: 44px; }
.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 960px) { .products { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .products { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; display: flex; flex-direction: column; gap: 10px; position: relative;
  box-shadow: var(--shadow); text-decoration: none;
  transition: transform .2s ease;
}
a.card:hover { transform: translateY(-3px); }
.card .icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff; margin-bottom: 6px; }
.card .icon svg { width: 28px; height: 28px; }
.card h3 { margin: 0; }
.card .replaces { font-size: .85rem; color: var(--ink-soft); }
.card p { color: var(--ink-soft); margin: 0; font-size: .97rem; flex: 1; }
.badge { position: absolute; top: 22px; right: 22px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; }
.badge-live { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
.badge-soon { background: var(--bg-alt); color: var(--ink-soft); }
@media (prefers-color-scheme: dark) { .badge-live { color: var(--glint); } }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; position: relative; z-index: 1; }
.card.featured { grid-column: span 2; background: linear-gradient(135deg, #13213a, #0e5e63); color: #fff; border: none; }
.card.featured p, .card.featured .replaces { color: #cfe0e6; }
@media (max-width: 620px) { .card.featured { grid-column: auto; } }
.card.featured .row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.card.featured .badge-live { background: rgba(124, 240, 214, .18); color: var(--glint); }

/* Split feature layout */
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: center; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 40px; } }

/* Phone mockup */
.phone {
  width: 300px; aspect-ratio: 9 / 19.5; margin: 0 auto;
  border-radius: 44px; padding: 12px; background: #0b0d12;
  box-shadow: 0 40px 80px -30px rgba(10, 20, 40, .55), inset 0 0 0 2px #2a2f3a;
  position: relative;
}
.phone .screen { width: 100%; height: 100%; border-radius: 34px; overflow: hidden; background: #10131a; color: #fff; display: flex; flex-direction: column; }
.phone .bar { padding: 30px 16px 10px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.phone .bar small { color: #7cf0d6; font-size: .7rem; letter-spacing: .1em; }
.phone .day { padding: 8px 14px 6px; font-size: .75rem; font-weight: 600; color: #cfd6e4; }
.phone .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.phone .grid span { aspect-ratio: 1; display: block; }
.phone .tabs { margin-top: auto; display: flex; justify-content: space-around; padding: 12px 6px 18px; background: #1c2029; font-size: .62rem; color: #a3abbd; }
.phone .tabs b { color: #7cf0d6; font-weight: 600; }

/* Feature list */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .features { grid-template-columns: 1fr; } }
.feature { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.feature .ficon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--teal) 14%, transparent); color: var(--teal); margin-bottom: 14px; }
@media (prefers-color-scheme: dark) { .feature .ficon { color: var(--glint); } }
.feature .ficon svg { width: 22px; height: 22px; }
.feature h3 { font-family: inherit; font-size: 1.05rem; letter-spacing: 0; margin-bottom: 6px; }
.feature p { color: var(--ink-soft); margin: 0; font-size: .95rem; }

/* Steps */
.steps { counter-reset: step; display: grid; gap: 14px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: step; display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.steps li::before { content: counter(step); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }

/* Download panel */
.download {
  border-radius: 32px; padding: 48px; color: #fff;
  background: radial-gradient(circle at 85% 20%, rgba(124, 240, 214, .25), transparent 40%), linear-gradient(135deg, #13213a, #0e5e63);
  display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center;
}
.download p { color: #cfe0e6; margin: 0; }
.download .meta { font-size: .85rem; color: #9fb7c2; margin-top: 10px; }
@media (max-width: 760px) { .download { grid-template-columns: 1fr; padding: 32px; } }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 18px 0; }
details summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details summary::after { content: "+"; color: var(--brand); font-size: 1.3rem; line-height: 1; }
details[open] summary::after { content: "\2212"; }
details p { margin: 12px 0 0; color: var(--ink-soft); }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 40px 0 56px; font-size: .9rem; color: var(--ink-soft); }
footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .nav a:not(.btn) { display: none; }
  .hero { padding: 64px 0 48px; }
  section { padding: 64px 0; }
  .wrap { padding: 0 16px; }
}

/* ---------- Home: app launcher ---------- */
.apps-section { padding-top: 40px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.app-tile { display: grid; gap: 6px; }
.app-tile[hidden] { display: none; }
.app-open { display: grid; gap: 4px; justify-items: start; padding: 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .2s ease, box-shadow .2s ease, border-color .2s; }
.app-open:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.app-open b { font-size: 1.05rem; margin-top: 8px; }
.app-open small { color: var(--ink-soft); }
.app-ic { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff; box-shadow: 0 10px 24px -12px currentColor; }
.app-ic svg { width: 26px; height: 26px; }
.app-go { margin-top: 10px; display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--brand); font-size: .9rem; }
.app-go svg { width: 15px; height: 15px; }
.app-more { font-size: .85rem; color: var(--ink-soft); padding-left: 18px; text-decoration: none; }
.app-more:hover { color: var(--ink); text-decoration: underline; }
#appsStatus .btn { margin-left: 8px; vertical-align: middle; }
#appsStatus a:not(.btn) { color: var(--brand); }

/* ---------- Home: the Kestrel Cloud globe ---------- */
.hero-globe {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.12) 0%, rgba(0,0,0,.3) 35%, #000 60%);
          mask-image: linear-gradient(90deg, rgba(0,0,0,.12) 0%, rgba(0,0,0,.3) 35%, #000 60%);
}
@media (max-width: 760px) {
  .hero-globe { -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.3), rgba(0,0,0,.6)); mask-image: linear-gradient(180deg, rgba(0,0,0,.3), rgba(0,0,0,.6)); }
}

/* hidden must win over display rules on buttons and tiles */
[hidden] { display: none !important; }
