/* ==========================================================================
   THE SEARCH STANDARD — the house's dress since 2026-11-19.
   --------------------------------------------------------------------------
   A classless-first CSS design system in the language of
   searchbrowser.app, which Roberto named on 2026-11-19 as "exactly the
   reflection of everything I want to create" and ordered applied here.
   The standard is written down in Baruch's `searchbrowser-standard`
   skill; the tokens below are that site's own, measured from its
   stylesheet. This file replaces the earlier Figma-based Web Design
   System wholesale (Roberto rejected that system on 2026-11-08).

   Load this one file and plain semantic HTML is styled. No classes, no
   ids are required; a small, documented set of contract classes covers
   the few things semantics cannot express (see README.md, "The class
   contract"). The contract is unchanged from the system this replaces,
   so every page's markup stands as it was.

   Layers: tokens -> reset -> base -> components -> contract.
   ========================================================================== */

@layer tokens, reset, base, components, contract;

/* ==========================================================================
   TOKENS — the Search standard's own :root, verbatim where the site
   declares it; the house additions after it are marked as such.
   ========================================================================== */
@layer tokens {
  :root {
    /* --- The one ink, stepped by alpha (site tokens, verbatim) --- */
    --ink: #171717;
    --ink-2: rgba(23, 23, 23, .5); /* secondary text */
    --ink-3: rgba(23, 23, 23, .36); /* tertiary text, fine print */
    --ink-4: rgba(23, 23, 23, .2); /* faintest text, disabled */

    /* --- Ground and fills (site tokens, verbatim) --- */
    --ground: #fff;
    --wash: #f3f3f2; /* warm off-white panel fill */
    --pill: #ececec; /* pill / chip fill */
    --hover: #f5f5f5; /* hover wash */
    --hair: rgba(23, 23, 23, .09); /* the hairline: the ink at 9% */

    /* --- Type (site token, verbatim) --- */
    --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
      "Helvetica Neue", Helvetica, Arial, sans-serif;

    /* --- Motion (site tokens, verbatim): glide for state, settle
           (a hair of overshoot) for entrances --- */
    --glide: cubic-bezier(.22, 1, .36, 1);
    --settle: cubic-bezier(.2, .9, .3, 1.02);

    /* --- Measure (site tokens, verbatim) --- */
    --page-pad: 24px;
    --max-w: 1280px;
    --edge: max(var(--page-pad),
        calc((100% - var(--max-w)) / 2 + var(--page-pad)));
    --radius: 18px; /* panels and stages */

    /* --- Elevation (site values): soft shadow + a 1px ring --- */
    --lift-hero: 0 50px 120px rgba(0, 0, 0, .16), 0 0 0 1px rgba(0, 0, 0, .06);
    --lift-panel: 0 14px 40px rgba(0, 0, 0, .12), 0 0 0 1px rgba(0, 0, 0, .06);
    --lift-small: 0 1px 3px rgba(0, 0, 0, .08);

    /* --- House additions ---------------------------------------------
       The spacing scale and the functional colors. The reference
       chrome carries no accent color at all; these three exist only
       where a state must be told (a confirmed subscription, a failed
       delivery), never as decoration. The spacing names are kept from
       the previous system because static/app.css builds on them. */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 16px;
    --space-4: 24px;
    --space-5: 32px;
    --space-6: 40px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 80px;
    --space-10: 96px;

    --color-success-500: #2e7d32;
    --color-warning-500: #8a6d00;
    --color-danger-500: #b00020;

    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
      "Liberation Mono", monospace;
  }
}

/* ==========================================================================
   RESET — a minimal modern reset; carries no design decisions of its own.
   ========================================================================== */
@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  * {
    margin: 0;
  }

  body {
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  img,
  picture,
  video,
  canvas,
  svg {
    display: block;
    max-width: 100%;
  }

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

  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }
}

/* ==========================================================================
   BASE — the document itself: the white ground, the ink, the shell,
   headings carried by weight more than size, hairline rows.
   ========================================================================== */
