/* Reset, typography and page layout. Uses tokens.css and fonts.css. */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- Page --- */
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background-color: var(--color-paper);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(255, 253, 248, 0.7), transparent 60%);
  background-repeat: no-repeat;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-inline: var(--space-4);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
}
h1 { font-size: 1.8rem; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p, li { max-width: var(--text-width); }
a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--color-accent-hover); text-decoration-thickness: 2px; }
strong { font-weight: 600; }
.muted { color: var(--color-ink-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Focus: always visible for keyboard users --- */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--color-surface);
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: var(--space-4); top: -100px;
  padding: var(--space-2) var(--space-4); z-index: 10;
  background: var(--color-accent); color: var(--color-accent-contrast);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-2); color: var(--color-accent-contrast); }

/* --- Layout: header, main, footer --- */
.site-header,
.ornament-rule,
.site-main,
.site-footer {
  max-width: var(--content-width);
  margin-inline: auto;
}
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-5) var(--space-3);
}
.site-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-ink);
  text-decoration: none;
  letter-spacing: 0.01em;
  min-height: var(--tap);
  display: inline-flex;
  align-items: flex-end;
}
.site-title:hover { color: var(--color-accent); text-decoration: none; }

/* Double sepia line under the header, like a ruled album page */
.ornament-rule {
  height: 4px;
  border-top: 1px solid var(--color-ornament);
  border-bottom: 1px solid var(--color-ornament);
}
.site-main {
  display: grid;
  gap: var(--space-5);
  align-content: start;
  padding-block: var(--space-5) var(--space-7);
}
.site-main > * { min-width: 0; }
.site-footer {
  border-top: 1px solid var(--color-rule);
  padding-block: var(--space-4) var(--space-5);
  color: var(--color-ink-muted);
  font-family: var(--font-display);
  font-style: italic;
  text-align: center;
}

/* A narrow, centred column for forms and short messages */
.narrow { max-width: 30rem; width: 100%; justify-self: center; }

@media (min-width: 40rem) {
  body { padding-inline: var(--space-5); }
  h1 { font-size: var(--text-2xl); }
}
@media (min-width: 64rem) {
  .site-main { padding-block: var(--space-6) var(--space-7); }
}

/* --- Less motion for people who ask for it --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
