/* TypersPad: landing page styles.
   Motion follows Emil Kowalski's rules: custom ease-out curves, transform/opacity only,
   UI feedback under 200 ms, hover effects gated to real pointers, reduced motion honoured. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --ink: #0e1116;
  --ink-2: #4a5361;
  --ink-3: #8a93a1;
  --line: #e6e8ec;
  --card: #ffffff;
  --accent: #2f6fd6;
  --accent-2: #1d4fa3;
  --accent-soft: rgba(47, 111, 214, 0.12);
  --on-accent: #ffffff;
  --win-bg: #ffffff;
  --win-bar: #f3f4f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 32px -8px rgba(16, 24, 40, 0.16);
  --shadow-lg: 0 2px 4px rgba(16, 24, 40, 0.05), 0 30px 60px -20px rgba(16, 24, 40, 0.28);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;
  --radius: 14px;
  --wrap: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10;
    --bg-soft: #111418;
    --ink: #eef1f5;
    --ink-2: #aab3c0;
    --ink-3: #6f7886;
    --line: #22262d;
    --card: #13161b;
    --accent: #4a8ff0;
    --accent-2: #2f6fd6;
    --accent-soft: rgba(74, 143, 240, 0.16);
    --win-bg: #16191e;
    --win-bar: #1d2127;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ------------------------------------------------------------------ nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.01em; text-decoration: none; }
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-links a { text-decoration: none; color: var(--ink-2); font-size: 15px; transition: color 150ms ease; }
.nav-links a:hover { color: var(--ink); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: 12px;
  font: 600 15px/1 var(--font); text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer; user-select: none;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn:active { transform: scale(0.97); }               /* press feedback */
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-small { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 10px; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--accent-2); }
  .btn-secondary:hover { border-color: var(--ink-3); }
}

/* ------------------------------------------------------------------ hero */
.hero { padding: 72px 0 40px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 56px; align-items: center; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: 0.02em; margin-bottom: 16px; }
h1 {
  font-size: clamp(40px, 5.6vw, 68px); line-height: 1.02; letter-spacing: -0.04em; font-weight: 700;
  margin-bottom: 20px;
}
.lede { color: var(--ink-2); font-size: 18px; line-height: 1.6; max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 14px; }
.fine { color: var(--ink-3); font-size: 13.5px; }

