/* lightroom-design 0.7.0 sha256:94550578f20f62055b13cd19c9b23daa4965b4a64a5ae972c40a504c5d6fa3df */
/* Lightroom base: layer order, square and flat (radios excepted), type, focus, theme ground.
   Everything sits in cascade layers, so a tool's own plain CSS always wins.
   Load lightroom-tokens.css first (it sets the variables and the three themes). */

@layer lightroom.base, lightroom.controls, lightroom.layout, lightroom.components;

@layer lightroom.base {
  /* Square and flat, everywhere. Nothing in Lightroom has a rounded corner or a shadow, except the radio button (see 10-controls.css), which is round so it is not mistaken for a checkbox. */
  *, ::before, ::after, ::backdrop, ::file-selector-button {
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: none;
    text-shadow: none;
  }

  /* What differs by theme is carried in variables set on each theme block, so the nearest themed
     ancestor wins: a light block inside a Dimmed page looks light. Custom properties inherit; a
     selector on a theme and its descendants (`[data-theme] .x`) would match a block's elements whatever is nearer.
     The main button is filled in White and Black and outlined in Dimmed (fill, text, hover, disabled fill);
     the lockup shows the black wordmark in White and the white one in Black and Dimmed. */
  :root, [data-theme="light"] {
    --lr-primary-bg: var(--tool-ink-strong);
    --lr-primary-fg: var(--ground);
    --lr-primary-hover: color-mix(in srgb, var(--tool-ink-strong) 80%, var(--ground));
    --lr-primary-off-bg: var(--tool-line);
    --lr-wordmark-black: block;
    --lr-wordmark-white: none;
  }
  [data-theme="dark"] {
    --lr-primary-bg: var(--tool-ink-strong);
    --lr-primary-fg: var(--ground);
    --lr-primary-hover: color-mix(in srgb, var(--tool-ink-strong) 80%, var(--ground));
    --lr-primary-off-bg: var(--tool-line);
    --lr-wordmark-black: none;
    --lr-wordmark-white: block;
  }
  [data-theme="dimmed"], [data-theme="room"] {  /* room: the old name of Dimmed */
    --lr-primary-bg: transparent;
    --lr-primary-fg: var(--tool-ink-strong);
    --lr-primary-hover: var(--tool-hover);
    --lr-primary-off-bg: transparent;
    --lr-wordmark-black: none;
    --lr-wordmark-white: block;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
      --lr-primary-bg: var(--tool-ink-strong);
      --lr-primary-fg: var(--ground);
      --lr-primary-hover: color-mix(in srgb, var(--tool-ink-strong) 80%, var(--ground));
      --lr-primary-off-bg: var(--tool-line);
      --lr-wordmark-black: none;
      --lr-wordmark-white: block;
    }
  }

  /* The ground and ink of the theme, on the page or on any element that pins a theme. */
  [data-theme], body {
    background: var(--ground);
    color: var(--ink);
  }

  body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.4;
  }

  h1, h2, h3, h4 {
    margin: 0;
    color: var(--tool-ink-strong);
    font-weight: 700;
    line-height: 1.2;
  }
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
  h3, h4 { font-size: 14px; }

  p { margin: 0; }

  /* Ids, codes and file names: system monospace, so every character reads on its own. 0.9em sits level
     with Acumin at body (14px), table and 12px sizes. The case and spacing are the text's own, never the
     capitals and tracking of the legend, heading, label, button or badge around it, so an id matches
     how it is written. */
  code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.9em;
    text-transform: none;
    letter-spacing: 0;
  }
  /* The 0.9em is set once: inside a pre, or inside another code, the text is already at that size. */
  pre :is(code, kbd, samp), :is(code, kbd, samp) :is(code, kbd, samp) { font-size: 1em; }
  small { font-size: 14px; }

  a { color: var(--tool-select); text-underline-offset: 2px; }

  hr { border: 0; border-block-start: 1px solid var(--rule); margin: 0; }

  /* One focus ring: 2px in tool-select, there at once, never animated. */
  :focus-visible, .lr-file:has(> input:focus-visible) {
    outline: 2px solid var(--tool-select);
    outline-offset: 2px;
    transition: none;
  }
}
/* Native controls, styled with no class. Buttons match the Mac app's square buttons: small bold capitals,
   outlined by default; the main one is marked data-variant="primary", the quiet one data-variant="quiet". */

