/* Shared stylesheet for the six app sites. Tokens follow DESIGN.md (warm paper neutrals,
   1px borders, Segoe UI); the page scale is larger because this is a reading page, not a
   420px tray window. --accent-light / --accent-dark are appended per app by build.mjs. */

:root {
  color-scheme: light dark;
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --surface-hover: #EFEEE9;
  --text: #1B1A18;
  --text-muted: #6B6862;
  --border: #E3E1DB;
  --control-border: #8A877F;
  --accent: var(--accent-light);
  --accent-fg: #FFFFFF;

  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;

  --fs-meta: 0.875rem;   /* 14 */
  --fs-body: 1.0625rem;  /* 17 */
  --fs-lead: 1.25rem;    /* 20 */
  --fs-h3: 1.0625rem;
  --fs-h2: 1.75rem;      /* 28 */
  --fs-h1: 2.25rem;      /* 36 on phones, 56 from 768 */

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px; --s16: 64px; --s24: 96px;
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px;
  --t-micro: 120ms; --ease: cubic-bezier(.2, 0, 0, 1);
  --measure: 62ch;
  --page: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1A18;
    --surface: #24231F;
    --surface-hover: #2E2C28;
    --text: #EDEBE6;
    --text-muted: #A3A09A;
    --border: #34322D;
    --control-border: #77746D;
    --accent: var(--accent-dark);
    --accent-fg: #1B1A18;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --t-micro: 0ms; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body)/1.6 var(--font);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

.skip { position: absolute; left: var(--s4); top: -100px; background: var(--surface); padding: var(--s2) var(--s4); border: 1px solid var(--border); z-index: 2; }
.skip:focus { top: var(--s4); }

.wrap { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 640px) { .wrap { padding: 0 var(--s8); } }

/* ---------- header ---------- */
.site-head { border-bottom: 1px solid var(--border); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: var(--s3); font-weight: 600; text-decoration: none; min-height: 44px; }
.brand img { width: 28px; height: 28px; }
.nav { display: flex; gap: var(--s4); font-size: var(--fs-meta); white-space: nowrap; }
@media (min-width: 640px) { .nav { gap: var(--s6); } }
.brand { white-space: nowrap; }
.nav a { color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.nav a:hover { color: var(--text); text-decoration: underline; }
.nav .hide-sm { display: none; }
@media (min-width: 768px) { .nav .hide-sm { display: inline-flex; } }

/* ---------- hero ---------- */
.hero { padding: var(--s12) 0 var(--s16); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s12); align-items: center; }
@media (min-width: 900px) {
  .hero { padding: var(--s24) 0; }
  .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: var(--s16); }
}
.hero h1 { font-size: var(--fs-h1); }
@media (min-width: 768px) { .hero h1 { font-size: 3.5rem; } }
.lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--text); margin-top: var(--s4); max-width: 34ch; }
.cta { margin-top: var(--s8); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s3);
  min-height: 52px; padding: 0 var(--s6);
  border-radius: var(--r-md); border: 1px solid transparent;
  font: 600 1.0625rem/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background-color var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); text-decoration: none; }
.btn-primary:active { transform: translateY(1px); background: color-mix(in srgb, var(--accent) 76%, #000); }
@media (prefers-color-scheme: dark) {
  .btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #fff); }
  .btn-primary:active { background: color-mix(in srgb, var(--accent) 76%, #fff); }
}
.dl-meta { font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.5; }
.dl-meta .sep { padding: 0 var(--s1); }
.dl-meta .nowrap { white-space: nowrap; }
.dl-sub { font-size: var(--fs-meta); color: var(--text-muted); max-width: 46ch; }
.dl-sub a { color: var(--text); }

.shot { margin: 0; justify-self: center; width: 100%; max-width: 402px; }
.shot img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.shot figcaption { font-size: var(--fs-meta); color: var(--text-muted); margin-top: var(--s2); text-align: center; }


/* ---------- sections ---------- */
.section { padding: var(--s16) 0; border-top: 1px solid var(--border); }
@media (min-width: 900px) { .section { padding: var(--s24) 0; } }
.section-head { max-width: var(--measure); margin-bottom: var(--s8); }
.section-head h2 { font-size: var(--fs-h2); }
.section-head p { color: var(--text-muted); margin-top: var(--s3); }

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s8); }
.split .section-head { margin-bottom: 0; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s16); align-items: start; }
  .split .section-head { position: sticky; top: var(--s8); margin-bottom: 0; }
}
.features { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.features li { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s1) var(--s8); padding: var(--s6) 0; border-bottom: 1px solid var(--border); }
@media (min-width: 640px) { .features li { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); } }
.features h3 { font-size: var(--fs-h3); font-family: var(--font); line-height: 1.6; }
.features p { color: var(--text-muted); }

/* why free */
.deal { font-family: var(--font-display); font-size: 1.375rem; line-height: 1.45; max-width: 40ch; }
@media (min-width: 768px) { .deal { font-size: 1.625rem; } }
.deal-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s8); margin-top: var(--s12); }
@media (min-width: 768px) { .deal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s8) var(--s12); } }
.deal-grid h3 { font-size: var(--fs-h3); font-family: var(--font); margin-bottom: var(--s3); }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.ticks li { padding-left: var(--s6); position: relative; color: var(--text-muted); }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 0.7em; width: 10px; height: 1px; background: var(--control-border); }
.prose-muted { color: var(--text-muted); }
.prose-muted + .prose-muted { margin-top: var(--s3); }
.know { margin-top: var(--s16); max-width: 820px; }
.know h3 { font-size: var(--fs-h3); font-family: var(--font); margin-bottom: var(--s4); }
.callout { margin-top: var(--s12); padding: var(--s6); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); max-width: var(--measure); }
.callout h3 { font-size: var(--fs-h3); font-family: var(--font); margin-bottom: var(--s2); }
.callout p { color: var(--text-muted); }
.callout p + p { margin-top: var(--s3); }

