/* Sermon Clipper — design foundation, Ace product-screen pattern.
   White surfaces, near-black ink, one blue accent; hairlines, not shadows.
   Values come from the ace-inspired-websites "Observed tokens" JSON. The role
   names below predate it and are kept so styles.css needs no renames.
   Shared by the operator app (styles.css) and /login. The legacy public page
   has its own frozen copy (tokens-legacy.css).
   No network assets: fonts are vendored woff2 under /static/fonts/. */

/* ---------- Vendored fonts (variable woff2, self-hosted) ---------- */
@font-face {
  font-family: "Geist";
  src: url("fonts/geist.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Pinned, so native controls stay light on a dark OS when light is chosen
     (the page's meta color-scheme is "light dark"). */
  color-scheme: light;
  /* Surfaces: white everywhere; grey only for the sidebar, chips and hovers. */
  --paper-500: #ffffff; /* bg / card / surface */
  --paper-450: #f5f5f5; /* hover */
  --paper-400: #f4f4f5; /* chip / inner tile */
  --paper-350: #f0f0f0; /* divider between rows */
  --sidebar:   #fafafa;
  --selected:  #ededed; /* active nav item / selected row */
  --canvas:    #ffffff;

  /* Ink */
  --ink-900: #171717;
  --ink-950: #0a0a0a;
  /* Ink used as a FILL (inverse button, toast, brand mark). Separate from
     --ink-900 because dark mode turns ink text light but must keep fills dark. */
  --ink-fill: #171717;
  --ink-fill-hover: #262626;

  /* Blue — the one accent. JSON accentHover as the base: #3b82f6 with white
     text is 3.7:1, below AA at 12.5px. */
  --blue:        #2563eb;
  --blue-hover:  #1d4ed8;
  --blue-bright: #3b82f6;
  --blue-chip:   #eaf2fe;
  --blue-pale:   #eaf2fe;
  --on-blue:     #fff;   /* text on a --blue fill */

  /* Borders */
  --hair:        #ebebeb;
  --hair-strong: #e5e5e5; /* control border */
  --dashed:      #e4e4e4;

  /* Text */
  --text-1: #525252; /* secondary */
  --text-2: #737373; /* muted */
  --text-3: #8a8a8a; /* faint */

  /* Text on an ink fill */
  --on-ink-text: #ffffff;

  /* Status. Colour lives in a 6px dot (--*-dot); --red is the JSON danger text. */
  --green-dot: #16a34a;
  --amber-dot: #f97316;
  --red:       #dc2626;  --red-dot: #dc2626;

  /* Type */
  --font-display: "Geist", "Inter", -apple-system, "Helvetica Neue", sans-serif;
  --font-sans: "Geist", "Inter", -apple-system, "Helvetica Neue", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  /* Radii — tag 4 · control 6 · card 8 · popover 10 · dialog 12 */
  --r-chip: 999px; /* dots, switch, avatar stacks only */
  --r-shell: 12px;
  --r-16: 8px;
  --r-14: 8px;
  --r-11: 8px;
  --r-8: 6px;
  --r-5: 4px;

  /* Shadows — barely there */
  --shadow-shell: 0 8px 24px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lift: 0 1px 2px rgba(0, 0, 0, 0.04);

  /* Spacing (4px unit) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0.2, 1);
  --dur: 140ms;

  /* Layout */
  --rail-width: 232px;
  --shell-max: 1440px;
}

/* Dark — operator console only (index.html sets data-theme before first paint;
   /login never does). Same roles, neutral greys, no tint. --blue is lifted so
   it reads as TEXT on dark; its fills then carry dark text (--on-blue). */
[data-theme="dark"] {
  color-scheme: dark;
  --paper-500: #0a0a0a;
  --paper-450: #1a1a1a;
  --paper-400: #1c1c1c;
  --paper-350: #1f1f1f;
  --sidebar:   #111111;
  --selected:  #262626;
  --canvas:    #0a0a0a;
  --ink-900:   #ededed;
  --ink-fill:  #262626;
  --ink-fill-hover: #333333;
  --blue:        #60a5fa;
  --blue-hover:  #93c5fd;
  --blue-bright: #60a5fa;
  --blue-chip:   #172554;
  --blue-pale:   #172554;
  --on-blue:     #0a0a0a;
  --hair:        #262626;
  --hair-strong: #2e2e2e;
  --dashed:      #2e2e2e;
  --text-1: #a3a3a3;
  --text-2: #8f8f8f;
  --text-3: #737373;
  --green-dot: #22c55e;
  --amber-dot: #f97316;
  --red:       #f87171;  --red-dot: #ef4444;
  --shadow-shell: 0 8px 24px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 1px 2px rgba(0, 0, 0, 0.4);
}
/* The toggle shows the mode you would switch TO. */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }
html { font-size: 16px; }
body { margin: 0; }

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

button { font: inherit; color: inherit; cursor: pointer; }
input, button, textarea, select { font: inherit; color: inherit; }
input, textarea, select, button { border: none; background: none; }

ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }

/* The `hidden` attribute must always win over a component's own `display`
   (flex/grid/etc.) — otherwise toggling `.hidden = true` on an element whose
   class sets display:flex/grid does nothing visually. Load-bearing: the
   operator view-router and both tab bars depend on this. */
[hidden] { display: none !important; }

/* ---------- Base ---------- */
body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--blue-chip); }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--paper-500), 0 0 0 4px var(--blue);
  border-radius: var(--r-8);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Icons ----------
   Ace stroke icons: 1.6px lines at any size. non-scaling-stroke makes the width
   screen pixels, so 16- and 24-unit viewBoxes (and icons app.js builds) match. */
