/* css/tokens.css */
/*
 * tokens.css – the design system as CSS variables (docs/05-design/tokens.md).
 *
 * Two levels:
 *   1. Base values: the palette, without meaning (--bordeaux-600).
 *   2. Semantic values: what a value stands for (--color-accent).
 * Components only ever use semantic values. Dark mode swaps semantic values only.
 */

/* Order of the cascade layers: later layers win, no specificity tricks. */
@layer tokens, base, layout, components, utilities;

@layer tokens {
  :root {
    /* ---------- Base values: palette "Samt" (decided 28.09.2026) ---------- */
    --canvas-50: #FBF8F2;
    --canvas-100: #F6F1E7;
    --canvas-200: #E4DCCD;
    --ink-500: #6B625A;
    --ink-900: #1C1917;
    --night-900: #141110;
    --night-800: #1E1A18;
    --night-700: #322B27;
    --night-300: #A89E92;
    --night-100: #EDE6D8;
    --bordeaux-600: #7A1F2B;
    --bordeaux-300: #D46A74;
    --daisy-500: #E3B23C;
    --daisy-400: #E8BD52;

    /* Status colours: muted green, muted ochre, and a red that is
       lighter and warmer than bordeaux so errors never look like the accent. */
    --green-600: #3F6B4A;
    --green-300: #8DBF98;
    --ochre-600: #8A6414;
    --ochre-300: #D9B25E;
    --red-600: #B8412C;
    --red-300: #F08A74;

    /* Age rating labels in the familiar FSK colours (decided 29.09.2026).
       A marking, not a "moment": this yellow is FSK's, not the daisy's. */
    --fsk-0-bg: #FFFFFF;
    --fsk-0-text: #1C1917;
    --fsk-6-bg: #FFE500;
    --fsk-6-text: #1C1917;
    --fsk-12-bg: #00A650;
    --fsk-12-text: #FFFFFF;
    --fsk-16-bg: #0075BE;
    --fsk-16-text: #FFFFFF;
    --fsk-18-bg: #E2001A;
    --fsk-18-text: #FFFFFF;

    /* ---------- Semantic values: light (default) ---------- */
    --color-bg: var(--canvas-100);
    --color-surface: var(--canvas-50);
    --color-text: var(--ink-900);
    --color-muted: var(--ink-500);
    --color-accent: var(--bordeaux-600);
    --color-on-accent: var(--canvas-50);
    --color-line: var(--canvas-200);
    /* Daisy yellow: only for the loving moments. Never text on a light background. */
    --color-moment: var(--daisy-500);
    --color-success: var(--green-600);
    --color-warning: var(--ochre-600);
    --color-error: var(--red-600);
    --color-focus: var(--bordeaux-600);
    /* On images and videos: the same in light and dark, since pictures do not change. */
    --color-on-image: var(--canvas-50);
    --color-scrim: rgb(20 17 16 / 0.6);
    --color-video-bg: var(--night-900);

    /* ---------- Spacing: 4 px grid, in rem so it grows with the font size ---------- */
    --space-1: 0.25rem;  /*  4 px */
    --space-2: 0.5rem;   /*  8 px */
    --space-3: 0.75rem;  /* 12 px */
    --space-4: 1rem;     /* 16 px */
    --space-5: 1.5rem;   /* 24 px */
    --space-6: 2rem;     /* 32 px */
    --space-7: 3rem;     /* 48 px */
    --space-8: 4rem;     /* 64 px */
    --space-9: 6rem;     /* 96 px */

    /* ---------- Radii ---------- */
    --radius-s: 4px;
    --radius-m: 8px;
    --radius-l: 16px;
    --radius-full: 9999px;
    --radius-poster: 2px; /* posters and covers: objects, not app tiles */

    /* ---------- Shadows: warm, a touch of brown instead of black ---------- */
    --shadow-rest: 0 1px 2px rgb(60 36 20 / 0.08);
    --shadow-raised: 0 2px 4px rgb(60 36 20 / 0.08), 0 6px 16px rgb(60 36 20 / 0.08);
    --shadow-floating: 0 8px 24px rgb(60 36 20 / 0.12), 0 24px 48px rgb(60 36 20 / 0.12);

    /* ---------- Fonts (docs/05-design/typografie.md) ---------- */
    --font-read: "Newsreader", Georgia, "Noto Serif", "DejaVu Serif", "Times New Roman", serif;
    --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;

    /* Type scale, ratio about 1.25, grows gently from phone to desktop.
       Reading text never below 17 px (decided 28.09.2026). */
    --text-xs: 0.8125rem;                                  /* 13 px */
    --text-s: 0.9375rem;                                   /* 15 px */
    --text-m: clamp(1.0625rem, 1.03rem + 0.16vw, 1.125rem); /* 17 → 18 px */
    --text-l: clamp(1.3125rem, 1.25rem + 0.31vw, 1.4375rem); /* 21 → 23 px */
    --text-xl: clamp(1.625rem, 1.53rem + 0.47vw, 1.8125rem); /* 26 → 29 px */
    --text-2xl: clamp(2.0625rem, 1.69rem + 1.88vw, 2.8125rem); /* 33 → 45 px */

    --leading-read: 1.6;
    --leading-ui: 1.35;
    --measure: 66ch; /* line length for reading text */

    /* ---------- Motion (docs/05-design/bewegung-klang-haptik.md) ---------- */
    --motion-instant: 100ms;
    --motion-quick: 200ms;
    --motion-gentle: 350ms;
    --motion-slow: 600ms;
    /* Curves: how a movement speeds up and slows down. */
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-enter: cubic-bezier(0, 0, 0.2, 1);
    --ease-exit: cubic-bezier(0.4, 0, 1, 1);
    --ease-curtain: cubic-bezier(0.7, 0, 0.2, 1);

    color-scheme: light dark;
  }

  /* ---------- Semantic values: dark ---------- */
  /* Follows the system setting; data-theme lets a later user setting override it. */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --color-bg: var(--night-900);
      --color-surface: var(--night-800);
      --color-text: var(--night-100);
      --color-muted: var(--night-300);
      --color-accent: var(--bordeaux-300);
      --color-on-accent: var(--night-900);
      --color-line: var(--night-700);
      --color-moment: var(--daisy-400);
      --color-success: var(--green-300);
      --color-warning: var(--ochre-300);
      --color-error: var(--red-300);
      --color-focus: var(--bordeaux-300);
      /* In the dark a slightly lighter surface replaces the shadow. */
      --shadow-rest: none;
      --shadow-raised: none;
      --shadow-floating: none;
    }
  }

  :root[data-theme="dark"] {
    --color-bg: var(--night-900);
    --color-surface: var(--night-800);
    --color-text: var(--night-100);
    --color-muted: var(--night-300);
    --color-accent: var(--bordeaux-300);
    --color-on-accent: var(--night-900);
    --color-line: var(--night-700);
    --color-moment: var(--daisy-400);
    --color-success: var(--green-300);
    --color-warning: var(--ochre-300);
    --color-error: var(--red-300);
    --color-focus: var(--bordeaux-300);
    --shadow-rest: none;
    --shadow-raised: none;
    --shadow-floating: none;
    color-scheme: dark;
  }

  :root[data-theme="light"] {
    color-scheme: light;
  }

  /* Reduced motion: movements become (almost) instant. */
  @media (prefers-reduced-motion: reduce) {
    :root {
      --motion-instant: 0ms;
      --motion-quick: 0ms;
      --motion-gentle: 0ms;
      --motion-slow: 0ms;
    }
  }
}