@layer base {
  html {
    font-size: 16px;
    scroll-behavior: smooth;
  }

  body {
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    font-feature-settings: "ss01", "cv11";
    overflow-x: hidden;
  }

  ::selection {
    background: var(--ink);
    color: #fff;
  }

  /* The standard's focus: a real outline in the ink. */
  :focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
    border-radius: 4px;
  }

  /* --- Page shell: the translucent sticky nav, main, footer ---------- */
  body > header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    min-height: 64px;
    padding: 10px var(--edge);
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--hair);
  }

  body > header p {
    margin: 0;
  }

  body > header a {
    text-decoration: none;
  }

  body > header strong {
    font-weight: 600;
  }

  body > header small {
    color: var(--ink-2);
    font-size: 13px;
    margin-inline-start: var(--space-2);
  }

  body > main {
    padding: clamp(40px, 6vw, 72px) var(--edge) clamp(56px, 8vw, 96px);
  }

  body > footer {
    padding: var(--space-5) var(--edge) var(--space-6);
    border-top: 1px solid var(--hair);
    color: var(--ink-2);
    font-size: 14px;
  }

  body > footer strong {
    color: var(--ink);
    font-weight: 600;
  }

  nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  nav a {
    color: var(--ink-2);
    text-decoration: none;
    transition: color .15s;
  }

  nav a:hover {
    color: var(--ink);
  }

  /* The working nav inside the desk's main: quiet pills of text, the
     page the owner stands on filled with the wash. */
  main nav {
    margin-block-end: var(--space-5);
  }

  main nav ul {
    gap: var(--space-1);
  }

  main nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
  }

  main nav a:hover {
    background: var(--hover);
  }

  section,
  article {
    margin-block: var(--space-6);
  }

  /* --- Headings: Inter 600, hierarchy by weight and alpha ------------ */
  h1,
  h2,
  h3,
  h4 {
    font-weight: 600;
    line-height: 1.25;
    margin-block: var(--space-5) var(--space-3);
  }

  h1 {
    font-size: 30px;
    letter-spacing: -0.01em;
    line-height: 1.2;
  }

  h2 {
    font-size: 23px;
    letter-spacing: -0.01em;
  }

  h3 {
    font-size: 18px;
    line-height: 1.3;
  }

  h4 {
    font-size: 16px;
    line-height: 1.35;
  }

  h5 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-block: var(--space-4) var(--space-2);
  }

  h6 {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    line-height: 1.4;
    margin-block: var(--space-4) var(--space-2);
  }

  /* The statement: a headline written as a running paragraph in
     half-strength ink, its load-bearing words in full ink — the
     reference hero's own device. Set on an <h1 class="lead">. */
  .lead {
    font-size: 21px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--ink-2);
    max-width: 62ch;
    letter-spacing: 0;
    margin-block: 0 var(--space-4);
  }

  .lead strong,
  .lead b {
    color: var(--ink);
    font-weight: 600;
  }

  /* --- Body text ------------------------------------------------------ */
  p {
    margin-block-end: var(--space-3);
    max-width: 68ch;
  }

  small {
    font-size: 13px;
    color: var(--ink-2);
  }

  strong,
  b {
    font-weight: 600;
  }

  mark {
    background: var(--wash);
    color: inherit;
    padding-inline: var(--space-1);
    border-radius: 4px;
  }

  abbr[title] {
    text-decoration: underline dotted;
    cursor: help;
  }

  /* --- Links: the ink, underlined in the flow of prose ---------------- */
  a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--ink-4);
    transition: text-decoration-color .15s;
  }

  a:hover {
    text-decoration-color: var(--ink);
  }

  /* --- Lists ------------------------------------------------------------
     Plain lists keep their markers in prose. A list inside an article
     is a structured list: rows parted by hairlines, no markers. */
  ul,
  ol {
    margin-block-end: var(--space-3);
    padding-inline-start: var(--space-4);
  }

  li {
    margin-block-end: var(--space-2);
  }

  li::marker {
    color: var(--ink-3);
  }

  article ul {
    list-style: none;
    padding-inline-start: 0;
  }

  article li {
    padding-block: var(--space-3);
    border-bottom: 1px solid var(--hair);
    margin-block-end: 0;
  }

  article li:first-child {
    border-top: 1px solid var(--hair);
  }

  /* --- Quotation, code, rules ------------------------------------------ */
  blockquote {
    font-size: 17px;
    line-height: 1.55;
    border-inline-start: 2px solid var(--ink-4);
    padding-inline-start: var(--space-4);
    margin-block: var(--space-4);
    max-width: 62ch;
  }

  blockquote p {
    max-width: none;
  }

  code,
  kbd,
  samp {
    font-family: var(--font-mono);
    font-size: 0.9375em;
  }

  code {
    background: var(--wash);
    padding-inline: 6px;
    border-radius: 6px;
  }

  pre {
    background: var(--wash);
    padding: var(--space-3);
    border-radius: 12px;
    overflow-x: auto;
    margin-block-end: var(--space-3);
  }

  pre code {
    background: none;
    padding: 0;
  }

  kbd {
    background: var(--ground);
    border: 1px solid var(--hair);
    box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .12);
    border-radius: 6px;
    padding-inline: 6px;
  }

  hr {
    border: none;
    border-top: 1px solid var(--hair);
    margin-block: var(--space-5);
  }

  /* --- Figures ---------------------------------------------------------- */
  figure {
    margin-block: var(--space-4);
  }

  figcaption {
    font-size: 13px;
    color: var(--ink-2);
    margin-block-start: var(--space-2);
  }

  /* Inline icons ride inside the sentence. */
  p svg,
  li svg,
  a svg,
  button svg {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: -4px;
  }

  /* --- Data table: hairline rows, a quiet header ------------------------ */
  table {
    width: 100%;
    border-collapse: collapse;
    margin-block: var(--space-4);
    font-size: 15px;
  }

  caption {
    text-align: start;
    font-weight: 600;
    padding-block: var(--space-2);
  }

  th,
  td {
    text-align: start;
    padding: 12px var(--space-3);
    vertical-align: top;
  }

  thead th {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    border-bottom: 1px solid var(--hair);
  }

  tbody th {
    font-weight: 600;
  }

  tbody td,
  tbody th {
    border-bottom: 1px solid var(--hair);
  }

  tbody tr {
    transition: background .15s;
  }

  tbody tr:hover {
    background: var(--hover);
  }

  tfoot td {
    font-weight: 600;
    border-top: 1px solid var(--hair);
  }

  /* Numbers that compare stand in tabular figures. */
  td,
  th {
    font-variant-numeric: tabular-nums;
  }

  /* --- Accordion, carried by <details> ---------------------------------- */
  details {
    border-bottom: 1px solid var(--hair);
  }

  details:first-of-type {
    border-top: 1px solid var(--hair);
  }

  summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding-block: var(--space-3);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
  }

  summary::-webkit-details-marker {
    display: none;
  }

  summary::after {
    content: "+";
    color: var(--ink-3);
    font-weight: 400;
    line-height: 1;
  }

  details[open] > summary::after {
    content: "−";
  }

  details > :last-child {
    margin-block-end: var(--space-3);
  }
}

