/* ==========================================================================
   SkipBoard v2 — Settings
   Grouped paper cards: You · Handwriting · Ink · Screen · AI · Printing ·
   Safety · Your data. Chrome (.sub-head/.group-label) lives in me.css.
   ========================================================================== */

.settings-page { gap: var(--s-4); }
.settings-page.is-dirty { padding-bottom: calc(var(--s-12) + var(--foot-h)); }

.settings-page .settings-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-5);
}
.settings-page .settings-card .card-head { align-items: baseline; gap: var(--s-3); }
.settings-page .settings-card .card-head h2 {
  font-family: var(--font-display);
  font-size: var(--t-20);
  font-weight: 650;
  letter-spacing: -0.02em;
}
.settings-page .settings-card .card-head .hint { text-align: right; flex-shrink: 0; }
.settings-page .settings-card .hint a { color: var(--accent); font-weight: 600; }

/* --------------------------------- You ---------------------------------- */
.settings-page .settings-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3);
}
@media (min-width: 560px) {
  .settings-page .settings-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.settings-page .settings-site {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-soft);
}
.settings-page .settings-site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.settings-page .settings-site-head .field-label { margin: 0; }
.settings-page .settings-site .link-btn { font-size: var(--t-13); }
.settings-page .settings-site .row-dashed { margin-top: var(--s-1); }

/* ----------------------------- Handwriting ------------------------------ */
.settings-page .hw-figure {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.settings-page .hw-paper {
  position: relative;
  min-height: 118px;
  border-radius: var(--r-field);
  border: 1px solid var(--line);
  overflow: hidden;
  /* Paper artefact: warm white paper in every theme. */
  background: #fffdf8;
  box-shadow: var(--e-1);
}
.settings-page .hw-paper canvas { display: block; width: 100%; height: auto; }
.settings-page .hw-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-13);
  color: var(--muted);
}
.settings-page .hw-caption strong { color: var(--text); font-weight: 600; }

.settings-page .hw-groups { display: flex; flex-direction: column; gap: var(--s-4); }
.settings-page .hw-group { display: flex; flex-direction: column; gap: var(--s-2); }
.settings-page .hw-group-label {
  font-size: var(--t-11);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.settings-page .style-grid { gap: var(--s-2); }
.settings-page .style-card { min-height: 84px; padding: 12px; }
.settings-page .style-sample { font-size: clamp(15px, 4vw, 21px); }

/* --------------------------------- Ink ---------------------------------- */
@media (max-width: 560px) {
  .settings-page .setting-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-2);
    padding: var(--s-3) 0;
  }
  .settings-page .setting-row .segmented { width: 100%; }
}
.settings-page .setting-label small { line-height: 1.35; }

/* ------------------------------- Screen --------------------------------- */
.settings-page .theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
}
.settings-page .theme-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 124px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.settings-page .theme-card:hover { background: var(--surface-2); }
.settings-page .theme-card.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.settings-page .theme-thumb {
  position: relative;
  display: block;
  height: 48px;
  padding: 8px 8px;
  border-radius: 9px;
  border: 1px solid var(--tt-border);
  background: var(--tt-bg);
  overflow: hidden;
}
.settings-page .theme-thumb i { display: block; border-radius: 2px; }
.settings-page .theme-thumb .tt-bar { width: 26px; height: 4px; background: var(--tt-accent); margin-bottom: 7px; }
.settings-page .theme-thumb .tt-line { width: 72%; height: 3px; background: var(--tt-line); margin-bottom: 5px; }
.settings-page .theme-thumb .tt-line.short { width: 46%; }
.settings-page .theme-thumb .tt-dot {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tt-accent);
}
/* Theme previews are the one place the other themes' literal colours appear
   (values mirror css/tokens.css) — they have to look like what they select. */