/* css/fonts.css */
/*
 * fonts.css – self-hosted fonts (docs/05-design/typografie.md).
 * Newsreader for reading, Instrument Sans for the interface.
 * Variable fonts: one file covers all weights. The browser only downloads a
 * file when the page uses characters from its unicode-range. Characters
 * outside these ranges (e.g. Cyrillic) come from the fallback fonts in tokens.css.
 * Licence: SIL Open Font License, see fonts/*-OFL.txt.
 */

@layer base {
  /* Instrument Sans, normal, latin-ext */
  @font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 700;
    font-stretch: 75% 100%;
    font-display: swap;
    src: url("/static/fonts/instrument-sans-latin-ext.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;
  }

  /* Instrument Sans, normal, latin */
  @font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 700;
    font-stretch: 75% 100%;
    font-display: swap;
    src: url("/static/fonts/instrument-sans-latin.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;
  }

  /* Newsreader, italic, latin-ext */
  @font-face {
    font-family: "Newsreader";
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url("/static/fonts/newsreader-italic-latin-ext.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;
  }

  /* Newsreader, italic, latin */
  @font-face {
    font-family: "Newsreader";
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url("/static/fonts/newsreader-italic-latin.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;
  }

  /* Newsreader, normal, latin-ext */
  @font-face {
    font-family: "Newsreader";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/static/fonts/newsreader-latin-ext.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;
  }

  /* Newsreader, normal, latin */
  @font-face {
    font-family: "Newsreader";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/static/fonts/newsreader-latin.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;
  }

}

/* css/base.css */
/*
 * base.css – the typeface of the whole page: body text, headings, links, focus.
 * Interface text uses Instrument Sans; anything meant to be read uses Newsreader
 * (class .prose or the reading elements below).
 */

@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: var(--text-m);
    line-height: var(--leading-ui);
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--motion-gentle) var(--ease-standard);
  }

  h1,
  h2,
  h3 {
    font-family: var(--font-read);
    font-weight: 500;
    line-height: 1.15;
    margin: 0 0 var(--space-4);
    text-wrap: balance;
  }

  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
  h3 { font-size: var(--text-l); }

  p {
    margin: 0 0 var(--space-4);
  }

  /* Reading text: serif, generous leading, pleasant line length,
     old-style figures, hyphenation in the text's own language. */
  .prose {
    font-family: var(--font-read);
    font-size: var(--text-m);
    line-height: var(--leading-read);
    max-width: var(--measure);
    font-variant-numeric: oldstyle-nums;
    hyphens: auto;
    text-wrap: pretty;
  }

  a {
    color: var(--color-accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color var(--motion-quick) var(--ease-standard);
  }

  a:hover {
    text-decoration-thickness: 2px;
  }

  button {
    font: inherit;
    color: inherit;
  }

  /* Clearly visible focus ring in the accent colour, for keyboard users. */
  :focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
    border-radius: var(--radius-s);
  }

  ::selection {
    background: var(--color-accent);
    color: var(--color-on-accent);
  }

  /* Page transitions: a short cross-fade between pages (bewegung-klang-haptik.md). */
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: var(--motion-gentle);
    animation-timing-function: var(--ease-standard);
  }
}

/* css/layout.css */
/*
 * layout.css – the page grid: header, main content, footer.
 * The content column stays narrow and calm; the works will stand in the light.
 */

