:root {
  color-scheme: light;
  --green: #0c493b;
  --green-hover: #16362c;
  --ink: #182b25;
  --muted: #5f6b64;
  --line: #dce4df;
  --paper: #ffffff;
  --surface: #f2f5f3;
  --section-surface: #eef4f1;
  --on-accent: #ffffff;
  --peach: #ffdcad;
}
:root[data-palette="ocean"] {
  --green: #1e537f;
  --green-hover: #173e60;
  --ink: #192b3e;
  --muted: #566779;
  --line: #d8e3ed;
  --surface: #f0f5fa;
  --section-surface: #eaf2f9;
  --peach: #d9ebf7;
}
:root[data-palette="plum"] {
  --green: #713e75;
  --green-hover: #542c57;
  --ink: #342536;
  --muted: #706373;
  --line: #e6dce8;
  --surface: #f7f2f8;
  --section-surface: #f3ebf5;
  --peach: #efdef3;
}
:root[data-palette="sand"] {
  --green: #79502d;
  --green-hover: #583a22;
  --ink: #362b22;
  --muted: #726558;
  --line: #e5ddd3;
  --surface: #f7f3ec;
  --section-surface: #f3ecdf;
  --peach: #f1dfc3;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --green: #9ad6bb;
  --green-hover: #bee9d4;
  --ink: #edf4ef;
  --muted: #b1beb5;
  --line: #3c4d44;
  --paper: #121b17;
  --surface: #202e26;
  --section-surface: #1a2821;
  --on-accent: #15251c;
}
:root[data-theme="dark"][data-palette="ocean"] {
  --green: #9bc9f1;
  --green-hover: #c4e0f8;
  --ink: #edf3fa;
  --muted: #b2c0d1;
  --line: #3c4c60;
  --paper: #131c27;
  --surface: #223044;
  --section-surface: #1c293b;
  --on-accent: #162333;
}
:root[data-theme="dark"][data-palette="plum"] {
  --green: #d6afe0;
  --green-hover: #e8cbef;
  --ink: #f5eef7;
  --muted: #c5b7ca;
  --line: #55425a;
  --paper: #211825;
  --surface: #33283a;
  --section-surface: #2c2232;
  --on-accent: #2c1e32;
}
:root[data-theme="dark"][data-palette="sand"] {
  --green: #e3c092;
  --green-hover: #f3d9b8;
  --ink: #f7f1e9;
  --muted: #c8bbab;
  --line: #574a3b;
  --paper: #231d17;
  --surface: #352c22;
  --section-surface: #2d261e;
  --on-accent: #302316;
}

/* Shared colors keep every section, control and dialog in the selected theme. */
/* Static headings receive focus for reading order, not as interactive controls.
   Safari otherwise draws a blue ring after opening a dialog or reader view. */
:is(h1, h2, h3, h4, h5, h6)[tabindex="-1"]:focus { outline: none; }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--green); outline-offset: 5px; }
.draft, .button, .filter.active { background: var(--green); color: var(--on-accent); }
.button:hover { background: var(--green-hover); border-color: var(--green-hover); }
select { background: var(--surface); }
.text-link { color: inherit; }
.filter { background: var(--paper); }
.filter:hover:not(.active) { background: var(--surface); border-color: var(--green); }
.paths { background: var(--section-surface); }
.path { border-color: var(--line); }
.path span, .strip span { color: var(--muted); }
.hero-visual { color: #182b25; }
.visual-caption { border-color: #182b2533; }
dialog { background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #080d12aa; }

.appearance-bar {
  max-width: 1300px;
  margin: auto;
  padding: 12px 48px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
}
.appearance-title { color: var(--muted); font-size: 13px; letter-spacing: .03em; }
.appearance-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px 20px; }
.palette-control { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); min-width: 0; }
.palette-swatch { width: 14px; height: 14px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.palette-control select { min-height: 44px; max-width: 100%; border: 1px solid var(--line); cursor: pointer; }
.mode-control { display: flex; padding: 3px; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.mode-control button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.mode-control button[aria-pressed="true"] { background: var(--green); color: var(--on-accent); font-weight: 700; }
.mode-control button:hover:not([aria-pressed="true"]) { color: var(--ink); border-color: var(--line); }
.mode-control svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) {
  .appearance-bar { padding-inline: 24px; }
}
@media (max-width: 620px) {
  .appearance-bar { padding: 12px 18px; gap: 8px; }
  .appearance-title { flex-basis: 100%; font-size: 12px; }
  .appearance-controls { justify-content: flex-start; gap: 10px 16px; }
  .mode-control button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