@layer lightroom.controls {
  /* ---------- Button ----------
     Menu items (role="menuitem") and tabs (role="tab") are buttons in the markup but not push buttons:
     they keep the plain text style below and never take the capitals, the pressed dim or the 44px touch height.
     Their own rules are in 40-scripted.css. */
  button, ::file-selector-button, .lr-file {
    font: inherit;
    font-weight: 500;
    min-block-size: 36px;
    padding: 0 var(--space-2);
    border: 1px solid var(--tool-line-strong);
    background: transparent;
    color: var(--tool-ink-strong);
    cursor: pointer;
  }
  /* Type is set by hand, not with the `label` type token: the token has 0.02em spacing and a 1.2 line height, the
     Mac button has 0.8px spacing, so the web button matches the Mac, not the token.
     Push buttons, as on the Mac: Acumin Bold 12px in capitals, letter spacing 0.8px, 16px by 9px padding
     (about 31px high). The markup keeps normal case. On a touch screen the target is 44px. */
  button:where(:not([role="menuitem"], [role="tab"])), ::file-selector-button, .lr-file {
    min-block-size: 0;
    padding: 9px var(--space-2);
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.8px;
    text-transform: uppercase;
  }
  @media (pointer: coarse) {
    button:where(:not([role="menuitem"], [role="tab"])), ::file-selector-button, .lr-file { min-block-size: 44px; }
  }
  button:hover:not(:disabled, [aria-disabled="true"]), ::file-selector-button:hover,
  .lr-file:hover:not(:has(> input:disabled)) {
    background: var(--tool-hover);
  }
  /* Pressed: the whole button dims, as on the Mac. */
  button:where(:not([role="menuitem"], [role="tab"])):active:not(:disabled, [aria-disabled="true"]),
  ::file-selector-button:active, .lr-file:active:not(:has(> input:disabled)) {
    opacity: 0.7;
  }
  /* Main button: filled in White and Black, outlined in Dimmed (the variables come from the nearest theme). */
  button[data-variant="primary"] {
    background: var(--lr-primary-bg);
    border-color: var(--tool-ink-strong);
    color: var(--lr-primary-fg);
  }
  /* Hover: a filled main button softens a little; the outlined one (Dimmed) gets the hover tint. */
  button[data-variant="primary"]:hover:not(:disabled, [aria-disabled="true"]) {
    background: var(--lr-primary-hover);
  }
  button[data-variant="quiet"] {
    border-color: transparent;
  }
  button[aria-pressed="true"] {
    border-color: var(--tool-select);
    color: var(--tool-select);
  }
  button:disabled, button[aria-disabled="true"], .lr-file:has(> input:disabled) {
    background: transparent;
    border-color: var(--tool-line);
    color: var(--tool-inactive);
    cursor: not-allowed;
  }
  /* A disabled push button is muted, as on the Mac. A disabled main button has the line fill in White and
     Black, and only the line border in Dimmed. Menu items and tabs keep the inactive colour above. */
  button:where(:not([role="menuitem"], [role="tab"])):is(:disabled, [aria-disabled="true"]),
  .lr-file:has(> input:disabled) {
    color: var(--tool-ink-muted);
  }
  button[data-variant="primary"]:is(:disabled, [aria-disabled="true"]) {
    background: var(--lr-primary-off-bg);
  }
  /* A disabled quiet button keeps no border. */
  button[data-variant="quiet"]:disabled, button[data-variant="quiet"][aria-disabled="true"] {
    border-color: transparent;
  }

  /* ---------- File button ----------
     <label class="lr-file">Choose files <input type="file"></label>. The label is drawn as a secondary push button
     by the selectors above (it is listed in each one), so it cannot drift from the button. Only what a label needs
     that a button already has is set here: a centred box, and the real input kept in place but out of sight.
     The input stays focusable and takes Enter and Space itself; its focus ring is drawn on the label (00-base.css). */
  .lr-file {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .lr-file > input[type="file"] {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    cursor: inherit;
  }

  /* ---------- Text inputs, textarea, select ---------- */
  textarea, select,
  input:is(:not([type]), [type="text"], [type="search"], [type="email"], [type="url"], [type="tel"],
    [type="password"], [type="number"], [type="date"], [type="time"], [type="datetime-local"],
    [type="month"], [type="week"]) {
    font: inherit;
    min-block-size: 36px;
    max-inline-size: 100%;
    padding: 0 12px;
    border: 1px solid var(--tool-line-strong);
    background: transparent;
    color: var(--tool-ink-strong);
  }
  textarea { padding: 8px 12px; min-block-size: 96px; resize: vertical; }
  /* iPhone Safari zooms the page when a field under 16px takes focus, and does not zoom back.
     On touch screens the fields are 16px. Pinch zoom stays on; the viewport meta is not touched. */
  @media (pointer: coarse) {
    textarea, select,
    input:is(:not([type]), [type="text"], [type="search"], [type="email"], [type="url"], [type="tel"],
      [type="password"], [type="number"], [type="date"], [type="time"], [type="datetime-local"],
      [type="month"], [type="week"]) {
      font-size: 16px;
    }
  }
  ::placeholder { color: var(--tool-ink-muted); opacity: 1; }
  textarea:disabled, select:disabled, input:disabled {
    border-color: var(--tool-line);
    color: var(--tool-inactive);
    cursor: not-allowed;
  }
  select { cursor: pointer; }
  select:hover:not(:disabled) { background-color: var(--tool-hover); }

  /* Chrome 135+ lets us style the open list. Other engines keep the system list. */
  @supports (appearance: base-select) {
    select, ::picker(select) { appearance: base-select; }
    select { padding: 0 8px 0 12px; align-items: center; }
    ::picker(select) {
      border: 1px solid var(--tool-line-strong);
      background: var(--ground);
      color: var(--tool-ink-strong);
      padding: 0;
      box-shadow: none;
      border-radius: 0;
    }
    select option {
      padding: 8px 12px;
      font: inherit;
      color: var(--tool-ink-strong);
    }
    select option:hover, select option:focus-visible { background: var(--tool-hover); outline: 0; }
    select option:checked { font-weight: 700; }
    select option:disabled { color: var(--tool-inactive); }
  }

  /* ---------- Checkbox and radio: a square checkbox, a round radio, each with a mark that is a shape, not a colour ----------
     Radio buttons are round so they are not mistaken for checkboxes. This is the one place Lightroom has a rounded shape. */
  input[type="checkbox"], input[type="radio"] {
    appearance: none;
    position: relative;
    inline-size: 18px;
    block-size: 18px;
    margin: 0;
    flex: none;
    border: 1px solid var(--tool-line-strong);
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
  }
  input[type="checkbox"]:checked { background: var(--tool-ink-strong); border-color: var(--tool-ink-strong); }
  input[type="checkbox"]:checked::before {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--ground);
    clip-path: polygon(0 55%, 18% 38%, 40% 60%, 82% 8%, 100% 24%, 40% 100%);
  }
  input[type="radio"] { border-radius: 50%; }
  input[type="radio"]:checked { border-color: var(--tool-ink-strong); }
  input[type="radio"]:checked::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--tool-ink-strong);
  }
  input[type="checkbox"]:disabled, input[type="radio"]:disabled {
    border-color: var(--tool-line);
    cursor: not-allowed;
  }
  input[type="checkbox"]:disabled:checked { background: var(--tool-inactive); border-color: var(--tool-inactive); }
  input[type="radio"]:disabled:checked::before { background: var(--tool-inactive); }

  /* ---------- Switch: square track, square knob. On moves the knob and fills it. ---------- */
  input[type="checkbox"][role="switch"] {
    inline-size: 40px;
    block-size: 22px;
  }
  input[type="checkbox"][role="switch"]:checked { background: transparent; border-color: var(--tool-ink-strong); }
  input[type="checkbox"][role="switch"]::before,
  input[type="checkbox"][role="switch"]:checked::before {
    content: "";
    position: absolute;
    inset: 2px auto 2px 2px;
    inline-size: 16px;
    clip-path: none;
    background: var(--tool-inactive);
  }
  input[type="checkbox"][role="switch"]:checked::before {
    background: var(--tool-ink-strong);
    translate: 18px 0;
  }
  input[type="checkbox"][role="switch"]:disabled:checked { background: transparent; }
  input[type="checkbox"][role="switch"]:disabled::before { background: var(--tool-line); }

  /* ---------- Slider (single). Hard-edged fill; the one gradient the audit allows. ----------
     lightroom.js sets --slider-value (for example 40%) as the value changes. Without it
     Chrome and Safari show an unfilled track; Firefox draws the fill natively. */
  input[type="range"] {
    appearance: none;
    inline-size: 100%;
    block-size: 32px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
  }
  input[type="range"]::-webkit-slider-runnable-track {
    block-size: 2px;
    background: linear-gradient(to right, var(--tool-ink-strong) var(--slider-value, 0%), var(--tool-line-strong) var(--slider-value, 0%));
  }
  input[type="range"]::-moz-range-track { block-size: 2px; background: var(--tool-line-strong); }
  input[type="range"]::-moz-range-progress { block-size: 2px; background: var(--tool-ink-strong); }
  input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    inline-size: 16px;
    block-size: 16px;
    margin-block-start: -7px;
    border: 0;
    background: var(--tool-ink-strong);
  }
  input[type="range"]::-moz-range-thumb {
    inline-size: 16px;
    block-size: 16px;
    border: 0;
    background: var(--tool-ink-strong);
  }
  input[type="range"]:focus-visible { outline: 0; }
  input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--tool-select); outline-offset: 2px; }
  input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--tool-select); outline-offset: 2px; }
  input[type="range"]:disabled { cursor: not-allowed; }
  input[type="range"]:disabled::-webkit-slider-thumb { background: var(--tool-inactive); }
  input[type="range"]:disabled::-moz-range-thumb { background: var(--tool-inactive); }
  input[type="range"]:disabled::-moz-range-progress { background: var(--tool-inactive); }
  input[type="range"]:disabled::-webkit-slider-runnable-track {
    background: linear-gradient(to right, var(--tool-inactive) var(--slider-value, 0%), var(--tool-line) var(--slider-value, 0%));
  }

  /* ---------- Label, fieldset ---------- */
  label { font-weight: 500; color: var(--tool-ink-strong); }
  label:has(> input[type="checkbox"], > input[type="radio"]) {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: 400;
    cursor: pointer;
  }
  /* Space goes between the options of a group, not after a lone option or the last one:
     --space-2 after every option that has another label after it, and half --space-1 above and
     below each option of a group, so options that wrap onto a second row are --space-1 apart. */
  label:has(> input[type="checkbox"], > input[type="radio"]):not(:last-of-type) { margin-inline-end: var(--space-2); }
  label:has(> input[type="checkbox"], > input[type="radio"]):not(:only-of-type) { margin-block: calc(var(--space-1) / 2); }
  fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
  legend {
    padding: 0;
    color: var(--tool-ink-strong);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* ---------- Table ---------- */
  table { border-collapse: collapse; inline-size: 100%; }
  th, td {
    padding: 8px 12px;
    text-align: start;
    border-block-end: 1px solid var(--tool-line);
  }
  th { color: var(--tool-ink-muted); font-weight: 500; }
  thead th { border-block-end-color: var(--tool-line-strong); } /* only the header row; row-name cells keep the fine row line */
  tbody tr:hover { background: var(--tool-hover); }

  /* ---------- Dialog ---------- */
  dialog {
    inline-size: min(560px, calc(100vw - 32px));
    padding: var(--space-3);
    border: 1px solid var(--tool-line-strong);
    background: var(--ground);
    color: var(--ink);
  }
  dialog::backdrop { background: rgb(0 0 0 / 0.6); }
  dialog:focus-visible { outline: 0; }

  /* ---------- Accordion ---------- */
  details { border-block-end: 1px solid var(--tool-line); }
  summary {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 12px 0;
    color: var(--tool-ink-strong);
    font-weight: 500;
    list-style: none;
    cursor: pointer;
  }
  summary::-webkit-details-marker { display: none; }
  summary::after { content: "+" / ""; font-weight: 400; }
  details[open] > summary::after { content: "\2212" / ""; }
  details > :not(summary) { padding-block-end: 12px; }
}
/* Layout pieces that carry the lr- prefix: field, panel, table wrapper. */