@layer layout {
  .page {
    --page-max: 72rem;
    --gutter: var(--space-5);
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
  }

  @media (min-width: 48rem) {
    .page {
      --gutter: var(--space-7);
    }
  }

  .page-header,
  .page-main {
    width: 100%;
    max-width: var(--page-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .page-header {
    padding-block: var(--space-5);
  }

  .page-main {
    padding-block: var(--space-7) var(--space-9);
  }

  /* The footer uses outer margins instead of inner padding, so its top line
     is exactly as wide as the text column above it. */
  .page-footer {
    margin-inline: max(var(--gutter), (100% - var(--page-max)) / 2 + var(--gutter));
    padding-block: var(--space-6);
    border-top: 1px solid var(--color-line);
    color: var(--color-muted);
    font-size: var(--text-s);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: space-between;
    align-items: center;
  }
}

/* css/components/add.css */
/* add.css – the one field, the filter, the result list (its cards: work-card.css). */

@layer components {
  .add-page {
    max-width: 44rem;
    padding-block-start: var(--space-6);
  }

  .add-form {
    display: grid;
    gap: var(--space-2);
  }

  .add-field-row {
    display: flex;
    gap: var(--space-2);
  }

  .add-field-row input {
    flex: 1;
    font: inherit;
    font-size: var(--text-l);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-m);
    padding: var(--space-3) var(--space-4);
    min-width: 0;
  }

  /* The browser's own clear button (a blue ✕ in Chrome) does not fit the
     palette; clearing the field with the keyboard or by selecting still works. */
  .add-field-row input::-webkit-search-cancel-button {
    appearance: none;
  }

  .add-field-row input:focus-visible {
    border-color: var(--color-focus);
    outline-offset: 0;
    outline-width: 1px;
  }

  /* Medium filter as small, quiet chips. */
  .medium-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    border: 0;
    margin: var(--space-2) 0 0;
    padding: 0;
  }

  .chip {
    font-size: var(--text-s);
    font-weight: 400;
    cursor: pointer;
  }

  .chip input {
    position: absolute;
    opacity: 0;
  }

  .chip span {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-full);
    color: var(--color-muted);
    transition: all var(--motion-quick) var(--ease-standard);
  }

  .chip input:checked + span {
    border-color: var(--color-accent);
    color: var(--color-accent);
  }

  .chip input:focus-visible + span {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
  }

  .add-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-block-start: var(--space-2);
  }

  .list-controls {
    display: flex;
    flex-wrap: wrap; /* on a phone the second choice moves below the first */
    gap: var(--space-2) var(--space-4);
    font-size: var(--text-s);
  }

  .list-controls span {
    white-space: nowrap;
  }

  .list-controls label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 400;
    color: var(--color-muted);
  }

  .list-controls select {
    font-size: var(--text-s);
    padding: var(--space-1) var(--space-2);
  }

  #results {
    margin-block-start: var(--space-5);
  }

  .results-count {
    font-size: var(--text-s);
    color: var(--color-muted);
    margin: 0 0 var(--space-2);
  }

  /* "More hits than shown": right above the list, not below it. */
  .results-more {
    margin: 0 0 var(--space-3);
  }

  .result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--color-line);
  }

  .button-small {
    font: inherit;
    font-size: var(--text-s);
    font-weight: 600;
    color: var(--color-accent);
    background: transparent;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-4);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--motion-quick) var(--ease-standard);
  }

  .button-small:hover {
    color: var(--color-on-accent);
    background: var(--color-accent);
  }

  /* "Remove": the same shape, quieter, so adding stays the main action. */
  .button-small-quiet {
    color: var(--color-muted);
    border-color: var(--color-line);
  }

  .button-small-quiet:hover {
    color: var(--color-text);
    background: transparent;
    border-color: var(--color-muted);
  }

  .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-5);
    margin-block: var(--space-6);
    font-size: var(--text-s);
    color: var(--color-muted);
  }

  .free-entry {
    margin-block-start: var(--space-6);
  }

  .free-entry h2 {
    font-size: var(--text-l);
    margin-block-start: var(--space-6);
  }

  select {
    font: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-m);
    padding: var(--space-2) var(--space-3);
    justify-self: start;
  }

  input[type="url"] {
    font: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-m);
    padding: var(--space-3) var(--space-4);
    width: 100%;
  }
}

/* css/components/collection.css */
/* collection.css – status buttons with the daisy, the entry on the work
   page, and the collection list (card 1.5). */

