/* ==========================================================================
   Design system: the only stylesheet of the site.
   1. Tokens  2. Base  3. Layout  4. Components  5. Utilities
   ========================================================================== */

/* Open Sans (variable, 300-800), self-hosted. SIL Open Font License 1.1. */
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("/fonts/open-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("/fonts/open-sans-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;
}

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Matte palette: warm stone neutrals, one muted slate-blue accent, no gradients or shadows */
  --bg: #f4f3f0;
  --surface: #ebe9e4;
  --text: #25282c;
  --muted: #5f6368;
  --border: #d9d6cf;
  --accent: #2f4a63;
  --accent-hover: #243a4e;
  --accent-text: #f4f3f0;
  --success: #3d6b4f;
  --success-bg: #e1e8e0;
  --danger: #8f3b34;
  --danger-bg: #eddedb;

  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --text-2xl: clamp(2rem, 4vw + 1rem, 3.5rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --space-12: 6rem;

  --radius: 0.375rem;
  --measure: 42rem;
  --container: 64rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1d20;
    --surface: #232629;
    --text: #dcdad5;
    --muted: #8f9296;
    --border: #33363a;
    --accent: #8fa8bd;
    --accent-hover: #a3b9cb;
    --accent-text: #1b1d20;
    --success: #8db99f;
    --success-bg: #222b25;
    --danger: #d49a93;
    --danger-bg: #2f2423;
  }
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--space-8); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--text-base) / 1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--text-2xl); line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; }
h2 { font-size: var(--text-xl); line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
h3 { font-size: var(--text-lg); line-height: 1.3; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

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

/* 3. Layout ---------------------------------------------------------------- */
.container { width: min(100% - 2 * var(--space-3), var(--container)); margin-inline: auto; }
.section { padding-block: var(--space-8); }
.section + .section { border-top: 1px solid var(--border); }
.hero { padding-block: var(--space-12) var(--space-8); }
.hero .stack > * { max-width: var(--measure); }

.stack > * + * { margin-top: var(--space-3); }
.stack > h2 + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-1); }

.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.cluster-between { justify-content: space-between; }

.grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

#about p:not(.muted) { max-width: var(--measure); }

.hero-grid { display: grid; gap: var(--space-6); align-items: center; grid-template-columns: 1fr auto; }
.hero-grid .stack > * { max-width: var(--measure); }
.portrait { width: 15rem; height: 15rem; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--surface); }
@media (max-width: 40rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; width: 11rem; height: 11rem; justify-self: center; }
}
.h1-sub { font-size: var(--text-lg); font-weight: 400; color: var(--muted); letter-spacing: 0; }

/* 4. Components ------------------------------------------------------------ */
.header { position: sticky; top: 0; z-index: 10; padding-block: var(--space-2);
  background: var(--bg);
  border-bottom: 1px solid var(--border); }
.brand { font-weight: 650; text-decoration: none; letter-spacing: -0.01em; }

.link { color: var(--muted); text-decoration: none; font-size: var(--text-sm); transition: color 0.15s; }
.link:hover { color: var(--text); }

.eyebrow { color: var(--muted); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.lead { font-size: var(--text-lg); color: var(--muted); }
.muted { color: var(--muted); }

.btn { display: inline-block; padding: 0.75rem 1.5rem; border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: none;
  cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--muted); }
.btn-ghost:hover { background: var(--surface); border-color: var(--text); }

.card { padding: var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card p { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: var(--space-1); max-width: var(--measure); }
.field label { font-size: var(--text-sm); font-weight: 600; }
.field input, .field textarea { width: 100%; padding: 0.75rem 1rem; font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: var(--text-sm); }
.field textarea { resize: vertical; }

.alert { max-width: var(--measure); padding: var(--space-2) var(--space-3); border-radius: var(--radius); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }

.stack > .steps { margin-top: var(--space-6); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); counter-reset: step;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.step { counter-increment: step; padding: var(--space-3) 0 0; border-top: 2px solid var(--border); }
.step::before { content: counter(step, decimal-leading-zero); display: block; color: var(--accent); font-weight: 700; font-size: var(--text-sm); }
.step h3 { margin-block: 0.25rem var(--space-1); }
.step p { color: var(--muted); }

.lang-toggle { display: inline-flex; gap: var(--space-1); }
.lang { padding: 0.15rem 0.6rem; font-size: var(--text-sm); font-weight: 400; text-decoration: none; color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); }
.lang:hover { color: var(--text); }
.lang.is-current { font-weight: 800; color: var(--text); border-color: var(--text); }

.contact-list { list-style: none; margin: 0; padding: 0; }
.link-inline { color: var(--accent); }

/* htmx adds .htmx-request to the element issuing the request */
form.htmx-request .btn { opacity: 0.6; pointer-events: none; }

.footer { padding-block: var(--space-6); border-top: 1px solid var(--border); font-size: var(--text-sm); }

/* 5. Utilities ------------------------------------------------------------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
