/* Shared identity for every page in site/ — tokens, typography, the sticky
   top bar, buttons and the footer.
 *
 * Extracted from index.html when /privacy and /terms arrived. Three inline
 * copies of the palette would have drifted the first time a colour changed, and
 * the brand colour is documented in docs/brand.md as a single value for exactly
 * that reason. Page-specific layout stays inline in the page that uses it.
 *
 * Still no external requests: this is one same-origin file, no web fonts, no
 * analytics.
 */

/* Palette tokens are Icons/README.md's, not invented here. The page cream
   has to be the brand cream exactly: theme_color above is #FAF3E3, and a
   page painted a different cream would put a visible seam right under the
   browser chrome — the specific thing that README warns about. */
:root {
  --cream: #faf3e3;
  --cream-deep: #f3e9d3;
  --ink: #2b2438;
  --ink-soft: #6b6280;
  --violet: #6d3ae0;
  --violet-deep: #3f2385;
  --tint: #ede4f7;
  --rule: rgba(43, 36, 56, 0.13);
  --measure: 34rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* text-wrap: balance evens the line lengths instead of filling greedily,
   which is what left "in." alone on its own line under the headline.
   Unsupported browsers just get the old greedy wrap. */
h1, h2, h3 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.2rem, 5.2vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 650; }
h3 { font-size: 1.06rem; font-weight: 650; }
p { margin: 0; }
a { color: inherit; }

/* ---------- hero ---------- */

/* Sticky, and carrying the CTA. Previously the only way into the app was
   one button in the hero, so anyone who read to the end of the page —
   including the tradeoffs section, which is the most persuasive thing
   here — had to scroll back up to act on it. Both Evernote and Obsidian
   keep a permanent CTA in the top bar for exactly this reason.
   It also fills the empty right-hand side that made the masthead read as
   unfinished. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--cream) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
}
/* 40px, against the CTA's 53px. Matching the button's height exactly was
   tried and overshoots: a square carries far more ink than a pill of the
   same height, so a 53px tile competes with the CTA for attention and
   inverts the hierarchy — the button is what the bar is for. 40 gives the
   mark real presence while staying visibly secondary.
   Radius as a percentage, not a pixel value, so it tracks the tile's own
   96/512 corner however the size changes; squaring the element off would
   clip the rounded rect inside the SVG. */
.brand img {
  width: 2.5rem;
  height: 2.5rem;
  display: block;
  border-radius: 18.75%;
}
.brand span { font-weight: 650; font-size: 1rem; letter-spacing: -0.01em; }

/* Smaller than the hero button on purpose — it is the fallback, not the
   thing being pointed at. */
.btn {
  display: inline-block;
  background: var(--violet);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.02rem;
  padding: 0.85rem 1.7rem;
  border-radius: 11px;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:hover { background: var(--violet-deep); transform: translateY(-1px); }

/* Focus rings are the third thing the README assigns violet to, and the
   only one that is an accessibility requirement rather than a style. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 4px;
}

.quiet-link {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  font-size: 0.96rem;
}
.quiet-link:hover { color: var(--violet-deep); border-bottom-color: var(--violet); }

/* Smaller than the hero button on purpose — it is the fallback, not the
   thing being pointed at. */
.btn-sm { font-size: 0.9rem; padding: 0.5rem 1.05rem; border-radius: 9px; }


/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--rule);
  padding: 3rem 0 4rem;
  font-size: 0.93rem;
  color: var(--ink-soft);
}
footer nav { margin-top: 1rem; display: flex; gap: 1rem; flex-wrap: wrap; }
footer a { color: var(--ink-soft); }
footer a:hover { color: var(--violet-deep); }
footer .built { margin-top: 1.6rem; }
footer .built a { color: var(--ink); }

/* Respect a dark-mode reader without abandoning the cream identity —
   the warm hue carries over rather than snapping to neutral grey. */
@media (prefers-color-scheme: dark) {
  :root {
    --cream: #17131f;
    --cream-deep: #1f1a29;
    --ink: #f2ecf7;
    --ink-soft: #aaa1bb;
    /* Lifted off the brand violet: #6d3ae0 on a dark ground drops under
       4.5:1 against white, so the button would fail contrast exactly
       where the README says violet has to clear AA. */
    --violet: #9c74ff;
    --violet-deep: #b795ff;
    --tint: rgba(157, 116, 255, 0.12);
    --rule: rgba(242, 236, 247, 0.15);
  }
  .btn { color: #17131f; }
  form.notify input { background: rgba(255, 255, 255, 0.05); }
  form.notify button { color: #17131f; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
