/* ============================================================
   Simple AI Book — Landing
   Design tokens + base + components
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Warm neutral surfaces (the 90%) */
  --paper:      #FAF8F4;
  --paper-2:    #F2EDE6;
  --paper-3:    #EAE3D9;
  --card:       #FFFFFF;
  --ink:        #1A1613;
  --ink-2:      #2C2620;
  --ink-soft:   #5B524A;
  --ink-faint:  #908579;
  --line:       rgba(26,22,19,0.10);
  --line-soft:  rgba(26,22,19,0.06);

  /* Cinematic night surfaces */
  --night:      #141110;
  --night-2:    #1E1A17;
  --night-soft: rgba(255,255,255,0.62);
  --night-faint:rgba(255,255,255,0.40);
  --night-line: rgba(255,255,255,0.12);

  /* Purple brand scale (accent only) */
  --p50:  #F4F3FF;
  --p100: #EBE9FE;
  --p200: #D9D6FE;
  --p300: #BDB4FE;
  --p400: #9B8AFB;
  --p500: #7F56D9;
  --p600: #6938EF;
  --p700: #5925DC;
  --p800: #4A1FB8;
  --accent: var(--p500);
  --accent-deep: var(--p700);

  /* Type */
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Shape */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 34px;

  /* Shadows (premium, soft) */
  --sh-1: 0 1px 2px rgba(26,22,19,.05), 0 4px 14px rgba(26,22,19,.05);
  --sh-2: 0 4px 18px rgba(26,22,19,.07), 0 18px 48px rgba(26,22,19,.08);
  --sh-3: 0 12px 36px rgba(26,22,19,.10), 0 40px 90px rgba(26,22,19,.14);
  --glow: 0 30px 80px -20px rgba(127,86,217,.45);

  --maxw: 1200px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--p200); color: var(--ink); }

/* Subtle film grain over everything */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 32px; position: relative; }
.wrap-narrow { max-width: 920px; }
section { position: relative; z-index: 2; }

/* ---------- Type scale ---------- */
.eyebrow {
  font-family: var(--sans);
  font-size: 12.5px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent-deep);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow.on-dark { color: var(--p300); }
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: currentColor; opacity: .5;
}
.display {
  font-family: var(--serif); font-weight: 400;
  line-height: 1.02; letter-spacing: -0.015em;
  font-size: clamp(40px, 7vw, 88px);
  font-optical-sizing: auto;
}
.display .it { font-style: italic; }
.h2 {
  font-family: var(--serif); font-weight: 400;
  line-height: 1.05; letter-spacing: -0.01em;
  font-size: clamp(32px, 4.6vw, 60px);
}
.lede {
  font-size: clamp(18px, 1.5vw, 21px); line-height: 1.55;
  color: var(--ink-soft); max-width: 40ch; font-weight: 400;
  text-wrap: pretty;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--sans); font-weight: 600; font-size: 15.5px;
  padding: 15px 24px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .25s, color .25s;
  white-space: nowrap; will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--sh-2); }
.btn-primary:hover { box-shadow: var(--sh-3); }
.btn-appstore {
  background: var(--ink); color: var(--paper); padding-left: 20px;
  box-shadow: 0 10px 30px -8px rgba(26,22,19,.5);
}
.btn-appstore svg { width: 20px; height: 20px; }
.btn-appstore .small { font-size: 10.5px; line-height: 1; opacity: .72; font-weight: 500; }
.btn-appstore .big { font-size: 17px; line-height: 1.1; font-weight: 600; letter-spacing: -.01em; }
.btn-appstore .col { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.on-dark .btn-ghost, .btn-ghost.on-dark { color: var(--paper); border-color: var(--night-line); }
.on-dark .btn-ghost:hover { border-color: rgba(255,255,255,.6); }
.btn-appstore.on-dark, .on-dark .btn-appstore { background: var(--paper); color: var(--ink); box-shadow: 0 14px 40px -10px rgba(0,0,0,.6); }

.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15.5px; }
.link-arrow svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.link-arrow:hover svg { transform: translateX(4px); }

.appstore-badge {
  display: inline-flex; border-radius: 11px;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  will-change: transform;
}
.appstore-badge img { height: 54px; width: auto; display: block; border-radius: 11px; }
.appstore-badge:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -10px rgba(26,22,19,.45); }
.final .appstore-badge:hover { box-shadow: 0 16px 40px -12px rgba(0,0,0,.6); }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 0; transition: padding .4s var(--ease);
}
.nav-inner {
  width: calc(100% - 48px); max-width: var(--maxw);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 10px 18px; border-radius: 999px;
  border: 1px solid transparent; transition: all .4s var(--ease);
}
.nav.scrolled .nav-inner {
  background: rgba(250,248,244,0.72);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-color: var(--line);
  box-shadow: var(--sh-1);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand-logo { height: 26px; width: auto; display: block; }
.footer .brand-logo { height: 30px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(26,22,19,.16); flex-shrink: 0;
}
.nav-links { display: none; align-items: center; gap: 4px; }
.nav-links a {
  font-size: 16px; font-weight: 500; color: var(--ink-soft);
  padding: 9px 14px; border-radius: 999px;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--ink); background: rgba(26,22,19,.05); }
.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-pill {
  font-size: 14.5px; font-weight: 600; color: var(--paper); background: var(--ink);
  padding: 11px 20px; border-radius: 999px; transition: transform .3s var(--ease), box-shadow .3s;
}
.nav-pill:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.nav-burger { display: none !important; }

/* ============================================================
   Reveal animation primitives
   ============================================================ */
[data-reveal] { opacity: 1; }
html.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
html.js [data-reveal].in { opacity: 1; transform: none; }
[data-reveal-delay="1"] { transition-delay: .08s; }
[data-reveal-delay="2"] { transition-delay: .16s; }
[data-reveal-delay="3"] { transition-delay: .24s; }
[data-reveal-delay="4"] { transition-delay: .32s; }
[data-reveal-delay="5"] { transition-delay: .40s; }
.clip-line { display: block; overflow: hidden; }
.clip-line > span { display: block; }
html.js .clip-line > span { transform: translateY(110%); transition: transform 1.1s var(--ease); }
html.js .clip-line.in > span { transform: none; }
.clip-line[data-d="1"] > span { transition-delay: .08s; }
.clip-line[data-d="2"] > span { transition-delay: .16s; }
.clip-line[data-d="3"] > span { transition-delay: .24s; }
