:root[data-theme="haf"] {
  --accent: #155277; --accent-hover: #123d5b; --ink: #152e40; --heading: #163d57; --muted: #405c70;
  --canvas: #f2f7fa; --panel: #fff; --tint: #e3eef5; --selected: #cddfea;
  --line: #c7d6e1; --control-edge: #6c8292; --edge: #99b1c1; --focus: #99501a; --notice: #eeeedd;
}
:root[data-theme="sandur"] {
  --accent: #77421d; --accent-hover: #593016; --ink: #372d24; --heading: #51341c; --muted: #675241;
  --canvas: #faf3e4; --panel: #fffaf0; --tint: #f1e5ce; --selected: #e4d3b1;
  --line: #dcceb4; --control-edge: #8d765b; --edge: #baa381; --focus: #245782; --notice: #f3e7c2;
}
:root[data-theme="lyng"] {
  --accent: #66406e; --accent-hover: #492e50; --ink: #362b39; --heading: #513655; --muted: #625369;
  --canvas: #f8f4fa; --panel: #fffaff; --tint: #eee6f0; --selected: #e3d2e5;
  --line: #d9ccdb; --control-edge: #8d7991; --edge: #b49eb8; --focus: #835416; --notice: #f3e9de;
}
:root[data-theme="nott"] {
  color-scheme: dark;
  --accent: #a3dac3; --accent-hover: #c0edd9; --on-accent: #10251c;
  --ink: #f1f5ee; --heading: #e0f1e6; --muted: #b9c9bf;
  --canvas: #171e1b; --panel: #202a25; --tint: #25332c; --selected: #374d40;
  --line: #46584d; --control-edge: #899f92; --edge: #718b7c; --focus: #ffd981; --notice: #393629;
}
:root[data-theme="andstaedur"] {
  color-scheme: dark;
  --accent: #ffea59; --accent-hover: #fff5a9; --on-accent: #000;
  --ink: #fff; --heading: #fff; --muted: #eee;
  --canvas: #000; --panel: #080808; --tint: #131313; --selected: #303030;
  --line: #b8b8b8; --control-edge: #efefef; --edge: #bdbdbd; --focus: #5ef7ff; --notice: #242115;
}
:root[data-font="sans"] { --title-font: system-ui, sans-serif; }
:root[data-font="serif"] { --body-font: Georgia, serif; }
:root[data-font="mono"] { --body-font: ui-monospace, monospace; --title-font: ui-monospace, monospace; }
:root[data-size="stor"] { font-size: 112.5%; }
:root[data-size="staerri"] { font-size: 125%; }
:root[data-size="staerst"] { font-size: 150%; }

.sidebar-mast { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; }
.sidebar-mast button, .sidebar-restore button, .display-tools > button {
  background: var(--panel); border: 1px solid var(--control-edge); color: var(--accent);
  min-height: 2.5rem; padding: .4rem .65rem; line-height: 1.25; font-size: .92rem;
}
.sidebar-mast button:hover, .sidebar-restore button:hover, .display-tools > button:hover { background: var(--selected); }
.sidebar-restore { display: none; }
:root:is([data-sidebar="hidden"], [data-reading]) .site-sidebar { display: none; }
:root:is([data-sidebar="hidden"], [data-reading]) .site-layout { display: flex; flex-direction: column; }
:root:is([data-sidebar="hidden"], [data-reading]) .site-layout > main { flex: 1; }
:root:is([data-sidebar="hidden"], [data-reading]) .sidebar-restore {
  display: block; position: sticky; top: 0; z-index: 2; align-self: stretch;
  padding: .35rem max(1rem, calc((100% - 86rem)/2)); background: var(--canvas); border-bottom: 1px solid var(--line);
}
:root:is([data-sidebar="hidden"], [data-reading]) { scroll-padding-top: 3.5rem; }
.site-sidebar .site-nav { margin-block: .85rem; }
.display-tools { border-top: 1px solid var(--line); padding-top: .65rem; margin-bottom: .7rem; }
.display-tools summary { cursor: pointer; color: var(--heading); font-weight: 700; padding-block: .45rem; }
.display-tools fieldset { padding: 0; margin: .25rem 0 .65rem; border: 0; min-width: 0; }
.display-tools legend, .display-tools label { font-size: .9rem; }
.display-tools legend { font-weight: 650; margin-bottom: .25rem; }
.theme-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .3rem; }
.theme-options label {
  display: flex; position: relative; align-items: center; gap: .35rem;
  min-height: 2.35rem; padding: .25rem .35rem; border-radius: .35rem; border: 1px solid var(--edge);
  background: var(--panel); cursor: pointer; margin: 0; font-size: .875rem; line-height: 1.2; overflow-wrap: anywhere;
}
.theme-options label:has(:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-options input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; }
.theme-options label:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.theme-dot { flex: none; width: .9rem; height: .9rem; border-radius: 50%; border: 1px solid var(--edge); background: var(--swatch); }
.theme-options input:checked + .theme-dot::after { content: ''; display: block; width: 36%; height: 36%; margin: 32%; border-radius: 50%; background: var(--dot-center,#fff); }
.display-tools select { display: block; width: 100%; min-height: 2.5rem; margin-top: .12rem; padding-block: .25rem; font-size: .95rem; }
.display-tools label:has(select) { margin: 0 0 .6rem; }
.display-tools > button { width: 100%; margin-top: .25rem; }
.display-tools [role="status"] { margin: .25rem 0; font-size: .88rem; }
.display-tools [role="status"]:empty { display: none; }
.display-tools button:disabled { color: var(--muted); cursor: default; }
.site-layout .skip { z-index: 4; }
.site-layout .paper-text mark { color: #211b0e; }
@media (max-width: 52.99rem) { .display-tools { max-width: 30rem; } }
@media (max-width: 35rem) {
  .searchbox { flex-wrap: wrap; }
  .searchbox > input { flex: 1 1 10rem; max-width: 100%; }
}
@media print { .site-sidebar, html[data-sidebar] .sidebar-restore { display: none; } }

.sidebar-restore .reading-exit, .sidebar-restore .reading-info { display: none; }
:root[data-reading] .sidebar-restore .reading-exit, :root[data-reading] .sidebar-restore .reading-info { display: inline-block; }
:root[data-reading] .sidebar-restore .restore-toggle { display: none; }
.sidebar-restore .reading-info { margin-inline-start: .6rem; color: var(--muted); font-size: .9rem; }
:root[data-reading] .site-layout > main { max-width: none; width: calc(100% - 2rem); }