svg[stroke="currentColor"] :is(path, circle, rect, line, polyline, polygon) {
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

/* ---------- Type helpers ---------- */
.mono, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.overline {
  font-size: 12px;
  color: var(--text-2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  padding: 0 10px;
  border-radius: var(--r-8);
  border: 1px solid transparent;
  color: var(--ink-900);
  background: var(--paper-500);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn-primary { background: var(--blue); color: var(--on-blue); }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }

.btn-ink { background: var(--ink-fill); color: var(--on-ink-text); }
.btn-ink:hover:not(:disabled) { background: var(--ink-fill-hover); }

.btn-ghost {
  background: var(--paper-500);
  border-color: var(--hair-strong);
  color: var(--ink-900);
  box-shadow: var(--shadow-lift);
}
.btn-ghost:hover:not(:disabled) { background: var(--paper-450); }

/* Armed state of a two-click destructive button. `.lib-del.is-confirm` does the
   same job for the library's `×`; this is the variant for a labelled .btn. */
.btn.is-confirm { background: var(--paper-500); border-color: var(--hair-strong); color: var(--red); }
.btn.is-confirm:hover:not(:disabled) { background: var(--paper-450); }
.btn-icon.is-confirm { width: auto; padding: 0 8px; font-size: 12px;
  background: var(--paper-500); border-color: var(--hair-strong); color: var(--red); }

.btn-sm { padding: 0 8px; font-size: 12px; }
/* Controls carrying the Ace control shadow must restate the focus ring: their
   box-shadow would otherwise replace the global :focus-visible one. */
.btn:focus-visible, .btn-icon:focus-visible, .btn-row:focus-visible,
.btn-approve:focus-visible, .list-editor-remove:focus-visible, .segmented-btn.is-selected:focus-visible {
  box-shadow: 0 0 0 2px var(--paper-500), 0 0 0 4px var(--blue);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: var(--r-8);
  background: var(--paper-500);
  border: 1px solid var(--hair-strong);
  box-shadow: var(--shadow-lift);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon:hover:not(:disabled) { background: var(--paper-400); color: var(--ink-900); }
.btn-icon:disabled { opacity: 0.5; cursor: default; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1;
  padding: 0 7px;
  border-radius: var(--r-5);
  background: var(--paper-400);
  color: var(--ink-900);
  white-space: nowrap;
}
/* Status: a 6px dot + text. The colour is the dot's, never the text's. */
.chip-blue::before, .chip-green::before, .chip-amber::before, .chip-red::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
}
.chip-blue::before  { background: var(--blue-bright); }
.chip-green::before { background: var(--green-dot); }
.chip-amber::before { background: var(--amber-dot); }
.chip-red::before   { background: var(--red-dot); }

/* ---------- Card / hero surfaces ---------- */
.card {
  background: var(--paper-500);
  border: 1px solid var(--hair);
  border-radius: var(--r-16);
  box-shadow: var(--shadow-lift);
  padding: 16px;
}

/* ---------- Form controls ---------- */
.input,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
.select-control,
.textarea-control {
  width: 100%;
  background: var(--paper-500);
  border: 1px solid var(--hair-strong);
  border-radius: var(--r-8);
  box-shadow: var(--shadow-lift);
  height: 28px;
  padding: 4px 10px;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--ink-900);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder,
input::placeholder,
.textarea-control::placeholder { color: var(--text-2); }

.input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
.select-control:focus,
.textarea-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--paper-500), 0 0 0 4px var(--blue);
}

.textarea-control { height: auto; padding: 6px 10px; resize: vertical; line-height: 1.5; }

.select-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23737373' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 24px;
  cursor: pointer;
}

/* ---------- Switch (toggle) ---------- */
.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative;
  flex: none;
  width: 30px;
  height: 18px;
  border-radius: var(--r-chip);
  background: var(--hair-strong);
  transition: background var(--dur) var(--ease);
}
.switch-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: var(--r-chip);
  background: #fff;
  box-shadow: var(--shadow-lift);
  transition: transform var(--dur) var(--ease);
}
.switch-input:checked + .switch-track { background: var(--blue); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(12px); }
.switch-input:focus-visible + .switch-track {
  box-shadow: 0 0 0 2px var(--paper-500), 0 0 0 4px var(--blue);
}
.switch-text { font-size: 12.5px; }

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--paper-400);
  border-radius: var(--r-8);
}
.segmented-btn {
  height: 24px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
  background: transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.segmented-btn.is-selected {
  background: var(--paper-500);
  color: var(--ink-900);
  box-shadow: var(--shadow-lift);
}

/* ---------- Tabs (shared: operator + public page) ---------- */
.tab-bar, .tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--hair);
}
.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  transition: color var(--dur) var(--ease);
}
.tab-btn:hover { color: var(--ink-900); }
.tab-btn svg { width: 14px; height: 14px; flex: none; }
.tab-btn.is-active { color: var(--blue); }
.tab-btn.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--blue);
}

/* ---------- Coming-soon placeholder ---------- */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 340px;
  gap: 12px;
  padding: 32px 24px;
  border: 1px solid var(--hair);
  border-radius: var(--r-16);
  background: var(--paper-500);
}
.coming-soon-title { font-size: 13px; font-weight: 500; margin: 0; }
.coming-soon-text { font-size: 12.5px; color: var(--text-2); margin: 0; max-width: 42ch; }

/* ---------- Animations ---------- */
@keyframes sc-spin { to { transform: rotate(360deg); } }
@keyframes sc-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
