/* wispwriter.com: tokens and primitives.
 *
 * Same bones as the app's design system (src/design.css): Swiss chrome,
 * one type scale, tracked section labels, no ornament without a job.
 * Landing-page deltas: lower density (big section gaps), higher contrast
 * (Literata display type), and a raised Motion dial (hero entrance,
 * staggered reveals, the live wisp), all collapsing under reduced motion.
 *
 * Theme: dark and light, both lifted from the app's own palettes. The
 * default follows the system; the header toggle overrides it via
 * data-theme on <html>, persisted in localStorage. */

/* ---------- Fonts ---------- */

@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-roman-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-italic-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  /* Colour: the app's dark theme, verbatim. */
  --bg: #0f0f0f;
  --surface: #161616;
  --surface-2: #1c1c1c;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --text: #ededed;
  --muted: #8a8a8a;
  --accent: #f2f2f2;
  --accent-hover: #ffffff;
  --accent-fg: #0f0f0f;
  --doc-text: #c9c9c9;
  --selection: #3a3a3a;
  --shadow-shot: 0 24px 60px -24px rgba(0, 0, 0, 0.8);
  --wisp-ink: #ededed;
  --wisp-eye: #0f0f0f;

  /* Type */
  --ui-font: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display-font: "Literata", Georgia, "Times New Roman", serif;

  /* Scale: harder jumps than the app; display type is the visual asset. */
  --text-xs: 12px;    /* tracked section labels */
  --text-sm: 14px;    /* secondary, captions, footer */
  --text-md: 16px;    /* body */
  --text-lg: 19px;    /* leads, subheads */
  --text-xl: clamp(26px, 3.2vw, 34px);   /* section titles */
  --text-2xl: clamp(38px, 5.5vw, 62px);  /* the hero claim */

  /* Spacing: 4px rhythm, plus landing-scale section gaps. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --gap-section: clamp(96px, 12vw, 150px);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 9px;

  --duration-fast: 120ms;
  --duration-base: 180ms;
  --duration-reveal: 600ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--muted);

  --measure: 62ch;
  --page-max: 1120px;
}

/* Light: the app's light theme, applied to the same token names. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f4f4;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --border: #dcdcdc;
    --border-strong: #bdbdbd;
    --text: #141414;
    --muted: #6f6f6f;
    --accent: #141414;
    --accent-hover: #000000;
    --accent-fg: #ffffff;
    --doc-text: #3a3a3a;
    --selection: #d4d4d4;
    --shadow-shot: 0 24px 50px -28px rgba(0, 0, 0, 0.4);
    --wisp-ink: #1a1a1a;
    --wisp-eye: #f4f4f4;
  }
}
:root[data-theme="light"] {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #dcdcdc;
  --border-strong: #bdbdbd;
  --text: #141414;
  --muted: #6f6f6f;
  --accent: #141414;
  --accent-hover: #000000;
  --accent-fg: #ffffff;
  --doc-text: #3a3a3a;
  --selection: #d4d4d4;
  --shadow-shot: 0 24px 50px -28px rgba(0, 0, 0, 0.4);
  --wisp-ink: #1a1a1a;
  --wisp-eye: #f4f4f4;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--duration-base) var(--ease), color var(--duration-base) var(--ease);
}

h1, h2, h3 {
  font-family: var(--display-font);
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); font-family: var(--ui-font); font-weight: 600; }

p { margin: 0 0 var(--space-4); max-width: var(--measure); }

a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

::selection { background: var(--selection); color: var(--accent-hover); }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* ---------- Primitives ---------- */

.label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--space-4);
}

.lead { font-size: var(--text-lg); color: var(--muted); }

.muted { color: var(--muted); }

.center { text-align: center; margin-left: auto; margin-right: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 46px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: 600 var(--text-md) var(--ui-font);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); color: var(--accent-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* The one CTA. Identical every time it repeats. */
.btn-cta {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-cta:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }

.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

/* The wisp mark, painted with the current text colour via mask so it
   survives both themes from one SVG. */
.mark {
  display: inline-block;
  background: currentColor;
  -webkit-mask: url("../img/wisp.svg") center / contain no-repeat;
  mask: url("../img/wisp.svg") center / contain no-repeat;
}

.shot {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-shot);
  background: var(--surface);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: border-color var(--duration-base) var(--ease), transform var(--duration-base) var(--ease);
}
.grid .card:hover, .plans .card:hover { border-color: var(--border-strong); transform: translateY(-3px); }

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 40px);
}

