/* ============================================================================
   base.css — reset, typography, layout primitives, header/footer, a11y
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0; background: var(--paper); color: var(--body);
  font-family: var(--font-body); font-size: var(--fs-400); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; vertical-align: middle; }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); line-height: var(--lh-tight);
  font-weight: 600; margin: 0 0 .5em; letter-spacing: -.02em;
  font-optical-sizing: auto; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 1.4rem + 3.4vw, var(--fs-1000)); }
h2 { font-size: clamp(1.55rem, 1.1rem + 1.6vw, var(--fs-800)); }
h3 { font-size: var(--fs-600); } h4 { font-size: var(--fs-500); }
p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }

a { color: var(--paddy); text-underline-offset: 2px; text-decoration-thickness: 1px;
  transition: color .15s var(--ease); }
a:hover { color: var(--paddy-hover); }

::selection { background: color-mix(in srgb, var(--grain) 38%, transparent); color: var(--ink); }

:focus-visible { outline: 2px solid var(--paddy); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--surface); color: var(--paddy); padding: 10px 14px; border-radius: 0 0 8px 0;
  box-shadow: var(--shadow-2); }
.skip-link:focus { left: 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- layout ---- */
.container { width: 100%; max-width: var(--content-max); margin-inline: auto;
  padding-inline: var(--sp-5); }
.section { padding-block: var(--sp-8); }
.section--tight { padding-block: var(--sp-6); }
.section--alt { background: var(--paper-2); border-block: 1px solid var(--border-soft); }
.prose { max-width: var(--measure); }
.lead { font-size: var(--fs-500); color: var(--muted); line-height: 1.55; }
.eyebrow { display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-200);
  letter-spacing: .1em; text-transform: uppercase; color: var(--terrace); margin: 0 0 var(--sp-3); }
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--grad-line); }
.grain-rule { height: 1px; border: 0; background:
  linear-gradient(90deg, transparent, var(--border) 12%, var(--border) 88%, transparent); margin: var(--sp-7) 0; }

/* ---- header ---- */
.site-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  transition: box-shadow .2s var(--ease), background .2s var(--ease); }
.site-header.is-scrolled { box-shadow: var(--shadow-1); background: color-mix(in srgb, var(--paper) 92%, transparent); }
.site-header__bar { display: flex; align-items: center; gap: var(--sp-4); height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: var(--sp-2); font-family: var(--font-display);
  font-weight: 600; color: var(--ink); text-decoration: none; font-size: var(--fs-500); white-space: nowrap;
  letter-spacing: -.01em; }
.brand .seedling { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  color: #fff; background: var(--grad-brand); box-shadow: var(--shadow-1); padding: 4px; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a, .nav details > summary { padding: 8px 12px; border-radius: var(--radius-sm); color: var(--body);
  text-decoration: none; font-size: var(--fs-300); font-weight: 500; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease); }
.nav a:hover, .nav details > summary:hover { background: color-mix(in srgb, var(--paddy) 9%, transparent); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--paddy); background: var(--ok-bg); }
.nav details { position: relative; }
.nav details > summary { list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.nav details > summary::-webkit-details-marker { display: none; }
.nav details[open] > .menu { display: block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 6px; }
.menu a { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }

.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--body); cursor: pointer; }
.icon-btn:hover { background: var(--grain-soft); color: var(--ink); }
/* theme toggle shows the action: moon in light mode (switch to dark), sun in dark mode (switch to light) */
[data-theme-toggle] .icon-sun { display: none; }
[data-theme-toggle] .icon-moon { display: inline-block; }
:root[data-theme="dark"] [data-theme-toggle] .icon-moon { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .icon-sun { display: inline-block; }

/* ---- footer ---- */
.site-footer { position: relative; margin-top: var(--sp-9); padding-top: var(--sp-5);
  background:
    radial-gradient(680px 140px at 50% 0%, color-mix(in srgb, var(--paddy) 8%, transparent), transparent 72%),
    linear-gradient(to bottom, var(--paper-2), var(--surface-2) 60%); }
/* Smooth gradient blend so the page fades into the footer instead of a hard edge. */
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--sp-9)); height: var(--sp-9);
  background: linear-gradient(to bottom, transparent, var(--paper-2)); pointer-events: none; }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--sp-6); padding-block: var(--sp-7); }
.site-footer h4 { font-family: var(--font-body); font-size: var(--fs-200); text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 6px 0; }
.site-footer a { color: var(--body); text-decoration: none; font-size: var(--fs-300); }
.site-footer a:hover { color: var(--paddy); }
.site-footer__strip { border-top: 1px solid var(--border); padding-block: var(--sp-4); color: var(--muted);
  font-size: var(--fs-200); display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: space-between; }

/* ---- header hamburger (mobile) ---- */
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .nav { position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--sp-3);
    box-shadow: var(--shadow-2); display: none; }
  .nav.is-open { display: flex; }
  .nav .menu { position: static; box-shadow: none; border: 0; padding-left: var(--sp-3); }
  .site-footer__grid { grid-template-columns: 1fr; gap: var(--sp-5); }
}
