/* Shared styles for every page: reset, neutral palette, Fraunces headings, site header bar, theme toggle, focus ring.
   Page-specific styles (and each app's accent colours) stay inline in the page. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url('/assets/fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

/* Neutral palette. Light is the default, dark follows the system unless data-theme overrides it. */
:root {
  --bg: #FDF6EF; --surface: #fff; --text: #2B2B2B; --text-muted: #5C5050; --text-faint: #7D6E65;
  --text-faintest: #C4B5AC; --border: rgba(58,48,40,0.06); --shadow: rgba(58,48,40,0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1E1815; --surface: #2A231F; --text: #F3EAE2; --text-muted: #C7B8AC; --text-faint: #9C8B7D;
    --text-faintest: #7A6C60; --border: rgba(255,255,255,0.08); --shadow: rgba(0,0,0,0.35);
  }
}
[data-theme="dark"] {
  --bg: #1E1815; --surface: #2A231F; --text: #F3EAE2; --text-muted: #C7B8AC; --text-faint: #9C8B7D;
  --text-faintest: #7A6C60; --border: rgba(255,255,255,0.08); --shadow: rgba(0,0,0,0.35);
}
[data-theme="light"] {
  --bg: #FDF6EF; --surface: #fff; --text: #2B2B2B; --text-muted: #5C5050; --text-faint: #7D6E65;
  --text-faintest: #C4B5AC; --border: rgba(58,48,40,0.06); --shadow: rgba(58,48,40,0.05);
}

h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; }

/* Site header bar */
.site-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 10px max(20px, calc((100% - 1160px) / 2));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}
.site-brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.site-links { display: flex; align-items: center; gap: 8px; }
.site-links a {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 2px 10px var(--shadow);
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.site-links a:hover { color: var(--text); transform: translateY(-1px); }
.site-links a[aria-current="page"] { color: var(--text); border-color: var(--text-faint); }

.theme-toggle {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.2s ease;
}
.theme-toggle:hover { transform: scale(1.06); }
.theme-toggle svg { width: 18px; height: 18px; stroke: var(--text); }
.theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  .theme-toggle .icon-sun { display: none; }
  .theme-toggle .icon-moon { display: block; }
}
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 480px) {
  .site-bar { padding: 8px 14px; }
  .site-brand span { display: none; }
  .site-links a { padding: 8px 10px; font-size: 12px; }
}

/* Keyboard focus */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-text, var(--accent, currentColor));
  outline-offset: 3px;
  border-radius: 6px;
}
