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

:root {
  --bg:         #f5f3ef;
  --surface:    #ffffff;
  --text:       #1a1a1a;
  --muted:      #888880;
  --border:     #e8e5df;
  --accent:     #2d2d2d;
  --page-width: 840px;
}
[data-theme="dark"] {
  --bg: #111110;
  --surface: #1c1c1a;
  --text: #e8e5df;
  --muted: #8a8a80;
  --border: #2d2d2a;
  --accent: #e8e5df;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Theme toggle ── */
.theme-toggle {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
  color: rgba(255,255,255,0.6);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  padding: 0;
  margin-left: 0.75rem;
  flex-shrink: 0;
}
.theme-toggle:hover { color: #fff; border-color: rgba(255,255,255,0.6); }
[data-theme="dark"] .theme-toggle { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.5); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Top nav ── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 2.5rem;
  height: 52px;
  background: var(--accent);
  color: #fff;
}
.nav-back {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.18s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-back:hover { color: #fff; }
.nav-back svg { width: 14px; height: 14px; }
.nav-site {
  margin-left: auto;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.18s;
}
.nav-site:hover { color: rgba(255,255,255,0.7); }

[data-theme="dark"] .top-nav { background: #1c1c1a; color: var(--text); }
[data-theme="dark"] .nav-back { color: var(--muted); }
[data-theme="dark"] .nav-back:hover { color: var(--text); }
[data-theme="dark"] .nav-site { color: var(--muted); }
[data-theme="dark"] .nav-site:hover { color: var(--text); }

@media (max-width: 640px) {
  .top-nav { padding: 0 1.5rem; }
}

/* ── Hero (sub-pages) ── */
.hero {
  position: relative;
  z-index: 1;
  padding: 1rem max(2.5rem, calc((100% - var(--page-width)) / 2 + 2.5rem)) 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  animation: fadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-label {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 0.75rem;
}
.hero p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Content (sub-pages) ── */
.content {
  position: relative;
  z-index: 1;
  max-width: var(--page-width);
  padding: 3rem 2.5rem 5rem;
  margin: 0 auto;
  animation: fadeUp 0.55s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 640px) {
  .hero { padding: 0.75rem 1.5rem 1.25rem; }
}

.theme-transitioning * { transition: background-color 0.3s, color 0.3s, border-color 0.3s !important; }
