/*
 * Site styles. All styling lives here: the CSP (style-src 'self') blocks <style> blocks and
 * style="" attributes in the HTML.
 */

/* ---------------------------------------------------------------------------------------------
 * Self-hosted web font (see docs/fonts.md in the repo). Google serves one variable woff2 per subset, so
 * each @font-face covers a weight range. Rename the files (version suffix) on every update:
 * /fonts/* is cached as immutable for a year. Copy unicode-range from the downloaded Google CSS.
 * ------------------------------------------------------------------------------------------- */

/* latin-ext */
@font-face {
  font-family: "{{FONT_FAMILY}}";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("/fonts/{{FONT_FILE}}-latin-ext-v1.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;
}

/* latin */
@font-face {
  font-family: "{{FONT_FAMILY}}";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("/fonts/{{FONT_FILE}}-latin-v1.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;
}

/* ---------------------------------------------------------------------------------------------
 * Tokens
 * ------------------------------------------------------------------------------------------- */

:root {
  --font-body: "{{FONT_FAMILY}}", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --color-text: #1b1f24;
  --color-muted: #57606a;
  --color-bg: #ffffff;
  --color-surface: #f4f6f8;
  --color-border: #d0d7de;
  --color-accent: #1f3a5f;
  --color-accent-text: #ffffff;
  --color-ok: #1a7f37;
  --color-error: #b42318;
  --radius: 6px;
  --wrap: 68rem;
  --space: 1rem;
}

/* ---------------------------------------------------------------------------------------------
 * Base
 * ------------------------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

h1,
h2,
h3 {
  line-height: 1.2;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0 0 var(--space);
}

h2 {
  font-size: 1.5rem;
  margin: calc(var(--space) * 2) 0 calc(var(--space) * 0.5);
}

a {
  color: var(--color-accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 calc(var(--space) * 1.25);
}

main:focus {
  outline: none;
}

.lead {
  font-size: 1.2rem;
  color: var(--color-muted);
}

/* Visible only when focused by keyboard. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: var(--color-accent-text);
  z-index: 10;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* ---------------------------------------------------------------------------------------------
 * Header and footer
 * ------------------------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: calc(var(--space) * 2);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  padding-top: var(--space);
  padding-bottom: var(--space);
}

.brand {
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--color-text);
}

.nav {
  display: flex;
  gap: calc(var(--space) * 1.25);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  text-decoration: none;
  font-weight: 500;
}

.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.site-footer {
  margin-top: calc(var(--space) * 4);
  padding: calc(var(--space) * 1.5) 0;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.9375rem;
}

/* ---------------------------------------------------------------------------------------------
 * Buttons and forms
 * ------------------------------------------------------------------------------------------- */

.button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.contact-form {
  max-width: 40rem;
}

.field {
  margin-bottom: calc(var(--space) * 1.25);
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  color: inherit;
  background: var(--color-bg);
}

.field textarea {
  resize: vertical;
}

.form-note {
  color: var(--color-muted);
  font-size: 0.9375rem;
}

.cf-turnstile {
  margin: var(--space) 0;
}

/* Honeypot: off-screen for people, still in the form for bots. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Result messages: hidden until targeted by the URL fragment (no-JS) or shown by site.js. */
.notice {
  display: none;
  max-width: 40rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  background: var(--color-surface);
}

.notice:target,
.notice.is-visible {
  display: block;
}

.notice-ok {
  border-color: var(--color-ok);
}

.notice-error {
  border-color: var(--color-error);
}

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