/* EmbleHart design tokens and shared furniture.
   The default is Midnight - dark near-black with a cool cast and one
   electric blue accent. Three sibling themes live below: Parchment (warm
   light), Meadow (soft green light), Ember (warm dark). Each is a full
   override of the token set, not a delta, so changing themes never leaves
   a stale value from the previous palette on any element. */

:root,
:root[data-theme="midnight"] {
  color-scheme: dark;

  /* Neutrals carry a slight blue cast so they sit with the accent rather
     than fighting it. Nothing is pure #000 - that flattens depth. */
  --bg: #08090d;
  --bg-2: #0b0d12;
  --surface: #101219;
  --surface-2: #161922;
  --surface-3: #1d212c;

  --ink: #f4f6fa;
  --ink-2: #c6ccda;
  --muted: #8b93a5;
  /* The dimmest text tier still has to clear 4.5:1, including where it sits
     on a tinted surface like a selected card, so it cannot go much below this. */
  --faint: #7c8598;

  --line: #1e222d;
  --line-strong: #2b3140;
  --hairline: rgba(255, 255, 255, .06);

  /* --accent is for solid fills carrying white text; it is pitched a shade
     deeper than the brand blue so white sits at ~5:1 rather than scraping
     4.5. --accent-text is the brighter tone for links and accent text on dark. */
  --accent: #2a63f0;
  --accent-hover: #4a80ff;
  --accent-text: #78a4ff;
  --accent-soft: rgba(47, 107, 255, .14);
  --accent-line: rgba(47, 107, 255, .38);
  --accent-ink: #ffffff;
  --accent-glow: rgba(47, 107, 255, .32);

  --good: #34d399;
  --good-soft: rgba(52, 211, 153, .13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .13);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, .13);

  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  /* On dark, depth comes from a hairline ring plus a soft ambient shadow. */
  --shadow-sm: 0 0 0 1px var(--hairline), 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 0 0 1px var(--hairline), 0 4px 12px rgba(0, 0, 0, .45), 0 16px 40px -20px rgba(0, 0, 0, .8);
  --shadow-lg: 0 0 0 1px var(--hairline), 0 12px 32px rgba(0, 0, 0, .55), 0 48px 96px -40px rgba(0, 0, 0, .9);
  --glow: 0 6px 24px -6px var(--accent-glow);

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI",
          Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--sans);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1180px;
  --header-h: 66px;
}

/* --- Parchment ---------------------------------------------------------
   Warm cream page, deep espresso ink, a terracotta accent. The photographs
   themselves are the colour; the frame around them steps back.
   Every text/background pair here holds at least 4.5:1. */
:root[data-theme="parchment"] {
  color-scheme: light;

  --bg: #f6f0e2;
  --bg-2: #efe8d5;
  --surface: #fbf6ea;
  --surface-2: #f2ecdb;
  --surface-3: #e9e2ce;

  --ink: #2a1e12;
  --ink-2: #4a3a2a;
  --muted: #6e5c46;
  --faint: #7c6a54;

  --line: #d9cfb6;
  --line-strong: #c2b697;
  --hairline: rgba(42, 30, 18, .08);

  --accent: #a63d1e;
  --accent-hover: #bd4b28;
  --accent-text: #8a331b;
  --accent-soft: rgba(166, 61, 30, .12);
  --accent-line: rgba(166, 61, 30, .34);
  --accent-ink: #ffffff;
  --accent-glow: rgba(166, 61, 30, .28);

  --good: #2f7a52;
  --good-soft: rgba(47, 122, 82, .12);
  --warn: #a05a12;
  --warn-soft: rgba(160, 90, 18, .12);
  --bad: #b93a2a;
  --bad-soft: rgba(185, 58, 42, .12);

  /* Shadow becomes a real shadow again on light backgrounds - the hairline
     ring that carries depth on dark reads as a smudge on cream. */
  --shadow-sm: 0 1px 2px rgba(42, 30, 18, .08);
  --shadow: 0 6px 20px -8px rgba(42, 30, 18, .18), 0 2px 4px rgba(42, 30, 18, .06);
  --shadow-lg: 0 20px 48px -18px rgba(42, 30, 18, .22), 0 4px 12px rgba(42, 30, 18, .08);
  --glow: 0 6px 24px -6px var(--accent-glow);
}

