
@layer reset, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, h3, p, figure, blockquote { margin: 0; }
  img, svg { display: block; max-width: 100%; }
  button, input { font: inherit; }
  table { border-collapse: collapse; }
}

@layer base {
  :root {
    color-scheme: light dark;
    --ink: #153139;
    --muted: #536a70;
    --paper: #f7faf8;
    --surface: #ffffff;
    --surface-2: #edf5f1;
    --line: #cbdad5;
    --brand: #155e75;
    --brand-2: #2f855a;
    --accent: #d97706;
    --danger: #9b2c2c;
    --shadow: 0 18px 48px rgba(20, 49, 57, .12);
    --radius: 1rem;
    --shell: min(74rem, calc(100% - 2rem));
  }
  html[data-theme="dark"] {
    --ink: #eaf5f1;
    --muted: #aec2bc;
    --paper: #0e1b1f;
    --surface: #14262b;
    --surface-2: #193139;
    --line: #315058;
    --brand: #62c0d0;
    --brand-2: #79c79b;
    --accent: #f2b35d;
    --danger: #f9a8a8;
    --shadow: 0 18px 48px rgba(0, 0, 0, .3);
  }
  @media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
      --ink: #eaf5f1; --muted: #aec2bc; --paper: #0e1b1f; --surface: #14262b;
      --surface-2: #193139; --line: #315058; --brand: #62c0d0; --brand-2: #79c79b;
      --accent: #f2b35d; --danger: #f9a8a8; --shadow: 0 18px 48px rgba(0, 0, 0, .3);
    }
  }
  body {
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(1rem, .96rem + .2vw, 1.1rem);
    line-height: 1.68;
    text-rendering: optimizeLegibility;
  }
  h1, h2, h3 { line-height: 1.12; text-wrap: balance; letter-spacing: -.025em; }
  h1 { font-size: clamp(2.5rem, 6vw, 5.5rem); }
  h2 { font-size: clamp(1.85rem, 4vw, 3.2rem); }
  h3 { font-size: clamp(1.25rem, 2.2vw, 1.65rem); }
  p { text-wrap: pretty; }
  a { color: var(--brand); text-underline-offset: .18em; text-decoration-thickness: .08em; }
  a:hover { text-decoration-thickness: .14em; }
  :focus-visible { outline: .2rem solid var(--accent); outline-offset: .22rem; }
  ::selection { background: var(--brand); color: #fff; }
}

