/* Layout, type and every shared component. Colors come only from variables:
   tokens.css, then a site's theme, then the owner's saved colors. */

/* Figtree. Copyright 2022 The Figtree Project Authors. SIL Open Font License
   1.1 (OFL-figtree.txt beside this file). Served by this site only. */
@font-face {
  font-family: "Figtree";
  src: url("figtree-latin.4ba7d3d0.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  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;
}

:root {
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* A theme may set these two, and nothing else below. They are used by the
     site name in the top bar and by the .display class only. */
  --font-display: var(--font-ui);
  --font-display-weight: 700;

  --text-1: 0.8125rem;
  --text-2: 0.9375rem;
  --text-3: 1rem;
  --text-4: 1.1875rem;
  --text-5: 1.5rem;
  --text-6: 1.75rem;
  --text-display: clamp(2.125rem, 1.4rem + 3.2vw, 3.25rem);
  --weight-regular: 400;
  --weight-medium: 600;
  --weight-bold: 700;
  --leading-body: 1.5;
  --leading-heading: 1.15;
  --leading-display: 1.05;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2.25rem;
  --space-7: 3.5rem;
  --space-8: 5rem;

  --radius-1: 4px;
  --radius-2: 8px;
  --radius-3: 14px;
  --line-1: 1px;
  --line-2: 2px;
  --tap: 2.75rem;
  --control: 3rem;

  /* --frame is the widest the page gets and grows on a computer screen;
     --column holds a form, --read text or a table, --menu the admin menu. */
  --frame: 40rem;
  --gutter: var(--space-4);
  --column: 34rem;
  --read: 46rem;
  --menu: 14.5rem;

  --fast: 120ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow-1: 0 1px 2px color-mix(in srgb, var(--color-text) 12%, transparent);
  --shadow-2: 0 10px 30px color-mix(in srgb, var(--color-text) 16%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-3);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
h1, h2, h3 { overflow-wrap: break-word; line-height: var(--leading-heading); font-weight: var(--weight-bold); text-wrap: balance; }
h1 { font-size: var(--text-6); letter-spacing: -0.015em; }
h2 { font-size: var(--text-5); letter-spacing: -0.01em; }
h3 { font-size: var(--text-4); }
strong, b { font-weight: var(--weight-bold); }
code { font-family: var(--font-mono); font-size: 0.92em; }

/* The headline a theme sets in its own lettering. */
.display { font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: var(--text-display); line-height: var(--leading-display); letter-spacing: 0; }

/* Links */
a { color: var(--color-brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.link-row, .form-foot a { display: inline-flex; align-items: center; min-height: var(--tap); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Skip link: first thing a keyboard user reaches. */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: 0;
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--color-brand);
  color: var(--color-on-brand);
  border-radius: 0 0 var(--radius-2) var(--radius-2);
  transform: translateY(-120%);
}
.skip-link:focus { transform: translateY(0); }

/* Shared inner width: the bar, the footer, main, and the inside of a band. */
.bar-inner, .cookie-notice, main, .footer-inner, .band-inner {
  width: 100%;
  max-width: var(--frame);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* Top bar */
.bar { background: var(--color-brand); color: var(--color-on-brand); }
.bar-inner { display: flex; align-items: center; gap: var(--space-3); min-height: 3.75rem; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.bar a { color: var(--color-on-brand); text-decoration: none; }
.brand { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap); font-family: var(--font-display); font-weight: var(--font-display-weight); font-size: var(--text-4); line-height: 1.1; }
.brand > * { order: -1; flex: none; } /* the theme's mark sits before the name on screen */
.bar-area { padding: 0.1rem var(--space-2); border: var(--line-1) solid var(--color-on-brand); border-radius: var(--radius-1); font-size: var(--text-1); font-weight: var(--weight-medium); letter-spacing: 0.04em; text-transform: uppercase; }
.bar-nav { margin-left: auto; min-width: 0; display: flex; align-items: center; gap: var(--space-4); }
.bar-nav a:not(.btn) { display: block; line-height: var(--tap); min-width: 0; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--weight-medium); font-size: var(--text-2); }

/* The frame holds the admin menu, the cookie notice and main. */
.frame { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }
main { flex: 1 0 auto; padding-top: var(--space-5); padding-bottom: var(--space-7); display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
main:focus { outline: none; }
.frame-wide > main { max-width: none; padding: 0; gap: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.muted { color: var(--color-text-muted); font-size: var(--text-2); }
.lede { color: var(--color-text-muted); font-size: var(--text-4); line-height: 1.4; }

/* Page header: the heading, an optional lede, optional actions at the right. */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-5); }
.page-head > div { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }

/* Bands: full-width sections of a frame-wide page. */
.band { padding-top: var(--space-7); padding-bottom: var(--space-7); }
.band-inner { display: flex; flex-direction: column; gap: var(--space-5); }
.band-surface { background: var(--color-surface); }
.band-brand { background: var(--color-brand); color: var(--color-on-brand); }
.band-primary { background: var(--color-primary); color: var(--color-on-primary); }
.band-brand a:not(.btn) { color: var(--color-on-brand); }
.band-primary a:not(.btn) { color: var(--color-on-primary); }

/* Footer */
.footer { font-size: var(--text-2); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5); padding-top: var(--space-3); padding-bottom: var(--space-5); border-top: var(--line-1) solid var(--color-border); }
.footer a { display: inline-flex; align-items: center; min-height: var(--tap); }
.frame-wide + .footer { background: var(--color-brand); color: var(--color-on-brand); }
.frame-wide + .footer .footer-inner { border-top: 0; padding-top: var(--space-5); }
.frame-wide + .footer a { color: var(--color-on-brand); }

/* Messages */
#status:empty { display: none; }
.note { padding: var(--space-3) var(--space-4); border: var(--line-1) solid currentColor; border-radius: var(--radius-2); font-size: var(--text-2); }
.note-info { background: var(--color-tint-brand); color: var(--color-brand); }
.note-ok { background: var(--color-tint-success); color: var(--color-success); }
.note-warn { background: var(--color-tint-warning); color: var(--color-warning); }
.note-bad { background: var(--color-tint-danger); color: var(--color-danger); }
div.note, section.note { display: flex; flex-direction: column; gap: var(--space-3); }

.cookie-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  font-size: var(--text-2);
}
.cookie-notice p { flex: 1 1 14rem; }
.frame-wide > .cookie-notice { margin-top: 0; max-width: none; background: var(--color-tint-brand); }

/* Card: one thing that is a separate object on a page with other content. */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  background: var(--color-surface);
  border: var(--line-1) solid var(--color-border);
  border-radius: var(--radius-3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control);
  padding: 0 var(--space-5);
  font: inherit;
  font-weight: var(--weight-bold);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  color: var(--color-brand);
  background: var(--color-surface);
  border: var(--line-2) solid var(--color-control-border);
  border-radius: var(--radius-2);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary-edge); }