/* --- Meadow ------------------------------------------------------------
   Soft green paper with pine ink. Reads as a walking trail more than as an
   app - restful, and easy on eyes that spent an hour scrolling photographs. */
:root[data-theme="meadow"] {
  color-scheme: light;

  --bg: #f0f3ea;
  --bg-2: #e8ede0;
  --surface: #f6f8f0;
  --surface-2: #eaeee0;
  --surface-3: #dde3cf;

  --ink: #1b2618;
  --ink-2: #34412f;
  --muted: #5c6a54;
  --faint: #6c7a63;

  --line: #ccd4be;
  --line-strong: #b1bd9c;
  --hairline: rgba(27, 38, 24, .08);

  --accent: #3e6b2e;
  --accent-hover: #4a7e38;
  --accent-text: #2f5324;
  --accent-soft: rgba(62, 107, 46, .12);
  --accent-line: rgba(62, 107, 46, .34);
  --accent-ink: #ffffff;
  --accent-glow: rgba(62, 107, 46, .28);

  --good: #2c6a4a;
  --good-soft: rgba(44, 106, 74, .12);
  --warn: #8a6b12;
  --warn-soft: rgba(138, 107, 18, .12);
  --bad: #a33a2a;
  --bad-soft: rgba(163, 58, 42, .12);

  --shadow-sm: 0 1px 2px rgba(27, 38, 24, .08);
  --shadow: 0 6px 20px -8px rgba(27, 38, 24, .18), 0 2px 4px rgba(27, 38, 24, .06);
  --shadow-lg: 0 20px 48px -18px rgba(27, 38, 24, .22), 0 4px 12px rgba(27, 38, 24, .08);
  --glow: 0 6px 24px -6px var(--accent-glow);
}

/* --- Ember -------------------------------------------------------------
   Dark, but warm rather than cool - the light from a fire, not from a
   screen. Same structural depth as Midnight, different temperature.
   Sits nicely for viewing family photographs at night. */
:root[data-theme="ember"] {
  color-scheme: dark;

  --bg: #14100c;
  --bg-2: #1a1510;
  --surface: #201a13;
  --surface-2: #29211a;
  --surface-3: #322921;

  --ink: #f6ede0;
  --ink-2: #d6c6ae;
  --muted: #a08e75;
  --faint: #8f7d64;

  --line: #2c241c;
  --line-strong: #3f342a;
  --hairline: rgba(255, 220, 180, .06);

  --accent: #c2691a;
  --accent-hover: #d97a2c;
  --accent-text: #e29455;
  --accent-soft: rgba(194, 105, 26, .16);
  --accent-line: rgba(194, 105, 26, .4);
  --accent-ink: #14100c;
  --accent-glow: rgba(194, 105, 26, .34);

  --good: #4bc48a;
  --good-soft: rgba(75, 196, 138, .13);
  --warn: #f0b040;
  --warn-soft: rgba(240, 176, 64, .13);
  --bad: #f0765a;
  --bad-soft: rgba(240, 118, 90, .13);

  --shadow-sm: 0 0 0 1px var(--hairline), 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 0 0 1px var(--hairline), 0 4px 12px rgba(0, 0, 0, .5), 0 16px 40px -20px rgba(0, 0, 0, .85);
  --shadow-lg: 0 0 0 1px var(--hairline), 0 12px 32px rgba(0, 0, 0, .6), 0 48px 96px -40px rgba(0, 0, 0, .9);
  --glow: 0 6px 24px -6px var(--accent-glow);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Display type is the same family, set tight and heavy. That reads as
   modern where an old-style serif read as archival. */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 680;
  letter-spacing: -0.032em;
  line-height: 1.1;
  margin: 0 0 .5em;
  text-wrap: balance;
  color: var(--ink);
}
h1 { font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.6rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.55rem, 1.1rem + 1.8vw, 2.35rem); letter-spacing: -0.035em; }
h3 { font-size: 1.15rem; letter-spacing: -0.02em; font-weight: 650; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent-text);
  text-decoration-color: color-mix(in srgb, var(--accent-text) 35%, transparent);
  text-underline-offset: 3px;
  transition: color .15s;
}
a:hover { color: #9dbcff; }

img { max-width: 100%; display: block; }
hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }

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

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: 5px;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, 720px); margin-inline: auto; }
.stack > * + * { margin-top: var(--gap, 1rem); }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.tiny { font-size: .775rem; }
.mono { font-family: var(--mono); font-size: .88em; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.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;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: .8rem;
}
.eyebrow::before {
  content: '';
  width: 1.4rem; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-text));
}

