/* =========================================================================
   Stories of Nikkei Canadians — Resilience in Struggle
   Shared stylesheet for all pages.

   DESIGN NOTES (for future maintainers)
   -------------------------------------
   • Palette: aged-paper neutrals + deep ink brown for text, with an
     "aizome" indigo (traditional Japanese textile dye) as the link/accent
     colour and a vermilion "seal" red used only for tiny accents.
   • Typography: intentionally uses installed system faces only — no
     external font requests, no render-blocking, works offline.
   • All colour pairings were checked against WCAG 2.1 AA:
       ink   #2B211A on paper #F3ECDF  ≈ 12.9:1  (body text)
       indigo#2F4A63 on paper #F3ECDF  ≈  6.9:1  (links)
       sepia #6C4F33 on paper #F3ECDF  ≈  5.6:1  (labels/captions)
   • Layout is mobile-first; the nav collapses to a disclosure menu
     below 44em (see js/main.js for the toggle behaviour).
   ========================================================================= */

/* ---- 1. Design tokens ------------------------------------------------- */
:root {
  /* Colour */
  --paper:        #F3ECDF;  /* page background — aged paper           */
  --paper-deep:   #E9DFCA;  /* alternate section background           */
  --print-white:  #FBF7EE;  /* "photo print" border / card surface    */
  --ink:          #2B211A;  /* primary text — deep sepia ink          */
  --sepia:        #6C4F33;  /* secondary text, labels, captions       */
  --indigo:       #2F4A63;  /* links & interactive elements (aizome)  */
  --indigo-deep:  #22374B;  /* link hover / active                    */
  --seal:         #9E2F27;  /* vermilion accent — used very sparingly */
  --rule:         #CBBA9D;  /* hairline borders                       */

  /* Type — system stacks only (no external requests) */
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
                Palatino, Georgia, "Times New Roman", serif;
  --font-sans:  system-ui, -apple-system, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, sans-serif;

  /* Rhythm */
  --measure: 65ch;          /* comfortable reading width              */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 3rem;
  --space-5: 5rem;
}

/* ---- 2. Reset / base -------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Respect users who prefer reduced motion — disables smooth scrolling
   and any transitions declared further down. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.125rem;           /* 18px base — generous for long reading */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- 3. Focus & skip link (a11y) -------------------------------------- */
/* One consistent, high-visibility focus style everywhere. */
:focus-visible {
  outline: 3px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100%;
  z-index: 100;
  padding: 0.6em 1em;
  background: var(--ink);
  color: var(--print-white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
}
.skip-link:focus { top: 0; }

/* ---- 4. Typography ----------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;            /* progressive enhancement */
}

h1 { font-size: clamp(2.1rem, 5.5vw, 3.4rem); margin: 0 0 var(--space-2); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: var(--space-4) 0 var(--space-2); }
h3 { font-size: 1.25rem; margin: var(--space-3) 0 var(--space-1); }

p, ul, ol, dl { margin: 0 0 var(--space-2); }

/* "Eyebrow" label above headings — sans, letterspaced, sepia.
   Encodes the section's category the way an archive folder tab would. */
.eyebrow {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sepia);
  margin-bottom: var(--space-1);
}

/* Lede paragraph — slightly larger opening text */
.lede {
  font-size: clamp(1.2rem, 2.5vw, 1.35rem);
  line-height: 1.55;
  max-width: var(--measure);
}

a {
  color: var(--indigo);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--indigo-deep); text-decoration-thickness: 2px; }

/* ---- 5. Layout primitives --------------------------------------------- */
.wrap {
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
}

/* Constrain long-form text to a readable measure */
.prose > * { max-width: var(--measure); }

section { padding-block: var(--space-4); }
.section-alt { background: var(--paper-deep); }

/* ---- 6. Header & navigation ------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-block: var(--space-2);
}

.site-brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.2;
}
.site-brand .brand-sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sepia);
}

/* Mobile toggle button — hidden on wide screens via media query below */
.nav-toggle {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.5em 0.9em;
  cursor: pointer;
}
.nav-toggle[aria-expanded="true"] { background: var(--paper-deep); }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
}
.nav-list a {
  display: block;
  padding: 0.6em 0.25em;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav-list a:hover { color: var(--indigo-deep); }

/* Current page indicator — colour + border, never colour alone */
.nav-list a[aria-current="page"] {
  color: var(--indigo-deep);
  border-bottom-color: var(--seal);
  font-weight: 700;
}

/* Mobile: nav is a stacked panel, hidden until toggled (see main.js) */
.site-nav { width: 100%; }
.site-nav .nav-list { display: none; padding-block: var(--space-1); }
.site-nav .nav-list.is-open { display: block; }

/* Desktop: toggle disappears, list becomes a horizontal row */
@media (min-width: 44em) {
  .nav-toggle { display: none; }
  .site-nav { width: auto; }
  .site-nav .nav-list {
    display: flex;
    gap: var(--space-3);
  }
}

/* ---- 7. Hero (home page) ----------------------------------------------- */
.hero { padding-block: var(--space-4) var(--space-5); }

.hero-grid {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}
@media (min-width: 56em) {
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
}

.hero .book-subtitle {
  font-style: italic;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  color: var(--sepia);
  margin-top: calc(var(--space-1) * -1);
}

/* ---- 8. Archival photo treatment --------------------------------------- */
/* Figures are styled like archival prints: a thick "print paper" border,
   a soft shadow, and a caption set in the utility sans with a sepia tone.
   Swap the .photo-placeholder div for a real <img> when photos arrive —
   an example is provided in an HTML comment beside each figure. */
figure.archival {
  margin: var(--space-3) 0;
  background: var(--print-white);
  border: 1px solid var(--rule);
  padding: var(--space-2);
  box-shadow: 0 2px 10px rgba(43, 33, 26, 0.12);
}

figure.archival figcaption {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--sepia);
  padding-top: var(--space-1);
}