/* ==========================================================================
   COMPONENTS — carried by elements, attributes and pseudo-classes alone:
   pill buttons, quiet fields, round choice controls.
   ========================================================================== */
@layer components {
  /* --- Buttons: the pill --------------------------------------------------
     Primary (the default) is the one filled action: ink fill, white
     text, 44px tall, full pill. Motion follows the standard: transform
     and shadow glide, background answers at once. */
  button,
  input[type="submit"],
  input[type="reset"],
  input[type="button"] {
    --btn-bg: var(--ink);
    --btn-fg: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 20px;
    background: var(--btn-bg);
    color: var(--btn-fg);
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .25s var(--glide), background .15s,
      box-shadow .25s var(--glide);
  }

  button:hover,
  input[type="submit"]:hover,
  input[type="reset"]:hover,
  input[type="button"]:hover {
    --btn-bg: #000;
    box-shadow: var(--lift-small);
  }

  button:active,
  input[type="submit"]:active,
  input[type="reset"]:active,
  input[type="button"]:active {
    transform: scale(.98);
  }

  button:disabled,
  input[type="submit"]:disabled,
  input[type="reset"]:disabled,
  input[type="button"]:disabled {
    --btn-bg: var(--pill);
    --btn-fg: var(--ink-4);
    box-shadow: none;
    cursor: not-allowed;
  }

  /* A button that is really a link keeps the Primary treatment. */
  a[role="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 20px;
    background: var(--ink);
    color: #fff;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    transition: transform .25s var(--glide), background .15s,
      box-shadow .25s var(--glide);
  }

  a[role="button"]:hover {
    background: #000;
    box-shadow: var(--lift-small);
    text-decoration: none;
  }

  a[role="button"]:active {
    transform: scale(.98);
  }

  /* In the nav the pill stands smaller, as the reference's CTA does. */
  header a[role="button"] {
    min-height: 36px;
    padding: 0 16px;
    font-size: 14px;
  }

  /* --- Form scaffolding --------------------------------------------------- */
  form {
    margin-block: var(--space-4);
  }

  fieldset {
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin-block-end: var(--space-4);
  }

  legend {
    font-weight: 600;
    padding-inline: var(--space-2);
  }

  label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-block-end: var(--space-2);
  }

  /* Choice labels (checkbox / radio / switch) sit inline with their box. */
  label:has(> input[type="checkbox"]),
  label:has(> input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    margin-block-end: var(--space-3);
  }

  label:has(> input:disabled) {
    color: var(--ink-4);
    cursor: not-allowed;
  }

  /* --- Text fields: white, a hairline ring, the ink on focus -------------- */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="month"],
  input[type="week"],
  input[type="color"],
  select,
  textarea {
    display: block;
    width: 100%;
    padding: 12px 14px;
    background: var(--ground);
    color: var(--ink);
    border: 1px solid rgba(23, 23, 23, .14);
    border-radius: 12px;
    margin-block-end: var(--space-4);
    transition: border-color .15s, box-shadow .25s var(--glide);
  }

  textarea {
    min-height: 128px;
    resize: vertical;
    line-height: 1.55;
  }

  input::placeholder,
  textarea::placeholder {
    color: var(--ink-3);
    opacity: 1;
  }

  input[type="text"]:hover,
  input[type="email"]:hover,
  input[type="password"]:hover,
  input[type="search"]:hover,
  input[type="tel"]:hover,
  input[type="url"]:hover,
  input[type="number"]:hover,
  input[type="date"]:hover,
  select:hover,
  textarea:hover {
    border-color: rgba(23, 23, 23, .28);
  }

  input[type="text"]:focus,
  input[type="email"]:focus,
  input[type="password"]:focus,
  input[type="search"]:focus,
  input[type="tel"]:focus,
  input[type="url"]:focus,
  input[type="number"]:focus,
  input[type="date"]:focus,
  select:focus,
  textarea:focus {
    border-color: var(--ink);
    outline: none;
    box-shadow: 0 0 0 1px var(--ink);
  }

  input:disabled,
  select:disabled,
  textarea:disabled {
    background: var(--wash);
    color: var(--ink-4);
    border-color: var(--hair);
    cursor: not-allowed;
  }

  /* Error is told in the functional danger color, and nowhere else. */
  input[aria-invalid="true"],
  select[aria-invalid="true"],
  textarea[aria-invalid="true"],
  input:user-invalid,
  select:user-invalid,
  textarea:user-invalid {
    border-color: var(--color-danger-500);
  }

  input[aria-invalid="true"]:focus,
  input:user-invalid:focus {
    box-shadow: 0 0 0 1px var(--color-danger-500);
  }

  /* The chevron for the Dropdown (select), drawn without any asset. */
  select {
    appearance: none;
    padding-inline-end: var(--space-7);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23171717' stroke-width='2'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
  }

  select:disabled {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9b9b6' stroke-width='2'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
  }

  /* --- Checkbox + Radio: round in this language, the ink when on --------- */
  input[type="checkbox"],
  input[type="radio"] {
    appearance: none;
    flex: none;
    width: 22px;
    height: 22px;
    margin: 0;
    background: var(--ground);
    border: 1.5px solid rgba(23, 23, 23, .3);
    border-radius: 7px;
    cursor: pointer;
    display: inline-grid;
    place-content: center;
    transition: background .15s, border-color .15s;
  }

  input[type="radio"] {
    border-radius: 50%;
  }

  input[type="checkbox"]:checked {
    background-color: var(--ink);
    border-color: var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E");
    background-size: 15px;
    background-position: center;
    background-repeat: no-repeat;
  }

  input[type="checkbox"]:indeterminate {
    background-color: var(--ink);
    border-color: var(--ink);
    background-image: linear-gradient(#fff, #fff);
    background-size: 10px 2px;
    background-position: center;
    background-repeat: no-repeat;
  }

  input[type="radio"]:checked {
    border-color: var(--ink);
    background-image: radial-gradient(circle,
        var(--ink) 0 5.5px, transparent 6.5px);
    background-position: center;
    background-repeat: no-repeat;
  }

  input[type="checkbox"]:disabled,
  input[type="radio"]:disabled {
    border-color: var(--hair);
    cursor: not-allowed;
  }

  input[type="checkbox"]:disabled:checked {
    background-color: var(--pill);
    border-color: var(--pill);
  }

  input[type="radio"]:disabled:checked {
    background-image: radial-gradient(circle,
        var(--ink-4) 0 5.5px, transparent 6.5px);
  }

  /* --- Slider -------------------------------------------------------------- */
  input[type="range"] {
    appearance: none;
    width: 100%;
    height: 24px;
    background: transparent;
    cursor: pointer;
    margin-block-end: var(--space-4);
  }

  input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: var(--pill);
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    margin-top: -9px;
    background: var(--ink);
    border: none;
    border-radius: 50%;
    box-shadow: var(--lift-small);
  }

  input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--pill);
  }

  input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--ink);
    border: none;
    border-radius: 50%;
    box-shadow: var(--lift-small);
  }

  input[type="range"]:disabled::-webkit-slider-thumb {
    background: var(--pill);
  }

  input[type="range"]:disabled::-moz-range-thumb {
    background: var(--pill);
  }

  /* --- File Uploader --------------------------------------------------------- */
  input[type="file"] {
    display: block;
    width: 100%;
    margin-block-end: var(--space-4);
    cursor: pointer;
  }

  input[type="file"]::file-selector-button {
    min-height: 36px;
    padding: 0 16px;
    margin-inline-end: var(--space-3);
    background: var(--wash);
    color: var(--ink);
    border: none;
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
  }

  input[type="file"]::file-selector-button:hover {
    background: var(--pill);
  }

  /* --- Progress: a pill track, the ink filling it ----------------------------- */
  progress {
    appearance: none;
    display: block;
    width: 100%;
    height: 8px;
    border: none;
    border-radius: 999px;
    background: var(--pill);
    overflow: hidden;
    margin-block: var(--space-3);
  }

  progress::-webkit-progress-bar {
    background: var(--pill);
  }

  progress::-webkit-progress-value {
    background: var(--ink);
    border-radius: 999px;
  }

  progress::-moz-progress-bar {
    background: var(--ink);
  }

  progress:indeterminate {
    background: linear-gradient(90deg,
        var(--pill) 0%,
        var(--ink-4) 50%,
        var(--pill) 100%);
    background-size: 200% 100%;
    animation: search-progress-slide 1.2s linear infinite;
  }

  progress:indeterminate::-webkit-progress-bar {
    background: transparent;
  }

  @keyframes search-progress-slide {
    from {
      background-position: 100% 0;
    }

    to {
      background-position: -100% 0;
    }
  }

  /* --- Modal: <dialog> — the hero lift, the panel radius ----------------------- */
  dialog {
    border: none;
    border-radius: var(--radius);
    padding: var(--space-5);
    max-width: min(560px, calc(100vw - var(--space-5)));
    background: var(--ground);
    color: var(--ink);
    box-shadow: var(--lift-hero);
  }

  dialog::backdrop {
    background: rgba(23, 23, 23, .4);
  }

  dialog > :first-child {
    margin-top: 0;
  }

  /* --- Pop Over: [popover] -------------------------------------------------------- */
  [popover] {
    border: none;
    border-radius: 14px;
    padding: var(--space-3) var(--space-4);
    background: var(--ground);
    color: var(--ink);
    box-shadow: var(--lift-panel);
  }
}

