/**
 * Copyright © 2026 Giacomo Leidi <therewasa@fishinthecalculator.me>
 * */

:root {
  --bg:#f2ece0;--bg-surface:#e7e0d0;
  --text:#2a3828;--text-muted:#5e6e58;--text-heading:#1b3018;
  --green:#3b7234;--green-soft:#6a9e5c;--green-pale:#c8dabe;
  --gold:#c8a030;
  --radius:6px;--radius-lg:12px;--content-w:64rem;
  --transition:0.3s ease;
  --divider-color:#c4bea0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
--bg:#111c11;--bg-surface:#1a291a;
--text:#d0ccbe;--text-muted:#8a9a7e;--text-heading:#b8d4a0;
--green:#7ab05b;--green-soft:#5a8e48;--green-pale:#243424;
--gold:#e2c44e;
--divider-color:#2a3a2a;
  }
}

[data-theme="dark"] {
  --bg:#111c11;--bg-surface:#1a291a;
  --text:#d0ccbe;--text-muted:#8a9a7e;--text-heading:#b8d4a0;
  --green:#7ab05b;--green-soft:#5a8e48;--green-pale:#243424;
  --gold:#e2c44e;
  --divider-color:#2a3a2a;
}

[data-theme="light"] {
  --bg:#f2ece0;--bg-surface:#e7e0d0;
  --text:#2a3828;--text-muted:#5e6e58;--text-heading:#1b3018;
  --green:#3b7234;--green-soft:#6a9e5c;--green-pale:#c8dabe;
  --gold:#c8a030;
  --divider-color:#c4bea0;
}

/* === RESET & BASE === */

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Fira Sans", sans-serif;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
  overflow-y: scroll;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: system-ui, -apple-system, "Fira Sans", sans-serif;
  color: var(--text-heading);
  line-height: 1.25;
  transition: color var(--transition);
}

a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--transition);
}

a:hover { color: var(--gold); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

img, svg { max-width: 100%; height: auto; }

.content-wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  padding-inline: 1.5rem;
}

section { padding-block: 2rem; }

@media (max-width: 640px) {
  section { padding-block: 2.5rem; }
}

/* === NAVIGATION === */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-block-end: 1px solid var(--divider-color);
  transition: background var(--transition), border-color var(--transition);
}

.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.5rem; max-width: var(--content-w); margin: 0 auto;
}

.site-name {
  font-family: system-ui, -apple-system, "Fira Sans", sans-serif;
  font-size: 1.3rem; font-weight: 700;
  color: var(--text-heading); text-decoration: none;
  display: flex; align-items: center; gap: 0.5rem;
}

.site-name:hover { color: var(--green); }
.site-name svg { width: 1.4rem; height: 1.4rem; flex-shrink: 0; }

.nav-links {
  display: flex; align-items: center; gap: 1.5rem;
  list-style: none; margin: 0; padding: 0;
}

.nav-links a { font-size: 0.9rem; text-decoration: none; color: var(--text-muted); }
.nav-links a:hover { color: var(--green); }

.bulb {
  background: none; border: 1px solid var(--divider-color);
  border-radius: var(--radius); cursor: pointer;
  padding: 0.35rem 0.5rem; font-size: 1rem; line-height: 1;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}

.bulb:hover { border-color: var(--green); color: var(--text); }

.nav-mobile-toggle { display: none; }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-mobile-toggle { display: block; }

  .nav-mobile-toggle summary {
      list-style: none; cursor: pointer;
      font-size: 1.4rem; color: var(--text-muted); padding: 0.2rem;
  }

  .nav-mobile-toggle summary::-webkit-details-marker { display: none; }

  .nav-mobile-toggle[open] .mobile-links {
      position: absolute; top: 100%; inset-inline: 0;
      background: var(--bg-surface);
      border-block-end: 1px solid var(--divider-color);
      padding: 1rem 1.5rem; display: flex; flex-direction: column; gap: 0.75rem;
  }

  .mobile-links a {
      color: var(--text); text-decoration: none; font-size: 1rem; padding-block: 0.25rem;
  }
}

/* === HERO === */

.hero { padding-block: 5rem 3rem; }

@media (max-width: 640px) {
  .hero { padding-block: 3rem 2rem; }
}

/* No physical left/right anywhere so the order stays correct in RTL. */
.hero-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.hero-text { text-align: center; }

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 auto 1rem; max-width: 18ch; letter-spacing: -0.02em;
}

.hero-figure { margin: 0; }

.hero-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 32px -16px rgba(28, 48, 24, 0.45), 0 4px 10px -4px rgba(28, 48, 24, 0.18);
}

.hero-figure-caption {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-block-start: 0.6rem;
  /* Centred under the artwork so the attribution sits on the same
 centre axis as the hero copy above. */
  text-align: center;
}

.hero-figure-caption a {
  color: var(--text-muted);
  text-decoration-style: dotted;
}

.hero-figure-caption a:hover { color: var(--green); }

.hero-tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--text-muted); max-width: 50ch; margin: 0 auto 2rem;
}

/* === PROSE === */

.prose { font-size: 1.1rem; line-height: 1.8; }

/* === TABLES === */

table, th, td { border: 1px solid var(--divider-color); border-collapse: collapse; padding: 0.5rem; }
table { margin-block: 2rem; }

/* === FOOTER === */

.site-footer {
  padding-block: 2.5rem;
  border-block-start: 1px solid var(--divider-color);
  font-size: 0.85rem; color: var(--text-muted);
}

.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 1rem; align-items: center;
}

.footer-inner a { color: var(--text-muted); }
.footer-inner a:hover { color: var(--green); }

@media (max-width: 480px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* === UTILITY === */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media print {
  .site-header, .bulb { display: none; }
  body { background: white; color: black; }
  a { color: inherit; text-decoration: underline; }
  .hero-figure { max-width: 60%; }
}
