/* iPilot — official site.
   Every surface here is ported from the app's Crystal theme (lib/ai_chat_ui/theme/glass.dart + chat_tokens.dart):
   the same sky, the same glass recipe (fill 155°, inner light, 1px rim, white bloom, blue drop), the same lit-tile
   recipe, the same ink ramp and Figtree. The web adds two things the phone can't: the visitor's pointer is the light
   that hits the crystal, and the sky behind it is liquid. */

@font-face { font-family: "Figtree"; src: url("assets/fonts/Figtree-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("assets/fonts/Figtree-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("assets/fonts/Figtree-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("assets/fonts/Figtree-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  /* ChatColors */
  --bg: #cfe4fb;
  --surface: #f2f8ff;
  --ink: #0c1a57;
  --ink-800: #1a2a69;
  --ink-700: #2c3e7c;
  --ink-600: #44588e;
  --muted: #51669a;
  --dim: #7e90bc;
  --accent: #5578e6;
  --accent-700: #304dbb;
  --sky: #a5e0f6;
  --mid: #8fb4f3;
  --deep: #7e98ef;
  --glass-shadow: 66 118 222;  /* #4276DE */
  --lit-shadow: 84 128 232;    /* #5480E8 */
  --rim-warm: #bee8ff;
  --emerald: #0d9a6a;

  /* Type: Figtree is the app's voice; Instrument Serif italic is used only for the one word in a heading
     that carries the idea, its swash echoing the star's swept petals. */
  --sans: "Figtree", ui-sans-serif, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;

  /* 4pt scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px; --s10: 160px;

  /* Easing: exponential outs only (no bounce): crystal settles, it doesn't wobble. */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Default light source: the sky's own sun, top-left. JS moves it to the pointer. */
  --lx: 22vw; --ly: -10vh;

  /* z scale */
  --z-sky: 0; --z-light: 1; --z-content: 2; --z-nav: 10; --z-toast: 20;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { text-wrap: pretty; margin: 0; }

/* Selection: the app's own (accent at 28%). */
::selection { background: rgb(85 120 230 / 0.28); color: var(--ink); }

/* Scrollbar: a thin lit capsule riding on the sky rather than a grey OS rail. */
html { scrollbar-width: thin; scrollbar-color: var(--mid) transparent; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
  background-color: var(--mid); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.7);
}

/* Focus: the glass bloom tightened into a ring, so keyboard focus looks like light, not a browser outline. */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgb(85 120 230 / 0.75), 0 0 18px 4px rgb(255 255 255 / 0.9) !important;
}

/* ── Atmosphere ───────────────────────────────────────────────────────────── */

/* The baked sky: what shows before WebGL starts, in still renders, and under reduced motion. */
.sky {
  position: fixed; inset: 0; z-index: var(--z-sky);
  background: url("assets/img/sky_wide.jpg") center top / cover no-repeat, var(--bg);
  filter: blur(6px) saturate(1.05);
  transform: scale(1.04);
}
@media (max-aspect-ratio: 3/4) {
  .sky { background-image: url("assets/img/crystal_sky.jpg"); filter: none; transform: none; }
}
/* The liquid sky: the same image flowing under a shader. Fades in once its first frame is drawn. */
#liquid {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: var(--z-sky);
  opacity: 0; transition: opacity 1.2s var(--ease);
}
#liquid.on { opacity: 1; }

/* The visitor's light: a soft white sun that follows the pointer. Everything glass reads its position. */
.sunlight {
  position: fixed; left: 0; top: 0; z-index: var(--z-light); pointer-events: none;
  width: 900px; height: 900px; margin: -450px 0 0 -450px;
  transform: translate3d(var(--lx), var(--ly), 0);
  background: radial-gradient(closest-side, rgb(255 255 255 / 0.42), rgb(255 255 255 / 0.12) 45%, transparent 72%);
  mix-blend-mode: soft-light;
}

main, .nav, footer { position: relative; z-index: var(--z-content); }

/* ── Glass (GlassPainter._glassBody / _glassGlow) ─────────────────────────── */

.glass {
  --r: 20px;
  position: relative;
  border-radius: var(--r);
  background: linear-gradient(155deg, rgb(255 255 255 / 0.46) 0%, rgb(255 255 255 / 0.13) 52%, rgb(255 255 255 / 0.27) 100%);
  box-shadow:
    inset 0 0 13px rgb(255 255 255 / 0.62),          /* light inside the rim */
    inset 0 1px 0 rgb(255 255 255 / 0.9),            /* the bright line along the top */
    inset 0 0 0 1px rgb(255 255 255 / 0.82),         /* the rim */
    0 0 16px rgb(255 255 255 / 0.58),                /* white bloom onto the sky */
    0 18px 30px -18px rgb(var(--glass-shadow) / 0.30); /* the blue drop */
  isolation: isolate;
}
/* Glass over moving content blurs and lifts it exactly like GlassBlur: blur σ12, saturate 1.3, brightness 1.05. */
.glass.backdrop {
  -webkit-backdrop-filter: blur(12px) saturate(1.3) brightness(1.05);
  backdrop-filter: blur(12px) saturate(1.3) brightness(1.05);
}
/* Where the browser can refract (Chromium), the backdrop also bends at the edges like a real lens.
   main.js builds a displacement map per element and sets --lens. */
