/* =============================================================================
   Less Writer Design System — v1
   Tokens and components shared by the landing page and (over time) the app.
   Tokens mirror the values already used in app/app/index.html.
   Principles: one accent, two typefaces, hairlines instead of boxes, no motion
   that does not explain something. See docs/design-system.md.
   ============================================================================= */

/* ---- 1. Tokens -------------------------------------------------------------- */
:root {
  /* colour roles */
  --ground: #F1F1EE;   /* page background */
  --paper:  #F7F7F5;   /* the writing surface */
  --ink:    #1C1C1A;   /* text */
  --muted:  #6F6E69;   /* secondary text (AA on ground) */
  --line:   #DCDBD6;   /* hairlines */
  --signal: #DD5418;   /* the one accent: action, concepts, focus */
  --signal-ink: #FFFFFF;
  --idea:   rgba(240, 214, 74, .55); /* highlighter */
  --flash:  rgba(221, 84, 24, .18);

  /* type */
  --write: "Literata", Georgia, "Times New Roman", serif;
  --ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* type scale (1.25, rounded) */
  --t-xs: .8125rem;
  --t-sm: .9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.375rem;
  --t-xl: clamp(1.75rem, 3.2vw, 2.25rem);
  --t-2xl: clamp(2.5rem, 6.4vw, 4.5rem);

  /* space (4px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 72px; --s9: 112px;

  /* shape */
  --r: 6px;
  --measure: 34rem;      /* reading width */
  --wide: 68rem;         /* page width */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #151514; --paper: #1C1C1B; --ink: #E5E4DF; --muted: #96958E; --line: #2D2D2B;
    --signal: #F2733D; --signal-ink: #151514;
    --idea: rgba(214, 186, 52, .30); --flash: rgba(242, 115, 61, .22);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #151514; --paper: #1C1C1B; --ink: #E5E4DF; --muted: #96958E; --line: #2D2D2B;
  --signal: #F2733D; --signal-ink: #151514;
  --idea: rgba(214, 186, 52, .30); --flash: rgba(242, 115, 61, .22);
  color-scheme: dark;
}

/* ---- 2. Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--ui); font-size: var(--t-md); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--flash); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: .25em; }
a:hover { text-decoration-color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }

/* ---- 3. Type roles ---------------------------------------------------------- */
.display  { font-family: var(--write); font-weight: 600; font-size: var(--t-2xl); line-height: 1.04; letter-spacing: -.025em; margin: 0; text-wrap: balance; }
.headline { font-family: var(--write); font-weight: 600; font-size: var(--t-xl); line-height: 1.15; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.lede     { font-family: var(--write); font-size: var(--t-lg); line-height: 1.55; color: var(--muted); margin: 0; text-wrap: pretty; }
.body     { font-size: var(--t-md); line-height: 1.65; color: var(--muted); margin: 0; text-wrap: pretty; }
.eyebrow  { font-family: var(--ui); font-size: var(--t-xs); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0; }
.prose    { font-family: var(--write); font-size: 1.1875rem; line-height: 1.72; }

/* ---- 4. Layout -------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: max(var(--s5), env(safe-area-inset-left)); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---- 5. Components ---------------------------------------------------------- */
/* Button: one filled button per view. */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  font: 500 var(--t-sm)/1 var(--ui); padding: 14px 22px; border-radius: var(--r);
  border: 1px solid var(--ink); color: var(--ink); background: transparent;
  text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--ink); color: var(--ground); }
.btn--primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn--primary:hover { background: var(--ink); border-color: var(--ink); color: var(--ground); }
.btn--quiet { border-color: transparent; padding-inline: 4px; }
.btn--quiet:hover { background: transparent; color: var(--signal); }

/* Highlighter: an idea captured inside the text. */
mark.idea {
  color: inherit; background: linear-gradient(transparent 38%, var(--idea) 38%, var(--idea) 92%, transparent 92%);
}
/* Concept: a term with a signal underline. */
.concept { border-bottom: 2px solid var(--signal); }

.kbd {
  font: 500 var(--t-xs)/1 var(--ui); padding: 3px 6px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--paper);
}
.badge {
  font: 500 11px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase;
  color: var(--signal); border: 1px solid var(--signal); border-radius: 3px; padding: 3px 6px;
}
/* Paper: the writing surface. Elevation comes from tone, not shadow. */
.paper { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