/* --- buttons ------------------------------------------------------------- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  --btn-border: transparent;
  --btn-shadow: var(--glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .66rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: .94rem;
  font-weight: 600;
  letter-spacing: -.008em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
  transition: transform .13s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s;
  white-space: nowrap;
}
.btn:hover { --btn-bg: var(--accent-hover); --btn-shadow: 0 8px 30px -6px var(--accent-glow); color: var(--btn-fg); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-busy { opacity: .5; pointer-events: none; box-shadow: none; }

.btn-ghost { --btn-bg: var(--surface-2); --btn-fg: var(--ink); --btn-border: var(--line-strong); --btn-shadow: none; }
.btn-ghost:hover { --btn-bg: var(--surface-3); --btn-fg: var(--ink); --btn-border: var(--accent-line); --btn-shadow: none; }

.btn-quiet { --btn-bg: transparent; --btn-fg: var(--muted); --btn-border: transparent; --btn-shadow: none; padding: .45rem .6rem; }
.btn-quiet:hover { --btn-bg: var(--surface-2); --btn-fg: var(--ink); --btn-shadow: none; }

/* A button that reads as a link. Used where a name is both a label and a way
   through to that record - a member in a family, a family on an account -
   so the route is obvious without a button's weight in the middle of a table. */
.btn-link {
  appearance: none; background: none; border: 0; padding: 0;
  font: inherit; color: var(--accent); cursor: pointer;
  text-align: inherit; text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: .15em;
}
.btn-link:hover { text-decoration-color: currentColor; }
.btn-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent-text); --btn-border: var(--accent-line); --btn-shadow: none; }
.btn-soft:hover { --btn-bg: rgba(47, 107, 255, .22); --btn-fg: var(--accent-text); --btn-shadow: none; }

.btn-danger { --btn-bg: var(--bad-soft); --btn-fg: var(--bad); --btn-border: color-mix(in srgb, var(--bad) 30%, transparent); --btn-shadow: none; }
.btn-danger:hover { --btn-bg: var(--bad); --btn-fg: #1a0b0b; --btn-shadow: none; }

.btn-lg { padding: .88rem 1.6rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: .42rem .78rem; font-size: .84rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

/* --- form controls ------------------------------------------------------- */
label { display: block; font-size: .83rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; letter-spacing: -.005em; }
.field { margin-bottom: 1rem; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.field .err { font-size: .78rem; color: var(--bad); margin-top: .35rem; font-weight: 600; }

.field-input-eye { position: relative; }
.field-input-eye input { padding-right: 2.6rem; }
.field-eye {
  position: absolute; top: 50%; right: .5rem; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer;
}
.field-eye:hover { color: var(--ink); background: var(--line); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="month"], input[type="number"], input[type="search"], input[type="tel"],
select, textarea {
  width: 100%;
  padding: .64rem .8rem;
  font: inherit;
  font-size: .94rem;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 6rem; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}
select option { background: var(--surface-2); color: var(--ink); }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1rem; height: 1rem; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }
fieldset { border: none; padding: 0; margin: 0; }

.check { display: flex; align-items: flex-start; gap: .6rem; font-size: .9rem; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: .2rem; flex: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* --- surfaces ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.panel-head h3 { margin: 0; font-size: 1rem; }
.panel-body { padding: 1.3rem; }

.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .62rem;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 650;
  letter-spacing: .005em;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.pill-good { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 28%, transparent); }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.pill-bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 28%, transparent); }