/* One-time entrance: short stagger, ease-out, transform + opacity only */
.stagger { animation: rise 520ms var(--ease-out) both; }
.hero-copy .stagger:nth-child(1) { animation-delay: 40ms; }
.hero-copy .stagger:nth-child(2) { animation-delay: 90ms; }
.hero-copy .stagger:nth-child(3) { animation-delay: 140ms; }
.hero-copy .stagger:nth-child(4) { animation-delay: 190ms; }
.hero-copy .stagger:nth-child(5) { animation-delay: 240ms; }
.demo.stagger { animation-delay: 200ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ------------------------------------------------------------------ sync demo */
.demo { margin: 0; display: grid; grid-template-columns: 1fr 64px 1fr; align-items: center; }
.win {
  background: var(--win-bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; font-size: 13px;
}
.win-bar { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; background: var(--win-bar); border-bottom: 1px solid var(--line); }
.win-title { color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-controls { margin-left: auto; display: flex; gap: 10px; }
.win-controls i { width: 9px; height: 1.5px; background: var(--ink-3); display: block; }
.win-lights { display: flex; gap: 6px; }
.win-lights i { width: 10px; height: 10px; border-radius: 50%; display: block; background: #ff5f57; }
.win-lights i:nth-child(2) { background: #febc2e; }
.win-lights i:nth-child(3) { background: #28c840; }
.win-mac .win-title { margin: 0 auto; transform: translateX(-20px); }
.win-body { font-family: var(--mono); font-size: 12.5px; line-height: 1.75; padding: 12px 14px; min-height: 164px; color: var(--ink); }
.win-body p { white-space: pre; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; margin: 0 -4px; padding: 0 4px; }
.win-body p:first-child { font-weight: 600; }
.win-body .caret {
  display: inline-block; width: 1.5px; height: 1.1em; background: var(--accent);
  vertical-align: -2px; margin-left: 1px; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.win-body .arrived { animation: arrived 1400ms var(--ease-out); }
@keyframes arrived { from { background: var(--accent-soft); } to { background: transparent; } }
.win-status { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); }
.sync-chip { color: var(--ink-3); transition: color 200ms ease; }
.sync-chip[data-state="syncing"] { color: var(--accent); }

.bridge { position: relative; height: 40px; display: grid; place-items: center; }
.bridge-line { position: absolute; left: 6px; right: 6px; top: 50%; border-top: 1.5px dashed var(--line); }
.bridge-cloud {
  position: relative; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.bridge-cloud svg { width: 18px; height: 18px; fill: var(--accent); }
.packet {
  position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-radius: 50%; background: var(--accent); opacity: 0;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ------------------------------------------------------------------ screenshot */
.shot-section { padding: 48px 0 24px; }
.shot {
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  background: var(--win-bg);
}
.caption { color: var(--ink-3); font-size: 14px; text-align: center; margin-top: 16px; }

/* ------------------------------------------------------------------ sections */
.section { padding: 96px 0; }
.section-soft { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title {
  font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -0.03em; line-height: 1.12; font-weight: 700;
  max-width: 22em; margin-bottom: 40px;
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card h3 { font-size: 17px; letter-spacing: -0.01em; margin: 14px 0 8px; }
.card p { color: var(--ink-2); font-size: 15px; }
.ico { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.step-n {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
}
.steps h3 { font-size: 18px; margin: 16px 0 8px; letter-spacing: -0.01em; }
.steps p { color: var(--ink-2); font-size: 15px; }

.privacy { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.privacy .section-title { margin-bottom: 16px; }
.text-link { display: inline-block; margin-top: 20px; color: var(--accent); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.checks li { position: relative; padding-left: 32px; color: var(--ink-2); }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%232f6fd6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/20px no-repeat;
}

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dl-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: grid; gap: 12px; align-content: start; }
.dl-card h3 { font-size: 22px; letter-spacing: -0.02em; }
.dl-card p { color: var(--ink-2); font-size: 15px; margin-bottom: 8px; }
.dl-card .btn { justify-self: start; }

.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 17px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ink-3); font-weight: 400; font-size: 22px; line-height: 1; transition: transform 200ms var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); margin-top: 10px; }

/* ------------------------------------------------------------------ footer */
.footer { border-top: 1px solid var(--line); padding: 48px 0 56px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 32px; align-items: start; }
.footer .fine { margin-top: 12px; }
.company { font-style: normal; color: var(--ink-2); line-height: 1.7; }
.company a, .footer-links a { color: var(--ink-2); text-decoration: none; }
.company a:hover, .footer-links a:hover { color: var(--ink); text-decoration: underline; }
.footer-links { display: grid; gap: 8px; justify-items: start; }
.footer-links button { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; }
.footer-links button:hover { color: var(--ink); text-decoration: underline; }

/* ------------------------------------------------------------------ cookie choice (analytics) */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; max-width: 420px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 16px 18px; font-size: 14.5px;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
@starting-style { .consent { opacity: 0; transform: translateY(8px); } }
.consent p { margin: 0 0 12px; color: var(--ink-2); }
.consent a { color: var(--accent); }
.consent-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ------------------------------------------------------------------ scroll reveals (once) */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal-clip { clip-path: inset(0 0 12% 0 round 14px); opacity: 0.001; transition: clip-path 900ms var(--ease-out), opacity 400ms ease; }
.js .reveal-clip.in { clip-path: inset(0 0 0 0 round 14px); opacity: 1; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; gap: 28px; }
  .privacy { grid-template-columns: 1fr; gap: 32px; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-links { display: none; }
  .nav .btn { margin-left: auto; }
  .hero { padding-top: 40px; }
  .cta .btn { flex: 1 1 100%; }
  .grid, .downloads { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
  .demo { grid-template-columns: 1fr; grid-template-rows: auto 48px auto; }
  .bridge { height: 48px; }
  .bridge-line { left: 50%; right: auto; top: 6px; bottom: 6px; border-top: 0; border-left: 1.5px dashed var(--line); }
  .packet { left: 50%; top: 0; margin: 0 0 0 -4px; }
  .win-body { min-height: 0; }
}

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .consent { transition: none; }
  .stagger { animation: fade 200ms ease both; }
  @keyframes fade { from { opacity: 0; } }
  .js .reveal { transform: none; transition: opacity 200ms ease; }
  .js .reveal-clip { clip-path: none; transition: opacity 200ms ease; }
  .win-body .caret { animation: none; }
  .btn { transition: background-color 150ms ease, border-color 150ms ease; }
  .btn:active { transform: none; }
}

.center { text-align: center; margin-top: 20px; }
.dl-card code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }

/* ------------------------------------------------------------------ legal pages */
.legal { max-width: 760px; }
.legal h1 { font-size: clamp(32px, 4vw, 44px); letter-spacing: -0.03em; margin-bottom: 8px; }
.legal h2 { font-size: 20px; letter-spacing: -0.01em; margin: 36px 0 10px; }
.legal p, .legal li { color: var(--ink-2); }
.legal p + p { margin-top: 12px; }
.legal ul { padding-left: 20px; display: grid; gap: 8px; }
.legal a { color: var(--accent); }
.legal code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }
.legal > .fine { margin-bottom: 28px; }

.text-link-inline { color: var(--accent); text-decoration: none; font-weight: 600; }
.text-link-inline:hover { text-decoration: underline; }