@layer components {
  /* ---------- Status buttons (as in the design sample) ---------- */
  .status-group {
    margin: var(--space-3) 0 0;
  }

  .status-group > div {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .status-chip {
    font: inherit;
    font-size: var(--text-s);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-3);
    min-height: 2.25rem; /* easy to hit with a thumb */
    cursor: pointer;
    transition:
      border-color var(--motion-quick) var(--ease-standard),
      background-color var(--motion-quick) var(--ease-standard),
      color var(--motion-quick) var(--ease-standard);
  }

  .status-chip:hover {
    border-color: var(--color-muted);
  }

  .status-chip[aria-pressed="true"] {
    border-color: var(--color-accent);
    color: var(--color-accent);
  }

  /* Loved: the daisy's yellow as a soft wash; the text stays dark (never
     yellow text on a light background). */
  .status-chip.status-loved[aria-pressed="true"] {
    border-color: var(--color-moment);
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-moment) 14%, var(--color-surface));
  }

  /* The button just tapped nods once: a small, springy confirmation. */
  .status-chip.tapped {
    animation: status-nod var(--motion-quick) var(--ease-standard);
  }

  @keyframes status-nod {
    50% {
      scale: 0.94;
    }
  }

  /* ---------- The daisy ---------- */
  .daisy {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
    overflow: visible;
  }

  .daisy-petals {
    transform-origin: 12px 12px;
  }

  .daisy-petal {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
  }

  .daisy-center {
    fill: var(--color-surface);
    stroke: currentColor;
    stroke-width: 1.4;
  }

  [aria-pressed="true"] .daisy-petal {
    fill: var(--color-moment);
    stroke: var(--color-moment);
  }

  [aria-pressed="true"] .daisy-center {
    fill: var(--color-accent);
    stroke: var(--color-accent);
  }

  /* It blooms once when loved is switched on: the petals unfold, overshoot
     a little and settle (bewegung-klang-haptik.md, section 4). With
     "reduce motion" the duration token is 0 and it simply appears. */
  .bloom .daisy-petals {
    animation: daisy-bloom var(--motion-slow) var(--ease-curtain);
  }

  @keyframes daisy-bloom {
    0% {
      transform: scale(0.55) rotate(-30deg);
    }
    60% {
      transform: scale(1.2) rotate(6deg);
    }
    100% {
      transform: scale(1) rotate(0);
    }
  }

  /* ---------- Icons (Lucide, drawn into the page) ---------- */
  .icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
  }

  /* A round button with just a symbol; its words are in title and aria-label. */
  .icon-button {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--color-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition:
      color var(--motion-quick) var(--ease-standard),
      background-color var(--motion-quick) var(--ease-standard),
      border-color var(--motion-quick) var(--ease-standard);
  }

  .icon-button:hover {
    color: var(--color-text);
    background: var(--color-surface);
    border-color: var(--color-line);
  }

  .icon-button-small {
    width: 1.75rem;
    height: 1.75rem;
  }

  .icon-button-small .icon {
    width: 1rem;
    height: 1rem;
  }

  /* ---------- The bar above the work: way back, eye and bin ---------- */
  .work-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding-block-start: var(--space-4);
  }

  .work-bar + .work {
    padding-block-start: var(--space-3);
  }

  .back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-s);
    color: var(--color-muted);
    text-decoration: none;
  }

  .back-link:hover {
    color: var(--color-accent);
  }

  .entry-actions {
    display: flex;
    gap: var(--space-1);
  }

  /* The eye's menu: a popover (opens and closes without a script). */
  .menu {
    margin: 0;
    padding: var(--space-2);
    min-width: 16rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-floating);
  }

  .menu form {
    display: grid;
    gap: var(--space-1);
  }

  .menu-title {
    font-size: var(--text-xs);
    color: var(--color-muted);
    margin: var(--space-1) var(--space-2) var(--space-2);
  }

  .menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    font: inherit;
    font-size: var(--text-s);
    text-align: start;
    color: var(--color-text);
    background: transparent;
    border: 0;
    border-radius: var(--radius-s);
    padding: var(--space-2);
    cursor: pointer;
  }

  .menu-item:hover {
    background: var(--color-bg);
  }

  .menu-item[aria-checked="true"] {
    color: var(--color-accent);
    font-weight: 600;
  }

  /* Wider than the collection allows: visible, but not choosable. */
  .menu-item:disabled {
    color: var(--color-muted);
    opacity: 0.55;
    cursor: not-allowed;
  }

  .menu-item:disabled:hover {
    background: transparent;
  }

  .menu-hint {
    font-size: var(--text-xs);
    color: var(--color-muted);
    margin: var(--space-2) var(--space-2) var(--space-1);
    max-width: 16rem;
  }

  /* A closed eye that is not a button: the collection is "only me". */
  .icon-button.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
  }

  .icon-button.is-disabled:hover {
    background: transparent;
    border-color: transparent;
    color: var(--color-muted);
  }

  /* Where the browser can, the menu hangs right below the eye (CSS anchor
     positioning: Chrome 125+, Safari 26+). Elsewhere it opens in the middle
     of the screen, which still works. */
  @supports (anchor-name: --a) {
    [popovertarget="visibility-menu"] {
      anchor-name: --visibility-eye;
    }

    [popovertarget="collection-visibility-menu"] {
      anchor-name: --collection-eye;
    }

    #visibility-menu,
    #collection-visibility-menu {
      position-anchor: --visibility-eye;
      inset: auto;
      top: anchor(bottom);
      right: anchor(right);
      margin-block-start: var(--space-2);
    }

    #collection-visibility-menu {
      position-anchor: --collection-eye;
    }
  }

  /* ---------- Dialogs: note and remove ---------- */
  .dialog {
    width: min(32rem, 100% - 2 * var(--space-4));
    padding: var(--space-5);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-floating);
  }

  .dialog::backdrop {
    background: var(--color-scrim);
  }

  .dialog[open] {
    animation: entry-in var(--motion-gentle) var(--ease-enter);
  }

  /* Opened in the page (without JavaScript): part of the flow. */
  .entry-note .dialog[open]:not(:modal),
  .entry-actions .dialog[open]:not(:modal) {
    position: static;
    margin-block: var(--space-4);
  }

  .dialog form {
    display: grid;
    gap: var(--space-3);
  }

  .dialog-title {
    font-size: var(--text-l);
    margin: 0;
  }

  .dialog-hint {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: var(--text-s);
    color: var(--color-muted);
    margin: 0;
  }

  .dialog-hint .icon {
    width: 1rem;
    height: 1rem;
    margin-block-start: 0.15em;
  }

  .dialog textarea {
    font-family: var(--font-read);
    font-size: var(--text-m);
    line-height: var(--leading-read);
    resize: vertical;
  }

  .dialog-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-3);
  }

  .dialog-actions a {
    text-decoration: none;
  }

  @keyframes entry-in {
    from {
      opacity: 0;
    }
  }

  /* ---------- The own entry on the work page ---------- */
  .entry {
    display: grid;
    gap: var(--space-3);
    margin-block: var(--space-4) var(--space-5);
  }

  .entry .status-group {
    margin: 0;
  }

  .entry-where {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-s);
    color: var(--color-muted);
    margin: 0;
  }

  .entry-where .icon {
    width: 1rem;
    height: 1rem;
  }

  /* The note: set into the page in the reading font, quietly marked as private. */
  .note {
    margin: 0;
    padding-inline-start: var(--space-4);
    border-inline-start: 2px solid var(--color-line);
  }

  .note-text-body {
    margin: 0;
    font-family: var(--font-read);
    font-size: var(--text-m);
    line-height: var(--leading-read);
    white-space: pre-line; /* keep the line breaks someone typed */
    max-width: var(--measure);
  }

  .note-caption {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-muted);
  }

  .note-caption > .icon {
    width: 0.875rem;
    height: 0.875rem;
  }

  .note-add {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    font-weight: 400;
  }

  .note-add .icon {
    width: 1rem;
    height: 1rem;
  }

  /* ---------- The collection page ---------- */
  .collection-page {
    max-width: 44rem;
    padding-block-start: var(--space-6);
  }

  /* Title on the left, who sees the collection on the right. */
  .collection-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2) var(--space-4);
  }

  .collection-visibility {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .collection-filters {
    display: grid;
    gap: var(--space-3);
    margin-block-end: var(--space-5);
  }

  .filter-legend {
    float: left; /* keeps the legend on the chips' line */
    font-size: var(--text-s);
    color: var(--color-muted);
    min-width: 4rem;
    padding: var(--space-1) 0;
  }

  /* The search field with its magnifier inside. */
  .search-field {
    position: relative;
  }

  .search-field .icon {
    position: absolute;
    inset-inline-start: var(--space-3);
    top: 50%;
    translate: 0 -50%;
    color: var(--color-muted);
    pointer-events: none;
  }

  .search-field input {
    width: 100%;
    font: inherit;
    font-size: var(--text-m);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4) var(--space-2) calc(var(--space-3) + 1.25rem + var(--space-2));
  }

  .search-field input:focus-visible {
    border-color: var(--color-focus);
    outline-offset: 0;
    outline-width: 1px;
  }

  .search-field input::-webkit-search-cancel-button {
    appearance: none;
  }

  .collection-filters .list-controls {
    justify-content: flex-end;
  }

  .collection-empty {
    display: grid;
    gap: var(--space-4);
    margin-block-start: var(--space-5);
  }
}