/* ==========================================================================
   CONTRACT — the only classes in the system. Each exists because semantics
   alone cannot express it; each is documented in README.md. No utility
   classes, no ids, nothing else.
   ========================================================================== */
@layer contract {
  /* --- .display -----------------------------------------------------------------
     The dashboard's standing numbers: Inter 600 at display size, in
     tabular figures, label beneath. (Under the previous system this
     class carried the serif Display style; the desk's stat grid is
     its only use, and numbers are what it has ever shown.) */
  .display {
    font-size: 40px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    margin: 0;
  }

  /* --- .rise ----------------------------------------------------------------------
     The entrance: elements rise on the settle curve, staggered by the
     --i custom property, exactly as the reference page's hero does.
     Used on the public pages; the desk stands still. */
  .rise {
    opacity: 0;
    transform: translateY(14px);
    animation: rise .9s var(--settle) forwards;
    animation-delay: calc(var(--i, 0) * 80ms + 60ms);
  }

  @keyframes rise {
    to {
      opacity: 1;
      transform: none;
    }
  }

  /* --- Button variants --------------------------------------------------------------
     HTML has one <button>; the house has three more kinds. Secondary is
     the wash pill, Ghost is plain text with a hover wash, Danger tells
     a destructive act in the functional danger color on a tinted wash —
     the chrome itself stays ink and white. */
  .btn-secondary {
    --btn-bg: var(--wash);
    --btn-fg: var(--ink);
    background: var(--wash);
    color: var(--ink);
  }

  .btn-secondary:hover {
    --btn-bg: var(--pill);
    background: var(--pill);
    box-shadow: none;
  }

  .btn-secondary:disabled {
    background: var(--wash);
    color: var(--ink-4);
  }

  .btn-ghost {
    --btn-bg: transparent;
    --btn-fg: var(--ink-2);
    background: transparent;
    color: var(--ink-2);
  }

  .btn-ghost:hover {
    --btn-bg: var(--hover);
    background: var(--hover);
    color: var(--ink);
    box-shadow: none;
  }

  .btn-ghost:disabled {
    background: transparent;
    color: var(--ink-4);
  }

  .btn-danger {
    --btn-bg: rgba(176, 0, 32, .07);
    --btn-fg: var(--color-danger-500);
    background: rgba(176, 0, 32, .07);
    color: var(--color-danger-500);
  }

  .btn-danger:hover {
    --btn-bg: rgba(176, 0, 32, .12);
    background: rgba(176, 0, 32, .12);
    box-shadow: none;
  }

  .btn-danger:disabled {
    background: var(--wash);
    color: var(--ink-4);
  }

  /* --- .switch ------------------------------------------------------------------------
     The toggle: a checkbox drawn as a pill track with a sliding knob.
     Off is the pill fill; on is the ink. The knob glides. */
  input[type="checkbox"].switch {
    width: 48px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: var(--pill);
    background-image: none;
    position: relative;
    transition: background .25s var(--glide);
  }

  input[type="checkbox"].switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--lift-small);
    transition: left .25s var(--glide);
  }

  input[type="checkbox"].switch:checked {
    background: var(--ink);
    background-image: none;
  }

  input[type="checkbox"].switch:checked::after {
    left: 23px;
  }

  input[type="checkbox"].switch:disabled {
    background: var(--wash);
  }

  input[type="checkbox"].switch:disabled::after {
    background: var(--wash);
    box-shadow: none;
  }

  input[type="checkbox"].switch:disabled:checked {
    background: var(--pill);
  }

  /* --- .card ----------------------------------------------------------------------------
     A raised surface in this language is a wash panel: the warm fill,
     the panel radius, no border. On a wash band the card turns white
     (see .band below) so tone always alternates. */
  .card {
    background: var(--wash);
    border-radius: var(--radius);
    padding: var(--space-4);
    margin-block: var(--space-4);
  }

  .card > :first-child {
    margin-top: 0;
  }

  .card > :last-child {
    margin-bottom: 0;
  }

  /* A post presented whole is read on white, at reading measure; the
     card's panel gives it the stage's soft lift instead of the wash. */
  article.card:has(.post-body) {
    background: var(--ground);
    box-shadow: var(--lift-panel);
    padding: clamp(24px, 4vw, 44px);
  }

  .post-body {
    max-width: 68ch;
  }

  /* --- .band ------------------------------------------------------------------------------
     A full-bleed wash section, the reference page's alternating band.
     Cards inside it turn white. */
  .band {
    background: var(--wash);
    border-radius: var(--radius);
    padding: var(--space-5);
    margin-block: var(--space-6);
  }

  .band .card {
    background: var(--ground);
  }

  /* --- .notice --------------------------------------------------------------------------------
     The notification banner: a wash panel with a ring. Severity tints
     the wash with its functional color at a whisper; the words carry
     the meaning, the tint only points. */
  .notice {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    background: var(--wash);
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px var(--hair);
    padding: var(--space-3) var(--space-4);
    margin-block: var(--space-4);
  }

  .notice p {
    margin: 0;
    max-width: none;
  }

  .notice-success {
    background: rgba(46, 125, 50, .07);
    box-shadow: inset 0 0 0 1px rgba(46, 125, 50, .18);
  }

  .notice-warning {
    background: rgba(138, 109, 0, .07);
    box-shadow: inset 0 0 0 1px rgba(138, 109, 0, .2);
  }

  .notice-danger {
    background: rgba(176, 0, 32, .06);
    box-shadow: inset 0 0 0 1px rgba(176, 0, 32, .16);
  }

  /* --- .tabs -------------------------------------------------------------------------------------
     The content switcher as a segmented pill: a pill track, the chosen
     label on white with the small lift. Native radio inputs carry the
     state (no ids needed — each radio is wrapped in its label). Shape:

       <div class="tabs">
         <label><input type="radio" name="x" checked> First </label>
         <section> …panel… </section>
         <label><input type="radio" name="x"> Second </label>
         <section> …panel… </section>
       </div>

     Each label must be immediately followed by its panel. */
  .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-2);
    margin-block: var(--space-4);
  }

  .tabs > label {
    order: 0;
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 16px;
    margin: 0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .25s var(--glide);
  }

  .tabs > label > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .tabs > label:hover {
    color: var(--ink);
    background: var(--hover);
  }

  .tabs > label:has(> input:checked) {
    color: var(--ink);
    background: var(--ground);
    box-shadow: var(--lift-small), inset 0 0 0 1px var(--hair);
  }

  .tabs > label:has(> input:focus-visible) {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
  }

  .tabs > section {
    order: 1;
    flex-basis: 100%;
    display: none;
    margin: 0;
    padding-block: var(--space-4);
  }

  .tabs > label:has(> input:checked) + section {
    display: block;
  }

  /* --- Motion ------------------------------------------------------------------------------------- */
  @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;
    }

    .rise {
      opacity: 1;
      transform: none;
    }
  }
}