.avatar {
  --size: 34px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--surface-3), var(--surface-2));
  color: var(--accent-text);
  font-size: calc(var(--size) * .36);
  font-weight: 680;
  letter-spacing: .01em;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  object-fit: cover;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.meter { height: 7px; border-radius: 999px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line); }
.meter > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #6d9bff);
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width .4s cubic-bezier(.4, 0, .2, 1);
}
.meter.is-warn > i { background: linear-gradient(90deg, #d97706, var(--warn)); box-shadow: 0 0 12px rgba(251,191,36,.3); }
.meter.is-bad > i { background: linear-gradient(90deg, #dc2626, var(--bad)); box-shadow: 0 0 12px rgba(248,113,113,.3); }

.divider { height: 1px; background: var(--line); margin: 1.2rem 0; }

.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
}
.empty h3 { color: var(--ink); }

table.data { width: 100%; border-collapse: collapse; font-size: .89rem; }
table.data th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--faint); font-weight: 650; padding: .55rem .8rem; border-bottom: 1px solid var(--line);
}
table.data td { padding: .72rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- toasts -------------------------------------------------------------- */
#toasts {
  position: fixed; z-index: 200; bottom: 1.1rem; right: 1.1rem;
  display: flex; flex-direction: column; gap: .5rem; align-items: flex-end;
  pointer-events: none;
  max-width: min(28rem, calc(100vw - 2rem));
}
.toast {
  pointer-events: auto;
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: .72rem 1.05rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .89rem;
  font-weight: 500;
  display: flex; gap: .55rem; align-items: flex-start;
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1.4);
}
.toast.is-bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: #ffd9d6; }
.toast.is-good { border-color: color-mix(in srgb, var(--good) 45%, transparent); color: #c8f4e0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* --- modal --------------------------------------------------------------- */
.modal-backdrop {
  /* Above the lightbox (160), below toasts (200). A confirm dialog opened from
     the photo viewer used to render behind the photograph. */
  position: fixed; inset: 0; z-index: 180;
  background: rgba(4, 5, 8, .72);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 1rem;
  animation: fade-in .16s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  width: min(100%, 33rem);
  max-height: min(88vh, 46rem);
  display: flex; flex-direction: column;
  animation: modal-in .2s cubic-bezier(.2, .9, .3, 1.15);
}
.modal.is-wide { width: min(100%, 47rem); }
.modal-head {
  padding: 1.25rem 1.5rem .8rem;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.modal-body { padding: 0 1.5rem 1.2rem; overflow-y: auto; }
.modal-foot {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap;
}
.modal-close {
  border: none; background: transparent; color: var(--muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: .1rem .35rem; border-radius: 7px;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* --- misc ---------------------------------------------------------------- */
.spinner {
  width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --- Theme picker ------------------------------------------------------
   A tiny native select in the site header and the app settings screen.
   Kept in base.css because both surfaces render it, and because the styling
   only uses tokens - so it takes on the right look in every palette. */
.theme-picker { display: inline-flex; align-items: center; gap: .35rem; }
.theme-picker-select {
  appearance: none;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .3rem 1.6rem .3rem .8rem;
  font: inherit; font-size: .82rem;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.theme-picker-select:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-picker-select:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
/* The larger swatch grid used on the settings screen: one card per theme
   with a small preview of its palette. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: .8rem;
}
.theme-swatch {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .8rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: transform .12s ease, border-color .12s ease;
}
.theme-swatch:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.theme-swatch.is-current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch .preview {
  display: flex; gap: 0; height: 2.4rem;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: .55rem;
  border: 1px solid var(--hairline);
}
.theme-swatch .preview span { flex: 1; }
.theme-swatch b { font-size: .95rem; display: block; }
.theme-swatch small { color: var(--muted); font-size: .78rem; }

/* The legal documents are English-only by decision. The note says so at the
   top of each one, quietly - it is an explanation, not a warning. */
.legal-language-note {
  max-width: 44rem; margin: 1.2rem auto 0; padding: .6rem .9rem;
  background: var(--surface-2); border-radius: var(--radius-sm);
  color: var(--muted); font-size: .85rem;
}
