/* Accessibility baseline shared by every page (the login page and the app shell); colours come from tokens.css.
 * Page-specific rules live in the <style> of Page.java and may override these. */

/* IBM Plex, self-hosted (SIL OFL 1.1, see fonts/OFL.txt): exactly the faces the UI uses (Sans 400, 400 italic, 600; Mono 400, 600), Latin and Latin Extended, so no weight or
 * style is synthesised by the browser. Keep font-weight in the CSS to 400 or 600 (ThemeTest checks). No request
 * leaves for a third-party font service, so no visitor IP address is passed on without consent. The unicode-range lets
 * the browser fetch only the files a page needs. */
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-ext-400-normal.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;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-400-normal.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;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-ext-400-italic.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;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-400-italic.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;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-ext-600-normal.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;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-600-normal.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;
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-ext-400-normal.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;
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-400-normal.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;
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-ext-600-normal.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;
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-600-normal.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;
}
@font-face {
  font-family: 'IBM Plex Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-serif-latin-ext-400-normal.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;
}
@font-face {
  font-family: 'IBM Plex Serif'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-serif-latin-400-normal.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;
}
@font-face {
  font-family: 'IBM Plex Serif'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/ibm-plex-serif-latin-ext-600-normal.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;
}
@font-face {
  font-family: 'IBM Plex Serif'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/ibm-plex-serif-latin-600-normal.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;
}
/* Fallbacks metric-matched to Plex (size-adjust and the ascent / descent overrides), so the swap from the system face to
 * the webfont does not move the text. */
@font-face { font-family: 'Plex Sans Fallback'; src: local('Arial'); size-adjust: 100.5%; ascent-override: 102%; descent-override: 27%; line-gap-override: 0%; }
@font-face { font-family: 'Plex Serif Fallback'; src: local('Georgia'); size-adjust: 96%; ascent-override: 100%; descent-override: 28%; line-gap-override: 0%; }

html { font-size: 100%; }
body { font-size: 1rem; }

/* Links use the brand accent and underlined unless a component says otherwise (tabs, chips and buttons set
 * text-decoration:none themselves). Never the browser default, which is unreadable on the dark background. */
a { color: var(--accent); text-decoration: underline; text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }

/* Placeholders: the browser default is too faint (about 4:1) on both themes. */
::placeholder { color: var(--text-muted); opacity: 1; }

/* One visible keyboard focus ring everywhere: 2px, in the accent colour. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Touch targets of at least 44x44px for controls (WCAG 2.5.8 / 2.5.5). Links inside running text are exempt. */
button, summary, select, input:not([type=checkbox]):not([type=radio]), a.button, .theme-toggle {
  min-height: 44px; min-width: 44px; box-sizing: border-box;
}
/* room for the native arrow, so a long option ("Cada semana") does not run under it */
select { padding-inline-end: 1.75rem; max-width: 100%; }
input[type=checkbox], input[type=radio] { width: 24px; height: 24px; margin: 10px; }
/* Native controls wear the tokens, in both themes: checkboxes and radios are drawn from --border-strong, --bg, --accent and
 * --accent-text (not the browser's grey and blue), and date inputs and selects take the surface, text and border colours. */
input[type=checkbox], input[type=radio] {
  appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; flex: none;
  border: 2px solid var(--border-strong); background: var(--bg); color: var(--accent-text); cursor: pointer;
}
input[type=checkbox] { border-radius: 5px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ""; width: 11px; height: 6px; border-left: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: translate(0, -1px) rotate(-45deg); }
input[type=radio]:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: default; }
select, input[type=date] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 10px; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: inline-flex; align-items: center; min-height: 44px; }
a.button { display: inline-flex; align-items: center; }

/* The one primary action of a form on a phone sits at the bottom of the screen, within thumb reach. */
.bottom-action { display: flex; gap: .75rem; align-items: center; justify-content: space-between; }
@media (max-width: 640px) {
  .bottom-action { position: sticky; bottom: 0; padding: .75rem 0; background: var(--bg, Canvas); border-top: 1px solid var(--border, currentColor); z-index: 5; }
  .bottom-action .primary, .bottom-action a.button.primary { flex: 1 1 auto; }
}

/* Topic state chip and the cards of suggested places to look. */
.chip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--border-strong); font-size: .875rem; }
.chip-active { border-color: var(--accent); color: var(--accent); }
.chip-needs_attention { border-color: var(--warn); color: var(--warn); }
.chip-paused { color: var(--text-muted); }
ul.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
ul.cards > li.card { border: 1px solid var(--border); border-radius: 8px; padding: .75rem; background: var(--surface); }
details.advanced > summary { cursor: pointer; margin: 1rem 0; }