.glass.backdrop.lensed {
  -webkit-backdrop-filter: var(--lens) blur(3px) saturate(1.3) brightness(1.06);
  backdrop-filter: var(--lens) blur(3px) saturate(1.3) brightness(1.06);
}

/* The rim catches the visitor's light: a bright arc on the 1.5px edge nearest the pointer. */
.glass::before, .lit::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: radial-gradient(260px circle at var(--px, 18%) var(--py, 0%), #fff, rgb(255 255 255 / 0.55) 30%, transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  z-index: 2;
}
/* …and the face takes a faint specular where the light falls. */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(420px circle at var(--px, 18%) var(--py, 0%), rgb(255 255 255 / 0.32), transparent 65%);
  opacity: var(--spec, 0.6);
  transition: opacity 0.6s var(--ease);
}

/* ── Lit (GlassPainter._litBody / _litGlow) ───────────────────────────────── */

.lit {
  position: relative; isolation: isolate;
  color: #fff;
  background:
    radial-gradient(60% 50% at 24% 6%, rgb(180 236 251 / 1), rgb(180 236 251 / 0) 72%),
    radial-gradient(110% 80% at 56% 106%, rgb(111 139 238 / 1), rgb(111 139 238 / 0) 80%),
    linear-gradient(165deg, #8fcbf5, #7fa6f1);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.9),
    inset 0 0 0 2px rgb(255 255 255 / 0.22),
    inset 0 0 0 3.6px rgb(255 255 255 / 0.12),
    inset 0 0 0 7px rgb(255 255 255 / 0.06),
    0 0 15px 1px rgb(255 255 255 / 0.72),
    0 9px 16px -7px rgb(var(--lit-shadow) / 0.55);
  text-shadow: 0 1px 6px rgb(48 77 187 / 0.35);
}

/* ── Glyphs: the app's crystal masks, tinted the way ChatIcon tints them. ─── */

.glyph {
  --g: none; --size: 22px; --tint: var(--ink);
  display: inline-block; flex: none; width: var(--size); height: var(--size);
  background: var(--tint);
  -webkit-mask: var(--g) center / contain no-repeat;
  mask: var(--g) center / contain no-repeat;
}
/* The "shine" style from the app: a 1.05× copy at 35% white behind a full-white copy. */
.glyph.shine { --tint: #fff; filter: drop-shadow(0 0 0.5px rgb(255 255 255 / 0.35)) drop-shadow(0 0 5px rgb(255 255 255 / 0.55)); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  --h: 54px;
  display: inline-flex; align-items: center; gap: 10px;
  height: var(--h); padding: 0 26px 0 22px; border-radius: 999px; border: 0;
  font: 600 16px/1 var(--sans); letter-spacing: -0.01em; text-decoration: none; cursor: pointer;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), filter 0.5s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn.glass { --r: 999px; color: var(--ink); }
.btn .glyph { --size: 20px; }
/* Press: glass gives a little under the finger, then springs back on the same out-curve. */
.btn:active { transform: scale(0.965); transition-duration: 0.12s; }
.btn.lit:hover { filter: brightness(1.06) saturate(1.08); }
.btn.glass:hover { --spec: 1; }
.btn .arrow { transition: transform 0.6s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ── Links: a hairline of light under the word, which sweeps on hover. ───── */

.link {
  color: var(--accent-700); font-weight: 600; text-decoration: none;
  background:
    linear-gradient(90deg, transparent, #fff 50%, transparent) -120% 100% / 60% 2px no-repeat,
    linear-gradient(90deg, var(--sky), var(--deep)) 0 100% / 100% 1.5px no-repeat;
  padding-bottom: 2px;
  transition: background-position 0.9s var(--ease), color 0.3s;
}
.link:hover { color: var(--accent); background-position: 220% 100%, 0 100%; }

/* ── Navigation ──────────────────────────────────────────────────────────── */

.nav {
  position: fixed; top: 18px; left: 50%; z-index: var(--z-nav);
  transform: translateX(-50%);
  width: min(1080px, calc(100% - 28px));
  height: 60px; padding: 0 8px 0 14px;
  display: flex; align-items: center; gap: var(--s4);
}
.nav.glass { --r: 999px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.brand img { width: 34px; height: auto; filter: drop-shadow(0 2px 6px rgb(var(--glass-shadow) / 0.35)); }

/* ── Page ── */

.nav { width: min(1240px, calc(100% - 28px)); justify-content: space-between; padding: 0 10px 0 14px; }
.nav-link {
  padding: 10px 18px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; color: var(--ink-700);
  transition: background 0.4s var(--ease), color 0.3s, box-shadow 0.4s var(--ease);
}
/* Hover: a small droplet of glass condenses under the link. */
.nav-link:hover { color: var(--ink); background: rgb(255 255 255 / 0.42); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.85), 0 0 10px rgb(255 255 255 / 0.6); }

h1, h2 { font-size: clamp(2.6rem, 4.8vw, 4.75rem); line-height: 1; letter-spacing: -0.035em; font-weight: 600; color: var(--ink); }
h1 em, h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; padding-right: 0.05em; }
.lede { font-size: clamp(1.08rem, 1.3vw, 1.25rem); line-height: 1.55; color: var(--ink-700); max-width: 30ch; }


/* ── The phone ── */

.phone {
  --ph: min(calc(100svh - 150px), 820px);
  position: relative; height: var(--ph); aspect-ratio: 0.4982;
  transform: perspective(1800px) rotateX(var(--trx, 0deg)) rotateY(var(--try, 0deg));
  transition: transform 0.2s linear;
  z-index: 2;
}
/* It stands in the same light as the page: its shadow falls away from the visitor's light. */
.phone::before {
  content: ""; position: absolute; left: 8%; right: 8%; bottom: -3.5%; height: 7%; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgb(var(--glass-shadow) / 0.42), transparent);
  transform: translateX(var(--shx, 0px)); filter: blur(10px);
}
.frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3;
  filter: drop-shadow(var(--shx, 0px) 34px 46px rgb(var(--glass-shadow) / 0.30)); }
