/* Istel website — "Ink & Cosmos" theme (see docs/DESIGN.md). Same tokens as src/constants/theme.ts. */
/* Fonts are served from this site (same files as the app), so no third party sees visitors. */
@font-face { font-family: 'Anton'; src: url('/fonts/Anton_400Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Oswald'; font-weight: 500; src: url('/fonts/Oswald_500Medium.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Oswald'; font-weight: 700; src: url('/fonts/Oswald_700Bold.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Space Mono'; font-weight: 400; src: url('/fonts/SpaceMono_400Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Space Mono'; font-weight: 700; src: url('/fonts/SpaceMono_700Bold.ttf') format('truetype'); font-display: swap; }
:root {
  --paper: #e8e7e3;
  --surface: #f4f3ef;
  --ink: #0e0e0e;
  --ink-soft: #4a4a48;
  --muted: #8c8b87;
  --line: #c9c8c3;
  --face: #ffffff;
  --space: #0e0e0e;
  --display: 'Anton', Impact, 'Arial Narrow', sans-serif;
  --label: 'Oswald', 'Arial Narrow', sans-serif;
  --body: 'Space Mono', ui-monospace, Menlo, monospace;
  /* Motion: fast out, soft landing. */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 180ms;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e0e0e;
    --surface: #1a1a1a;
    --ink: #ecebe7;
    --ink-soft: #b4b3af;
    --muted: #6e6d6a;
    --line: #2e2e2e;
    --space: #000000;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Decorations may bleed off the edge like in the reference, without making the page scroll sideways. */
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper) url('/grain.png') repeat;
  color: var(--ink);
  font: 15px/1.6 var(--body);
  letter-spacing: 0.02em;
}
a { color: inherit; }
img, svg { display: block; max-width: 100%; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* Top nav, like the reference */
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 22px 0; }
.brand { flex-shrink: 0; display: flex; align-items: center; gap: 10px; text-decoration: none; font: 500 16px var(--label); letter-spacing: 0.12em; text-transform: uppercase; }
.nav ul { display: flex; flex-wrap: wrap; gap: 8px 28px; list-style: none; margin: 0; padding: 0; }
.nav ul a { font: 500 14px var(--label); letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; color: var(--ink-soft); }
.nav ul a:not(.btn) {
  padding-bottom: 4px;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat;
  transition: background-size 220ms var(--ease), color var(--fast) var(--ease);
}
.nav ul a:not(.btn):hover, .nav ul a[aria-current='page'] { color: var(--ink); background-size: 100% 2px; }

/* The 3D display heading: white face, ink outline, stacked ink extrusion */
.h3d {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1.02;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--face);
  -webkit-text-stroke: 0.06em var(--ink);
  paint-order: stroke fill;
  text-shadow:
    0.01em 0.035em 0 var(--ink), 0.015em 0.07em 0 var(--ink), 0.02em 0.105em 0 var(--ink),
    0.025em 0.14em 0 var(--ink), 0.03em 0.175em 0 var(--ink), 0.035em 0.21em 0 var(--ink);
}
@media (prefers-color-scheme: dark) {
  .h3d { color: var(--paper); }
}
.h3d.xl { font-size: clamp(56px, 13vw, 132px); }
.h3d.lg { font-size: clamp(44px, 9vw, 84px); }

/* Hero */
.hero { position: relative; padding: 48px 0 72px; min-height: 480px; }
.hero .art { position: absolute; inset: 0; pointer-events: none; }
.hero .copy { position: relative; max-width: 640px; }
.lead { font-weight: 700; color: var(--ink-soft); max-width: 520px; margin: 28px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 26px; border: 2px solid var(--ink); border-radius: 999px;
  font: 500 16px var(--label); letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
/* Buttons lift onto the same stacked ink shadow as the 3D headings. */
.btn:not([aria-disabled='true']):hover { transform: translate(-2px, -2px); box-shadow: 3px 4px 0 var(--ink); }
.btn:not([aria-disabled='true']):active { transform: translate(0, 0) scale(0.97); box-shadow: 0 0 0 var(--ink); transition-duration: 80ms; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn[aria-disabled='true'] { opacity: 0.45; cursor: default; }
.btn:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Blobs and floating art */
.blob { position: absolute; }
.hero .blob-a { right: -40px; top: -10px; width: 300px; }
.hero .planet { position: absolute; right: 120px; top: 40px; width: 200px; animation-delay: -3s; }
.hero .blob-b { left: -150px; bottom: -150px; width: 200px; animation-delay: -5s; }
.hero .moon { position: absolute; right: 340px; bottom: 40px; width: 80px; animation-delay: -7s; }
.float { animation: drift 9s ease-in-out infinite; }
@keyframes drift { 50% { transform: translateY(-10px) rotate(-2deg); } }
@media (prefers-reduced-motion: reduce) { .float { animation: none; } }

/* Feature cards */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 24px 0 72px; }
.card { background: var(--surface); border: 2px solid var(--ink); border-radius: 22px; padding: 22px; }
.card h3 { font: 700 20px var(--label); letter-spacing: 0.06em; text-transform: uppercase; margin: 14px 0 6px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 13px; }

/* Dark band with the island */
.band { background: var(--space); color: #d8d7d2; border-radius: 30px; padding: 40px 28px; display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: center; margin-bottom: 72px; }
.band h2 { font: 700 26px var(--label); letter-spacing: 0.06em; text-transform: uppercase; color: #fff; margin: 0 0 10px; }
.band p { margin: 0; font-size: 14px; }

/* Long-form pages */
.doc { padding: 24px 0 72px; }
.doc .updated { color: var(--muted); font-size: 13px; margin: 28px 0 32px; }
.doc h2 { font: 700 20px var(--label); letter-spacing: 0.06em; text-transform: uppercase; margin: 40px 0 10px; }
.doc p, .doc li { color: var(--ink); }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.doc th { font: 500 13px var(--label); letter-spacing: 0.08em; text-transform: uppercase; }
.note { background: var(--surface); border: 2px solid var(--ink); border-radius: 22px; padding: 18px 20px; margin: 20px 0; }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  /* Art sits in its own strip above the heading so it never covers text. */
  .hero { min-height: 0; padding-top: 150px; }
  .hero .blob-a { width: 170px; right: -60px; top: -10px; }
  .hero .planet { width: 120px; right: 60px; top: 20px; }
  .hero .moon { display: block; width: 50px; left: 10px; right: auto; top: 60px; bottom: auto; }
  .hero .blob-b { display: none; }
  .nav ul { gap: 6px 16px; }
}

/* ---------- Landing page ---------- */
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 999px; z-index: 10; }
.skip:focus { left: 12px; }
.btn.small { padding: 8px 16px; font-size: 13px; }
.nav ul a.btn.primary { color: var(--paper); text-decoration: none; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.actions.center { justify-content: center; }
.eyebrow { font: 500 13px var(--label); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 14px; }
.fine { font-size: 12px; color: var(--muted); margin-top: 18px; }
.h3d.md { font-size: clamp(40px, 6vw, 64px); }

/* Hero */
.hero-c { position: relative; padding: 56px 0 0; text-align: center; }
.hero-copy { position: relative; z-index: 1; max-width: 820px; }
.hero-copy .lead { margin-left: auto; margin-right: auto; }
.hero-c .art { position: absolute; inset: 0 0 auto 0; height: 620px; pointer-events: none; }
.h-blob-l { left: -90px; top: 60px; width: 260px; animation-delay: -4s; }
.h-blob-r { right: -70px; top: -30px; width: 320px; }
.h-planet { position: absolute; right: 12%; top: 40px; width: 190px; animation-delay: -2s; }
.h-moon { position: absolute; left: 11%; top: 300px; width: 70px; animation-delay: -6s; }
.h-spark { position: absolute; width: 22px; }
.h-spark.s1 { left: 22%; top: 70px; }
.h-spark.s2 { right: 26%; top: 330px; width: 16px; }
.h-spark.s3 { left: 30%; top: 470px; width: 14px; }

/* Phone and laptop frames: ink bezel with the same stacked 3D shadow as the headings */
.phone { margin: 0; width: 100%; max-width: 280px; border: 9px solid var(--ink); border-radius: 38px; overflow: hidden; background: var(--ink); box-shadow: 6px 8px 0 var(--ink); }
.phone img { width: 100%; height: auto; }
.phones { position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-start; gap: 0; margin: 56px auto 0; padding: 0 20px 72px; max-width: 1000px; }
.phones .phone { flex: 0 1 280px; }
.phones .mid { position: relative; z-index: 2; margin: 0 -26px; transform: translateY(-28px); }
.phones .tilt-l { transform: rotate(-6deg) translateY(30px); }
.phones .tilt-r { transform: rotate(6deg) translateY(30px); }

.laptop { margin: 32px auto 0; max-width: 900px; }
.laptop .screen { border: 12px solid var(--ink); border-bottom-width: 20px; border-radius: 18px 18px 6px 6px; overflow: hidden; background: var(--ink); }
.laptop img { width: 100%; height: auto; }
.laptop .base { height: 16px; margin: 0 -5%; background: var(--ink); border-radius: 0 0 18px 18px; box-shadow: 0 6px 0 var(--line); }

/* Scrolling ink ticker */
.ticker { background: var(--ink); color: var(--paper); overflow: hidden; white-space: nowrap; padding: 14px 0; margin-top: 8px; transform: rotate(-1.2deg); }
.ticker-track { display: inline-block; animation: ticker 32s linear infinite; }
.ticker span { font: 400 26px var(--display); letter-spacing: 0.06em; text-transform: uppercase; padding-right: 8px; }
@keyframes ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

/* Sections */
.section { padding: 96px 0 24px; }
.section > .h3d { margin-bottom: 48px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.step { position: relative; background: var(--surface); border: 2px solid var(--ink); border-radius: 22px; padding: 24px 22px 26px; }
.step svg { width: 100%; max-width: 180px; height: auto; margin: 6px auto 4px; }
.step .num { font: 400 44px var(--display); color: var(--face); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 2px 4px 0 var(--ink); }
.step h3 { font: 700 22px var(--label); letter-spacing: 0.06em; text-transform: uppercase; margin: 8px 0 6px; }
.step p { margin: 0; color: var(--ink-soft); font-size: 13px; }

.feature { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; padding: 40px 0; }
.feature .phone { justify-self: center; transform: rotate(2deg); }
.feature.flip .feature-copy { order: 2; }
.feature.flip .phone { transform: rotate(-2deg); }
.feature-copy .h3d { margin-bottom: 26px; }
.feature-copy > p { color: var(--ink-soft); font-weight: 700; max-width: 480px; }
.feature-copy.center > p { margin-left: auto; margin-right: auto; max-width: 620px; }
.ticks { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 28px; font-size: 14px; }
.ticks li::before { content: '✦'; position: absolute; left: 0; top: 0; }

.devices { text-align: center; }
.devices .h3d { margin-bottom: 26px; }

.band { margin-top: 96px; }
.band-link a { color: #fff; font: 500 14px var(--label); letter-spacing: 0.1em; text-transform: uppercase; }
.band p + p { margin-top: 14px; }

.faq { max-width: 760px; margin: 0 auto; }
.faq details { border-bottom: 2px solid var(--ink); padding: 18px 4px; }
.faq details:first-of-type { border-top: 2px solid var(--ink); }
.faq summary { cursor: pointer; list-style: none; font: 700 18px var(--label); letter-spacing: 0.05em; text-transform: uppercase; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--display); font-size: 24px; line-height: 1; transition: transform 240ms var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 12px 0 0; color: var(--ink-soft); }

.cta { position: relative; text-align: center; padding: 120px 0 110px; }
.cta > * { position: relative; }
.cta-blob { position: absolute; width: 360px; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg); opacity: 0.1; }

@media (max-width: 860px) {
  .feature, .feature.flip { grid-template-columns: 1fr; gap: 28px; }
  .feature.flip .feature-copy { order: 0; }
  .feature .phone { max-width: 250px; }
}
@media (max-width: 640px) {
  .landing-links li:not(:last-child) { display: none; }
  .hero-c { padding-top: 130px; }
  .hero-c .art { height: 260px; }
  .h-blob-l { width: 150px; left: -70px; top: 10px; }
  .h-blob-r { width: 170px; right: -60px; top: -20px; }
  .h-planet { width: 110px; right: 70px; top: 10px; }
  .h-moon { width: 44px; left: 90px; top: 30px; }
  .h-spark.s2, .h-spark.s3 { display: none; }
  .h-spark.s1 { left: 56%; top: 72px; }
  .phones { padding-bottom: 48px; margin-top: 40px; }
  .phones .tilt-l, .phones .tilt-r { display: none; }
  .phones .mid { margin: 0; transform: none; max-width: 250px; }
  .section { padding-top: 72px; }
  .ticker span { font-size: 20px; }
}

/* Hero: heading and button on the left, one app screen on a blob on the right */
.soon { font-size: 12px; color: var(--muted); margin-top: 14px; }
.lead { margin-top: 22px; }

.hero-s { padding: 48px 0 80px; }
.s-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; }
.s-copy .lead { max-width: 440px; }
.s-copy .h3d.xl { font-size: clamp(56px, 9vw, 112px); }
.s-visual { position: relative; display: flex; justify-content: center; padding: 30px 0; }
.s-blob { position: absolute; width: 380px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.s-phone { position: relative; max-width: 260px; transform: rotate(3deg); }
@media (max-width: 860px) {
  .s-grid { grid-template-columns: 1fr; text-align: center; }
  .s-copy .lead { margin-left: auto; margin-right: auto; }
  .s-copy .actions { justify-content: center; }
  .s-blob { width: 280px; }
  .s-phone { max-width: 220px; }
}

/* ---------- Motion ---------- */
/* Everything below animates opacity, translate and scale only, and is off when people ask for less motion. */
@media (prefers-reduced-motion: no-preference) {
  /* Hero: copy slides up in sequence, art pops in, phones rise into place. */
  .hero-copy > *, .s-copy > * { animation: rise 640ms var(--ease) both; }
  .s-visual { animation: rise-far 900ms var(--ease) 200ms both; }
  .hero-copy > :nth-child(2) { animation-delay: 70ms; }
  .hero-copy > :nth-child(3) { animation-delay: 160ms; }
  .hero-copy > :nth-child(4) { animation-delay: 240ms; }
  .hero-copy > :nth-child(5) { animation-delay: 300ms; }
  .hero-c .art .float { animation: pop 820ms var(--ease) both, drift 9s ease-in-out infinite; }
  .hero-c .art .h-blob-r { animation-delay: 0ms, 0s; }
  .hero-c .art .h-blob-l { animation-delay: 90ms, -4s; }
  .hero-c .art .h-planet { animation-delay: 200ms, -2s; }
  .hero-c .art .h-moon { animation-delay: 280ms, -6s; }
  .h-spark { animation: twinkle 3.2s ease-in-out infinite; }
  .h-spark.s2 { animation-delay: -1.1s; }
  .h-spark.s3 { animation-delay: -2.2s; }
  .phones .phone { animation: rise-far 900ms var(--ease) both; }
  .phones .mid { animation-delay: 260ms; }
  .phones .tilt-l { animation-delay: 360ms; }
  .phones .tilt-r { animation-delay: 440ms; }

  /* Cards and phones lift on hover. */
  .step { transition: transform 220ms var(--ease), box-shadow 220ms var(--ease); }
  .step:hover { transform: translate(-3px, -4px); box-shadow: 5px 7px 0 var(--ink); }
  .feature .phone { transition: transform 360ms var(--ease), box-shadow 360ms var(--ease); }
  .feature .phone:hover, .feature.flip .phone:hover { transform: rotate(0deg) translateY(-8px); box-shadow: 9px 12px 0 var(--ink); }
  .ticker:hover .ticker-track { animation-play-state: paused; }

  /* FAQ answers open and close smoothly where the browser supports it. */
  .faq { interpolate-size: allow-keywords; }
  .faq details::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 280ms var(--ease), content-visibility 280ms allow-discrete;
  }
  .faq details[open]::details-content { block-size: auto; }
  .faq details[open] p { animation: rise 320ms var(--ease) both; }

  /* Reveal on scroll (motion.js adds .rv and then .in). */
  .motion .rv {
    opacity: 0;
    translate: 0 28px;
    transition: opacity 520ms var(--ease), translate 680ms var(--ease), scale 680ms var(--ease),
      transform 220ms var(--ease), box-shadow 220ms var(--ease);
  }
  .motion .h3d.rv { scale: 0.94; }
  .motion .rv.in { opacity: 1; translate: 0 0; scale: 1; }
  .motion .feature .phone.rv { transition: opacity 520ms var(--ease), translate 680ms var(--ease),
      transform 360ms var(--ease), box-shadow 360ms var(--ease); }
}

@keyframes rise { from { opacity: 0; translate: 0 22px; } }
@keyframes rise-far { from { opacity: 0; translate: 0 90px; } }
@keyframes pop { from { opacity: 0; scale: 0.6; } }
@keyframes twinkle { 50% { opacity: 0.35; scale: 0.6; } }