/* css/components/device-list.css */
/* device-list.css – signed-in devices under Settings → Security. */

@layer components {
  .device-list {
    list-style: none;
    margin: var(--space-5) 0;
    padding: 0;
    border-top: 1px solid var(--color-line);
  }

  .device {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding-block: var(--space-4);
    border-bottom: 1px solid var(--color-line);
  }

  .device p {
    margin: 0;
  }

  .device-label {
    font-weight: 600;
  }

  .device-current {
    margin-inline-start: var(--space-2);
    font-weight: 400;
    font-size: var(--text-xs);
    color: var(--color-muted);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-full);
    padding: 0 var(--space-2);
  }

  .device-meta {
    color: var(--color-muted);
    font-size: var(--text-s);
  }

  .device form {
    margin: 0;
  }
}

/* css/components/error-page.css */
/* error-page.css – "not found" and "something went wrong". */

@layer components {
  .error-page {
    max-width: var(--measure);
    padding-block-start: var(--space-8);
  }
}

/* css/components/forms.css */
/*
 * forms.css – labels, fields and buttons.
 * Large, calm fields; one clear main button per form; errors in words,
 * never only in colour.
 */

@layer components {
  .narrow-page {
    max-width: 32rem;
    padding-block-start: var(--space-7);
  }

  .stack-form {
    display: grid;
    gap: var(--space-3);
    margin-block: var(--space-6);
  }

  label {
    font-size: var(--text-s);
    font-weight: 600;
  }

  input[type="email"],
  input[type="text"],
  textarea,
  .code-input {
    font: inherit;
    font-size: var(--text-m);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-m);
    padding: var(--space-3) var(--space-4);
    width: 100%;
    transition: border-color var(--motion-quick) var(--ease-standard);
  }

  input:hover,
  textarea:hover {
    border-color: var(--color-muted);
  }

  /* Fields show focus through their own border, so there is one line, not two. */
  input:focus-visible,
  textarea:focus-visible {
    border-color: var(--color-focus);
    outline-offset: 0;
    outline-width: 1px;
  }

  input[aria-invalid="true"] {
    border-color: var(--color-error);
  }

  /* Six digits, set wide apart like on a ticket. */
  .code-input {
    font-size: var(--text-xl);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.4em;
    max-width: 14ch;
  }

  .button {
    justify-self: start;
    font: inherit;
    font-weight: 600;
    color: var(--color-on-accent);
    background: var(--color-accent);
    border: 0;
    border-radius: var(--radius-m);
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    box-shadow: var(--shadow-rest);
    transition:
      box-shadow var(--motion-quick) var(--ease-standard),
      translate var(--motion-instant) var(--ease-standard);
  }

  .button:hover {
    box-shadow: var(--shadow-raised);
  }

  .button:active {
    translate: 0 1px;
  }

  /* Secondary actions: text only, no box. */
  .button-quiet,
  .link-button {
    font: inherit;
    font-size: var(--text-s);
    color: var(--color-accent);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    justify-self: start;
  }

  .link-button {
    text-decoration: none;
  }

  .form-error {
    color: var(--color-error);
    font-size: var(--text-s);
    margin: 0;
  }

  .note-text {
    color: var(--color-muted);
    font-size: var(--text-s);
  }
}

/* css/components/home.css */
/* home.css – the start page: a short, calm introduction. */

@layer components {
  .home {
    max-width: var(--measure);
    padding-block-start: var(--space-8);
  }

  .home h1 {
    margin-block-end: var(--space-5);
  }

  .home .lead {
    font-size: var(--text-l);
    line-height: 1.45;
    color: var(--color-text);
  }

  .home .note {
    margin-block-start: var(--space-7);
    font-family: var(--font-ui);
    font-size: var(--text-s);
    color: var(--color-muted);
  }

  /* A single daisy dot: the one moment of yellow on this page. */
  .home .note::before {
    content: "";
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    margin-inline-end: var(--space-2);
    border-radius: var(--radius-full);
    background: var(--color-moment);
    vertical-align: 0.05em;
  }

  /* Gentle entrance, skipped when the user prefers less motion (tokens set 0 ms). */
  .home > * {
    animation: home-rise var(--motion-slow) var(--ease-enter) both;
  }
  .home > :nth-child(2) { animation-delay: calc(var(--motion-instant) * 1); }
  .home > :nth-child(3) { animation-delay: calc(var(--motion-instant) * 2); }
  .home > :nth-child(4) { animation-delay: calc(var(--motion-instant) * 3); }

  @keyframes home-rise {
    from {
      opacity: 0;
      translate: 0 var(--space-3);
    }
  }
}

/* css/components/language-switch.css */
/* language-switch.css – "Deutsch · English" in the footer. */

@layer components {
  .language-switch {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    /* The buttons have inner padding; pull back so the text lines up with the page. */
    margin-inline-start: calc(-1 * var(--space-2));
  }

  .language-switch button {
    background: none;
    border: 0;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-s);
    color: var(--color-muted);
    font-size: var(--text-s);
    cursor: pointer;
    transition: color var(--motion-quick) var(--ease-standard);
  }

  .language-switch button:hover {
    color: var(--color-accent);
  }

  .language-switch button[aria-current="true"] {
    color: var(--color-text);
    font-weight: 600;
    cursor: default;
  }

  .language-switch .separator {
    color: var(--color-line);
  }
}

