/* Library pages on top of /site/site.css (the shared shell: app fonts and tokens, header, footer).
   This file styles only the Library content: hero, guide column, cards, tables, drawings and tools.
   The names below alias the app tokens, so light and dark follow the app. */
:root {
  --background: var(--bg);
  --surface: var(--card);
  --muted: var(--ink-2);
  --rule: var(--hairline);
  --accent: var(--link);
  --table-heading: var(--card);
  --lib-read: var(--site-read, 720px);
  --lib-wide: var(--site-max, 1120px);
  --lib-gutter: var(--site-gutter, 24px);
  /* Illustration palette: hero drawings and tools use only these, so both themes work without their own colours.
     Outlines a reader must see use --ill-muted or stronger (3:1 on --ill-surface and --ill-faint). */
  --ill-ink: var(--ink);
  --ill-muted: light-dark(#6c6c70, #98989f);
  --ill-line: light-dark(#c7c7cc, #48484a);
  --ill-faint: light-dark(#f2f2f7, #2c2c2e);
  --ill-surface: var(--card);
  --ill-rain: light-dark(#0a6fd6, #5aa9ff);
  --ill-rain-soft: light-dark(#cfe3fb, #1f3a5c);
  --ill-snow: light-dark(#7a6bd0, #b4a8ff);
  --ill-ice: light-dark(#3f9fb8, #7fd0e3);
  --ill-cold: light-dark(#2f6fc6, #84b4ff);
  --ill-warm: light-dark(#d9692e, #ff9f66);
  --ill-hot: light-dark(#c23d2a, #ff7b63);
  --ill-green: light-dark(#2b8457, #6fd3a1);
  --ill-amber: light-dark(#a8760a, #f0c050);
  --ill-red: light-dark(#c23a3a, #ff8080);
  --ill-accent: light-dark(#0064d2, #4ea3ff);
  --ill-accent-soft: light-dark(#e3eefc, #10304f);
}

.lib { margin: 0; }
.lib a:focus-visible, .lib button:focus-visible, .lib input:focus-visible, .lib select:focus-visible, .table-scroll:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

/* Hero: eyebrow, title, description, meta and (on guides) the drawing in a card. No photograph. */
.lib-hero { border-bottom: 1px solid var(--hairline); }
.lib-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  align-items: center;
  gap: 32px 56px;
  width: min(100% - 2 * var(--lib-gutter), var(--lib-wide));
  margin: 0 auto;
  padding: clamp(36px, 6vw, 72px) 0 clamp(32px, 5vw, 56px);
}
.hero-index .lib-hero-inner, .lib-hero-inner:not(:has(.hero-art)) { grid-template-columns: minmax(0, 1fr); }
.eyebrow-lib {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.eyebrow-lib a { display: inline-block; min-height: 24px; color: inherit; text-decoration: none; }
.eyebrow-lib a:hover { text-decoration: underline; }
.lib-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 54px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.hero-index h1 { font-size: clamp(38px, 5.4vw, 68px); }
.dek {
  max-width: 40em;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.5;
  text-wrap: pretty;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 18px 0 0;
  padding: 0;
  color: var(--ink-2);
  font-size: 15px;
  font-variant-numeric: lining-nums tabular-nums;
  list-style: none;
}
.meta li + li { margin: 0; }
.meta li + li::before { content: '·'; margin-right: 16px; }
.hero-art {
  margin: 0;
  padding: 16px 16px 10px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: var(--card);
}
.hero-art svg { display: block; width: 100%; height: auto; }
/* The app's type everywhere: SVG labels and tool text use Source Serif 4 too (the files name a sans stack). */
.hero-art svg text, .card-art svg text, .tool svg text { font-family: var(--font-text); }
.tool, .tool button, .tool input, .tool select { font-family: var(--font-text); }
.hero-art figcaption, .tool-note { margin-top: 8px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }

/* Guide column. */
.lib-body { width: min(100% - 2 * var(--lib-gutter), var(--lib-read)); margin: clamp(28px, 5vw, 48px) auto 0; }
.lib-index .lib-body { width: min(100% - 2 * var(--lib-gutter), var(--lib-wide)); }

.lib-body h2, .lib-body h3 { margin: 0 0 12px; font-weight: 600; line-height: 1.16; letter-spacing: -.015em; text-wrap: balance; }
.lib-body h2 { margin-top: 44px; font-size: clamp(25px, 3.6vw, 30px); }
.lib-body h3 { margin-top: 26px; font-size: 21px; }
.lib-body p, .lib-body ul, .lib-body ol { margin: 0 0 16px; text-wrap: pretty; }
.lib-body ul, .lib-body ol { padding-inline-start: 24px; }
.lib-body li + li { margin-top: 6px; }
.lib-body a { color: var(--link); text-underline-offset: .18em; }

.intro { font-size: 20px; }
.intro p:first-child { margin-top: 0; }
.category, .source-check, .source-note, .app-link { color: var(--ink-2); font-size: 15px; }
/* Kicker above a plain page's title (places, climate, best months). */
.category { margin: 0 0 8px; font-weight: 600; }
.source-note { display: block; }
.source-disclosure { margin: -8px 0 12px; }
.source-disclosure summary { width: fit-content; padding: 8px 0; color: var(--link); cursor: pointer; }
.source-disclosure summary:hover { text-decoration: underline; text-underline-offset: .18em; }
.source-disclosure .source-list { margin-top: 8px; }
/* Standalone list links get a 24 px target (WCAG 2.5.8); links inside sentences keep their inline box. */
.source-list > li > a:first-child, .related-list a, .app-link a { display: inline-block; min-height: 24px; padding-block: 1px; }
.app-link { margin-top: 32px; }

.table-scroll { max-width: 100%; margin: 20px 0; overflow-x: auto; }
.lib-body table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: 16px;
  font-variant-numeric: lining-nums tabular-nums;
}
.lib-body th, .lib-body td {
  /* Whole words only: the table scrolls sideways instead of breaking "Freezing" in two. */
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
  text-align: start;
  vertical-align: top;
}
.lib-body th:first-child, .lib-body td:first-child { min-width: 6.5rem; font-weight: 600; }
.lib-body thead th { background: var(--card); font-weight: 650; }
.lib-body tbody th { font-weight: 600; }

/* Two-column question-and-answer tables keep the row header with its answer on phones. */
@media (max-width: 479px) {
  .lib-body table:has(tbody th[scope="row"]):not(:has(tr > :nth-child(3))) {
    display: block;
    min-width: 0;
  }
  .lib-body table:has(tbody th[scope="row"]):not(:has(tr > :nth-child(3))) thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .lib-body table:has(tbody th[scope="row"]):not(:has(tr > :nth-child(3))) :is(tbody, tr, th, td) {
    display: block;
  }
  .lib-body table:has(tbody th[scope="row"]):not(:has(tr > :nth-child(3))) :is(th, td) {
    min-width: 0;
    padding-inline: 0;
    overflow-wrap: anywhere;
  }
  .lib-body table:has(tbody th[scope="row"]):not(:has(tr > :nth-child(3))) tbody th {
    border-bottom: 0;
    padding-bottom: 0;
  }
  .lib-body table:has(tbody th[scope="row"]):not(:has(tr > :nth-child(3))) tbody td {
    padding-top: 3px;
  }
}

/* Interactive tools: a framed figure in the guide column; each tool adds its own /library/tools/<slug>.css. */
.tool {
  margin: 32px 0;
  padding: 22px clamp(16px, 3vw, 26px) 18px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--card);
  font-size: 16px;
  line-height: 1.5;
}
.tool > h3, .tool .tool-title { margin: 0 0 4px; font-size: 19px; font-weight: 650; letter-spacing: 0; }
.tool-lede { margin: 0 0 16px; color: var(--ink-2); }
@media (prefers-reduced-motion: no-preference) {
  .tool [data-result-reveal="a"] { animation: tool-result-fade var(--dur-exit) var(--ease) both; }
  .tool [data-result-reveal="b"] { animation: tool-result-fade-again var(--dur-exit) var(--ease) both; }
  @keyframes tool-result-fade { from { opacity: 0; } }
  @keyframes tool-result-fade-again { from { opacity: 0; } }
}

/* Library index: one grid of guide cards. */
.lib-index .lib-body { container-type: inline-size; }
.lib-body .cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lib-body .cards li, .lib-body .cards li + li { margin: 0; }
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
}
.lib-body a.card { color: var(--ink); text-decoration: none; }
.card:is(:hover, :focus-visible) { box-shadow: var(--card-shadow); }
.card:active { opacity: .85; }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: box-shadow var(--dur-press) var(--ease), opacity var(--dur-press) var(--ease); }
}
.card:hover .card-title { text-decoration: underline; text-underline-offset: .15em; }
.card-art { display: grid; place-items: center; aspect-ratio: 16 / 10; padding: 14px; overflow: hidden; background: var(--ill-faint); }
.card-art svg { display: block; width: 100%; height: 100%; }
.card-body { display: block; padding: 16px 20px 20px; }
.card-kicker { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.card-title { display: block; font-size: 21px; font-weight: 600; line-height: 1.22; letter-spacing: -.01em; }
.card-dek { display: block; margin-top: 8px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
@container (min-width: 656px) {
  .lib-index .cards > :first-child { grid-column: 1 / -1; }
  .lib-index .cards > :first-child .card {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    align-items: center;
  }
}
.more { margin-top: 48px; }
.lib-body .more ul { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; list-style: none; }
.lib-body .more li, .lib-body .more li + li { margin: 0; }
.lib-body .more a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: 15px;
  text-decoration: none;
}
.lib-body .more a:hover { background: var(--card); }

@media (max-width: 900px) {
  .lib-hero-inner { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hero-art { max-width: 560px; }
}
@media (max-width: 730px) {
  .intro { font-size: 18px; }
  .lib-hero h1 { font-size: clamp(30px, 8.4vw, 38px); }
  .hero-index h1 { font-size: clamp(34px, 9vw, 44px); }
  .meta { flex-direction: column; gap: 2px; }
  .meta li + li::before { content: none; }
  .hero-art { padding: 12px 12px 8px; }
}

/* Hero drawing colours (content/library/visuals/<slug>/hero.svg): classes instead of style attributes, which the
   site test rejects. Drawings appear on the index too, so their rules live here, not in the tools CSS. */
.ill-ar-1 { stop-color:var(--ill-faint); }
.ill-ar-2 { stop-color:var(--ill-rain-soft); }
.ill-ar-3 { stop-color:var(--ill-accent-soft); }
.ill-ar-4 { fill:var(--ill-faint); }
.ill-ar-5 { stroke:var(--ill-muted); }
.ill-ar-6 { stroke:var(--ill-line); }
.ill-ar-7 { fill:var(--ill-accent-soft); }
.ill-ar-8 { fill:var(--ill-surface); }
.ill-ar-9 { stroke:var(--ill-ink); }
.ill-ar-10 { fill:var(--ill-surface);stroke:var(--ill-muted); }
.ill-ar-11 { stroke:var(--ill-rain); }
.ill-ar-12 { stroke:var(--ill-accent); }
.ill-ar-13 { fill:var(--ill-ink); }
.ill-cor-1 { fill:var(--ill-faint); }
.ill-cor-2 { stroke:var(--ill-muted); }
.ill-cor-3 { fill:var(--ill-surface);stroke:var(--ill-muted); }
.ill-cor-4 { fill:var(--ill-accent-soft);stroke:var(--ill-accent); }
.ill-cor-5 { fill:var(--ill-accent); }
.ill-cor-6 { stroke:var(--ill-ink); }
.ill-cor-7 { stroke:var(--ill-accent); }
.ill-cor-8 { fill:var(--ill-accent-soft);stroke:var(--ill-muted); }
.ill-cor-9 { fill:var(--ill-rain); }
.ill-cor-10 { fill:var(--ill-ink);font-family:var(--sans); }
.ill-flt-1 { fill:var(--ill-faint); }
.ill-flt-2 { fill:var(--ill-rain-soft); }
.ill-flt-3 { fill:var(--ill-accent-soft); }
.ill-flt-4 { fill:var(--ill-surface);stroke:var(--ill-muted); }
.ill-flt-5 { stroke:var(--ill-ink); }
.ill-flt-6 { fill:var(--ill-ink); }
.ill-flt-7 { fill:var(--ill-ink);font-family:var(--sans); }
.ill-gve-1 { stroke:var(--ill-muted); }
.ill-gve-2 { fill:var(--ill-faint); }
.ill-gve-3 { fill:var(--ill-surface); }
.ill-gve-4 { fill:var(--ill-rain-soft);stroke:var(--ill-rain); }
.ill-gve-5 { fill:var(--ill-accent-soft);stroke:var(--ill-accent); }
.ill-gve-6 { fill:var(--ill-ink); }
.ill-hrrr-1 { stroke:var(--ill-muted); }
.ill-hrrr-2 { fill:var(--ill-faint); }
.ill-hrrr-3 { fill:var(--ill-rain-soft);stroke:var(--ill-rain); }
.ill-hrrr-4 { fill:var(--ill-rain); }
.ill-hrrr-5 { stroke:var(--ill-accent); }
.ill-hrrr-6 { fill:var(--ill-faint);stroke:var(--ill-muted); }
.ill-hrrr-7 { fill:var(--ill-rain-soft); }
.ill-hrrr-8 { stroke:var(--ill-rain); }
.ill-hrrr-9 { fill:var(--ill-ink);font-family:var(--sans); }
.ill-sfr-1 { fill:var(--ill-surface); }
.ill-sfr-2 { fill:var(--ill-cold); }
.ill-sfr-3 { fill:var(--ill-warm); }
.ill-sfr-4 { fill:var(--ill-faint); }
.ill-sfr-5 { stroke:var(--ill-muted); }
.ill-sfr-6 { stroke:var(--ill-ink); }
.ill-sfr-7 { fill:var(--ill-rain-soft);stroke:var(--ill-ink); }
.ill-sfr-8 { fill:var(--ill-ice);stroke:var(--ill-ink); }
.ill-sfr-9 { font-family:var(--sans);fill:var(--ill-ink); }
.ill-wwa-1 { fill:var(--ill-ink); }
.ill-wwa-2 { fill:var(--ill-faint); }
.ill-wwa-3 { fill:var(--ill-surface); }
.ill-wwa-4 { stroke:var(--ill-muted); }
.ill-wwa-5 { stroke:var(--ill-red); }
.ill-wwa-6 { stroke:var(--ill-accent); }
.ill-ten-1 { fill:var(--ill-faint); }
.ill-ten-2 { fill:var(--ill-accent-soft);stroke:var(--ill-accent); }
.ill-ten-3 { stroke:var(--ill-muted); }
.ill-ten-4 { stroke:var(--ill-accent); }
.ill-ten-5 { fill:var(--ill-ink); }
.ill-wear-1 { fill:var(--ill-faint); }
.ill-wear-2 { stroke:var(--ill-muted); }
.ill-wear-3 { fill:var(--ill-rain-soft);stroke:var(--ill-muted); }
.ill-wear-4 { fill:var(--ill-accent-soft);stroke:var(--ill-muted); }
.ill-wear-5 { fill:var(--ill-surface);stroke:var(--ill-muted); }
.ill-wear-6 { stroke:var(--ill-accent); }
.ill-sog-1 { fill:var(--ill-faint);stroke:var(--ill-muted); }
.ill-sog-2 { fill:var(--ill-line); }
.ill-sog-3 { fill:var(--ill-surface);stroke:var(--ill-muted); }
.ill-sog-4 { fill:var(--ill-ice);stroke:var(--ill-ink); }
.ill-sog-5 { font-family:var(--sans);fill:var(--ill-ink); }