@layer lightroom.layout {
  /* A label, a control and an optional hint underneath. */
  .lr-field {
    display: grid;
    gap: 4px;
    align-content: start;
  }
  .lr-hint { color: var(--tool-ink-muted); font-size: 14px; font-weight: 400; }

  /* A grouped area with a hairline and the panel tint. */
  .lr-panel {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--tool-line);
    background: var(--tool-panel);
  }

  /* Wide tables scroll sideways inside this box. Give it tabindex="0" and an aria-label
     so a keyboard can scroll it. */
  .lr-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--tool-line);
  }
  .lr-table-wrap > table { min-inline-size: 480px; }
  .lr-table-wrap th:first-child, .lr-table-wrap td:first-child { padding-inline-start: var(--space-2); }

  /* Dialog header and footer, when a dialog uses them. */
  dialog > header { display: grid; gap: var(--space-1); margin-block-end: var(--space-2); }
  dialog > footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-1); margin-block-start: var(--space-3); }
}
/* Lightroom's own pieces: status badge, surface label, header lockup, theme switcher.
   A status is always a bar plus a word, never colour alone. */

@layer lightroom.components {
  /* ---------- Status badge ---------- */
  .lr-badge {
    --lr-status: var(--tool-ink-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25em; /* a word space: an id (code) inside the badge is its own flex item, which drops the space before it. One text node has nothing to space. */
    min-block-size: 28px;
    padding: 0 10px;
    border-inline-start: 3px solid var(--lr-status);
    background: color-mix(in srgb, var(--lr-status) 14%, var(--ground));
    color: var(--tool-ink-strong);
    font-weight: 500;
    white-space: nowrap;
  }
  .lr-badge[data-status="ok"] { --lr-status: var(--tool-ok); }
  .lr-badge[data-status="warning"] { --lr-status: var(--tool-warning); }
  .lr-badge[data-status="problem"] { --lr-status: var(--tool-problem); }
  .lr-badge[data-status="info"] { --lr-status: var(--tool-info); }
  .lr-badge[data-status="override"] { --lr-status: var(--tool-override); }
  .lr-badge[data-status="inactive"] {
    --lr-status: var(--tool-inactive);
    background: transparent;
    color: var(--tool-ink-muted);
  }

  /* ---------- Surface label: a swatch in the wall colour and its name ---------- */
  .lr-surface {
    --lr-surf: var(--tool-ink-muted);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--tool-ink-strong);
    font-weight: 500;
    white-space: nowrap;
  }
  .lr-surface::before {
    content: "";
    inline-size: 14px;
    block-size: 14px;
    background: var(--lr-surf);
  }
  .lr-surface[data-surface="A"] { --lr-surf: var(--tool-surf-A); }
  .lr-surface[data-surface="B"] { --lr-surf: var(--tool-surf-B); }
  .lr-surface[data-surface="C"] { --lr-surf: var(--tool-surf-C); }
  .lr-surface[data-surface="D"] { --lr-surf: var(--tool-surf-D); }
  .lr-surface[data-surface="floor"] { --lr-surf: var(--tool-surf-floor); }
  .lr-surface[data-surface="surtitles"] { --lr-surf: var(--tool-surf-surtitles); }

  /* ---------- Header lockup: wordmark, divider, tool name ---------- */
  .lr-lockup {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }
  .lr-lockup img { display: block; block-size: 20px; inline-size: auto; }
  .lr-lockup-name {
    padding-inline-start: var(--space-2);
    border-inline-start: 1px solid var(--tool-line-strong);
    color: var(--tool-ink-strong);
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 24px;
  }
  /* Black wordmark in White, white wordmark in Black and Dimmed (the variables come from the nearest theme). */
  .lr-lockup .lr-wordmark-black { display: var(--lr-wordmark-black); }
  .lr-lockup .lr-wordmark-white { display: var(--lr-wordmark-white); }

  /* ---------- Joined button group: .lr-button-group, and the theme switcher (.lr-theme-switch) which is one ----------
     Push buttons side by side with one shared 1px border. Every button overlaps its next neighbour, in the row and
     down a row, by its own 1px border; the group's 1px of end padding gives that back, so a one-row group is exactly
     as high and as wide as the buttons laid edge to edge less the shared borders. The chosen button
     (aria-pressed="true") is drawn above its neighbours so its border colour is whole, and the focused one above the
     chosen one so the keyboard ring is whole. On a narrow screen the group wraps to rows that share a border too.
     lightroom.js wires data-set-theme on the theme switcher. */
  :is(.lr-button-group, .lr-theme-switch) {
    display: inline-flex;
    flex-wrap: wrap;
    padding-inline-end: 1px;
    padding-block-end: 1px;
    max-inline-size: 100%;
  }
  :is(.lr-button-group, .lr-theme-switch) > button {
    margin-inline-end: -1px;
    margin-block-end: -1px;
  }
  :is(.lr-button-group, .lr-theme-switch) > button[aria-pressed="true"] { position: relative; z-index: 1; }
  :is(.lr-button-group, .lr-theme-switch) > button:focus-visible { position: relative; z-index: 2; }
}
/* Pieces that need lightroom.js: menu, tabs, tooltip, toast, slider with number box.
   Markup and keys are written up in the gallery. Menu and tooltip are native popovers placed
   with CSS anchor positioning; the script only names the anchor. */