.screen { position: absolute; left: 7.112%; top: 3.544%; width: 85.775%; height: 92.913%; overflow: hidden; border-radius: calc(var(--k, 1) * 54px); z-index: 1; background: var(--bg); }
/* The glass of the screen catches the visitor's light, like every other pane on the page. */
.sheen { position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(520px circle at var(--px, 20%) var(--py, 0%), rgb(255 255 255 / 0.22), transparent 60%),
              linear-gradient(118deg, transparent 38%, rgb(255 255 255 / 0.10) 46%, transparent 56%);
  mix-blend-mode: screen; }

/* The app's UI at its real size (402×874 pt), scaled to the frame. */
.ui { position: absolute; left: 0; top: 0; width: 402px; height: 874px; transform: scale(var(--k, 1)); transform-origin: 0 0;
  background: url("assets/img/crystal_sky.jpg") center / cover; color: var(--ink); font-size: 15px; line-height: 1.4; }
.statusbar { position: absolute; left: 0; right: 0; top: 0; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 6px 30px 0 44px; font-size: 16.5px; }
.statusbar b { font-weight: 600; letter-spacing: -0.01em; }
.sb-icons { display: flex; align-items: center; gap: 6px; }
.sb-icons i { display: block; height: var(--h); aspect-ratio: var(--ar); background: var(--ink); -webkit-mask: var(--g) center / contain no-repeat; mask: var(--g) center / contain no-repeat; }
.sig { --g: url(assets/glyphs/signal.png); --h: 11.5px; --ar: 102 / 96; }
.wifi { --g: url(assets/glyphs/wifi.png); --h: 11.5px; --ar: 125 / 96; }
.batt { --g: url(assets/glyphs/battery.png); --h: 12.5px; --ar: 222 / 96; }

/* ── Close ── */

.close { position: relative; z-index: 2; min-height: calc(100svh - 90px); display: grid; align-content: center; justify-items: center; gap: 18px; padding: 120px 0 64px; text-align: center; }
.word {
  font-size: clamp(6rem, 22vw, 19rem); line-height: 0.8; font-weight: 700; letter-spacing: -0.055em;
  color: rgb(255 255 255 / 0.5);
  text-shadow: 0 0 1px rgb(255 255 255 / 0.9), 0 0 24px rgb(255 255 255 / 0.65), 0 18px 40px rgb(var(--glass-shadow) / 0.18);
  user-select: none; margin-bottom: var(--s5);
}
.close-line { font-size: clamp(1.25rem, 2vw, 1.6rem); font-weight: 600; letter-spacing: -0.02em; }
.mail { font-size: 17px; }

footer { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 26px 0 40px; font-size: 13.5px; color: var(--muted); }
/* The divider is a refracted line of light: bright in the middle, gone at the ends. */
footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, #fff 30%, var(--rim-warm) 60%, transparent); box-shadow: 0 0 8px rgb(255 255 255 / 0.9); }
footer nav { display: flex; gap: 22px; }
footer nav a { color: var(--ink-700); font-weight: 600; text-decoration: none; transition: color 0.3s; }
footer nav a:hover { color: var(--accent); }
footer .tm { margin-left: auto; }
.wrap { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }

@media (max-width: 560px) {
  .nav { top: 10px; height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  html { scroll-behavior: auto; }
}

.nav.glass {
  box-shadow:
    inset 0 0 13px rgb(255 255 255 / 0.62), inset 0 1px 0 rgb(255 255 255 / 0.9), inset 0 0 0 1px rgb(255 255 255 / 0.82),
    0 0 0 1.5px rgb(126 152 239 / 0.22), 0 0 16px rgb(255 255 255 / 0.58), 0 14px 34px -14px rgb(var(--glass-shadow) / 0.42);
}
