@layer reset, base, chrome, layout, components, utilities;

:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface-subtle: #f5f7f8;
  --surface-dark: #132530;
  --ink: #162229;
  --text: #26333b;
  --muted: #55646e;
  --brand: #204f64;
  --brand-hover: #153747;
  --action: #00557b;
  --error: #983713;
  --line: #d5dde2;
  --line-strong: #6e7f8a;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1320px;
  --gutter: clamp(20px, 4vw, 56px);
}

@layer reset {
  :where(
    html, body, main, header, footer, section, article, aside, nav, div,
    fieldset, legend, form, label, input, textarea, select, button,
    table, thead, tbody, tr, th, td, dl, dt, dd, ul, ol, li,
    figure, figcaption, details, summary, h1, h2, h3, p, a, img, progress, span
  ) {
    box-sizing: border-box;
  }

  [hidden] {
    display: none !important;
  }
}

@layer base {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
  }

  body {
    margin: 0;
    color: var(--text);
    background: var(--paper);
    font: 400 17px/1.6 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    accent-color: var(--brand);
  }

  h1, h2, h3, p {
    margin-top: 0;
  }

  h1, h2, h3 {
    color: var(--ink);
  }

  a {
    color: var(--action);
    text-underline-offset: 0.2em;
  }

  a:hover {
    color: var(--brand-hover);
    text-decoration-thickness: 2px;
  }

  a:active {
    color: var(--ink);
    text-decoration-thickness: 2px;
  }

  button, input, textarea, select {
    font: inherit;
  }

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

  :focus-visible {
    outline: 3px solid var(--action);
    outline-offset: 3px;
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }
  }
}

@layer chrome {
  body.short-content-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  body.short-content-page > main {
    flex: 1;
  }

  .wrap {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .skip-link {
    position: absolute;
    z-index: 90;
    inset-inline-start: 16px;
    top: 0;
    padding: 10px 16px;
    background: var(--ink);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-160%);
  }

  .skip-link:focus {
    top: 12px;
    transform: translateY(0);
    color: #ffffff;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  @supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
      @keyframes header-elevation {
        0%, 4% {
          box-shadow: 0 1px 0 transparent;
        }
        12%, 100% {
          box-shadow: 0 6px 20px rgba(19, 37, 48, 0.07);
        }
      }

      .site-header {
        animation: header-elevation linear both;
        animation-timeline: scroll(root);
      }
    }
  }

  .header-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .site-header .wordmark,
  .site-footer .wordmark {
    flex: 0 0 auto;
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
  }

  .site-header .wordmark-tld,
  .site-footer .wordmark-tld {
    color: var(--muted);
    font-weight: 600;
  }

  .site-header .wordmark:hover,
  .site-footer .wordmark:hover {
    color: var(--brand);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
  }

  .site-header nav,
  .site-footer nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px clamp(16px, 2.6vw, 34px);
  }

  .site-header nav a,
  .site-footer nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding-inline: 2px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-underline-offset: 5px;
  }

  .site-header nav a:hover,
  .site-footer nav a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-thickness: 2px;
  }

  .site-header nav a:active,
  .site-footer nav a:active {
    color: var(--brand);
    text-decoration: underline;
    text-decoration-thickness: 2px;
  }

  .site-header nav a.nav-cta {
    position: relative;
    min-height: 42px;
    padding: 9px 16px;
    background: var(--brand);
    color: #ffffff;
    border: 1.5px solid var(--brand);
    border-radius: 0;
    font-weight: 700;
    text-decoration: none;
  }

  .nav-sticker {
    position: absolute;
    top: -11px;
    bottom: auto;
    inset-inline-end: -6px;
    padding: 2px 7px;
    background: #f5d26b;
    color: var(--ink);
    border: 2px solid #ffffff;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(19, 37, 48, 0.16);
    pointer-events: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    .nav-sticker {
      transform: rotate(2.5deg);
      transition: transform 0.16s ease, background-color 0.16s ease;
    }

    .site-header nav a.nav-cta:hover .nav-sticker {
      transform: rotate(0deg) translateY(-1px);
      background: #fae08c;
    }
  }

  .site-header nav a.nav-cta:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    color: #ffffff;
    text-decoration: none;
  }

  .site-header nav a.nav-cta:active {
    background: var(--ink);
    border-color: var(--ink);
    color: #ffffff;
    text-decoration: none;
  }

  .site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface-subtle);
  }

  .footer-inner {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-block: 16px;
  }

  @media (max-width: 680px) {
    .site-header nav a.nav-optional {
      display: none;
    }

    .header-inner {
      min-height: 68px;
      gap: 12px;
    }

    .site-header .wordmark {
      font-size: 17px;
    }

    .site-header nav a.nav-cta {
      padding: 8px 13px;
      font-size: 13px;
    }

    .nav-sticker {
      inset-inline-end: 0;
      top: -10px;
      bottom: auto;
      padding: 2px 6px;
    }

    .footer-inner {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
      padding-block: 20px;
    }

    .site-footer nav {
      gap: 4px 18px;
    }
  }
}

@layer utilities {
  .visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
  }
}
