/* =====================================================
   BASE — reset, typography, layout primitives, header, footer
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
html { height: 100%; }
body {
  /* Sticky footer: the page is a full-height column; <main> grows to fill
     whatever the content leaves, so the footer sits at the bottom of the
     viewport on short pages and after the content on long ones. */
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); font-size: var(--fs-base); line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--space-3); color: var(--ink); }
h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: var(--fs-h2); font-weight: 750; }
h3 { font-size: var(--fs-h3); font-weight: 650; }
p { margin: 0 0 var(--space-4); }
ul, ol { padding-left: 1.25rem; }
button { font: inherit; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.narrow { max-width: var(--narrow); }
.container.narrow { max-width: calc(var(--narrow) + 4rem); }
main { flex: 1 0 auto; width: 100%; }
.site-footer { flex-shrink: 0; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 200; }
.skip-link:focus { left: 8px; }
.hide-mobile { display: none !important; }
@media (min-width: 900px) { .hide-mobile { display: inline-flex !important; } }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 100; padding-top: env(safe-area-inset-top);
  background: var(--header-bg); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color 0.2s, box-shadow 0.2s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; gap: var(--space-5); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 9px; background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--accent)); box-shadow: 0 0 18px var(--accent-glow); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg); }
.brand-logo { border-radius: 8px; object-fit: contain; }
.nav-main { display: none; align-items: center; gap: var(--space-1); margin-left: var(--space-3); }
.nav-main a { color: var(--ink-dim); font-weight: 550; font-size: var(--fs-sm); padding: 8px 12px; border-radius: var(--radius-pill); transition: color 0.15s, background 0.15s; }
.nav-main a:hover, .nav-main a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); text-decoration: none; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.icon-btn:hover { border-color: var(--border-strong); background: var(--bg-soft); }
[data-theme="dark"] .icon-sun, :root:not([data-theme="dark"]) .icon-moon { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: inline; }
.mobile-menu { border-top: 1px solid var(--border); background: var(--bg); max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.mobile-menu nav { display: flex; flex-direction: column; padding-block: var(--space-4); }
.mobile-menu nav > a:not(.btn) { color: var(--ink); font-weight: 600; font-size: 1.1rem; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.mobile-menu-cta { display: grid; gap: var(--space-3); margin-top: var(--space-5); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 900px) {
  .nav-main { display: flex; }
  .nav-toggle, .mobile-menu { display: none !important; }
}

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding: var(--space-8) 0 calc(var(--space-6) + env(safe-area-inset-bottom)); margin-top: 0; }
.footer-grid { display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
.footer-brand p { max-width: 34ch; color: var(--ink-dim); margin-top: var(--space-3); }
.footer-mail { font-weight: 600; font-size: var(--fs-sm); }
.footer-col h2 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); font-weight: 700; margin-bottom: var(--space-3); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footer-col a { color: var(--ink-dim); font-size: var(--fs-sm); display: inline-block; padding: 5px 0; }
.footer-col a:hover { color: var(--ink); }
.footer-bottom { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--border); color: var(--ink-faint); font-size: var(--fs-xs); }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } .footer-brand { grid-column: 1 / -1; } }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.6fr repeat(3, 1fr); } .footer-brand { grid-column: auto; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