/* css/components/legal.css */
/* legal.css – imprint, privacy, sources and thanks; the report form and
   links; the links in the footer (card 1.7). Quiet pages, easy to read. */

@layer components {
  .legal h2 {
    font-size: var(--text-l);
    margin-block: var(--space-6) var(--space-2);
  }

  .legal .prose {
    margin-block: 0 var(--space-3);
  }

  .operator {
    display: grid;
    gap: var(--space-1);
    font-style: normal;
    margin-block: var(--space-4) var(--space-5);
  }

  .source-logo {
    height: 1.25rem;
    width: auto;
  }

  .sources-list {
    padding-inline-start: var(--space-5);
  }

  .report-reasons {
    display: grid;
    gap: var(--space-2);
    border: 0;
    margin: 0;
    padding: 0;
  }

  .report-reasons legend {
    font-size: var(--text-s);
    font-weight: 600;
    margin-block-end: var(--space-2);
  }

  .report-reasons input {
    accent-color: var(--color-accent);
  }

  .report-link {
    font-size: var(--text-xs);
    color: var(--color-muted);
  }

  .report-link:hover {
    color: var(--color-accent);
  }

  /* The footer: legal links on the left, the language switch on the right. */
  .page-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3) var(--space-5);
  }

  .legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    font-size: var(--text-s);
  }

  .legal-links a {
    color: var(--color-muted);
    text-decoration: none;
  }

  .legal-links a:hover {
    color: var(--color-accent);
  }
}

/* css/components/recommend.css */
/* recommend.css – the recommend form and the recommendation page (card 1.6a).
   The sentence stands in the light, in the reading font (principle 4:
   friends before Alfred). */

@layer components {
  .recommend-page {
    max-width: 36rem;
    padding-block-start: var(--space-6);
  }

  .recommend-work {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-block: var(--space-4);
  }

  .recommend-work img {
    width: 3.75rem;
    height: auto;
    border-radius: var(--radius-poster);
    box-shadow: var(--shadow-rest);
  }

  /* A video's image is wide (16:9); older 4:3 images lose their black bars. */
  .recommend-work.is-wide img {
    width: 7rem;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  .recommend-work p {
    display: grid;
    margin: 0;
  }

  .recommend-work-title {
    font-family: var(--font-read);
    font-size: var(--text-l);
  }

  .recommend-form .recipients {
    display: grid;
    gap: var(--space-3);
    border: 0;
    margin: 0;
    padding: 0;
  }

  .recommend-form legend {
    font-size: var(--text-s);
    font-weight: 600;
    margin-block-end: var(--space-2);
  }

  /* Name and address side by side; on a phone one below the other. */
  .recipient-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: var(--space-2) var(--space-3);
  }

  .recipient-row label {
    display: grid;
    gap: var(--space-1);
    font-weight: 400;
    color: var(--color-muted);
  }

  .recipient-row input {
    width: 100%;
  }

  .recipient-row .form-error {
    grid-column: 1 / -1;
  }

  @media (max-width: 36rem) {
    .recipient-row {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .recommend-form input[type="email"] {
    font: inherit;
    font-size: var(--text-m);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-m);
    padding: var(--space-3) var(--space-4);
  }

  .recommend-form textarea {
    font-family: var(--font-read);
    font-size: var(--text-l);
    line-height: var(--leading-read);
  }

  .recommend-form .recipients > button {
    justify-self: start;
  }

  .checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 400;
  }

  .checkbox input {
    accent-color: var(--color-accent);
    width: 1.1rem;
    height: 1.1rem;
  }

  .work-recommend {
    margin-block: var(--space-2) var(--space-4);
  }

  /* ---------- The recommendation page ---------- */
  .recommendation {
    max-width: 40rem;
    padding-block-start: var(--space-7);
  }

  .recommendation-sentence {
    margin: 0;
    font-family: var(--font-read);
    font-size: var(--text-xl);
    line-height: 1.4;
    text-wrap: pretty;
  }

  .recommendation-from {
    margin: var(--space-3) 0 var(--space-7);
    color: var(--color-muted);
    font-size: var(--text-m);
  }

  .recommendation-work {
    display: flex;
    gap: var(--space-5);
    align-items: flex-start;
  }

  .recommendation-work img {
    width: 7.5rem;
    height: auto;
    border-radius: var(--radius-poster);
    box-shadow: var(--shadow-raised);
  }

  .recommendation-work.is-wide img {
    width: 15rem;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  /* On a phone the wide image stands above the text. */
  @media (max-width: 36rem) {
    .recommendation-work.is-wide {
      flex-direction: column;
    }
  }

  .recommendation-work p {
    margin: 0;
  }

  .recommendation-title {
    font-family: var(--font-read);
    font-size: var(--text-l);
    color: var(--color-text);
    text-decoration: none;
  }

  a.recommendation-title:hover {
    color: var(--color-accent);
  }

  .people-role {
    color: var(--color-muted);
    margin-inline-end: var(--space-1);
  }

  .recommendation-meta {
    margin-block-start: var(--space-7);
    padding-block-start: var(--space-4);
    border-top: 1px solid var(--color-line);
    font-size: var(--text-s);
    color: var(--color-muted);
  }

  .recommendation-meta p {
    margin: 0 0 var(--space-2);
  }

  .recommendation-meta .separator {
    margin-inline: var(--space-2);
  }

  .recommendation-delivery {
    list-style: none;
    margin: 0 0 var(--space-4);
    padding: 0;
  }

  .withdraw summary {
    cursor: pointer;
  }

  .withdraw form {
    display: grid;
    gap: var(--space-2);
    justify-items: start;
    margin-block-start: var(--space-2);
  }

  /* ---------- Replies ---------- */
  .comments {
    margin-block-start: var(--space-7);
  }

  .comments-title {
    font-size: var(--text-l);
    margin-block-end: var(--space-4);
  }

  .comment-list {
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
    display: grid;
    gap: var(--space-5);
  }

  .comment {
    padding-inline-start: var(--space-4);
    border-inline-start: 2px solid var(--color-line);
  }

  .comment-own {
    border-inline-start-color: var(--color-accent);
  }

  .comment-meta {
    margin: 0 0 var(--space-1);
    font-size: var(--text-s);
    color: var(--color-muted);
  }

  .comment-meta .separator {
    margin-inline: var(--space-2);
  }

  .comment-author {
    color: var(--color-text);
    font-weight: 600;
  }

  .comment-body {
    margin: 0;
    font-family: var(--font-read);
    font-size: var(--text-m);
    line-height: var(--leading-read);
    white-space: pre-line; /* keep the line breaks of mails and replies */
    max-width: var(--measure);
  }

  .comment-form {
    margin-block: 0;
  }

  .comment-form textarea {
    font-family: var(--font-read);
    font-size: var(--text-m);
  }
}

/* css/components/site-nav.css */
/* site-nav.css – the small navigation in the header: quiet, never loud. */

@layer components {
  .page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
  }

  /* On a phone the links wrap onto a second line instead of making the
     page wider than the screen. */
  .site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: baseline;
    gap: var(--space-2) var(--space-5);
    font-size: var(--text-s);
  }

  .site-nav > * {
    white-space: nowrap;
  }

  @media (max-width: 36rem) {
    .site-nav {
      column-gap: var(--space-4);
    }
  }

  .site-nav a,
  .site-nav .link-button {
    color: var(--color-muted);
    text-decoration: none;
  }

  .site-nav a:hover,
  .site-nav .link-button:hover {
    color: var(--color-accent);
  }

  .site-nav form {
    margin: 0;
  }
}

