/* ============================================================
   settings.css — Culturily Settings page
   Dark theme on the shared design tokens (see global.css).
   ============================================================ */

:root {
  --set-width: 560px;
}

/* ── Top app bar ─────────────────────────────────────────── */
.set-top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg);
  border-bottom: 1px solid var(--border);
}

.set-back-btn,
.set-top-spacer {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.set-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--text-primary);
  font-size: 1.35rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease);
}
.set-back-btn:hover { background: var(--surface-2); }

.set-top-title {
  flex: 1;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Page ────────────────────────────────────────────────── */
.set-page {
  max-width: var(--set-width);
  margin-inline: auto;
  padding: var(--sp-4) var(--sp-4) 96px;   /* clear the bottom nav */
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* ── Section ─────────────────────────────────────────────── */
.set-section-title {
  margin: 0 0 var(--sp-2);
  padding-left: var(--sp-1);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.set-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* ── Row ─────────────────────────────────────────────────── */
.set-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 14px var(--sp-4);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease);
}
.set-row:last-child { border-bottom: none; }
.set-row:hover { background: var(--surface-2); }
.set-row-btn:active { transform: scale(0.995); }

/* Reminder time picker */
.set-time-input {
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 7px 10px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.set-time-input:focus { outline: none; border-color: var(--accent-ink); }
.set-time-input::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.set-row-icon {
  flex-shrink: 0;
  width: 26px;
  font-size: 1.25rem;
  line-height: 1;
  text-align: center;
  color: var(--text-subtle);
}

.set-row-label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 600;
}
.set-row-label.is-danger { color: var(--error-ink); }
.set-row-label.is-danger ~ .set-row-chevron { color: color-mix(in srgb, var(--error) 60%, transparent); }

.set-row-sub {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-subtle);
}

.set-row-value,
.set-row-action {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.set-row-action {
  font-weight: 700;
  color: var(--accent);
}

.set-row-chevron {
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--text-disabled);
}

/* ── Toggle switch ───────────────────────────────────────── */
.set-toggle {
  flex-shrink: 0;
  position: relative;
  width: 46px;
  height: 28px;
  border: none;
  border-radius: var(--r-full);
  background: var(--surface-3);
  cursor: pointer;
  padding: 0;
  transition: background var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.set-toggle.is-on { background: var(--accent); }
.set-toggle.is-disabled { opacity: 0.4; cursor: not-allowed; }
/* Hit-slop only — the visible 46x28 pill is unchanged; -8px top/bottom
   brings the tappable height to 44px (same technique as .pf-icon-btn). */
.set-toggle::before {
  content: '';
  position: absolute;
  inset: -8px -1px;
}

.set-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  /* WO-VIS Wave B: physical switch-knob white, identical in both themes by
     design (no theme-light override ever existed for it) — no token
     represents "always white regardless of theme," left literal. */
  background: #fff;
  transition: transform var(--t-fast) var(--ease);
}
.set-toggle.is-on .set-toggle-knob { transform: translateX(18px); }

/* ── Toast ───────────────────────────────────────────────── */
.set-toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  padding: 10px 20px;
  font-size: var(--text-sm);
  font-weight: 600;
  max-width: calc(100% - 32px);
  text-align: center;
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.set-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Inline note (e.g. iOS push unavailable) ─────────────── */
.set-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 12px var(--sp-4);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  border-top: 1px solid var(--border);
}
.set-note:first-child { border-top: none; }

/* ── Inline status (change password) ─────────────────────── */
.set-row-sub.is-success { color: var(--text-primary); } /* dark-theme small text is never lime — Wave D follow-up; light stays --accent-ink below */
html.theme-light .set-row-sub.is-success { color: var(--accent-ink); }
.set-row-sub.is-error   { color: var(--error-ink); }

/* ── Stacked row (label above content) ───────────────────── */
.set-row-stack {
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  cursor: default;
}
.set-row-stack:hover { background: none; }

/* ── Culture switcher chips ──────────────────────────────── */
.set-culture-grid {
  display: flex;
  gap: var(--sp-2);
}
.set-culture-loading {
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

/* ── Culture Rush personal bests ─────────────────────────── */
.set-rush-bests {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  margin: 0;
}

.set-culture-chip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md, 12px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.set-culture-chip:hover { background: var(--surface-3); }
.set-culture-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.set-culture-chip-flag {
  font-size: 1.6rem;
  line-height: 1;
}
.set-culture-chip-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-primary);
}
.set-culture-chip.is-active .set-culture-chip-name { color: var(--text-primary); } /* dark-theme small text is never lime — Wave D follow-up; light stays --accent-ink below */
html.theme-light .set-culture-chip.is-active .set-culture-chip-name { color: var(--accent-ink); }

/* Language grid: reuses the culture chip look but wraps to a 2×2 so the
   longer language names (e.g. Slovenčina) never get cramped. */
.set-language-grid { flex-wrap: wrap; }
.set-language-grid .set-culture-chip { flex: 1 1 calc(50% - var(--sp-2)); }