.btn-brand { background: var(--color-brand); color: var(--color-on-brand); border-color: var(--color-brand); }
.btn-quiet { background: transparent; border-color: transparent; padding-left: var(--space-3); padding-right: var(--space-3); }
.btn-danger { color: var(--color-danger); border-color: var(--color-danger); }
.btn-on-brand { background: transparent; color: var(--color-on-brand); border-color: var(--color-on-brand); }
.btn-small { min-height: var(--tap); padding: 0 var(--space-4); font-size: var(--text-2); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--color-border); color: var(--color-text-muted); border-color: var(--color-border); cursor: not-allowed; transform: none; }
.btn-quiet[disabled], .btn-quiet[aria-disabled="true"] { background: transparent; border-color: transparent; }
/* A button whose form is on its way keeps its colors and shows a ring. */
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::before { content: ""; width: 1em; height: 1em; border: var(--line-2) solid currentColor; border-right-color: transparent; border-radius: 50%; animation: turn 0.7s linear infinite; }
.btn-primary[aria-busy="true"] { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary-edge); }
@keyframes turn { to { transform: rotate(1turn); } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* Forms */
form { display: flex; flex-direction: column; gap: var(--space-4); }
.cookie-notice form { flex-direction: row; }
.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
label { font-weight: var(--weight-medium); }
input, select, textarea {
  width: 100%;
  min-height: var(--control);
  padding: 0 var(--space-3);
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: var(--line-2) solid var(--color-control-border);
  border-radius: var(--radius-2);
  transition: border-color var(--fast) var(--ease);
}
textarea { min-height: 7rem; padding-top: var(--space-3); padding-bottom: var(--space-3); resize: vertical; }
select {
  appearance: none;
  padding-right: var(--space-6);
  background-image: linear-gradient(45deg, transparent 50%, var(--color-text) 50%), linear-gradient(135deg, var(--color-text) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 50%, calc(100% - 0.8rem) 50%;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
}
input[type="color"] { flex: none; width: 5.5rem; min-width: 5.5rem; max-width: none; height: var(--control); padding: var(--space-1); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; min-height: 0; padding: 0; flex: none; accent-color: var(--color-brand); }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); font-weight: var(--weight-regular); cursor: pointer; }
::placeholder { color: var(--color-text-muted); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-color: var(--color-text); }
input[readonly], textarea[readonly] { background: var(--color-bg); }
input[disabled], select[disabled], textarea[disabled] { background: var(--color-border); color: var(--color-text-muted); border-color: var(--color-border); cursor: not-allowed; }
input[disabled] + label, .check:has([disabled]) { color: var(--color-text-muted); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--color-danger); }
.help { color: var(--color-text-muted); font-size: var(--text-2); }
.field-error { color: var(--color-danger); font-size: var(--text-2); font-weight: var(--weight-medium); }
/* Secondary links under a form, set off by a hairline. */
.form-foot { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); padding-top: var(--space-4); border-top: var(--line-1) solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-2); }