@layer lightroom.components {
  /* ---------- Menu ---------- */
  /* The box look applies to any data-lr="menu": the plain popover, or a React popup (Base UI). */
  [data-lr="menu"] {
    min-inline-size: 200px;
    padding: 4px 0;
    border: 1px solid var(--tool-line-strong);
    background: var(--ground);
    color: var(--ink);
  }
  [data-lr="menu"]:focus-visible { outline: 0; }
  /* Placement and the closed state belong to the native popover and CSS anchor positioning. */
  [popover][data-lr="menu"] {
    inset: auto;
    margin: 4px 0 0;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block, flip-inline;
  }
  [data-lr="menu"] [role="menuitem"] {
    display: block;
    inline-size: 100%;
    text-align: start;
    border: 0;
    font-weight: 400;
  }
  [data-lr="menu"] [role="menuitem"]:focus-visible { outline-offset: -2px; background: var(--tool-hover); }

  /* ---------- Compact theme switcher: one icon button that opens the menu with the four themes ---------- */
  .lr-theme-pick {
    display: inline-grid;
    place-items: center;
    min-inline-size: 28px;
    min-block-size: 28px;
    padding: 0;
  }
  /* On a touch screen the hit area is 44px. The icon stays 16px. */
  @media (pointer: coarse) {
    .lr-theme-pick { min-inline-size: 44px; min-block-size: 44px; }
  }
  /* Each item has a small square before the word: empty, and filled on the chosen one, so the choice never rests on colour. */
  .lr-theme-menu [role="menuitem"] { display: flex; align-items: center; gap: 8px; }
  .lr-theme-menu [role="menuitem"]::before {
    content: "";
    flex: none;
    inline-size: 8px;
    block-size: 8px;
    border: 1px solid currentColor;
  }
  .lr-theme-menu [role="menuitem"][aria-pressed="true"]::before { background: currentColor; }
  /* A switcher at the page foot opens upward. --up for a button at the end of the line (the menu grows to the left),
     --up-start for a button at the start (the menu grows to the right). The base menu's fallbacks still flip it if it does not fit. */
  .lr-theme-menu--up[popover][data-lr="menu"] { margin: 0 0 4px; position-area: block-start span-inline-start; }
  .lr-theme-menu--up-start[popover][data-lr="menu"] { margin: 0 0 4px; position-area: block-start span-inline-end; }

  /* ---------- Tabs ---------- */
  [data-lr="tabs"] > [role="tablist"] {
    display: flex;
    gap: var(--space-1);
    overflow-x: auto;
    border-block-end: 1px solid var(--tool-line);
  }
  [data-lr="tabs"] [role="tab"] {
    border: 0;
    border-block-end: 2px solid transparent;
    color: var(--tool-ink-muted);
    white-space: nowrap;
  }
  [data-lr="tabs"] [role="tab"][aria-selected="true"] {
    border-block-end-color: var(--tool-select);
    color: var(--tool-ink-strong);
    font-weight: 700;
  }
  [data-lr="tabs"] > [role="tabpanel"] { padding-block: var(--space-2); }

  /* ---------- Tooltip ---------- */
  .lr-tooltip {
    inset: auto;
    margin: 6px;
    inline-size: max-content;
    max-inline-size: 32ch;
    padding: 4px 8px;
    border: 1px solid var(--tool-line-strong);
    background: var(--ground);
    color: var(--tool-ink-strong);
    pointer-events: none;
    position-area: block-start;
    position-try-fallbacks: flip-block;
  }

  /* ---------- Toast: a bar in the status colour, the status word, the message ---------- */
  .lr-toasts {
    position: fixed;
    inset-block-end: var(--space-2);
    inset-inline-end: var(--space-2);
    z-index: 1;
    display: grid;
    gap: var(--space-1);
    inline-size: min(380px, calc(100vw - 2 * var(--space-2)));
    pointer-events: none;
  }
  .lr-toast {
    --lr-status: var(--tool-ink-muted);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 4px 4px 12px;
    border: 1px solid var(--tool-line-strong);
    border-inline-start: 3px solid var(--lr-status);
    background: var(--ground);
    color: var(--ink);
    pointer-events: auto;
  }
  .lr-toast > span { flex: 1; }
  .lr-toast-label { color: var(--tool-ink-strong); }
  .lr-toast[data-status="ok"] { --lr-status: var(--tool-ok); }
  .lr-toast[data-status="warning"] { --lr-status: var(--tool-warning); }
  .lr-toast[data-status="problem"] { --lr-status: var(--tool-problem); }
  .lr-toast[data-status="info"] { --lr-status: var(--tool-info); }

  /* ---------- Slider with number box: range, number, unit in one row ---------- */
  .lr-slider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-1);
  }
  .lr-slider > input[type="number"] { inline-size: 12ch; font-variant-numeric: tabular-nums; }
  .lr-unit { min-inline-size: 3ch; color: var(--tool-ink-muted); }
}
/* The two vendored helpers, styled from Lightroom variables only. Their own themes are not shipped.
   - Searchable picker: Tom Select (vendor/tom-select/). Wraps a plain <select>.
   - Two-handle slider: range-slider-element (vendor/range-slider-element/). The <range-slider> tag.
   A tool that does not load the vendor files never uses these rules.
   Layer lightroom.helpers is not named in 00-base.css; it joins the lightroom layers after the
   ones named there, so it sits after them and a tool's own plain CSS still wins. */