/* ── Heritage cultures (123_user_heritage_cultures.sql) ─────────
   Same modifier shape as .set-language-grid above: .set-culture-grid is a
   bare flex row sized for the 4 fixed cultures of the "Active culture"
   switcher, and heritage renders every row of public.cultures (9 and
   growing), so it has to wrap. 3-up on phones, 4-up once there's room —
   the chips are .set-culture-chip untouched, only the track changes. */
.set-heritage-grid { flex-wrap: wrap; }
.set-heritage-grid .set-culture-chip { flex: 1 1 calc(33.333% - var(--sp-2)); }
@media (min-width: 600px) {
  .set-heritage-grid .set-culture-chip { flex: 1 1 calc(25% - var(--sp-2)); }
}

/* At the cap, the unpicked chips stay legible but read as unavailable —
   the cap is surfaced here AND in the hint line, never as a silent no-op. */
.set-heritage-grid .set-culture-chip.is-capped {
  opacity: 0.45;
  cursor: not-allowed;
}
.set-heritage-grid .set-culture-chip[disabled] { cursor: not-allowed; }

/* Non-member locked state — the section stays visible (discoverability is the
   whole point of this build) and says what unlocks it. */
.set-heritage-locked {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-subtle);
  line-height: var(--leading-relaxed);
}

/* ── Sign out — neutral outlined button, below all sections ─ */
.set-signout-zone {
  margin-top: var(--sp-6, 24px); /* was 32px — that's --sp-8, not --sp-6 (24px) */
  display: flex;
  justify-content: center;
}
.btn-set-signout {
  width: 100%;
  max-width: 320px;
  padding: 13px 20px;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn-set-signout:hover {
  background: var(--surface-2);
  border-color: var(--text-subtle);
}
.btn-set-signout:active { transform: scale(0.99); }
.btn-set-signout:disabled { opacity: 0.5; cursor: default; }

/* ── Delete account — isolated, low-prominence, danger ───── */
.set-delete-zone {
  margin-top: var(--sp-5, 20px); /* was 24px — that's --sp-6, not --sp-5 (20px) */
  padding-top: var(--sp-5, 20px);
  border-top: 1px solid var(--border);
  text-align: center;
}
.set-delete-link {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--error-ink);
  text-decoration: none;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}
.set-delete-link:hover { text-decoration: underline; }

/* ── Feedback form (inline, expandable) ──────────────────────── */
.set-row-btn[aria-expanded="true"] .set-row-chevron { transform: rotate(90deg); }
.set-feedback-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
}
.set-feedback-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.set-feedback-cat {
  display: inline-flex; align-items: center; justify-content: center; /* a11y low-pass: needed so min-height below actually centers the label */
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  color: var(--text-subtle);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 7px 14px;
  min-height: 44px; /* a11y low-pass (2026-07-11): was ~33.5px */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.set-feedback-cat.is-selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-primary); /* dark-theme small text is never lime — Wave D follow-up; light stays --accent-ink below */
}
html.theme-light .set-feedback-cat.is-selected { color: var(--accent-ink); }
.set-feedback-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  padding: 12px 14px;
  resize: vertical;
}
.set-feedback-input:focus { outline: none; border-color: var(--accent-ink); }
.set-feedback-send { align-self: flex-start; }

/* ============================================================
   REWARD-KIT SETTINGS RESKIN — design "Culturily Settings" (+ Light)
   Grouped cards, lime row icons, segmented controls, badges.
   Token-driven → dark + light.
   ============================================================ */
.set-top-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  /* Grow by the status-bar inset and pad the top so the back button + title sit
     below the notch (sticky bar → it occupies flow space, so content below the bar
     stays correctly offset; no double-padding needed). */
  height: calc(60px + var(--safe-top));
  padding: var(--safe-top) 18px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--c-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.set-back-btn {
  position: relative; /* anchors the hit-slop ::before below */
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-subtle); text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.set-back-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.set-back-btn svg { width: 17px; height: 17px; }
/* Hit-slop only — the visible 36px box is unchanged (same technique as
   .pf-icon-btn, which already solves this elsewhere in the app). */
.set-back-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
}
.set-top-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0; color: var(--text-primary); }