/* css/components/wordmark.css */
/* wordmark.css – the name "daizee" in the header. Quiet, set in the reading face. */

@layer components {
  .wordmark {
    font-family: var(--font-read);
    font-size: var(--text-l);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--color-text);
    text-decoration: none;
  }

  .wordmark:hover {
    color: var(--color-accent);
  }
}

/* css/components/work-card.css */
/* work-card.css – a work in a list, the same card in the collection and in
   the result list (card 1.7b). Each page puts its own buttons at the bottom. */

@layer components {
  /* Image on the left, text on the right. The whole card is the link (the
     title link is stretched over it); the buttons lie on top. */
  .work-card {
    position: relative;
    display: grid;
    grid-template-columns: 4.6rem minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
    padding-block: var(--space-3);
    border-bottom: 1px solid var(--color-line);
    border-radius: var(--radius-s);
    transition: background-color var(--motion-quick) var(--ease-standard);
  }

  .work-card:hover {
    background: var(--color-surface);
  }

  /* A video: its image is wide (16:9), the text simply starts further right. */
  .work-card-wide {
    grid-template-columns: 8rem minmax(0, 1fr);
  }

  .work-card-image,
  .work-card-image img {
    display: block;
  }

  .work-card-image img,
  .work-card-image-empty {
    width: 4.6rem;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: var(--radius-poster);
    box-shadow: var(--shadow-rest);
    background: var(--color-line);
  }

  /* object-fit: cover also cuts off the black bars of older 4:3 preview
     images, until the next refresh replaces them. */
  .work-card-wide .work-card-image img,
  .work-card-wide .work-card-image-empty {
    width: 8rem;
    aspect-ratio: 16 / 9;
  }

  .work-card-text p {
    margin: 0;
  }

  .work-card-title {
    font-family: var(--font-read);
    font-size: var(--text-l);
    line-height: 1.25;
    color: var(--color-text);
    text-decoration: none;
  }

  .work-card-title::after {
    content: "";
    position: absolute;
    inset: 0;
  }

  .work-card:hover .work-card-title {
    color: var(--color-accent);
  }

  .work-card-title:focus-visible {
    outline: none;
  }

  .work-card:has(.work-card-title:focus-visible) {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
  }

  /* Under the title two columns: original title, year and kind on the
     left; direction and music on the right. On a phone one below the other. */
  .work-card-facts {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: var(--space-1) var(--space-5);
    margin-block-start: var(--space-1);
  }

  .card-people {
    display: grid;
    gap: var(--space-1);
    margin: 0;
    font-size: var(--text-s);
  }

  .card-people > div {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-2);
  }

  .card-people dt {
    color: var(--color-muted);
  }

  .card-people dd {
    margin: 0;
  }

  /* Why a search found it: "Mit Brad Pitt". */
  .work-card-hint {
    font-size: var(--text-s);
    color: var(--color-muted);
    margin-block-start: var(--space-1) !important;
  }

  /* The page's buttons. The row itself lets clicks through to the card's
     link; only the buttons catch them. "Add" stands at the bottom right. */
  .work-card-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-block-start: var(--space-3);
    pointer-events: none;
  }

  .work-card-actions > * {
    pointer-events: auto;
  }

  .work-card-actions:empty {
    display: none;
  }

  .work-card-actions .add-button {
    margin: 0 0 0 auto;
  }

  .work-card-actions .status-group {
    margin: 0;
  }

  /* Text styles a work's facts share, also on the recommendation page. */
  .result-original {
    font-family: var(--font-read);
    font-style: italic;
    color: var(--color-muted);
  }

  .result-meta,
  .result-people {
    font-size: var(--text-s);
    color: var(--color-muted);
    margin-block-start: var(--space-1) !important;
  }

  @media (max-width: 36rem) {
    .work-card {
      grid-template-columns: 3.6rem minmax(0, 1fr);
    }

    .work-card-wide {
      grid-template-columns: 6rem minmax(0, 1fr);
    }

    .work-card-image img,
    .work-card-image-empty {
      width: 3.6rem;
    }

    .work-card-wide .work-card-image img,
    .work-card-wide .work-card-image-empty {
      width: 6rem;
    }

    .work-card-facts {
      grid-template-columns: minmax(0, 1fr);
    }
  }
}

/* css/components/work.css */
/* work.css – the work page. The work stands in the light (design principle 1). */

