/* ==========================================================================
   The Everyday Learner — Phase 1
   Plain CSS. No build step, no preprocessor, no third-party requests.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts — Andika, self-hosted (SIL Open Font License, see fonts/OFL.txt)
   Latin subset, Regular + Bold only.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Andika';
  src: url('fonts/Andika-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Andika';
  src: url('fonts/Andika-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Design tokens
   Sage is book one's accent only. It is not the site's primary colour —
   book two gets its own accent and must not inherit this one.
   -------------------------------------------------------------------------- */

:root {
  --paper:        #FBF9F4;
  --ink:          #2B2B28;
  --muted:        #6E6B63;
  --rule:         #E3DED2;
  --accent-book1: #7E9C79;

  --font-body: Andika, "Segoe UI", system-ui, -apple-system, sans-serif;

  --measure: 62ch;
  --step: 1.5rem;
}

/* --------------------------------------------------------------------------
   Reset and base
   -------------------------------------------------------------------------- */

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

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;       /* 18px floor, per brief §5 */
  line-height: 1.7;
  overflow-wrap: break-word; /* long words never force sideways scroll */
}

img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Layout — mobile first. Designed at 360px, then widened.
   -------------------------------------------------------------------------- */

.page {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 2.5rem 1.25rem 4rem;
}

@media (min-width: 40em) {
  .page {
    padding: 5rem 2rem 6rem;
  }
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1 {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

@media (min-width: 40em) {
  h1 { font-size: 2.5rem; }
}

.subtitle {
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--muted);
  margin: 0 0 var(--step);
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 700;
  margin: 2.5rem 0 0.25rem;
}

p {
  margin: 0 0 var(--step);
}

.lede {
  font-size: 1.1875rem;
}

em {
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */

a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-book1);
  transition: text-decoration-color 120ms ease, color 120ms ease;
}

a:hover {
  text-decoration-color: var(--ink);
}

/* Visible focus on every interactive element, per brief §5. */
a:focus-visible,
.download:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Download button — the primary action on /guide/book1.
   Ink on sage is 4.68:1 (WCAG AA for normal text).
   White on sage would be 3.04:1 and fail, so ink it is.
   -------------------------------------------------------------------------- */

.download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  min-height: 3.5rem;          /* 56px — clears the 48px floor in brief §5 */
  padding: 1rem 1.25rem;
  margin: 2rem 0;

  background-color: var(--accent-book1);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 4px;

  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;

  transition: transform 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 2px 0 var(--ink);
}

.download:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--ink);
  text-decoration: none;
}

.download:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.download__icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

@media (min-width: 40em) {
  .download {
    width: auto;
    min-width: 24rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .download:hover,
  .download:active {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Notes, rules, footer
   -------------------------------------------------------------------------- */

.note {
  font-size: 1rem;
  color: var(--muted);   /* 5.06:1 on paper — WCAG AA */
  margin: 0 0 var(--step);
}

hr,
.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

.colophon {
  font-size: 1rem;
  color: var(--muted);
}

.colophon strong {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Guide index list
   -------------------------------------------------------------------------- */

.entry {
  padding-block: 0.5rem;
}

.entry p {
  margin-bottom: 0.5rem;
}

.entry--pending h2,
.entry--pending p {
  color: var(--muted);
}