.set-page {
  max-width: var(--app-width);
  margin: 0 auto;
  padding: 22px 20px calc(var(--nav-bottom-h) + 40px);
  display: flex;
  flex-direction: column;
  gap: 26px;
  /* §ED469 — the ground. .set-page never declared a background at all; the
     page rendered on whatever `body{background-color:var(--bg)}` resolved
     to (css/global.css), the retired achromatic ground. profile.css's
     .pf-page already carries this exact override — same fix, same shape. */
  background: var(--c-bg);
}
.set-section { display: flex; flex-direction: column; gap: 10px; }
.set-section-title {
  font-size: var(--text-xs); /* a11y low-pass (2026-07-11): was a raw 10.5px, doesn't scale — same fix as profile.css's identical .pf-section-title, aligned to the (dead, shadowed) earlier block's own var(--text-xs) */
  font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-subtle); padding-left: 4px; margin: 0;
}
.set-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  padding: 0;
}
.set-row {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-row-icon { color: var(--accent); font-size: 19px; flex: 0 0 auto; display: inline-flex; }
/* a11y medium-pass (2026-07-11): was hardcoded #5f7d00, the light-theme
   --accent-ink value BEFORE it was darkened for contrast (see global.css) —
   stale duplicate, now inconsistent with the token. Points at the token
   itself so it can never drift again. */
html.theme-light .set-row-icon { color: var(--accent-ink); }
.set-row-label { flex: 1; font-size: var(--text-base); color: var(--text-primary); } /* a11y medium-pass: was 15px */
.set-row-sub { font-size: var(--text-xs); color: var(--text-subtle); }
.set-row-chevron { color: var(--text-disabled); font-size: 16px; }
.set-row-value { font-size: 13.5px; color: var(--text-subtle); white-space: nowrap; }
.set-email-value { max-width: 170px; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }

/* badge pill — FREE / SUPER / SOON */
.set-row-badge {
  flex: 0 0 auto;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--text-subtle);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 9px;
}
/* K4/§4: lime-filled badge — hairline rectangle, not a colored pill. */
.set-row-badge.is-super { color: var(--accent-text); background: var(--accent); border-color: transparent; }

/* coming-soon rows */
.set-row.is-disabled { opacity: 0.6; }
.set-row.is-disabled .set-toggle,
.set-row.is-disabled .set-time-input { pointer-events: none; }

/* segmented control (Appearance) */
.set-segmented {
  display: flex; gap: 4px;
  background: var(--c-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.set-seg-btn {
  flex: 1; padding: 9px 4px; border-radius: 9px;
  border: none; background: none; cursor: pointer;
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  color: var(--text-subtle);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.set-seg-btn.is-active { background: var(--accent); color: var(--accent-text); }
/* WO-VIS Wave B: removed html.theme-light override using the retired #99CC00
   toned accent — base rule's var(--accent) already resolves correctly in both themes. */

/* stacked row (label row + control underneath) */
.set-row-stack { flex-direction: column; align-items: stretch; gap: 11px; }
.set-row-stack > .set-row-label { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; text-align: left; }

/* account actions */
.set-signout-zone { padding: 6px 20px 0; }
.btn-set-signout {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 15px;
  font-family: var(--font-body); font-weight: 700; font-size: var(--text-base); /* a11y medium-pass: was 15px */
  color: var(--text-primary); cursor: pointer;
}
.btn-set-signout:hover { border-color: var(--text-disabled); }
.set-delete-zone { padding: 10px 20px 0; text-align: center; }
.set-delete-link {
  display: inline-flex; align-items: center; justify-content: center; /* a11y low-pass: was inline-block, ~30px tall */
  min-height: 44px;
  color: var(--error-ink); font-weight: 700; font-size: 15px;
  text-decoration: none; padding: 13px 16px;
}

/* ── Desktop — clear the fixed .app-topnav (css/global.css), which replaces
   the bottom-nav pill ≥900px (world-sweep components pass, 2026-07-21).
   .set-top-bar drops its own sticky pin + gets pushed below the top nav via
   margin (it's a sibling of .set-page, not nested inside it, so .set-page's
   own padding can't reach it) — same reasoning as profile.css's .pf-topbar. */
@media (min-width: 900px) {
  .set-top-bar { position: static; margin-top: 64px; }
}

/* §ED132: extracted verbatim from settings.html's one design-bearing style=""
   attribute (the change-password Turnstile box). Values unchanged — this is
   layout, not type, and the widget itself is a third-party iframe. */
.set-turnstile { margin: 4px 0 0; display: flex; justify-content: center; }


/* ══════════════════════════════════════════════════════════════════════
   §ED140 — THE TOP, THE BANDS, THE DANGER ZONE (layout only)
   Same rules as profile.css's §ED140 block, same reasoning: not one type
   rule, not one colour literal. .lv2-eyebrow / .lv2-h1 are inherited from
   css/landing-v2.css in the markup; spacing is --sp-*; the rule is --border.
   ══════════════════════════════════════════════════════════════════════ */

/* The page's only headline used to be the 19px sticky top-bar label, which
   is a repeat of the title, not the title. It is now a span; the document
   h1 lives here, at landing scale. */
.set-hero {
  display: block;
  text-align: left;
  padding: var(--sp-2) 0 var(--sp-1);
}

/* Bands. .set-page already gaps its children by 26px; a band gets a rule and
   another 26px above it, so between-group space reads as roughly double
   within-group space and the eight equal blocks resolve into three. */
.set-band {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}
.set-band + .set-band {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-6);
}

/* Destructive action, alone. Sign out stays above the rule — it is
   reversible; deleting your account is not. */
.set-danger-zone {
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