@layer components {
  .work {
    display: grid;
    gap: var(--space-7);
    padding-block-start: var(--space-6);
  }

  @media (min-width: 48rem) {
    .work {
      grid-template-columns: minmax(12rem, 20rem) 1fr;
      align-items: start;
    }
  }

  .poster {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-poster);
    box-shadow: var(--shadow-raised);
  }

  /* The video: the stored preview image with a play symbol on top (ADR 0031). */
  .work:has(.video, .video-frame) {
    grid-template-columns: 1fr;
  }

  .video,
  .video-frame {
    position: relative;
    display: block;
    width: 100%;
    max-width: 48rem;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-poster);
    box-shadow: var(--shadow-raised);
    overflow: hidden;
    background: var(--color-video-bg);
  }

  .video-frame {
    border: 0;
  }

  .video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter var(--motion-quick) var(--ease-standard);
  }

  .video:hover img {
    filter: brightness(0.85);
  }

  /* A calm, round play symbol in the middle. */
  .video-play {
    position: absolute;
    inset: 50% auto auto 50%;
    translate: -50% -50%;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: var(--radius-full);
    background: var(--color-scrim);
    backdrop-filter: blur(4px);
    transition: background-color var(--motion-quick) var(--ease-standard), scale var(--motion-quick) var(--ease-standard);
  }

  .video-play::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 54%;
    translate: -50% -50%;
    border-style: solid;
    border-width: 0.8rem 0 0.8rem 1.35rem;
    border-color: transparent transparent transparent var(--color-on-image);
  }

  .video:hover .video-play,
  .video:focus-visible .video-play {
    background: var(--color-accent);
    scale: 1.06;
  }

  /* Small, quiet note where playing leads, before anyone clicks. */
  .video-note {
    position: absolute;
    inset: auto var(--space-3) var(--space-2) auto;
    font-size: var(--text-xs);
    color: var(--color-on-image);
    opacity: 0.75;
    text-shadow: 0 1px 2px var(--color-scrim);
  }

  .work-add {
    margin-block: var(--space-4);
  }

  .work-title {
    font-size: var(--text-2xl);
    margin-block-end: var(--space-2);
  }

  .work-original {
    font-family: var(--font-read);
    font-style: italic;
    font-size: var(--text-l);
    color: var(--color-muted);
    margin: 0 0 var(--space-4);
  }

  .work-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    color: var(--color-muted);
    font-size: var(--text-s);
    font-variant-numeric: tabular-nums;
  }

  .age-rating {
    border: 1px solid var(--color-line);
    border-radius: var(--radius-s);
    padding: 0 var(--space-2);
    font-weight: 600;
  }

  /* The familiar FSK colours; other rating systems stay neutral. */
  .fsk-0 { background: var(--fsk-0-bg); color: var(--fsk-0-text); border-color: var(--color-line); }
  .fsk-6 { background: var(--fsk-6-bg); color: var(--fsk-6-text); border-color: transparent; }
  .fsk-12 { background: var(--fsk-12-bg); color: var(--fsk-12-text); border-color: transparent; }
  .fsk-16 { background: var(--fsk-16-bg); color: var(--fsk-16-text); border-color: transparent; }
  .fsk-18 { background: var(--fsk-18-bg); color: var(--fsk-18-text); border-color: transparent; }

  .work-notice {
    font-family: var(--font-read);
    font-style: italic;
    color: var(--color-muted);
  }

  .credits {
    margin: var(--space-6) 0;
    display: grid;
    gap: var(--space-2);
  }

  .credit {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: var(--space-3);
  }

  .credit dt {
    font-size: var(--text-s);
    color: var(--color-muted);
  }

  .credit dd {
    margin: 0;
  }

  .work-origin {
    font-size: var(--text-s);
    overflow-wrap: anywhere;
  }

  .work-sources {
    margin-block-start: var(--space-7);
    padding-block-start: var(--space-4);
    border-top: 1px solid var(--color-line);
    font-size: var(--text-xs);
    color: var(--color-muted);
  }

  .work-sources p {
    margin: 0 0 var(--space-1);
  }

  .work-sources a {
    color: var(--color-muted);
  }

  .work-sources .separator {
    margin-inline: var(--space-1);
  }

  .nav-add {
    color: var(--color-accent) !important;
  }

  /* On a phone the poster sits small beside the title, so status and note
     show without scrolling. The text block dissolves into the grid
     (display: contents) so title, original title and facts can stand next
     to the poster and everything else runs below at full width. Videos
     keep their full width. */
  @media (max-width: 47.99rem) {
    .work:not(:has(.video, .video-frame)) {
      grid-template-columns: 6.5rem 1fr;
      gap: 0 var(--space-4);
      align-items: start;
    }

    .work:not(:has(.video, .video-frame)) .work-text {
      display: contents;
    }

    .work:not(:has(.video, .video-frame)) .work-text > * {
      grid-column: 1 / -1;
    }

    .work:not(:has(.video, .video-frame)) .work-image {
      grid-column: 1;
      grid-row: 1 / span 3;
    }

    .work:not(:has(.video, .video-frame)) .work-text > :is(.work-title, .work-original, .work-meta) {
      grid-column: 2;
    }

    .work:not(:has(.video, .video-frame)) .work-title {
      font-size: var(--text-xl);
      margin-block-start: 0;
    }

    .work:not(:has(.video, .video-frame)) .work-original {
      font-size: var(--text-m);
      margin-block-end: var(--space-2);
    }

    .work:not(:has(.video, .video-frame)) .work-meta {
      margin-block-end: var(--space-2);
    }

    .work:not(:has(.video, .video-frame)) .poster {
      box-shadow: var(--shadow-rest);
    }

    .credit {
      grid-template-columns: 6.5rem 1fr;
    }
  }
}

/* css/utilities.css */
/* utilities.css – a few helpers. Keep this file small. */

@layer utilities {
  /* Hidden on screen, still read by screen readers. */
  .visually-hidden:not(:focus):not(:active) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* "Skip to content": appears when reached with the keyboard. */
  .skip-link {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--color-accent);
    color: var(--color-on-accent);
    border-radius: var(--radius-m);
    z-index: 10;
  }
}