/* Password strength hint, filled by the script. The server decides. */
.strength { display: grid; gap: var(--space-1); }
.strength-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-1); }
.strength-bar span { height: 6px; border-radius: 3px; background: var(--color-border); }
.strength[data-level="1"] .strength-bar span:nth-child(-n+1) { background: var(--color-danger); }
.strength[data-level="2"] .strength-bar span:nth-child(-n+2) { background: var(--color-warning); }
.strength[data-level="3"] .strength-bar span:nth-child(-n+3),
.strength[data-level="4"] .strength-bar span { background: var(--color-success); }
.strength-text { font-size: var(--text-2); color: var(--color-text-muted); min-height: 1.4em; }

/* The bot trap field: off-screen, never seen or reached by people. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Settings rows: one setting, saved by itself, under a group heading. */
.setting-group { display: flex; flex-direction: column; }
.setting-group > h2 { font-size: var(--text-4); padding-bottom: var(--space-2); border-bottom: var(--line-2) solid var(--color-text); }
.setting-row { padding: var(--space-4) 0; border-bottom: var(--line-1) solid var(--color-border); gap: var(--space-3); }
.setting-row > .btn { align-self: flex-end; }
.setting-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-count { color: var(--color-text-muted); font-size: var(--text-2); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-2); font-variant-numeric: tabular-nums; }
th, td { padding: var(--space-3) var(--space-4) var(--space-3) 0; text-align: left; vertical-align: middle; border-bottom: var(--line-1) solid var(--color-border); }
thead th { font-size: var(--text-1); font-weight: var(--weight-medium); letter-spacing: 0.02em; white-space: nowrap; border-bottom: var(--line-2) solid var(--color-text); }
tbody th { font-weight: var(--weight-medium); overflow-wrap: anywhere; }
tbody tr { height: 3.25rem; }