@layer lightroom.helpers {
  /* ================= Searchable picker (Tom Select) ================= */

  /* Tom Select keeps the real <select> for forms and hides it; the wrapper is what people see. */
  .ts-hidden-accessible {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .ts-wrapper {
    position: relative;
    display: block;
    inline-size: 100%;
    max-inline-size: 100%;
  }

  .ts-control {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--space-1);
    inline-size: 100%;
    min-block-size: 36px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--tool-line-strong);
    background: transparent;
    color: var(--tool-ink-strong);
    font: inherit;
    cursor: pointer;
    overflow: hidden;
  }
  /* Same rule as the plain fields: 16px on touch screens so iOS does not zoom. The typing box inherits it. */
  @media (pointer: coarse) {
    .ts-control { font-size: 16px; }
  }
  .ts-wrapper:not(.disabled) .ts-control:hover { background: var(--tool-hover); }
  .ts-wrapper.dropdown-active .ts-control { background: transparent; border-color: var(--tool-ink-strong); }

  /* The chosen value. */
  .ts-control > .item { color: var(--tool-ink-strong); }

  /* The typing box lives inside the control and looks like part of it. */
  .ts-control > input {
    flex: 1 1 4ch;
    min-inline-size: 4ch;
    inline-size: auto;
    min-block-size: 0;
    block-size: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    outline: 0;
    cursor: inherit;
  }
  .ts-control > input:focus-visible { outline: 0; }
  .ts-wrapper.input-active .ts-control, .ts-wrapper.input-active .ts-control > input { cursor: text; }
  .ts-wrapper.input-hidden .ts-control > input {
    position: absolute;
    inset-inline-start: -10000px;
    opacity: 0;
  }

  /* The caret is a small triangle drawn as a shape. It points down when closed and up when open. */
  .ts-wrapper.single .ts-control::after {
    content: "";
    position: absolute;
    inset-inline-end: 14px;
    inset-block-start: 50%;
    inline-size: 10px;
    block-size: 6px;
    translate: 0 -50%;
    background: var(--tool-ink-strong);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
  }
  .ts-wrapper.single.dropdown-active .ts-control::after { clip-path: polygon(50% 0, 100% 100%, 0 100%); }

  /* One focus ring, same as every other control. */
  .ts-wrapper.focus .ts-control {
    outline: 2px solid var(--tool-select);
    outline-offset: 2px;
    transition: none;
  }

  .ts-wrapper.disabled .ts-control {
    border-color: var(--tool-line);
    background: transparent;
    cursor: not-allowed;
  }
  .ts-wrapper.disabled .ts-control > .item,
  .ts-wrapper.disabled .ts-control > input { color: var(--tool-inactive); }
  .ts-wrapper.disabled .ts-control::after { background: var(--tool-inactive); }

  /* The open list. */
  .ts-dropdown {
    position: absolute;
    inset-block-start: 100%;
    inset-inline: 0;
    z-index: 10;
    margin: 4px 0 0;
    border: 1px solid var(--tool-line-strong);
    background: var(--ground);
    color: var(--tool-ink-strong);
    font: inherit;
  }
  .ts-dropdown-content {
    max-block-size: 240px;
    overflow: hidden auto;
  }

  .ts-dropdown .option,
  .ts-dropdown .no-results,
  .ts-dropdown .optgroup-header {
    padding: 8px 12px 8px 9px;
    border-inline-start: 3px solid transparent;
  }
  .ts-dropdown .option { cursor: pointer; }
  /* The option under the keyboard or pointer: a tint and a bar, so it is not shown by colour alone. */
  .ts-dropdown .option.active {
    background: var(--tool-hover);
    border-inline-start-color: var(--tool-select);
  }
  .ts-dropdown .option.selected { font-weight: 700; }
  .ts-dropdown .option[data-disabled] { color: var(--tool-inactive); cursor: not-allowed; }
  .ts-dropdown .no-results { color: var(--tool-ink-muted); }
  .ts-dropdown .optgroup-header { color: var(--tool-ink-muted); font-weight: 700; cursor: default; }
  .ts-dropdown .optgroup + .optgroup { border-block-start: 1px solid var(--tool-line); }

  /* The typed letters found in each option: bold and underlined, no highlighter colour. */
  .ts-dropdown .highlight {
    background: transparent;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  /* ================= Two-handle slider (range-slider-element) =================
     Markup: a <range-slider> with its track, fill and two thumbs written out, so each thumb
     can carry its own aria-label. Its value reads "20,70" (low,high).
     Hard-edged and solid: no gradient, thumbs are squares. */

  range-slider {
    --track-size: 2px;
    --thumb-size: 16px;
    position: relative;
    display: flex;
    align-items: center;
    inline-size: 100%;
    block-size: 32px;
    margin: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    outline: 0;
  }
  range-slider [data-track] {
    flex: 1;
    block-size: var(--track-size);
    background: var(--tool-line-strong);
    pointer-events: none;
  }
  range-slider [data-track-fill] {
    position: absolute;
    block-size: var(--track-size);
    background: var(--tool-ink-strong);
    pointer-events: none;
  }
  range-slider [data-runnable-track] {
    position: absolute;
    inset: 0 calc(var(--thumb-size) / 2);
    display: flex;
    align-items: center;
    pointer-events: none;
  }
  range-slider [data-thumb] {
    position: absolute;
    inline-size: var(--thumb-size);
    block-size: var(--thumb-size);
    margin-inline-start: calc(var(--thumb-size) / -2);
    background: var(--tool-ink-strong);
    pointer-events: auto;
    touch-action: none;
    outline: 0;
  }
  range-slider [data-thumb]:focus-visible {
    outline: 2px solid var(--tool-select);
    outline-offset: 2px;
    transition: none;
  }

  range-slider[disabled] { cursor: not-allowed; }
  range-slider[disabled] [data-track] { background: var(--tool-line); }
  range-slider[disabled] [data-track-fill],
  range-slider[disabled] [data-thumb] { background: var(--tool-inactive); }
}
/* Sortable table header (.lr-sort) and detail panel (.lr-detail with .lr-facts). No script: sorting, opening and
   placement stay in the tool. */

