/* Design tokens and document defaults
 * Edit theme variables here to keep pages consistent. */
:root {
  color-scheme: light;
  --paper: #f7f8fa;
  --surface: #fff;
  --ink: #182a42;
  --muted: #526279;
  --line: #c9d2df;
  --accent: #796016;
  --notice: #f4efdc;
  --focus: #1458c0;
  --gold: #e5c976;
  --midnight: #182a42;
  --cta-hover: #263b58;
  --cta-hover-text: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%;
  line-height: 1.55;
  background: var(--paper);
  color: var(--ink);
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: var(--focus);
  text-underline-offset: .2em;
}

button, input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}
/* Shared page layout and navigation */
.site-header, main, footer {
  width: min(100% - 2.5rem, 64rem);
  margin-inline: auto;
}

.site-header {
  padding-block: 3.5rem 2rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: .3rem;
  min-height: 4.25rem;
  margin-bottom: 2.5rem;
  padding: .45rem .5rem .45rem .65rem;
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: .85rem;
  background: var(--surface);
  box-shadow: 0 .5rem 1.5rem rgb(24 42 66 / 8%);
}

.site-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-height: 3.1rem;
  margin-right: auto;
  padding: .25rem .8rem .25rem .15rem;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -.015em;
  text-decoration: none;
}

.site-nav__brand img {
  width: 2.55rem;
  height: 2.55rem;
  filter: drop-shadow(0 .15rem .2rem rgb(24 42 66 / 20%));
  transition: transform 180ms ease;
}

.site-nav > a:not(.site-nav__brand) {
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  padding: .4rem .85rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.site-nav > a:not(.site-nav__brand):hover {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
  transform: translateY(-1px);
}

.site-nav > a[aria-current="page"]:not(.site-nav__brand) {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
  box-shadow: inset 0 -2px 0 var(--gold);
}

.site-nav__brand:hover img {
  transform: translateY(-2px) rotate(-3deg);
}

.site-nav__brand:hover span {
  text-decoration: underline;
  text-underline-offset: .2em;
}
/* About page and reusable information cards */
.about-content {
  padding-bottom: 2rem;
}

.about-intro, .reference-card {
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  box-shadow: 0 .55rem 1.35rem rgb(0 0 0 / 5%);
}

.about-intro {
  padding: clamp(1.25rem, 3vw, 2rem);
  border-top-color: var(--gold);
}

.reference-card {
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
}

.reference-card h2, .about-intro h2 {
  margin-top: 0;
}

.backup-feedback {
  grid-column: 1 / -1;
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.backup-feedback:empty {
  display: none;
}

.about-content section {
  margin-block: 0 2rem;
}

.about-content section:last-child {
  margin-bottom: 0;
}

.about-content h2 {
  font-size: 1.25rem;
}

.about-content p, .about-content li {
  max-width: 75ch;
}

.about-content li + li {
  margin-top: .5rem;
}

.book-cta {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-block: 1.25rem !important;
}

.book-cta a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .65rem .95rem;
  border: 1px solid var(--ink);
  border-radius: .4rem;
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
  text-decoration: none;
  box-shadow: inset 0 -2px 0 var(--gold);
}

.book-cta a:hover {
  background: var(--cta-hover);
  color: var(--cta-hover-text);
  text-decoration: underline;
}
/* Shared typography, statistics, and buttons */
.edition {
  color: var(--muted);
  font-size: .9rem;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  margin: .35rem 0 .4rem;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: -.035em;
}

.site-header > p {
  margin: .8rem 0 0;
  color: var(--muted);
}

dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 0 0 1.3rem;
}

dt {
  font-size: .84rem;
}

dd {
  margin: .1rem 0 0;
  font-size: 1.5rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

button {
  min-height: 2.75rem;
  padding: .5rem .8rem;
  border: 1px solid var(--muted);
  border-radius: .4rem;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

button:hover {
  background: var(--paper);
}

button:active {
  background: var(--notice);
}
/* Footer and accessibility helpers */
footer {
  border-top: 1px solid var(--line);
  padding-block: 1.5rem 2rem;
  color: var(--muted);
  font-size: .85rem;
}

footer p {
  max-width: 80ch;
}

.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  display: inline-block;
  margin: 1rem;
}
/* Shared small-screen layout */
@media (max-width: 640px) {
  .site-header, main, footer {
    width: min(100% - 1.5rem, 64rem);
  }

  .site-header {
    padding-top: 2rem;
  }

  .site-nav {
    margin-bottom: 1.75rem;
  }

  .site-nav {
    min-height: 3.75rem;
    padding: .35rem;
    border-radius: .65rem;
  }

  .site-nav__brand {
    gap: .4rem;
    min-height: 2.9rem;
    padding-right: .5rem;
  }

  .site-nav__brand img {
    width: 2.15rem;
    height: 2.15rem;
  }

  .site-nav > a:not(.site-nav__brand) {
    min-height: 2.7rem;
    padding-inline: .55rem;
  }

  dl {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 5rem), 1fr));
    gap: .75rem;
  }

  dt {
    font-size: .75rem;
  }

  dd {
    font-size: 1.2rem;
  }
}
/* System dark scheme
 * Explicit theme selection below takes precedence. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #151e2a;
    --surface: #1e2b3c;
    --ink: #e8edf5;
    --muted: #b2bfd1;
    --line: #45566d;
    --notice: #342f21;
    --accent: #dfc475;
    --focus: #99c1ff;
    --cta-hover: #dfc475;
    --cta-hover-text: #182a42;
  }
}
/* Explicit dark theme */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151e2a;
  --surface: #1e2b3c;
  --ink: #e8edf5;
  --muted: #b2bfd1;
  --line: #45566d;
  --notice: #342f21;
  --accent: #dfc475;
  --focus: #99c1ff;
  --cta-hover: #dfc475;
  --cta-hover-text: #182a42;
}

.site-nav .theme-toggle {
  min-height: 2.25rem;
  padding: .3rem .65rem;
  font-size: .85rem;
}
/* Native dialogs and shared actions */
dialog {
  width: min(100% - 2rem, 30rem);
  max-height: calc(100% - 2rem);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--surface);
  color: var(--ink);
}

dialog::backdrop {
  background: rgb(12 25 42 / 65%);
}

dialog h2 {
  margin-top: 0;
  line-height: 1.3;
  font-size: 1.4rem;
}

dialog p {
  max-width: 60ch;
}

dialog label {
  display: block;
  font-weight: 600;
  margin-bottom: .4rem;
}

dialog input {
  min-height: 2.75rem;
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--muted);
  background: var(--surface);
  color: var(--ink);
  border-radius: .2rem;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
}

.dialog-actions button {
  min-height: 2.75rem;
  padding: .6rem 1rem;
  border: 1px solid var(--muted);
  border-radius: .2rem;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
}

.dialog-actions button[type="submit"] {
  background: var(--ink);
  color: var(--surface);
}