/* Photo credit pattern: <figcaption> caption text <cite>Credit</cite> */
figure.archival cite {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  margin-top: 0.25em;
}

/* Placeholder block shown until real photographs are supplied.
   aspect-ratio keeps layout stable so nothing shifts when images land. */
.photo-placeholder {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--space-2);
  background:
    repeating-linear-gradient(
      45deg,
      var(--paper-deep) 0 12px,
      var(--paper) 12px 24px
    );
  border: 1px dashed var(--sepia);
  color: var(--sepia);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
.photo-placeholder.portrait { aspect-ratio: 3 / 4; }

/* ---- 9. Signature element: the five-generations timeline --------------- */
/* An ordered list — order carries real meaning here (Issei → Gosei). */
.generations {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: grid;
  gap: 1px;                      /* hairline seams between panels */
  background: var(--rule);
  border: 1px solid var(--rule);
}
@media (min-width: 44em) {
  .generations { grid-template-columns: repeat(5, 1fr); }
}

.generations li {
  background: var(--print-white);
  padding: var(--space-2);
}

.generations .gen-kanji {
  display: block;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--seal);            /* the one place vermilion appears large */
  margin-bottom: 0.35em;
}
.generations .gen-term {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
}
.generations .gen-desc {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--sepia);
  margin-top: 0.35em;
}

/* ---- 10. Pull quote ----------------------------------------------------- */
.pull-quote {
  margin: var(--space-4) 0;
  padding-left: var(--space-3);
  border-left: 3px solid var(--seal);
  max-width: var(--measure);
}
.pull-quote p {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}

/* ---- 11. Teaser cards (home page section links) ------------------------ */
.teasers {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
@media (min-width: 44em) {
  .teasers { grid-template-columns: repeat(3, 1fr); }
}

.teaser {
  background: var(--print-white);
  border: 1px solid var(--rule);
  padding: var(--space-3);
}
.teaser h3 { margin-top: 0; }
.teaser p {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--sepia);
}
/* The whole-card link: heading link gets a pseudo-element hit area.
   Keeps ONE link in the tab order (not a wrapper link around everything). */
.teaser { position: relative; }
.teaser h3 a { text-decoration: none; color: var(--indigo); }
.teaser h3 a::after { content: ""; position: absolute; inset: 0; }
.teaser:hover { border-color: var(--indigo); }
.teaser:focus-within { outline: 3px solid var(--indigo); outline-offset: 3px; }

/* ---- 12. Honours list --------------------------------------------------- */
.honours-list {
  list-style: none;
  margin: var(--space-3) 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}
@media (min-width: 44em) {
  .honours-list { grid-template-columns: repeat(2, 1fr); }
}

.honours-list li {
  background: var(--print-white);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--seal);
  padding: var(--space-2) var(--space-3);
}
.honours-list h3 { margin: 0 0 0.2em; font-size: 1.1rem; }
.honours-list .honour-year {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sepia);
  margin: 0 0 0.4em;
}
.honours-list p:last-child { margin: 0; font-size: 1rem; }

/* Editorial note box — used wherever content is pending verification */
.note {
  max-width: var(--measure);
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}
.note strong { color: var(--ink); }

/* ---- 13. Definition lists (book details, contact) ----------------------- */
.detail-list {
  max-width: var(--measure);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4em var(--space-3);
  font-family: var(--font-sans);
  font-size: 1rem;
}
.detail-list dt { font-weight: 700; color: var(--sepia); }
.detail-list dd { margin: 0; }

/* ---- 14. Footer ---------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-5);
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
  padding-block: var(--space-4);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--sepia);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: space-between;
}
.site-footer nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.site-footer a { color: var(--indigo); }

/* ---- 15. Print ------------------------------------------------------------ */
@media print {
  .site-header, .site-footer, .nav-toggle { display: none; }
  body { background: #fff; color: #000; }
}