/* privacy summary */
.facts { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--border); max-width: 820px; }
.facts > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s1) var(--s8); padding: var(--s4) 0; border-bottom: 1px solid var(--border); }
@media (min-width: 640px) { .facts > div { grid-template-columns: 200px minmax(0, 1fr); } }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; color: var(--text-muted); }
.more { margin-top: var(--s6); }

/* faq */
.faq { max-width: 820px; border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  cursor: pointer; list-style: none; min-height: 56px; padding: var(--s4) var(--s8) var(--s4) 0;
  font-weight: 600; position: relative; display: flex; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: var(--s2); top: 50%; width: 9px; height: 9px;
  border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg); transition: transform var(--t-micro) var(--ease);
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq summary:hover { color: var(--accent); }
.faq .answer { padding: 0 0 var(--s6); color: var(--text-muted); max-width: var(--measure); }
.faq .answer p + p, .faq .answer p + ol, .faq .answer ol + p { margin-top: var(--s3); }
.faq ol { margin: 0; padding-left: 1.25em; }

/* closing download */
.closing { text-align: left; }
.closing .cta { margin-top: var(--s6); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--border); padding: var(--s12) 0 var(--s8); font-size: var(--fs-meta); color: var(--text-muted); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s8); }
@media (min-width: 768px) { .foot-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.foot-title { color: var(--text); font-weight: 600; margin-bottom: var(--s3); font-size: var(--fs-meta); }
.siblings { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s6); }
@media (min-width: 640px) { .siblings { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.siblings a, .legal-links a { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; text-decoration: none; color: var(--text-muted); }
.siblings a:hover, .legal-links a:hover { color: var(--text); text-decoration: underline; }
.siblings img { width: 20px; height: 20px; }
.legal-links { list-style: none; margin: 0; padding: 0; }
.foot-note { margin-top: var(--s8); padding-top: var(--s6); border-top: 1px solid var(--border); line-height: 1.6; }

/* ---------- legal pages ---------- */
.doc { padding: var(--s12) 0 var(--s16); }
.doc article { max-width: 720px; }
.doc h1 { font-size: var(--fs-h1); }
.doc .updated { color: var(--text-muted); font-size: var(--fs-meta); margin-top: var(--s3); }
.doc h2 { font-size: 1.25rem; margin-top: var(--s12); margin-bottom: var(--s3); }
.doc h3 { font-size: var(--fs-h3); margin-top: var(--s6); margin-bottom: var(--s2); font-family: var(--font); }
.doc p, .doc li { color: var(--text); }
.doc p + p { margin-top: var(--s3); }
.doc ul, .doc ol { padding-left: 1.25em; margin: var(--s3) 0 0; }
.doc li + li { margin-top: var(--s2); }
.doc .intro { font-size: var(--fs-lead); line-height: 1.5; margin-top: var(--s6); }
.doc address { font-style: normal; margin-top: var(--s3); }
.doc address + p, .doc ul + p, .doc ol + p, .doc .table-scroll + p { margin-top: var(--s4); }
.doc code { font-size: 0.9em; overflow-wrap: anywhere; }
.doc .todo { background: color-mix(in srgb, #E2A33B 30%, transparent); padding: 0 var(--s1); border-radius: var(--r-sm); }
.doc table { border-collapse: collapse; width: 100%; margin-top: var(--s3); font-size: var(--fs-meta); }
.doc th, .doc td { text-align: left; vertical-align: top; padding: var(--s2) var(--s3) var(--s2) 0; border-bottom: 1px solid var(--border); }
.doc th { font-weight: 600; }
.table-scroll { overflow-x: auto; }
.back { display: inline-flex; min-height: 44px; align-items: center; font-size: var(--fs-meta); color: var(--text-muted); }

/* ---------- uninstall feedback (/bye/) ---------- */
.bye-form { margin-top: var(--s8); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s4); }
.bye-form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s1); width: 100%; }
.bye-form legend { font-weight: 600; margin-bottom: var(--s3); padding: 0; }
.choice { display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.choice:hover { background: var(--surface-hover); }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.choice:has(input:checked) { border-color: var(--accent); }
.field-label { font-weight: 600; }
.field-label .optional { font-weight: 400; color: var(--text-muted); }
.bye-form textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--r-md); padding: var(--s3); resize: vertical; margin-top: calc(-1 * var(--s2)); }
.form-hint { font-size: var(--fs-meta); color: var(--text-muted); margin-top: calc(-1 * var(--s2)); }
.form-error { color: #B3261E; font-size: var(--fs-meta); }
@media (prefers-color-scheme: dark) { .form-error { color: #F2B8B5; } }
.bye-thanks { margin-top: var(--s8); padding: var(--s6); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.bye-thanks h2 { margin-top: 0; }
.bye-thanks p { margin-top: var(--s2); }
[hidden] { display: none !important; }

:root { --accent-light: #2B3A8C; --accent-dark: #9DAAF0; }