.settings-page .theme-card[data-theme-pick='paper'] .theme-thumb { --tt-bg: #fbfaf5; --tt-line: #d8d2c1; --tt-accent: #0b6b4f; --tt-border: #dfdacb; }
.settings-page .theme-card[data-theme-pick='forest'] .theme-thumb { --tt-bg: #0e1513; --tt-line: #2a3833; --tt-accent: #34d399; --tt-border: #2a3833; }
.settings-page .theme-card[data-theme-pick='sunlight'] .theme-thumb { --tt-bg: #ffffff; --tt-line: #7c877f; --tt-accent: #0b5c43; --tt-border: #7c877f; }
.settings-page .theme-card[data-theme-pick='auto'] .theme-thumb {
  --tt-bg: #fbfaf5; --tt-line: #8a9a92; --tt-accent: #34d399; --tt-border: #8a9a92;
  background: linear-gradient(135deg, #fbfaf5 0 50%, #0e1513 50% 100%);
}
@media (min-width: 720px) {
  .settings-page .theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.settings-page .theme-name { font-size: var(--t-13); font-weight: 600; }
.settings-page .theme-card.is-on .theme-name { color: var(--accent); }
.settings-page .theme-note { font-size: var(--t-11); line-height: 1.3; color: var(--muted); }

/* -------------------------------- AI ------------------------------------ */
.settings-page .ai-note {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-field);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: var(--t-13);
  line-height: 1.5;
  color: var(--muted);
}
.settings-page .ai-note svg { color: var(--accent); margin-top: 2px; flex-shrink: 0; }
.settings-page .ai-note strong { color: var(--text); font-weight: 600; }

/* ----------------------------- Printing --------------------------------- */
.settings-page .print-facts { display: flex; flex-direction: column; }
.settings-page .print-fact {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}
.settings-page .print-fact:first-child { padding-top: 0; }
.settings-page .print-fact + .print-fact { border-top: 1px solid var(--line-soft); }
.settings-page .print-fact .row-icon { width: 36px; height: 36px; border-radius: 10px; }
.settings-page .print-fact .row-text strong { font-size: var(--t-15); }
.settings-page .print-fact .row-text small { white-space: normal; line-height: 1.4; }
.settings-page .print-link { align-self: flex-start; }

/* ------------------------------ Safety ---------------------------------- */
.settings-page .safety-loc { margin-bottom: var(--s-1); }
.settings-page .osha-links { display: flex; flex-direction: column; }
.settings-page .osha-link {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 60px;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
}
.settings-page .osha-link + .osha-link { border-top: 1px solid var(--line-soft); }
.settings-page .osha-link .row-icon { width: 36px; height: 36px; border-radius: 10px; }
.settings-page .osha-link .row-text strong { font-size: var(--t-15); white-space: normal; line-height: 1.3; }
.settings-page .osha-link .row-text small { white-space: normal; line-height: 1.4; }
.settings-page .osha-link .ext-icon { color: var(--faint); flex-shrink: 0; }
.settings-page .osha-link:hover .row-text strong { color: var(--accent); }

/* ------------------------------ Your data -------------------------------- */
.settings-page .data-rows { display: flex; flex-direction: column; }
.settings-page .data-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 60px;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
}
.settings-page .data-row + .data-row { border-top: 1px solid var(--line-soft); }
.settings-page .data-row .row-icon { width: 36px; height: 36px; border-radius: 10px; }
.settings-page .data-row > svg { color: var(--faint); flex-shrink: 0; }
.settings-page .data-row:hover .row-text strong { color: var(--accent); }
.settings-page .settings-check { width: 26px; height: 26px; flex-shrink: 0; accent-color: var(--accent); }
.settings-page .data-row.is-static { color: var(--muted); }
.settings-page .data-row.is-static .row-text strong { color: var(--text); }
.settings-page .data-row .row-text small { white-space: normal; }

.settings-foot { padding-bottom: var(--s-8); line-height: 1.55; }
.settings-foot a { color: var(--accent); font-weight: 600; }

/* --------------------------- Grouped save bar ---------------------------- */
.screen-me .settings-savebar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 10px);
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: min(calc(100% - 24px), 520px);
  padding: 8px 8px 8px 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--e-2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.screen-me .settings-savebar[hidden] { display: none; }
.screen-me .settings-savebar .save-text {
  flex: 1;
  min-width: 0;
  font-size: var(--t-13);
  font-weight: 600;
  color: var(--muted);
}
.screen-me .settings-savebar .btn { min-height: 48px; padding: 0 18px; }

/* ------------------------------- Desktop -------------------------------- */
@media (min-width: 900px) {
  .screen-me .settings-savebar { bottom: 24px; }
  .settings-page.is-dirty { padding-bottom: calc(var(--s-8) + var(--foot-h)); }
  .settings-page .style-card { min-height: 92px; }
  .settings-page .theme-card { min-height: 132px; }
  .settings-page .theme-thumb { height: 56px; }
}

/* ----------------------------- Reduced motion --------------------------- */
@media (prefers-reduced-motion: reduce) {
  .settings-page .theme-card { transition: none; }
}
