/* Shared stylesheet for site/ — the top bar, the inner-page shell, and the
   site-wide type system. Loaded by every page. Light only, flat, monochrome
   ink on white, hairline rules. No accent, no gradient, no glow, no shadow.
   Read site/DESIGN.md ("The site nav" and "The type system") before changing
   anything here.

   Used by:
   - index.html  — the bar is hidden on load and slid in by nav.js on the first
     scroll past the hero, then stays put (see the "site nav" section of DESIGN.md).
   - tutorials.html / students.html / about.html / updates.html — the bar is
     present from load (markup carries `is-visible`); nav.js only runs the reveal
     when a `[data-topbar-reveal]` element is on the page.

   NOT re-themed yet: install/windows.html + install/mac.html (own guide.css). */

/* ── Type system — self-hosted, no CDN (see DESIGN.md's Google-Fonts bug note).
   Three voices: Fraunces (all big type), Inter (body + UI), JetBrains Mono
   (labels, metadata, code). Files in site/fonts/, from @fontsource. Fraunces is
   the variable font — one file covers every weight, opsz auto-mapped from size;
   its italic (a lighter wght-only cut) does the emphasis the "alise" cursive is
   otherwise reserved for. ───────────────────────────────────────────────────── */
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 100 900;
  font-display: swap; src: url("fonts/fraunces-var.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces"; font-style: italic; font-weight: 100 900;
  font-display: swap; src: url("fonts/fraunces-var-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("fonts/jetbrains-mono-500.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --ink: oklch(24% 0.02 50);
  --soft: oklch(44% 0.015 50);
  --muted: oklch(24% 0.02 50 / 0.5);
  --line: oklch(24% 0.02 50 / 0.16);
  --topbar-h: 56px;

  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* The one label treatment, used by every eyebrow on the site. */
  --eyebrow: 500 12px/1.4 var(--mono);
  --eyebrow-tracking: 0.14em;
}

/* Serif display: optical sizing on, tight tracking, balanced wrap. Applied to
   every heading role via the classes below — never to running text. */
.t-serif {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.018em;
  text-wrap: balance;
}
.t-eyebrow {
  font: var(--eyebrow);
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--muted);
}

/* ── The bar ─────────────────────────────────────────────────────────── */
/* Three tracks: brand left, links dead-centre, socials right. The 1fr on each
   side keeps the links centred on the viewport no matter how wide the brand or
   the social cluster gets. */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 clamp(16px, 4vw, 28px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  transform: translateY(-100%);
  transition: transform .34s cubic-bezier(.4, 0, .2, 1);
}
.topbar.is-visible { transform: translateY(0); }

.topbar-brand {
  justify-self: start;
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  font-family: var(--sans); font-weight: 600; font-size: 16px; letter-spacing: -0.01em;
}
.topbar-brand img { width: 24px; height: 24px; border-radius: 50%; display: block; }

.topbar-links {
  justify-self: center;
  display: flex; align-items: center;
  gap: clamp(14px, 2.6vw, 32px);
  min-width: 0;
}
.topbar-links a {
  text-decoration: none;
  color: var(--muted);
  font-family: var(--sans); font-size: 14.5px; font-weight: 500; letter-spacing: 0.005em;
  white-space: nowrap;
  transition: color .14s ease;
}
.topbar-links a:hover { color: var(--ink); }
/* The Students link reads "Notealise for students" on desktop; at the mobile
   breakpoint that label overflows the crammed nav, so it shortens to
   "Students" (the label the footer keeps in full). */
.topbar-links .tb-narrow { display: none; }
.topbar-links a.is-active { color: var(--ink); font-weight: 600; }

.topbar-social {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 2px;
}
.topbar-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--muted);
  transition: color .14s ease;
}
.topbar-social a:hover { color: var(--ink); }
.topbar-social svg { width: 18px; height: 18px; display: block; fill: currentColor; }

/* Fixed floating mark on the home page — nav.js hides it once the bar is in,
   so the bar's own mark isn't doubled up. Harmless on pages without a .mark. */
html.topbar-in .mark { opacity: 0; pointer-events: none; }
.mark { transition: opacity .2s ease; }

/* Below this width the three-up grid can't hold the centred links without
   crushing them — drop to brand + links (socials move to the footer instead,
   handled per page) and let the links scroll if they must. */
