/* Fonts, element defaults and the focus ring: what every page gets before any class. */
@layer base {
  /* ─── Material Symbols Outlined — self-hosted (no Google Fonts CDN) ───────── */
  @font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('/static/material-symbols-outlined.woff2') format('woff2');
  }
  .material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
  }

  /* ─── Roboto Flex — self-hosted, the weight axis only ───────────────────── */
  @font-face {
    font-family: "Roboto Flex Variable";
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
    src: url("/static/fonts/roboto-flex-latin-ext-wght-normal.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: "Roboto Flex Variable";
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
    src: url("/static/fonts/roboto-flex-latin-wght-normal.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;
  }

  [hidden] { display: none !important; }

  /* ─── Reset ──────────────────────────────────────────────────────────────── */

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

  html { height: 100%; }

  body {
    background: var(--md-sys-color-background);
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: 1.6;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  a { color: var(--md-sys-color-primary); text-decoration: none; }
  a:hover { text-decoration: underline; }

  code {
    font-family: var(--md-ref-typeface-mono);
    font-size: 0.88em;
    background: var(--md-sys-color-surface-container);
    border-radius: 3px;
    padding: 1px var(--md-sys-spacing-1);
  }

  pre {
    font-family: var(--md-ref-typeface-mono);
    font-size: 0.88em;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-medium);
    padding: var(--md-sys-spacing-4);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
  }

  h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: var(--md-sys-color-on-surface);
  }

  /* ─── Focus ──────────────────────────────────────────────────────────────── */

  :focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }

  /* ─── Form controls ──────────────────────────────────────────────────────── */

  input[type="text"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  select,
  textarea {
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-medium);
    color: var(--md-sys-color-on-surface);
    font-family: inherit;
    font-size: var(--md-sys-typescale-body-medium-size);
    padding: var(--md-sys-spacing-2) var(--md-sys-spacing-3);
    width: 100%;
    transition: border-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  }
  input:focus, select:focus, textarea:focus { border-color: var(--md-sys-color-primary); }
  /* With the border already primary, a 1px ring reads as M3's 2px focused outline. */
  input:focus-visible, select:focus-visible, textarea:focus-visible { outline-width: 1px; outline-offset: 0; }

  /* sr-only — visually hidden but screen-reader accessible */
  .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;
  }
}
