*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-parchment);
  color: var(--color-ink);
  font-family: var(--font-ui);
}

/* The OS-default scrollbar (thick, dark, square arrow buttons on Linux/GTK)
   reads as visibly foreign against this app's parchment/wood palette --
   restyle it to match rather than leave a generic system widget in view. */
html {
  scrollbar-color: var(--color-wood-mid) var(--color-parchment);
}

::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  background: var(--color-parchment);
}

::-webkit-scrollbar-thumb {
  background: var(--color-wood-mid);
  border: 3px solid var(--color-parchment);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-wood-dark);
}

main {
  width: min(100%, 48rem);
  margin-inline: auto;
  padding: clamp(1.5rem, 6vw, 4rem);
}

h1 {
  color: var(--color-burgundy);
  font-family: var(--font-serif);
}

a {
  color: var(--color-burgundy);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-burgundy);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* Secondary/back navigation rendered as <Link> (a plain <a>), styled to
   match <button>'s footprint without the burgundy fill .button-primary
   reserves for the page's primary/mutating action. */
.button-secondary {
  display: inline-block;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--color-wood-mid);
  border-radius: var(--radius-sm);
  background: var(--color-ivory);
  color: var(--color-ink);
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  line-height: 1.6;
}
.button-secondary:hover { background: var(--color-parchment); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-ivory);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: top 0.15s ease-in-out;
}

.skip-link:focus {
  top: var(--space-2);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
.message:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

/* Page <h1> headings get tabIndex="-1" + .focus() on mount purely to move DOM
   focus so screen readers announce the new page title on client-side route
   changes. tabindex="-1" excludes the heading from the Tab order, so no
   keyboard user can ever land here by tabbing -- focus only ever arrives via
   the SPA's own script. A visible ring on this non-interactive, non-tabbable
   target is never meaningful; suppress it explicitly (including the browser's
   own default focus-visible outline, not just the custom ring above). */
h1:focus-visible {
  outline: none;
}

.message {
  padding: 0.75rem;
  border-left: 4px solid var(--color-olive);
  background: #f0ecd4;
}

.error,
.field-error {
  color: var(--color-burgundy-dark);
}

.transitional-page p {
  color: var(--color-wood-mid);
}