@media (max-width: 620px) {
  .topbar { grid-template-columns: auto 1fr; }
  .topbar-brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .topbar-links { justify-self: end; gap: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar-links::-webkit-scrollbar { display: none; }
  .topbar-social { display: none; }
  .topbar-links .tb-wide { display: none; }
  .topbar-links .tb-narrow { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .topbar { transition: none; }
}

/* ── "Explore" list on the home page (replaces the old blank .gap) ────── */
.explore {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  gap: 8px;
  padding: 120px clamp(24px, 6vw, 40px);
  max-width: 720px; margin: 0 auto;
}
.explore-eyebrow {
  margin: 0 0 14px;
  font: var(--eyebrow); letter-spacing: var(--eyebrow-tracking); text-transform: uppercase;
  color: var(--muted);
}
.explore-links { display: flex; flex-direction: column; }
.explore-links a {
  display: block;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
}
.explore-links a:last-child { border-bottom: 1px solid var(--line); }
.explore-title {
  display: inline-flex; align-items: baseline; gap: 12px;
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: clamp(1.4rem, 3.4vw, 1.95rem); font-weight: 500; letter-spacing: -0.018em;
}
.explore-title::after {
  content: "\2192";
  font-family: var(--sans);
  font-size: 0.72em; color: var(--muted);
  transition: transform .16s ease, color .16s ease;
}
.explore-links a:hover .explore-title::after { transform: translateX(4px); color: var(--ink); }
.explore-sub { margin: 6px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--soft); }

@media (prefers-reduced-motion: reduce) {
  .explore-title::after { transition: none; }
}

/* ── Inner-page shell (tutorials / students / about / updates) ────────── */
body.page {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; font-weight: 400; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  display: flex; flex-direction: column; min-height: 100dvh;
}
body.page * { box-sizing: border-box; }
.page-main {
  flex: 1 0 auto;
  width: min(640px, 100%); margin: 0 auto;
  padding: clamp(128px, 22vh, 220px) 24px 96px;
}
.page-eyebrow {
  margin: 0 0 16px;
  font: var(--eyebrow); letter-spacing: var(--eyebrow-tracking); text-transform: uppercase;
  color: var(--muted);
}
.page-main h1 {
  margin: 0 0 20px;
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: clamp(2.1rem, 5vw, 2.9rem); font-weight: 500; letter-spacing: -0.02em;
  line-height: 1.08; text-wrap: balance;
}
.page-main h2 {
  margin: 40px 0 14px;
  font-family: var(--serif); font-optical-sizing: auto;
  font-size: clamp(1.4rem, 3vw, 1.7rem); font-weight: 500; letter-spacing: -0.014em;
  line-height: 1.18; text-wrap: balance;
}
.page-lede { margin: 0 0 16px; font-size: 17px; line-height: 1.6; color: var(--soft); }
.page-back {
  display: inline-block; margin-top: 28px;
  font-size: 14px; color: var(--muted); text-decoration: none;
}
.page-back:hover { color: var(--ink); }

/* Long-form pages (privacy.html / terms.html) — lists, inline links and inline
   code inside .page-main. Running <p> text is left to inherit body.page's own
   size/line-height, so nothing here can reach .page-eyebrow / .page-lede. */
.page-meta {
  margin: -4px 0 32px;
  font: var(--eyebrow); letter-spacing: 0.04em;
  color: var(--muted);
}
.page-main ul { margin: 0 0 16px; padding-left: 1.3em; }
.page-main li { margin: 5px 0; }
.page-main h2 + p, .page-main h2 + ul { margin-top: 0; }
.page-main p a, .page-main li a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.page-main p a:hover, .page-main li a:hover { text-decoration-color: currentColor; }
.page-main code {
  font: 500 0.88em/1 var(--mono);
  padding: 0.12em 0.36em;
  background: oklch(24% 0.02 50 / 0.07);
  border-radius: 4px;
}

/* ── Bottom bar — same as index.html / guide.css ─────────────────────── */
.footer {
  flex: none;
  min-height: 64px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding: 20px clamp(20px, 5vw, 48px);
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.footer-brand { color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
.footer-est { color: var(--muted); font-weight: 400; letter-spacing: 0.06em; }
/* Inner-page footer nav — the legal links (index.html carries its own copy of
   these rules in landing.css, with the explore links alongside). */
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

@media (max-width: 480px) {
  .footer { justify-content: center; text-align: center; }
}
