/* © 2026 Created with ♥ by Alex Munteanu | alexmunteanu.com */
/* Folio shared stylesheet - base elements, cross-surface chrome, and shared
   components. Consumes tokens.css. Every Courses surface (the gallery + each
   course) links tokens.css -> folio.css -> its own surface CSS. A future course
   needs only these three links: no per-course palette or component CSS. */

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }

/* The [hidden] attribute (set by search JS on cards/grid/empty-states) must
   always win over author display rules (.grid{display:grid}, .card{display:block}),
   which otherwise beat the UA [hidden] rule because author origin outranks UA. */
[hidden] { display: none !important; }

html { overflow-x: clip; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-16);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--tracking-heading);
  line-height: var(--leading-heading);
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
code, pre { font-family: var(--font-mono); }
img { max-width: 100%; display: block; }
::selection { background: var(--color-brand-soft); }

/* ---------- Scrollbars (hairline, theme-aware, no chrome) ---------- */
/* Firefox */
html { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
/* WebKit / Chromium */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border: 2px solid transparent; background-clip: padding-box;
  border-radius: var(--radius-pill);
  transition: background-color var(--dur-fast) var(--ease-out);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-faint); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--color-brand); color: var(--color-on-brand);
  padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* ---------- Sticky top progress bar (shared, full-width) ---------- */
.top-progress {
  position: fixed; top: 0; left: 0; width: 100%;
  height: var(--top-progress-h); z-index: 200;
  background: var(--color-border);
}
.top-progress-fill {
  height: 100%; width: 0;
  background: var(--color-accent);
  transition: width 400ms var(--ease-out);
}

/* ---------- Top bar (shared chrome) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 14px var(--page-pad);
  background: linear-gradient(to bottom, var(--color-bg) 62%, transparent);
}
.brand {
  display: inline-flex; align-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 16px;
  letter-spacing: -0.01em; color: var(--color-text);
}
.brand:hover { color: var(--color-text); }
.brand-text { white-space: nowrap; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill);
  background: transparent; color: var(--color-text-muted); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-brand-soft); }

/* Theme toggle glyph: a pure-CSS half-filled disc (light/dark contrast).
   No emoji - honors the "no pictographs but ♥ and functional arrows" rule. */
.theme-icon {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
}

/* ---------- Search (hairline underline, not a pill) ---------- */
#searchInput {
  box-sizing: border-box; width: 100%; padding: 12px 0;
  background: transparent; border: none;
  border-bottom: 1px solid var(--color-border); border-radius: 0;
  outline: none; color: var(--color-text);
  font-family: var(--font-body); font-size: 15px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
#searchInput::placeholder { color: var(--color-text-faint); }
#searchInput:focus { border-bottom-color: var(--color-brand); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-top: 96px; padding: 28px 0; border-top: 1px solid var(--color-border);
  color: var(--color-text-faint); font-size: 12.5px;
}
.site-footer .credit { margin: 0; }
.site-footer .heart { color: var(--color-heart); }
.site-footer a { color: var(--color-text-muted); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--color-text); }
.site-footer .version { margin: 0; font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- Empty states ---------- */
.empty { padding: 40px 0; color: var(--color-text-faint); font-size: 14px; }
.empty-title { margin: 0 0 4px; font-size: 15px; color: var(--color-text); font-weight: 500; }
.empty-hint { margin: 0; max-width: 52ch; color: var(--color-text-faint); }
.clear-search {
  margin-top: 12px; padding: 9px 16px; cursor: pointer;
  background: transparent; color: var(--color-text-muted);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 13.5px;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.clear-search:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.clear-search:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-brand-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--color-brand); color: var(--color-on-brand);
  font-family: var(--font-body); font-weight: 600; font-size: 13.5px; line-height: 1.2;
  cursor: pointer;
  transition: filter var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn:hover { filter: brightness(1.12); text-decoration: none; color: var(--color-on-brand); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-brand-soft); }
.btn.ghost {
  background: transparent; color: var(--color-text-muted);
  border-color: var(--color-border-strong);
}
.btn.ghost:hover { color: var(--color-text); border-color: var(--color-border-strong); filter: none; }

/* ---------- Callouts (neutral fill, mono mint kicker carries the kind) ---------- */
.callout {
  margin: 1.5em 0; padding: 16px 20px; border-radius: var(--radius-md);
  background: var(--callout-bg); border: 1px solid var(--color-border);
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout::before {
  display: block; margin-bottom: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--color-accent);
}
.callout.tip::before { content: "Tip"; }
.callout.warn::before { content: "Warning"; }
.callout.danger::before { content: "Danger"; }
.callout.note::before { content: "Note"; }
.callout.example::before { content: "Example"; }
.callout .callout-title { font-weight: 600; color: var(--color-text); margin-bottom: 3px; }
.callout p, .callout li { color: var(--color-text-muted); }
/* Pull-quote callout: no kind kicker, a single mint hairline rule. */
.callout.quote {
  border: none; border-left: 2px solid var(--color-accent);
  border-radius: 0; background: transparent; padding: 4px 0 4px 20px;
  font-family: var(--font-display); font-size: 1.15rem; color: var(--color-text);
}
.callout.quote::before { content: none; }

/* ---------- Level badge (plain mono label) ---------- */
.level-badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--color-text-faint); background: none; padding: 0; border-radius: 0;
}

/* ---------- Progress (mint fill on a hairline track) ---------- */
.progress-track { height: 2px; background: var(--color-border); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--color-accent); border-radius: var(--radius-pill); transition: width 400ms var(--ease-out); }

/* ---------- Ghost numeral ---------- */
.ghost-num {
  font-family: var(--font-display); font-weight: 700; line-height: 1;
  color: var(--color-ghost-numeral); pointer-events: none; user-select: none;
}

/* ---------- Mono eyebrow / kicker ---------- */
.kicker {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--color-text-faint);
}

/* ---------- Rise-in on load ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .4s var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { animation: none; }
  .top-progress-fill { transition: none; }
}