/* Status tags: the word says the state; the color supports it. */
.tag { display: inline-flex; align-items: center; gap: 0.4em; min-height: 1.625rem; padding: 0 var(--space-2); border-radius: var(--radius-1); font-size: var(--text-1); font-weight: var(--weight-medium); white-space: nowrap; background: var(--color-surface); color: var(--color-text); border: var(--line-1) solid var(--color-border); }
.tag-ok { background: var(--color-tint-brand); color: var(--color-brand); border-color: transparent; }
.tag-ok::before { content: ""; width: 0.45em; height: 0.45em; border-radius: 50%; background: currentColor; }
.tag-bad { background: var(--color-tint-danger); color: var(--color-danger); border-color: transparent; }
.tag-bad::before { content: ""; width: 0.6em; height: 2px; background: currentColor; }
.tag-warn { background: var(--color-tint-warning); color: var(--color-warning); border-color: transparent; }
.tag-warn::before { content: ""; width: 0.45em; height: 0.45em; background: currentColor; transform: rotate(45deg); }
.tag-muted { color: var(--color-text-muted); }
.tag-muted::before, .tag-plain::before { content: ""; width: 0.45em; height: 0.45em; border-radius: 50%; border: 1.5px solid currentColor; }
.status-big { margin: 0; }
.status-big .tag { min-height: 2.25rem; padding: 0 var(--space-4); font-size: var(--text-3); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.key-row { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) 0; border-bottom: var(--line-1) solid var(--color-border); }
.notices { display: flex; flex-direction: column; gap: var(--space-2); }
.recent-note { padding-top: var(--space-3); }
.tag-strong { background: var(--color-brand); color: var(--color-on-brand); border-color: transparent; }

/* Detail list: label and value pairs. */
.details { display: grid; grid-template-columns: minmax(0, 1fr); }
.details dt { padding-top: var(--space-3); color: var(--color-text-muted); font-size: var(--text-2); }
.details dd { padding-bottom: var(--space-3); border-bottom: var(--line-1) solid var(--color-border); overflow-wrap: anywhere; }

/* A plain list of links with a line about each (the admin home page). */
.link-list { list-style: none; padding: 0; display: flex; flex-direction: column; }
.link-list li { display: flex; flex-direction: column; padding: var(--space-3) 0; border-bottom: var(--line-1) solid var(--color-border); }
.link-list a { font-weight: var(--weight-medium); align-self: flex-start; }

/* Admin menu: folded behind one row on a phone, a column at the side on a
   computer. The layout draws it once for each and shows one. */
.admin-menu { display: none; }
.menu-fold { border-bottom: var(--line-1) solid var(--color-border); background: var(--color-surface); }
.menu-fold > summary { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control); padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px)); cursor: pointer; font-weight: var(--weight-bold); list-style: none; }
.menu-fold > summary::-webkit-details-marker { display: none; }
.menu-fold > summary::after { content: ""; margin-left: auto; width: 0.55rem; height: 0.55rem; border-right: var(--line-2) solid currentColor; border-bottom: var(--line-2) solid currentColor; transform: rotate(45deg) translateY(-0.15rem); transition: transform var(--fast) var(--ease); }
.menu-fold[open] > summary::after { transform: rotate(225deg) translateY(-0.15rem); }
.menu-fold-current { font-weight: var(--weight-regular); color: var(--color-text-muted); }
.menu-fold > nav { padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) var(--space-4) max(var(--gutter), env(safe-area-inset-left, 0px)); }
.menu-list { display: flex; flex-direction: column; gap: var(--space-1); }
.menu-list ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-list a { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-3); border-radius: var(--radius-2); color: var(--color-text); text-decoration: none; }
.menu-list a.menu-top { font-weight: var(--weight-bold); }
.menu-list a[aria-current="page"] { background: var(--color-brand); color: var(--color-on-brand); font-weight: var(--weight-medium); }
/* A group: its name in bold drops open to its pages. */
.menu-group > summary { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-3); border-radius: var(--radius-2); font-weight: var(--weight-bold); cursor: pointer; list-style: none; }
.menu-group > summary::-webkit-details-marker { display: none; }
.menu-group > summary::after { content: ""; margin-left: auto; width: 0.45rem; height: 0.45rem; border-right: var(--line-2) solid currentColor; border-bottom: var(--line-2) solid currentColor; transform: rotate(-45deg); transition: transform var(--fast) var(--ease); }
.menu-group[open] > summary::after { transform: rotate(45deg) translate(-0.1rem, -0.1rem); }
.menu-group > ul { padding: 0 0 var(--space-2) var(--space-3); }