/* An empty state: one sentence and one button. */
.empty-state { display: grid; gap: .75rem; justify-items: start; margin: 1rem 0; }
.empty-state .empty, .empty-action { margin: 0; }

/* Activity indicators (busy.js). The spinner is the brand mark; it takes the colour of the text around it, and every size is fixed so
 * showing or hiding an indicator moves nothing: the status line keeps its height whether it is empty, busy or showing an error. */
.lg-status { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 1.8em; }
/* A staged wait (a list of steps): the page puts a .lg-progress block where the steps go, so the room for them is there before the first
 * step is shown and the content below never moves as the steps change. */
.lg-progress { display: block; min-height: 9em; }
/* a GET form waiting for its new page: the button's label gives way to the mark, in the same space */
.lg-nav-busy { position: relative; }
.lg-nav-busy > .lg-label { visibility: hidden; }
.lg-nav-busy > .lg-spinner { position: absolute; left: 50%; top: 50%; margin: -.8em 0 0 -.8em; }
.lg-progress.lg-status { display: flex; align-content: flex-start; }
.lg-spinner { display: inline-block; flex: none; width: 1.6em; height: 1.6em; color: var(--accent); }
.lg-spinner svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lg-spinner .n1, .lg-spinner .n2, .lg-spinner .n3, .lg-spinner .l1, .lg-spinner .l2 { opacity: .25; animation: lg-light 1.2s ease-in-out infinite; }
.lg-spinner .n1 { animation-delay: 0s; }
.lg-spinner .l1 { animation-delay: .2s; }
.lg-spinner .n2 { animation-delay: .4s; }
.lg-spinner .l2 { animation-delay: .6s; }
.lg-spinner .n3 { animation-delay: .8s; }
@keyframes lg-light { 0%, 100% { opacity: .25; } 30%, 60% { opacity: 1; } }
/* No motion: the mark stands still, its nodes at three steady strengths, so it still reads as "in progress" */
@media (prefers-reduced-motion: reduce) {
  .lg-spinner .n1, .lg-spinner .n2, .lg-spinner .n3, .lg-spinner .l1, .lg-spinner .l2 { animation: none; }
  .lg-spinner .n1, .lg-spinner .l1 { opacity: .45; }
  .lg-spinner .n2, .lg-spinner .l2 { opacity: .7; }
  .lg-spinner .n3 { opacity: 1; }
}
.lg-error { color: var(--danger); }
.lg-retry { font: inherit; }
.lg-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; flex-basis: 100%; }
.lg-stage { color: var(--text-muted); }
.lg-stage::before { content: "○ "; }
.lg-stage.done::before { content: "✓ "; }
.lg-stage.current { color: var(--text); }   /* no bolder weight: the list must not rewrap as the current step moves */
.lg-stage.current::before { content: "● "; color: var(--accent); }
.lg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lg-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; box-sizing: border-box; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 13px; line-height: 1.5; color: var(--text); }
.lg-chip[data-state="running"] { color: var(--accent); }
.lg-chip[data-state="failed"] { color: var(--danger); }
.lg-chip[data-state="stale"] { color: var(--warn); }
.lg-chip[data-state="done"]::before { content: "✓"; }
/* The chips of a topic's long jobs. While one is running the box keeps the room of its tallest state (a chip and, when polling has given up,
 * the Refresh button under it), so the page below does not move as the chips change. With no chips at all it takes no room. */
.job-chips { margin: 0 0 8px; }
.job-chips:empty { display: none; }
.job-chips[data-running="true"] { min-height: 4.6em; }
.actions > .status { min-height: 28px; }

/* Help tune your sources (Today, LG-51): collapsed by default, apart from the queue; the cards are not queue cards (no impressions, no marks). */
.today-tune { margin: 1.5rem 0; border-top: 1px solid var(--border); padding-top: .75rem; }
.today-tune > summary { cursor: pointer; font-weight: 600; }
.tune-card { margin: 1rem 0; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: .5rem; }
.tune-card .tune-ask { margin: 0 0 .25rem; font-weight: 600; }
.tune-card .tune-answers { display: flex; gap: .5rem; margin-top: .5rem; }
.tune-card[data-done] .tune-answers { display: none; }