section { padding-top: var(--gap-section); }
section:last-of-type { padding-bottom: var(--gap-section); }

/* Header */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-5) 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand .mark { width: 26px; height: 26px; }
.brand-name {
  font-family: var(--display-font);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.site-nav { display: flex; align-items: center; gap: var(--space-5); }
.site-nav a { font-size: var(--text-sm); text-decoration: none; color: var(--muted); }
.site-nav a:hover { color: var(--text); }
.site-nav .btn { height: 36px; padding: 0 var(--space-4); font-size: var(--text-sm); }

/* Theme toggle: a quiet icon button. The two glyphs swap by theme. */
.theme-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}
.theme-btn:hover { color: var(--text); border-color: var(--border-strong); }
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .sun { display: none; }
.theme-btn .moon { display: block; }
[data-theme="light"] .theme-btn .sun { display: block; }
[data-theme="light"] .theme-btn .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-btn .sun { display: block; }
  :root:not([data-theme="dark"]) .theme-btn .moon { display: none; }
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-top: clamp(40px, 7vw, 96px);
}
.hero-wisp { height: 100px; margin-bottom: var(--space-4); }
.hero-proof { display: flex; gap: var(--space-5); flex-wrap: wrap; margin-top: var(--space-5); }
.hero-proof span { font-size: var(--text-sm); color: var(--muted); }
.hero-cta { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-6); flex-wrap: wrap; }

/* Entrance: plays once on load, staggered by --d, no observer needed. */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.hero-in { opacity: 0; animation: rise var(--duration-reveal) var(--ease) forwards; animation-delay: var(--d, 0ms); }

/* Feature rows: image one side, words the other, alternating. */

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.row.flip > .row-copy { order: 2; }
.row.flip > .row-media { order: 1; }

/* Ownership strip: three quiet columns. */

.strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-7) 0;
}
.strip h3 { margin-bottom: var(--space-2); }
.strip p { font-size: var(--text-sm); color: var(--muted); margin: 0; }

/* Feature grid */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.grid .card h3 { margin: 0 0 var(--space-2); font-size: var(--text-md); }
.grid .card p { font-size: var(--text-sm); color: var(--muted); margin: 0; }

/* Pricing */

.plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  align-items: stretch;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}
.plan { display: flex; flex-direction: column; gap: var(--space-4); text-align: left; }
.plan .price {
  font-family: var(--display-font);
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
}
.plan .price small { font-size: var(--text-sm); font-family: var(--ui-font); color: var(--muted); font-weight: 400; }
.plan ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); }
.plan li { padding-left: 22px; position: relative; font-size: var(--text-sm); }
.plan li::before { content: "·"; position: absolute; left: 6px; color: var(--muted); }
.plan .plan-note { font-size: var(--text-sm); color: var(--muted); border-top: 1px solid var(--border); padding-top: var(--space-4); margin: 0; }
.plan .btn { margin-top: auto; }
.tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

/* Q&A rows (pricing page) */

.qa { display: grid; gap: var(--space-5); max-width: var(--measure); }
.qa h3 { margin-bottom: var(--space-2); }
.qa p { margin: 0; color: var(--muted); }

/* Footer */

.site-foot {
  border-top: 1px solid var(--border);
  margin-top: var(--gap-section);
  padding: var(--space-7) 0;
  display: flex;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--muted);
}
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); }
.foot-links { display: flex; gap: var(--space-5); flex-wrap: wrap; }

/* Legal pages */

.doc { max-width: var(--measure); padding-top: var(--space-8); }
.doc h1 { font-size: var(--text-xl); }
.doc h2 { font-size: var(--text-lg); font-family: var(--ui-font); font-weight: 600; margin-top: var(--space-7); }
.doc p, .doc li { color: var(--doc-text); }
.doc .updated { font-size: var(--text-sm); color: var(--muted); }

/* ---------- Motion: reveals, once, staggered by --d ---------- */

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.shown {
  opacity: 1;
  transform: none;
  transition: opacity var(--duration-reveal) var(--ease),
              transform var(--duration-reveal) var(--ease);
  transition-delay: var(--d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .hero-in { opacity: 1; transform: none; animation: none; }
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero, .row, .row.flip { grid-template-columns: 1fr; }
  .row.flip > .row-copy { order: 1; }
  .row.flip > .row-media { order: 2; }
  .strip, .grid { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
  .site-nav a:not(.btn) { display: none; }
}