/* Recovery codes and the setup key */
.codes { list-style: none; padding: var(--space-4); display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--space-2); background: var(--color-surface); border: var(--line-1) solid var(--color-border); border-radius: var(--radius-2); }
.codes code, #key { font-family: var(--font-mono); font-size: 1.1rem; letter-spacing: 0.05em; overflow-wrap: anywhere; }

/* Groups that are a column on a phone and side by side on a computer. */
.card-grid, .look-layout { display: flex; flex-direction: column; gap: var(--space-5); }

/* The Look page's color rows: a swatch big enough to see, the color's name
   beside it, its code, then small buttons. One line where there is room. */
.look-colors .setting-row { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: var(--space-3) 0; }
.look-colors .setting-row > .field { flex: 1 1 15rem; display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2) var(--space-3); }
.look-colors .setting-row > .field > label { padding: 0; }
.look-colors .setting-row > .field > .field-error { flex-basis: 100%; order: -1; }
.look-colors .setting-tools { flex: 0 1 auto; margin-left: auto; }
.look-colors .setting-tools code { color: var(--color-text-muted); }
.look-colors .setting-tools .btn { padding: 0 var(--space-3); }
.look-colors input[type="color"] { width: 4.5rem; min-width: 4.5rem; height: var(--tap); }

/* The Look page preview: the site's own variables, which the page script
   overrides on this block only while a picker moves. */
.look-preview { background: var(--color-bg); color: var(--color-text); border: var(--line-1) solid var(--color-control-border); border-radius: var(--radius-3); overflow: hidden; }
.look-preview-bar { background: var(--color-brand); color: var(--color-on-brand); padding: var(--space-3) var(--space-4); font-family: var(--font-display); font-weight: var(--font-display-weight); }
.look-preview-body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); }
.look-preview a { color: var(--color-brand); }
.look-preview-card { align-self: stretch; padding: var(--space-3); background: var(--color-surface); border: var(--line-1) solid var(--color-border); border-radius: var(--radius-2); }
.look-preview-button { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-4); font-weight: var(--weight-bold); background: var(--color-primary); color: var(--color-on-primary); border: var(--line-2) solid var(--color-primary-edge); border-radius: var(--radius-2); }

/* Focus is always an outline, never removed. */
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.bar :focus-visible, .skip-link:focus-visible, .band-brand :focus-visible, .frame-wide + .footer :focus-visible, .menu-list a[aria-current="page"]:focus-visible { outline: 3px solid var(--color-on-brand); outline-offset: 2px; }
.band-primary :focus-visible { outline: 3px solid var(--color-on-primary); outline-offset: 2px; }

/* Hover only where a pointer hovers, so a tap leaves nothing looking hovered. */
@media (hover: hover) {
  a:hover { text-decoration-thickness: 2px; }
  .bar a:not(.btn):hover { text-decoration: underline; }
  .btn:hover { background: var(--color-tint-brand); }
  .btn-primary:hover { background: var(--color-primary-hover); }
  .btn-brand:hover, .btn-on-brand:hover { background: var(--color-brand-strong); border-color: var(--color-brand-strong); }
  .btn-on-brand:hover { border-color: var(--color-on-brand); }
  .btn-danger:hover { background: var(--color-tint-danger); }
  .btn[disabled]:hover, .btn[aria-disabled="true"]:hover { background: var(--color-border); border-color: var(--color-border); }
  .btn-quiet[disabled]:hover, .btn-quiet[aria-disabled="true"]:hover { background: transparent; border-color: transparent; }
  input:hover, select:hover, textarea:hover { border-color: var(--color-text); }
  input[disabled]:hover, select[disabled]:hover, textarea[disabled]:hover { border-color: var(--color-border); }
  input[aria-invalid="true"]:hover, textarea[aria-invalid="true"]:hover, select[aria-invalid="true"]:hover { border-color: var(--color-danger); }
  tbody tr:hover { background: var(--color-bg); }
  .menu-list a:hover, .menu-fold > summary:hover, .menu-group > summary:hover { background: var(--color-tint-brand); }
  .menu-list a[aria-current="page"]:hover { background: var(--color-brand); }
  .check:hover { text-decoration: underline; }
}