@layer lightroom.components {
  /* ---------- Sortable header: a button that reads as the heading text ----------
     Put it inside a th that has scope and aria-sort. Same font, size, case, spacing and colour as a plain th, and
     none of the push button's capitals, border, padding or height. Hover tint and the focus ring come from the
     plain button rules. The sort mark is drawn here from the th's aria-sort. */
  .lr-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    min-block-size: 0;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: inherit;
  }
  /* The mark: a small triangle after the text. Sorted: one triangle, up for ascending, down for descending, in
     strong ink. Sortable but not sorted: a quiet up and down pair in secondary ink. The shape says the order; the
     th's aria-sort says it to a screen reader. */
  .lr-sort::after {
    content: "";
    flex: none;
    inline-size: 8px;
    block-size: 12px;
    background: var(--tool-ink-muted);
    clip-path: polygon(50% 0%, 100% 38%, 0% 38%, 0% 62%, 100% 62%, 50% 100%);
  }
  /* The button may sit in a wrapper (a span) inside the header cell, or in a role="columnheader" cell. */
  :is(th, [role="columnheader"])[aria-sort="ascending"] .lr-sort::after {
    block-size: 8px;
    background: var(--tool-ink-strong);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  }
  :is(th, [role="columnheader"])[aria-sort="descending"] .lr-sort::after {
    block-size: 8px;
    background: var(--tool-ink-strong);
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
  }
  /* A touch screen needs a 44px target, but the header row stays 44px, not 60: the button's extra height
     goes into the cell's own padding, so it is taken back with a negative margin. */
  @media (pointer: coarse) {
    .lr-sort {
      min-block-size: 44px;
      min-inline-size: 44px;
      margin-block: -8px;
    }
  }

  /* ---------- Detail panel: facts and a few small edits about one chosen thing ----------
     Not a menu (commands) and not a dialog (a decision that blocks). The tool places it next to the thing. The head row is a `header`, or a `div.lr-detail-head`.
     Works as a plain element or as a native popover: the browser's popover box styles are reset so both look the same. */
  .lr-detail {
    display: grid;
    gap: var(--space-1);
    inset: auto;
    margin: 0;
    inline-size: 340px;
    /* 100% is the parent for a plain element and the viewport for a popover. */
    max-inline-size: min(100%, calc(100vw - 2 * var(--space-2)));
    block-size: auto;
    max-block-size: calc(100dvh - 2 * var(--space-2));
    padding: 12px var(--space-2);
    overflow: auto;
    border: 1px solid var(--tool-line-strong);
    background: var(--ground);
    color: var(--ink);
  }
  /* A popover that is closed stays closed: the grid above would otherwise show it. */
  .lr-detail:where([popover]:not(:popover-open)) { display: none; }
  .lr-detail:focus-visible { outline: 0; }
  .lr-detail > :is(header, .lr-detail-head) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
  }
  /* The close button: an icon button, 28px, and 44px on a touch screen. Give it aria-label="Close". */
  .lr-detail-close {
    display: inline-grid;
    place-items: center;
    flex: none;
    min-inline-size: 28px;
    min-block-size: 28px;
    padding: 0;
  }
  @media (pointer: coarse) {
    .lr-detail-close { min-inline-size: 44px; min-block-size: 44px; }
  }

  /* Facts: a term column of fixed width and the value beside it. Wrap each term and value in a div. */
  .lr-facts { display: grid; gap: 4px; margin: 0; }
  .lr-facts > div {
    display: grid;
    grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr);
    gap: var(--space-1);
  }
  .lr-facts dt { color: var(--tool-ink-muted); overflow-wrap: anywhere; }
  .lr-facts dd { margin: 0; overflow-wrap: anywhere; }
}
