@layer tokens, base, layout, components, utilities;

/* =============================================================================
   YubiKey AAGUIDs — styles.css

   Design intent: an independent technical reference, not a product page. The
   palette is a cool neutral carrying a single indigo accent, and the accent is
   reserved for interactive state (focus, active sort, pressed filter, links).
   Nothing is tinted just to be tinted — this is deliberate, so the page is not
   mistaken for official Yubico material.

   No build step. Every colour is themed with light-dark(); there are ZERO
   prefers-color-scheme blocks. The only !important in this file lives inside
   the prefers-reduced-motion block at the very bottom.
   ============================================================================= */


/* =============================================================================
   TOKENS
   ============================================================================= */
@layer tokens {

  :root {
    color-scheme: light dark;

    /* --- Accent ------------------------------------------------------------
       One hue, used only where something is interactive or active. Both ends
       clear AA against every surface they land on:
         #4A45C8 on #FFFFFF = 7.1:1   #A9A4FF on #151A21 = 7.9:1
         #4A45C8 on #F7F8FA = 6.6:1   #A9A4FF on #0F1217 = 8.4:1            */
    --accent: light-dark(#4A45C8, #A9A4FF);
    --accent-solid: #4A45C8;
    --accent-on: light-dark(#FFFFFF, #0F1217);

    /* --- Surfaces --------------------------------------------------------- */
    --bg: light-dark(#F7F8FA, #0F1217);
    --surface: light-dark(#FFFFFF, #151A21);
    --surface-sunken: light-dark(#F1F3F6, #12161C);
    --th-bg: light-dark(#F1F3F6, #1A202A);
    --row-stripe: light-dark(#FAFBFC, #12171E);
    --row-hover: light-dark(#EEF1F7, #1D2430);

    /* --- Text ---------------------------------------------------------------
       muted is the weakest token in the file and still clears AA on the
       weakest surface it is used on (#5A6472 on #EEF1F7 = 5.3:1).           */
    --fg: light-dark(#14181F, #E6E9EF);
    --fg-muted: light-dark(#5A6472, #98A2B3);
    --fg-subtle: light-dark(#39414D, #C0C7D4);

    /* --- Certification badges ------------------------------------------------
       The one deliberate exception to "accent only": tier is amber for Level 1
       and green for Level 2, which is a rank convention readers already know
       and is worth more here than palette purity. It stays inside the badge —
       neither hue appears anywhere else, so the page chrome is unaffected.

       The tier is carried by the label text first ("Level 1" / "Level 2"); fill
       and border are the redundant channels, so nothing depends on hue alone.
       Re-checked against the neutral surfaces these now sit on:
         L1 #7A4E00 on #FFF3D6 = 6.5:1   L1 #F2C97D on #33260C = 9.4:1
         L2 #2F5D1C on #E9F4DA = 6.8:1   L2 #A7DD72 on #1B3018 = 8.9:1       */
    --cert1-fg: light-dark(#7A4E00, #F2C97D);
    --cert1-bg: light-dark(#FFF3D6, #33260C);
    --cert1-bd: light-dark(#E8CE8F, #4A3814);
    --cert2-fg: light-dark(#2F5D1C, #A7DD72);
    --cert2-bg: light-dark(#E9F4DA, #1B3018);
    --cert2-bd: light-dark(#BEDDA0, #2C4A26);

    /* --- Lines & focus ------------------------------------------------------- */
    --border: light-dark(#DDE1E8, #262E3A);
    --border-strong: light-dark(#B9C0CC, #3A4453);
    --focus-ring: var(--accent);
    --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);

    /* Pressed chip: solid accent fill, so the label flips to the paired ink. */
    --chip-on-bg: var(--accent);
    --chip-on-fg: var(--accent-on);

    /* Error strip. Light: #9B1C1C on #FDECEC = 7.1:1.
                    Dark:  #F5A9A9 on #2A1416 = 9.2:1. Both pass AA (and AAA). */
    --status-error-bg: light-dark(#FDECEC, #2A1416);
    --status-error-fg: light-dark(#9B1C1C, #F5A9A9);
    --status-error-bd: light-dark(#F0C9C9, #4A2124);

    /* --- Spacing ----------------------------------------------------------- */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* --- Radii ---------------------------------------------------------------
       Small and near-uniform. Pill shapes read as marketing chrome; on a
       reference table a 4px corner reads as a control.                       */
    --r-xs: 3px;
    --r-sm: 4px;
    --r-md: 6px;
    --r-lg: 8px;

    /* --- Type ----------------------------------------------------------------
       System stack, no webfont. This drops the two Google Fonts preconnects
       and the stylesheet request, which is what lets the CSP narrow to
       `style-src 'self'; font-src 'self'`.                                   */
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --fs-2xs: 0.6875rem;
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-md: 0.875rem;
    --fs-lg: 1rem;
    --fs-xl: 1.25rem;
    --fs-title: clamp(1.375rem, 1.1rem + 1.2vw, 1.75rem);
    --lh-tight: 1.25;
    --lh-snug: 1.4;
    --lh-normal: 1.55;
    --tracking-tight: -0.02em;
    --tracking-wide: 0.07em;

    /* --- Elevation ------------------------------------------------------------
       Two shadows in the whole file: the sticky header's lift, which signals
       that the thead is pinned over content, and the copy tooltip, which
       genuinely floats. Panels use a 1px border instead.                     */
    --shadow-stuck: 0 4px 10px -8px light-dark(rgba(20, 24, 31, .45), rgba(0, 0, 0, .75));
    --shadow-pop: 0 2px 8px -2px light-dark(rgba(20, 24, 31, .25), rgba(0, 0, 0, .65));

    /* --- Motion ---------------------------------------------------------------- */
    --dur-fast: 100ms;
    --dur-base: 160ms;
    --ease-out: cubic-bezier(.22, 1, .36, 1);

    /* --- Measure ---------------------------------------------------------------- */
    --content-max: 1120px;
    --gutter: clamp(16px, 4vw, 32px);
  }

  /* Explicit theme overrides written by theme-init.js / the theme switch. */
  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"]  { color-scheme: dark; }
}


/* =============================================================================
   BASE — element resets and global defaults
   ============================================================================= */
@layer base {

  *,
  *::before,
  *::after { box-sizing: border-box; }
  html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: var(--sp-16);
  }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: var(--fs-lg);
    line-height: var(--lh-normal);
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, p, figure { margin: 0; }
  img, svg { display: block; }
  a { color: var(--accent); }
  button,
  input {
    font: inherit;
    color: inherit;
  }

  /* One focus treatment for everything interactive. */
  :focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
  }
}


/* =============================================================================
   LAYOUT — page shell, masthead, footer geometry
   ============================================================================= */
@layer layout {

  /* --- Main container ------------------------------------------------------ */
  .content {
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
    padding-block: var(--sp-8);
  }

  /* --- Masthead -------------------------------------------------------------
     Flat: page background, one hairline at the bottom, no gradient and no
     inverted band. The title sits on the same row as the theme switch rather
     than the switch being absolutely pinned over a coloured field.          */
  .masthead {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
  .masthead-inner {
    max-width: var(--content-max);
    margin-inline: auto;
    padding: var(--sp-8) var(--gutter);
  }
  .masthead-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
  }
  .masthead-title {
    font-size: var(--fs-title);
    font-weight: 650;
    letter-spacing: var(--tracking-tight);
    line-height: var(--lh-tight);
  }
  .masthead-lede {
    max-width: 78ch;
    margin-top: var(--sp-3);
    font-size: var(--fs-md);
    line-height: var(--lh-normal);
    color: var(--fg-muted);
  }

  /* Plain inline run of facts, middot-separated. No pills. */
  .masthead-meta {
    list-style: none;
    margin: var(--sp-4) 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-3);
    font-size: var(--fs-sm);
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
  }
  .masthead-meta li + li::before {
    content: '\00B7';
    margin-right: var(--sp-3);
    color: var(--border-strong);
  }

  /* The only item on this line that answers a question rather than stating a
     number, so it takes full text strength while its siblings stay muted. The
     separator keeps its own colour above, so emphasising the item does not drag
     the middot along with it.

     app.js rewrites the <time> to a relative phrase ("today", "6 days ago") and
     parks the exact date on `title`; with JS off, the absolute date written in
     the markup stands and this rule still applies. */
  .masthead-meta .meta-updated {
    color: var(--fg);
    font-weight: 500;
  }

  /* --- Footer -------------------------------------------------------------- */
  .site-footer {
    margin-top: var(--sp-10);
    border-top: 1px solid var(--border);
    background: var(--surface-sunken);
    padding: var(--sp-8) 0 var(--sp-10);
    font-size: var(--fs-sm);
    color: var(--fg-muted);
  }
  .footer-inner {
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: var(--sp-6);
  }
}


/* =============================================================================
   COMPONENTS
   ============================================================================= */
@layer components {

  /* ---------------------------------------------------------------------------
     Theme switch — segmented control, in the masthead's flow
     ------------------------------------------------------------------------ */
  .theme-switch {
    display: inline-flex;
    flex: none;
    gap: 2px;
    padding: 2px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-sunken);
  }
  .theme-btn {
    width: 30px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--fg-muted);
    cursor: pointer;
    transition:
      background-color var(--dur-fast) var(--ease-out),
      color var(--dur-fast) var(--ease-out);
  }
  .theme-btn[aria-pressed="true"] {
    background: var(--surface);
    color: var(--fg);
    box-shadow: inset 0 0 0 1px var(--border-strong);
  }
  .theme-icon {
    width: 16px;
    height: 16px;
  }

  /* ---------------------------------------------------------------------------
     Panels — flat, bordered, no shadow and no overlap trickery
     ------------------------------------------------------------------------ */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
  }
  .card--toolbar { padding: var(--sp-4); }

  /* `overflow: clip` — NOT `hidden`, which would kill the sticky thead. */
  .card--table {
    margin-top: var(--sp-4);
    padding: 0;
    overflow: clip;
  }

  /* ---------------------------------------------------------------------------
     Toolbar — search, buttons, exports
     ------------------------------------------------------------------------ */
  .toolbar-row--search {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    flex-wrap: wrap;
  }
  .search-field {
    flex: 1 1 260px;
    min-width: 0;
    position: relative;
  }
  .search-icon {
    position: absolute;
    left: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--fg-muted);
    pointer-events: none;
  }
  .search-field input[type="search"] {
    width: 100%;
    height: 36px;
    padding: 0 var(--sp-3) 0 34px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--fg);
    font-size: var(--fs-md);
    transition:
      border-color var(--dur-fast) var(--ease-out),
      box-shadow var(--dur-fast) var(--ease-out);
  }
  .search-field input[type="search"]::placeholder { color: var(--fg-muted); }
  .search-field input[type="search"]:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
    border-color: var(--accent);
    box-shadow: var(--ring);
  }
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 var(--sp-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--fg);
    font-size: var(--fs-md);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition:
      border-color var(--dur-fast) var(--ease-out),
      background-color var(--dur-fast) var(--ease-out);
  }
  .btn:disabled {
    opacity: .5;
    cursor: not-allowed;
  }
  .export-controls {
    margin-left: auto;
    display: flex;
    gap: var(--sp-2);
  }
  .toolbar-row--meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-top: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
  }
  .result-count {
    font-size: var(--fs-sm);
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
    min-height: 1.2em;
    align-self: center;
  }

  /* ---------------------------------------------------------------------------
     Certification filter chips
     ------------------------------------------------------------------------ */
  .chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
  }
  .chip {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 var(--sp-3);
    border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: transparent;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--fg-muted);
    cursor: pointer;
    transition:
      background-color var(--dur-fast) var(--ease-out),
      border-color var(--dur-fast) var(--ease-out),
      color var(--dur-fast) var(--ease-out);
  }
  .chip-count {
    margin-left: 6px;
    color: inherit;
    opacity: .7;
    font-variant-numeric: tabular-nums;
  }
  .chip[aria-pressed="true"] {
    background: var(--chip-on-bg);
    border-color: var(--chip-on-bg);
    color: var(--chip-on-fg);
  }
  .chip[aria-pressed="true"] .chip-count { opacity: .8; }

  /* ---------------------------------------------------------------------------
     Table shell
     `border-collapse: collapse` silently drops borders on sticky cells in
     Chromium/WebKit, so every horizontal rule below is an inset box-shadow.
     ------------------------------------------------------------------------ */
  .table-wrap { position: relative; }
  .table-sentinel {
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
  }
  #csvTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
  }

  /* Fallback when the CSV headers are not Model/Firmware/AAGUID/Certification. */
  #csvTable.table--auto { table-layout: auto; }
  #csvTable.table--auto [data-col] { width: auto; }

  /* --- Column sizing, by name, never by nth-child -------------------------- */
  /* Sized to the typical name, not the longest one. Row-weighted across the 93
     rows the model name is a ~114px median / ~153px p90 at 14px 600; only
     "Security Key NFC Enterprise Ed." (237px, 7 rows) exceeds that, and letting
     it wrap costs nothing because two 14px lines (39px) still clear the 42px
     thumbnail that sets the row height. Sizing for that one outlier meant a
     324px slot holding 114px of text — 210px of dead gutter on the median row.

     Slack has to land somewhere, so it lands where it is least visible: the
     Certification column, whose badge is centred, splits its leftover evenly on
     both sides instead of pooling it into one visible gap. */
  [data-col="model"]         { width: 22%; }
  [data-col="firmware"]      { width: 12%; }
  [data-col="aaguid"]        { width: 38%; }
  [data-col="certification"] { width: 28%; text-align: center; }

  /* --- Header cells (stick to the VIEWPORT; no nested scroller) ------------ */
  #csvTable thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--th-bg);
    padding: var(--sp-2) var(--sp-4);
    font-size: var(--fs-2xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--fg-subtle);
    text-align: left;
    box-shadow: inset 0 -1px 0 var(--border);
  }
  /* The Certification column centres its badges, so its label centres too.
     `#csvTable thead th` (1,0,2) outranks the `[data-col]` width rule (0,1,0),
     so the alignment has to be restated at this specificity. */
  #csvTable thead th[data-col="certification"] { text-align: center; }
  th[data-col="certification"] .th-sort { justify-content: center; }

  /* Sentinel-driven lift once the header is pinned. */
  #csvTable.is-stuck thead th {
    box-shadow:
      inset 0 -1px 0 var(--border),
      var(--shadow-stuck);
  }
  .th-sort {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--sp-2);
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
  }

  /* The glyph follows the label in normal flow rather than being pinned to the
     <th>'s right edge. Pinned, it drifted the full width of a wide column away
     from the word it belongs to, and the dead span between the two read as an
     empty column. */
  .th-sort::after {
    content: '\21C5';
    font-size: 11px;
    line-height: 1;
    opacity: .35;
  }
  th.asc .th-sort::after {
    content: '\25B4';
    color: var(--accent);
    opacity: 1;
  }
  th.desc .th-sort::after {
    content: '\25BE';
    color: var(--accent);
    opacity: 1;
  }

  /* --- Body rows ------------------------------------------------------------ */
  tbody td {
    /* Vertical padding is deliberately small: the 42px thumbnail already
       sets the row height, so anything more just makes rows tall. */
    padding: 5px var(--sp-4);
    font-size: var(--fs-md);
    line-height: var(--lh-snug);
    vertical-align: middle;
    text-align: left;
    box-shadow: inset 0 -1px 0 var(--border);
  }
  tbody tr:nth-child(even) td { background: var(--row-stripe); }

  /* --- Cell types ----------------------------------------------------------- */
  td[data-col="model"] { overflow-wrap: break-word; }
  /* The flex row lives inside the cell. display:flex on the td itself takes
     it out of table layout, so the cell shrinks to the thumbnail and the name
     wraps one letter per line. */
  .model-layout {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    width: 100%;
    min-width: 0;
  }
  /* Unframed: every product shot is a 80x200 PNG with a transparent
     background, so it sits directly on the row in both themes. The box
     matches that 2:5 aspect ratio rather than being square — a square box
     letterboxed the key down to an 11px sliver and wasted 60% of its width. */
  .model-thumb {
    width: 17px;
    height: 42px;
    object-fit: contain;
    flex: none;
  }
  .model-name {
    font-weight: 600;
    overflow-wrap: break-word;
    min-width: 0;
  }
  td[data-col="firmware"] {
    font-size: var(--fs-sm);
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  td[data-col="aaguid"] {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    letter-spacing: .01em;
    white-space: nowrap;
    position: relative;
    padding-right: 28px;
  }
  td[data-col="certification"] { white-space: nowrap; }
  .copyable { cursor: pointer; }

  /* Copy affordance: a faint ⧉ that firms up to a ✓ on success. */
  td[data-col="aaguid"]::after {
    content: '\29C9';
    position: absolute;
    right: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-sans);
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease-out);
  }
  td[data-col="aaguid"]:focus-visible::after { opacity: .55; }
  td[data-col="aaguid"].is-copied::after {
    content: '\2713';
    color: var(--accent);
    opacity: 1;
  }

  /* --- Certification badges -------------------------------------------------- */
  /* No leading dot: the tier is already carried by the label text itself
     ("Level 1" / "Level 2") plus a distinct fill and border, so nothing here
     depends on hue alone and the dot was pure decoration. */
  .cert {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-xs);
    font-size: var(--fs-xs);
    font-weight: 500;
    border: 1px solid;
  }
  .cert-l1 {
    color: var(--cert1-fg);
    background: var(--cert1-bg);
    border-color: var(--cert1-bd);
  }
  .cert-l2 {
    color: var(--cert2-fg);
    background: var(--cert2-bg);
    border-color: var(--cert2-bd);
  }

  /* ---------------------------------------------------------------------------
     Status strip
     ------------------------------------------------------------------------ */
  .table-status {
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-sunken);
    color: var(--fg-subtle);
    box-shadow: inset 0 -1px 0 var(--border);
    font-size: var(--fs-md);
  }

  /* Error tint. Light: #9B1C1C on #FDECEC = 7.1:1.
     Dark:  #F5A9A9 on #2A1416 = 9.2:1. Both clear AA (and AAA) for body text. */
  .table-status.is-error {
    background: var(--status-error-bg);
    color: var(--status-error-fg);
    box-shadow: inset 0 -1px 0 var(--status-error-bd);
  }

  /* ---------------------------------------------------------------------------
     Empty state — beats the base `tbody td` rules on specificity alone
     (0,1,1 vs 0,0,2) plus layer order. No !important.
     ------------------------------------------------------------------------ */
  td.empty-state {
    text-align: center;
    padding: var(--sp-12) var(--sp-4);
    box-shadow: none;
    background: transparent;
  }
  .empty-title {
    font-size: var(--fs-lg);
    font-weight: 600;
  }
  .empty-hint {
    font-size: var(--fs-md);
    color: var(--fg-muted);
    margin: var(--sp-2) 0 var(--sp-5);
  }

  /* ---------------------------------------------------------------------------
     Copy tooltip — the one element that genuinely floats
     ------------------------------------------------------------------------ */
  .copy-tooltip {
    position: fixed;
    z-index: 20;
    margin: 0;
    padding: 4px 8px;
    border-radius: var(--r-xs);
    font-size: var(--fs-xs);
    background: light-dark(#14181F, #E6E9EF);
    color: light-dark(#E6E9EF, #14181F);
    box-shadow: var(--shadow-pop);
    pointer-events: none;
    white-space: nowrap;
  }
  .copy-tooltip[hidden] { display: none; }

  /* ---------------------------------------------------------------------------
     No-JS panel
     ------------------------------------------------------------------------ */
  .noscript-panel {
    padding: var(--sp-6) var(--sp-4);
    background: var(--surface-sunken);
    color: var(--fg);
    font-size: var(--fs-md);
    box-shadow: inset 0 -1px 0 var(--border);
  }
  .noscript-panel p { margin: 0; }
  .noscript-panel p + p { margin-top: var(--sp-2); }
  .noscript-panel strong { font-size: var(--fs-xl); display: block; }
  .noscript-panel a {
    color: var(--accent);
    font-weight: 600;
  }

  /* ---------------------------------------------------------------------------
     Skip link
     ------------------------------------------------------------------------ */
  .skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .skip-link:focus {
    position: fixed;
    top: var(--sp-3);
    left: var(--sp-3);
    z-index: 50;
    width: auto;
    height: auto;
    margin: 0;
    padding: 10px var(--sp-4);
    clip: auto;
    overflow: visible;
    border-radius: var(--r-sm);
    /* Fixed pair, not the themed token: this sits over whatever is beneath it,
       and #FFFFFF on #4A45C8 is 7.1:1 in both themes. */
    background: var(--accent-solid);
    color: #FFFFFF;
    font-size: var(--fs-md);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-pop);
  }

  /* ---------------------------------------------------------------------------
     Footer contents
     ------------------------------------------------------------------------ */
  .footer-col { min-width: 0; }

  /* <h2> reset to a small section label. */
  .footer-heading {
    font-size: var(--fs-2xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--fg-subtle);
    margin: 0 0 var(--sp-3);
  }
  .footer-note {
    margin: 0;
    max-width: 52ch;
  }

  /* Gap when two notes stack in the same column. */
  .footer-note + .footer-note { margin-top: var(--sp-3); }
  .footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .footer-links li + li { margin-top: var(--sp-2); }
  .footer-inner a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    text-underline-offset: 2px;
    transition: text-decoration-color var(--dur-fast) var(--ease-out);
  }

  /* ---------------------------------------------------------------------------
     Hover-only affordances
     ------------------------------------------------------------------------ */
  @media (hover: hover) and (pointer: fine) {

    .btn:hover:not(:disabled) {
      border-color: var(--accent);
      background: var(--row-hover);
    }
    .chip:hover:not([aria-pressed="true"]) {
      border-color: var(--accent);
      color: var(--fg);
    }
    .theme-btn:hover:not([aria-pressed="true"]) { color: var(--fg); }
    .th-sort:hover { color: var(--accent); }
    #csvTable tbody tr:hover td:not(.empty-state) { background: var(--row-hover); }

    /* The 2px accent edge is composed INTO the cell's inset shadow so the
       row's bottom rule survives. */
    #csvTable tbody tr:hover td:not(.empty-state):first-child {
      box-shadow:
        inset 2px 0 0 0 var(--accent),
        inset 0 -1px 0 var(--border);
    }
    #csvTable tbody tr:hover td[data-col="aaguid"]::after { opacity: .55; }
    .footer-inner a:hover { text-decoration-color: currentColor; }
  }

  /* ---------------------------------------------------------------------------
     Breakpoint: 1024px — give the table room
     ------------------------------------------------------------------------ */
  @media (max-width: 1024px) {

    .masthead-inner { padding-block: var(--sp-6); }

    /* Priority inverts as the table narrows: the AAGUID cannot wrap without
       becoming hard to read, but the model name can — and wrapping it is free,
       because two 14px lines (39px) are still shorter than the 42px thumbnail
       that sets the row height. So give the width to AAGUID. */
    [data-col="model"]         { width: 24%; }
    [data-col="firmware"]      { width: 11%; }
    [data-col="aaguid"]        { width: 45%; }
    [data-col="certification"] { width: 20%; }

    /* Safety net below ~800px, where even 45% is narrower than a 36-char
       UUID: let it wrap rather than overflow into the next column. */
    td[data-col="aaguid"] {
      white-space: normal;
      overflow-wrap: anywhere;
    }
  }

  /* ---------------------------------------------------------------------------
     Breakpoint: 768px — single-column footer, roomier toolbar
     ------------------------------------------------------------------------ */
  @media (max-width: 768px) {

    .footer-inner { grid-template-columns: 1fr; }
    .search-field { flex: 1 1 100%; }
    .export-controls { margin-left: 0; }
    .toolbar-row--meta { align-items: flex-start; }
  }

  /* ---------------------------------------------------------------------------
     Breakpoint: 700px — the table becomes a stacked card list.
     thead is visually hidden but stays in the accessibility tree
     (position: absolute, NOT display: none). No horizontal scroll.
     ------------------------------------------------------------------------ */
  @media (max-width: 700px) {

    .card--table {
      border: 0;
      background: transparent;
      padding: 0;
      margin-top: var(--sp-4);
    }
    .table-status,
    .noscript-panel {
      border: 1px solid var(--border);
      border-radius: var(--r-md);
      margin-bottom: var(--sp-3);
      box-shadow: none;
    }
    #csvTable thead {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
    #csvTable,
    #csvTable tbody,
    #csvTable tr,
    #csvTable td { display: block; }

    /* Percentage widths and nowrap make no sense once cells are blocks. */
    #csvTable [data-col] {
      width: auto;
      white-space: normal;
    }
    #csvTable tbody tr {
      margin-bottom: var(--sp-3);
      border: 1px solid var(--border);
      border-radius: var(--r-md);
      background: var(--surface);
      overflow: hidden;
    }

    /* Zebra striping off in card mode. */
    #csvTable tbody tr:nth-child(even) td { background: transparent; }
    #csvTable tbody td {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: var(--sp-4);
      padding: 10px var(--sp-4);
      text-align: right;
      box-shadow: inset 0 -1px 0 var(--border);
    }
    #csvTable tbody tr td:last-child { box-shadow: none; }
    #csvTable tbody td::before {
      content: attr(data-label);
      font-weight: 600;
      color: var(--fg-subtle);
      font-size: var(--fs-2xs);
      text-transform: uppercase;
      letter-spacing: var(--tracking-wide);
      text-align: left;
      flex: none;
    }

    /* Model keeps its thumbnail and reads as the card's title. */
    #csvTable tbody td.model-cell {
      justify-content: flex-start;
      text-align: left;
      background: var(--surface-sunken);
      padding: var(--sp-3) var(--sp-4);
      font-size: var(--fs-lg);
    }
    #csvTable tbody td.model-cell::before { content: none; }

    /* Let the copy glyph flow as a flex item instead of overlapping the value. */
    #csvTable tbody td[data-col="aaguid"] {
      padding-right: var(--sp-4);
      overflow-wrap: anywhere;
    }
    #csvTable tbody td[data-col="aaguid"]::after {
      position: static;
      transform: none;
      flex: none;
    }

    /* The empty state still spans the whole card list. */
    #csvTable tbody tr:has(td.empty-state) {
      border: 0;
      background: transparent;
      margin: 0;
    }
    #csvTable tbody td.empty-state {
      display: block;
      text-align: center;
      padding: var(--sp-10) var(--sp-4);
    }
    #csvTable tbody td.empty-state::before { content: none; }
  }

  /* ---------------------------------------------------------------------------
     Breakpoint: 520px — title and theme switch stack
     ------------------------------------------------------------------------ */
  @media (max-width: 520px) {

    /* Switch takes the first line on its own, title the second at full width.
       Ordering is done with `order`, not `row-reverse`: reversing the main axis
       does not reverse the order the wrapped lines stack in, so the switch
       still landed under the title. */
    .masthead-bar {
      flex-wrap: wrap;
      align-items: flex-start;
    }
    .theme-switch { order: 1; }
    .masthead-title {
      order: 2;
      flex: 1 1 100%;
    }
    .toolbar-row--search > .btn,
    .export-controls { flex: 1 1 100%; }
    .export-controls > .btn { flex: 1 1 0; }
  }
}


/* =============================================================================
   UTILITIES
   ============================================================================= */
@layer utilities {

  /* Same clip pattern the page shipped with. */
  .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;
  }
  [hidden] { display: none; }

  /* The only !important in the file, as mandated. */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}