/* A small phone: a wide table turns each row into a short block. */
@media (max-width: 39.99rem) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-stack tbody tr { display: block; height: auto; padding: var(--space-3) 0; border-bottom: var(--line-1) solid var(--color-border); }
  .table-stack th, .table-stack td { display: block; padding: 0.15rem 0; border: 0; }
  .table-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--color-text-muted); }
  .table-stack td:empty { display: none; }
  main > form > .btn, main > .stack > form > .btn { align-self: stretch; }
}

/* ---- Pictures, file fields, pages of a list, empty states, profile pages ---- */
/* Picture frame: a person's photo or logo, or their initial. */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 3rem; height: 3rem; border-radius: 50%; overflow: hidden; background: var(--color-tint-brand); color: var(--color-brand); border: var(--line-1) solid var(--color-border); font-weight: var(--weight-bold); font-size: var(--text-4); line-height: 1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-small { width: 2rem; height: 2rem; font-size: var(--text-2); }
.avatar-large { width: 4.5rem; height: 4.5rem; font-size: var(--text-5); }

/* Photo grid: square crops, each a link to the full picture. */
.photo-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.photo-grid li { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.photo-grid .photo { display: block; aspect-ratio: 1; border-radius: var(--radius-2); overflow: hidden; background: var(--color-tint-brand); border: var(--line-1) solid var(--color-border); }
.photo-grid img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-grid .btn { align-self: stretch; }

/* File field: the browser's own control at the height and edge of the others. */
input[type="file"] { width: 100%; min-height: var(--control); padding: var(--space-2); font: inherit; font-size: var(--text-2); color: var(--color-text); background: var(--color-surface); border: var(--line-1) solid var(--color-control-border); border-radius: var(--radius-2); }
input[type="file"]::file-selector-button { min-height: 2rem; margin-right: var(--space-3); padding: 0 var(--space-3); font: inherit; font-weight: var(--weight-medium); color: var(--color-text); background: var(--color-bg); border: var(--line-1) solid var(--color-control-border); border-radius: var(--radius-1); cursor: pointer; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-3); border-top: var(--line-1) solid var(--color-border); }
.pager a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: var(--weight-medium); }
.pager-now { color: var(--color-text-muted); font-size: var(--text-2); }
.pager-gap { min-width: 4.5rem; }

/* Empty state: one line saying what is missing, and one action. */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); padding: var(--space-5); border: var(--line-1) dashed var(--color-control-border); border-radius: var(--radius-2); color: var(--color-text-muted); }

/* A section of a page with its heading: used by the profile pages. */
.section { display: flex; flex-direction: column; gap: var(--space-3); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); padding-bottom: var(--space-2); border-bottom: var(--line-2) solid var(--color-text); }
.person { display: flex; align-items: flex-start; gap: var(--space-4); min-width: 0; }
.person > div { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.person h1, .person .person-name { overflow-wrap: anywhere; }
.prose p { white-space: pre-line; }
.prose { display: flex; flex-direction: column; gap: var(--space-3); max-width: var(--read); overflow-wrap: anywhere; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-3); }
.inline-form .field { flex: 1 1 12rem; }