@layer components {
  .shell { width: var(--shell); margin-inline: auto; }
  .skip-link { position: fixed; z-index: 100; inset: .5rem auto auto .5rem; transform: translateY(-160%); padding: .6rem .85rem; border-radius: .5rem; background: var(--ink); color: var(--paper); }
  .skip-link:focus { transform: translateY(0); }
  .site-header { position: sticky; z-index: 40; top: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(18px); }
  .header-inner { min-height: 4.6rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; }
  .brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; }
  .brand img { border-radius: .75rem; }
  .brand span { display: grid; line-height: 1.05; }
  .brand strong { font-size: 1.05rem; }
  .brand small { color: var(--muted); font-size: .72rem; margin-top: .24rem; }
  .site-nav { justify-self: center; display: flex; align-items: center; gap: .25rem; }
  .site-nav a { padding: .55rem .75rem; border-radius: .7rem; color: var(--ink); text-decoration: none; font-size: .93rem; font-weight: 650; }
  .site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--surface-2); color: var(--brand); }
  .header-actions { display: flex; gap: .35rem; }
  .icon-button { min-width: 2.55rem; min-height: 2.55rem; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: .75rem; color: var(--ink); background: var(--surface); cursor: pointer; }
  .icon-button:hover { border-color: var(--brand); color: var(--brand); }
  .nav-toggle { display: none; justify-self: end; }
  .hero { position: relative; overflow: clip; padding: clamp(4.5rem, 10vw, 8.5rem) 0 4.5rem; border-bottom: 1px solid var(--line); }
  .hero::before { content: ""; position: absolute; inset: -30% -15% auto 50%; width: 44rem; height: 44rem; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brand-2) 30%, transparent), transparent 68%); pointer-events: none; }
  .hero-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(17rem, .7fr); gap: clamp(2rem, 7vw, 6rem); align-items: center; }
  .eyebrow { color: var(--brand-2); text-transform: uppercase; letter-spacing: .13em; font-size: .78rem; font-weight: 850; }
  .hero h1 { max-width: 13ch; margin-top: .8rem; }
  .hero-copy { max-width: 63ch; margin-top: 1.35rem; color: var(--muted); font-size: clamp(1.08rem, 1rem + .55vw, 1.4rem); }
  .actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
  .button { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: .65rem 1rem; border: 1px solid var(--brand); border-radius: .8rem; background: var(--brand); color: #fff; font-weight: 750; text-decoration: none; }
  .button.secondary { background: transparent; color: var(--brand); }
  .button[aria-disabled="true"] { border-color: var(--line); background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
  .hero-panel { padding: 1.5rem; border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.3); background: color-mix(in srgb, var(--surface) 86%, transparent); box-shadow: var(--shadow); }
  .hero-panel ul { padding-left: 1.2rem; margin: 1rem 0 0; }
  .section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
  .section + .section { border-top: 1px solid var(--line); }
  .section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, .8fr); gap: 2rem; align-items: end; margin-bottom: 2rem; }
  .section-head p { color: var(--muted); }
  .cards { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; container-type: inline-size; }
  .card { grid-column: span 4; display: flex; flex-direction: column; min-height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 10px 30px rgba(20,49,57,.06); }
  .card.wide { grid-column: span 6; }
  .card img { aspect-ratio: 16/9; width: 100%; object-fit: cover; border-bottom: 1px solid var(--line); }
  .card-body { display: grid; gap: .85rem; padding: 1.25rem; }
  .card-body p { color: var(--muted); }
  .card .tag, .tag { width: fit-content; padding: .18rem .55rem; border-radius: 99rem; background: var(--surface-2); color: var(--brand-2); font-size: .74rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  .card a.stretched { color: var(--ink); text-decoration: none; }
  .card a.stretched::after { content: ""; position: absolute; inset: 0; }
  .card { position: relative; }
  .prose { width: min(48rem, calc(100% - 2rem)); margin-inline: auto; padding: clamp(3rem, 6vw, 5.5rem) 0; }
  .prose > * + * { margin-top: 1.35rem; }
  .prose h1 { font-size: clamp(2.25rem, 5vw, 4.5rem); margin-bottom: 1.2rem; }
  .prose h2 { margin-top: 3.4rem; }
  .prose h3 { margin-top: 2.5rem; }
  .prose ul, .prose ol { padding-left: 1.35rem; }
  .prose li + li { margin-top: .7rem; }
  .lead { color: var(--muted); font-size: clamp(1.12rem, 1rem + .5vw, 1.35rem); }
  .meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; color: var(--muted); font-size: .9rem; }
  .callout { padding: 1rem 1.15rem; border: 1px solid var(--line); border-left: .35rem solid var(--brand-2); border-radius: .75rem; background: var(--surface-2); }
  .callout.warning { border-left-color: var(--accent); }
  .callout.danger { border-left-color: var(--danger); }
  blockquote { padding: 1rem 1.25rem; border-inline-start: .35rem solid var(--brand); background: var(--surface-2); font-size: 1.08em; }
  .media { margin-block: 2.2rem; }
  .media img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .media figcaption { margin-top: .6rem; color: var(--muted); font-size: .85rem; }
  .checklist { display: grid; gap: .65rem; padding: 0; list-style: none; }
  .checklist li { position: relative; padding: .8rem .9rem .8rem 2.5rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); }
  .checklist li::before { content: "✓"; position: absolute; left: .9rem; color: var(--brand-2); font-weight: 900; }
  .resource-list { display: grid; gap: .8rem; }
  .resource-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); }
  .resource-item p { color: var(--muted); font-size: .9rem; }
  .status { padding: .2rem .55rem; border-radius: 99rem; font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
  .status.available { background: color-mix(in srgb, var(--brand-2) 18%, transparent); color: var(--brand-2); }
  .status.missing { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
  .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); }
  table { width: 100%; font-size: .92rem; }
  th, td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
  th { position: sticky; top: 0; background: var(--surface-2); }
  tr:last-child td { border-bottom: 0; }
  .filter-box { width: 100%; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); color: var(--ink); }
  details { border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); }
  details + details { margin-top: .8rem; }
  summary { cursor: pointer; padding: 1rem; font-weight: 800; }
  details > div { padding: 0 1rem 1rem; }
  .archive-content { width: min(60rem, calc(100% - 2rem)); }
  .archive-content table { margin-block: 1rem 2rem; }
  .archive-content > * + * { margin-top: 1rem; }
  .archive-content h2 { padding-top: 2.5rem; border-top: 1px solid var(--line); }
  .site-footer { border-top: 1px solid var(--line); background: var(--surface); }
  .footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 2rem; padding-block: 2.5rem; }
  .footer-grid p { margin-top: .45rem; color: var(--muted); font-size: .9rem; }
  .footer-bottom { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
  .search-dialog { width: min(42rem, calc(100% - 1.5rem)); max-height: 80vh; border: 1px solid var(--line); border-radius: 1rem; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  .search-dialog::backdrop { background: rgba(5, 18, 22, .6); backdrop-filter: blur(5px); }
  .search-dialog-inner { padding: 1.25rem; }
  .dialog-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
  .search-dialog input { width: 100%; margin-top: .35rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--paper); color: var(--ink); }
  .search-results { display: grid; gap: .55rem; margin-top: 1rem; max-height: 48vh; overflow: auto; }
  .search-result { padding: .8rem; border: 1px solid var(--line); border-radius: .75rem; text-decoration: none; }
  .search-result strong { display: block; color: var(--ink); }
  .search-result span { color: var(--muted); font-size: .85rem; }
  @container (max-width: 48rem) { .card, .card.wide { grid-column: span 6; } }
  @media (max-width: 50rem) {
    .header-inner { grid-template-columns: 1fr auto auto; }
    .nav-toggle { display: inline-grid; }
    .site-nav { position: absolute; inset: calc(100% + .4rem) 1rem auto; display: none; padding: .6rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--surface); box-shadow: var(--shadow); }
    .site-nav[data-open="true"] { display: grid; }
    .site-nav a { padding: .75rem; }
    .hero-grid, .section-head { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; }
  }
  @media (max-width: 38rem) {
    .card, .card.wide { grid-column: 1 / -1; }
    .resource-item { grid-template-columns: 1fr; }
    .brand small { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  }
}

@layer utilities {
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .muted { color: var(--muted); }
  .center { text-align: center; }
  .center-actions { justify-content: center; }
}