/* A column that only a wider screen has room for, and a cell that holds one small button. */
.wide-only { display: none; }
.cell-action { text-align: right; white-space: nowrap; }

@media (min-width: 40rem) {
  :root { --text-6: 2rem; }
  main { padding-top: var(--space-6); }
  .details { grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); column-gap: var(--space-5); }
  .details dt, .details dd { padding: var(--space-3) 0; border-bottom: var(--line-1) solid var(--color-border); }
  .details dt { font-size: inherit; }
  form > .btn, .card > form > .btn { align-self: flex-start; }
  .filter { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .filter .field { flex: 0 1 24rem; }
  .filter > .btn { align-self: flex-end; }
  .setting-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: var(--space-4); }
  .setting-row > .field, .setting-row > .strength { grid-column: 1; }
  .setting-row > .btn, .setting-row > .setting-tools { grid-column: 2; align-self: end; }
}

/* A computer screen: the frame widens. A public page keeps its form or text
   in a centered column; admin pages use the frame. */
@media (min-width: 48rem) {
  :root { --frame: 76rem; --gutter: var(--space-6); }
  .frame-column > main { max-width: calc(var(--column) + 2 * var(--gutter)); }
  .frame-read > main { max-width: calc(var(--read) + 2 * var(--gutter)); }
  main p:not(.note) { max-width: 70ch; }
  .card { padding: var(--space-5); }
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); align-items: start; }
  /* A settings row: the name, then the control with its help, then Save. */
  .setting-row { grid-template-columns: var(--menu) minmax(0, 1fr) auto; align-items: start; }
  .setting-row > .field { grid-column: 1 / 3; display: grid; grid-template-columns: subgrid; row-gap: var(--space-2); }
  .setting-row > .field > label { grid-column: 1; grid-row: 1 / span 3; padding-top: 0.7rem; }
  .setting-row > .field > :not(label) { grid-column: 2; max-width: 34rem; }
  .setting-row > .btn, .setting-row > .setting-tools { grid-column: 3; align-self: start; }
}

/* Wide enough for the admin menu to sit down the left of the content. */
@media (min-width: 60rem) {
  .menu-fold { display: none; }
  .frame-admin {
    display: grid;
    grid-template-columns: var(--menu) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "menu notice" "menu main";
    column-gap: var(--space-6);
    width: 100%;
    max-width: var(--frame);
    margin: 0 auto;
    padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  }
  .frame-admin > .cookie-notice { grid-area: notice; padding-left: 0; padding-right: 0; }
  .frame-admin > main { grid-area: main; max-width: none; padding-left: 0; padding-right: 0; }
  .frame-admin > .admin-menu {
    display: block;
    grid-area: menu;
    align-self: start;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    padding: var(--space-6) var(--space-4) var(--space-6) 0;
    border-right: var(--line-1) solid var(--color-border);
    min-height: 100%;
  }
}

/* The Look page: the preview stays in view beside the color rows. */
@media (min-width: 64rem) {
  .look-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-6); align-items: start; }
  .look-preview-panel { position: sticky; top: var(--space-4); }
}

/* High-contrast mode: use the system colors and keep every edge visible. */
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; outline-offset: 2px; }
  .btn, input, select, textarea, .card, .note, .tag, .codes, .menu-fold, .admin-menu { border: 1px solid ButtonText; }
  .menu-group > summary { border: 1px solid ButtonText; }
  .btn-primary { border-width: 2px; }
  .skip-link { border: 1px solid ButtonText; }
  .menu-list a[aria-current="page"] { border: 2px solid Highlight; }
  .look-preview, .look-preview-card, .look-preview-button { border: 1px solid ButtonText; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:active { transform: none; }
}

@media (min-width: 40rem) {
  .wide-only { display: table-cell; }
  td .row-actions { flex-wrap: nowrap; }
  td .row-actions .btn, td.nowrap { white-space: nowrap; }
  .avatar-large { width: 6rem; height: 6rem; font-size: var(--text-6); }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 60rem) {
  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .frame-admin .photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
