/* Hundredwood — a centenary tribute to Winnie-the-Pooh (1926–2026)
   Layout: a long reading column on honey-tinted paper; Shepard's drawings sit on
   "plates" (pieces of book paper) so they look printed in either theme. */
:root {
  --paper: #f8f1da;        /* page ground: old book paper, honey-tinted */
  --paper-2: #efe5c6;      /* bands and wells */
  --plate: #fbf6e6;        /* the paper under every Shepard drawing (same in both themes) */
  --ink: #2b241a;          /* text */
  --ink-soft: #62563f;     /* secondary text */
  --rule: #d9c999;
  --honey: #a8650a;        /* accent: the hunny pot */
  --honey-wash: #f1d48f;
  --sky: #5b86b8;          /* the blue balloon */
  --forest: #4d6845;       /* the Hundred Acre Wood */
  --focus: #2f6db3;

  --f-display: "IM Fell English", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-display-sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --f-body: "Spectral", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --step--1: clamp(0.84rem, 0.8rem + 0.15vw, 0.92rem);
  --step-0: clamp(1.05rem, 1rem + 0.25vw, 1.18rem);
  --step-1: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem);
  --step-2: clamp(1.7rem, 1.4rem + 1.3vw, 2.4rem);
  --step-3: clamp(2.2rem, 1.6rem + 2.6vw, 3.6rem);
  --step-hero: clamp(5.5rem, 3rem + 12vw, 12rem);

  --measure: 64ch;
  --wide: 1180px;
  --radius: 4px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1a14; --paper-2: #24211a; --plate: #f3ecd6;
    --ink: #efe5ca; --ink-soft: #b9ab8a; --rule: #4a4233;
    --honey: #e4a93c; --honey-wash: #5a4318; --sky: #8fb4df; --forest: #9cbb8f; --focus: #8fb4df;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1c1a14; --paper-2: #24211a; --plate: #f3ecd6;
  --ink: #efe5ca; --ink-soft: #b9ab8a; --rule: #4a4233;
  --honey: #e4a93c; --honey-wash: #5a4318; --sky: #8fb4df; --forest: #9cbb8f; --focus: #8fb4df;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.65 var(--f-body);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--honey); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.08; text-wrap: balance; margin: 0; }
p { margin: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; }

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.label {
  font-family: var(--f-display-sc);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap { display: flex; align-items: center; gap: 1rem; padding-block: 0.6rem; }
.brand { font-family: var(--f-display); font-size: 1.25rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--honey); }
.nav { display: flex; gap: 1.1rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { font-family: var(--f-display-sc); letter-spacing: 0.05em; color: var(--ink-soft); text-decoration: none; white-space: nowrap; font-size: 0.98rem; }
.nav a:hover { color: var(--ink); }
.theme-btn {
  border: 1px solid var(--rule); background: transparent; color: var(--ink-soft);
  border-radius: 999px; width: 2.1rem; height: 2.1rem; flex: none; cursor: pointer;
  display: grid; place-items: center;
}
.theme-btn svg { width: 1rem; height: 1rem; }
@media (max-width: 720px) { .nav { display: none; } .theme-btn { margin-left: auto; } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(2rem, 5vw, 4.5rem) clamp(2.5rem, 5vw, 4rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(1rem, 4vw, 3rem); align-items: center; }
@media (max-width: 820px) { .hero .wrap { grid-template-columns: 1fr; } }
.hero-copy { min-width: 0; display: grid; gap: 1.1rem; }
.hero-dates { font-family: var(--f-display-sc); letter-spacing: 0.12em; color: var(--honey); font-size: var(--step-0); }
.hero-title { display: grid; gap: 0.2rem; }
.hero-title .num {
  font-family: var(--f-body); font-weight: 400; font-variant-numeric: lining-nums; font-size: var(--step-hero); line-height: 0.8; letter-spacing: -0.03em;
  color: var(--ink);
}
.hero-title .num em { font-style: italic; color: var(--honey); }
.hero-title .name { font-family: var(--f-display); font-size: var(--step-3); }
.hero-lede { max-width: 46ch; font-size: var(--step-1); line-height: 1.45; color: var(--ink-soft); font-style: italic; }
.hero-age { font-variant-numeric: tabular-nums; color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.4rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 400 1.05rem/1 var(--f-display-sc); letter-spacing: 0.06em;
  padding: 0.8rem 1.2rem; border-radius: 999px; text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--ink); color: var(--ink); background: transparent;
}
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--honey); border-color: var(--honey); color: var(--paper); }
.btn svg { width: 1.1em; height: 1.1em; }

.hero-art { position: relative; min-width: 0; justify-self: center; width: min(100%, 460px); }
.hero-plate {
  position: relative; background: var(--plate); border-radius: 50% 50% 46% 54% / 52% 48% 52% 48%;
  aspect-ratio: 1; display: grid; place-items: center; padding: 10%;
  box-shadow: 0 0 0 1px var(--rule), 0 30px 60px -30px rgba(60, 40, 0, 0.45);
}
.hero-plate .float { position: relative; width: 100%; animation: drift 7s ease-in-out infinite; }
.hero-plate img { width: 100%; position: relative; z-index: 1; }
/* The blue balloon, so the bees think he's part of the sky. */
.hero-plate .balloon-tint {
  position: absolute; z-index: 0; left: 48.2%; top: -29%; width: 40%; aspect-ratio: 1;
  border-radius: 50%; background: radial-gradient(circle at 38% 34%, #b9d3ee, #6f99c8 70%);
  opacity: 0.8;
}
.hero-plate .bee { position: absolute; z-index: 2; width: 14px; height: 14px; color: #2b241a; }
.hero-note { text-align: center; margin-top: 0.8rem; color: var(--ink-soft); font-size: var(--step--1); font-style: italic; }
@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-14px) rotate(1.5deg); }
}

/* Balloons sent by visitors */
.sky-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.sky-balloon { position: absolute; bottom: -140px; width: 64px; }
.sky-balloon svg { width: 100%; height: auto; overflow: visible; }

/* ---------- Sections ---------- */
section { scroll-margin-top: 4rem; }
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.section.band { background: var(--paper-2); border-block: 1px solid var(--rule); }
.section-head { display: grid; gap: 0.6rem; margin-bottom: clamp(1.5rem, 4vw, 2.6rem); max-width: 52rem; }
.section-head h2 { font-size: var(--step-3); }
.section-head p { color: var(--ink-soft); max-width: var(--measure); }

/* Story + timeline */
.story { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 860px) { .story { grid-template-columns: 1fr; } }
.prose { display: grid; gap: 1.1rem; max-width: var(--measure); min-width: 0; }
.prose p:first-child::first-letter {
  font-family: var(--f-display); float: left; font-size: 4.2em; line-height: 0.8; padding: 0.06em 0.1em 0 0; color: var(--honey);
}
.pull {
  font-family: var(--f-display); font-style: italic; font-size: var(--step-1); line-height: 1.35;
  border-left: 2px solid var(--honey); padding-left: 1rem; color: var(--ink);
}
.pull cite { display: block; font: normal var(--step--1) var(--f-display-sc); letter-spacing: 0.06em; color: var(--ink-soft); margin-top: 0.4rem; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; min-width: 0; }
.timeline li { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: 1rem; padding-block: 0.9rem; border-top: 1px solid var(--rule); }
.timeline li:last-child { border-bottom: 1px solid var(--rule); }
.timeline .yr { font-family: var(--f-display); font-size: 1.5rem; line-height: 1.1; color: var(--honey); font-variant-numeric: lining-nums tabular-nums; }
.timeline b { font-weight: 600; }
.timeline .now .yr { color: var(--sky); }
.timeline p { font-size: 0.98rem; line-height: 1.5; }

/* Animated-book feature */
.feature { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; } }
.feature-copy { display: grid; gap: 1rem; min-width: 0; }
.feature-copy ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; color: var(--ink-soft); }
.book-preview {
  position: relative; display: block; text-decoration: none; perspective: 1600px; justify-self: center;
  width: min(100%, 520px); aspect-ratio: 1.36; max-width: 100%;
}
.book-preview .bp-left, .book-preview .bp-right {
  position: absolute; top: 4%; bottom: 4%; width: 48%; background: var(--plate);
  box-shadow: 0 20px 40px -20px rgba(40, 25, 0, 0.6); display: grid; place-items: center; padding: 6%;
}
.book-preview .bp-left { left: 2%; border-radius: 6px 0 0 6px; background-image: linear-gradient(to left, rgba(0,0,0,0.12), transparent 14%); }
.book-preview .bp-right { right: 2%; border-radius: 0 6px 6px 0; background-image: linear-gradient(to right, rgba(0,0,0,0.12), transparent 14%); }
.book-preview img { max-height: 100%; width: auto; }
.book-preview .bp-turn {
  position: absolute; top: 4%; bottom: 4%; left: 50%; width: 48%; background: var(--plate);
  transform-origin: left center; border-radius: 0 6px 6px 0;
  background-image: linear-gradient(to right, rgba(0,0,0,0.1), transparent 30%, rgba(0,0,0,0.04));
  animation: turn 5s cubic-bezier(.6,.05,.3,1) infinite;
}
@keyframes turn {
  0%, 30% { transform: rotateY(0deg); }
  70%, 100% { transform: rotateY(-178deg); }
}
.book-preview .bp-cta {
  position: absolute; left: 50%; bottom: -1.2rem; transform: translateX(-50%); white-space: nowrap;
}

/* Chapters */
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.chapter {
  background: var(--paper); display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; padding: 1.2rem;
  align-items: start;
}
.chapter .thumb { background: var(--plate); aspect-ratio: 1; display: grid; place-items: center; padding: 0.35rem; border-radius: var(--radius); }
.chapter .thumb img { max-height: 100%; width: auto; object-fit: contain; }
.chapter .num { font-family: var(--f-display); color: var(--honey); font-size: 1.1rem; }
.chapter h3 { font-family: var(--f-display-sc); font-size: 1.08rem; line-height: 1.25; letter-spacing: 0.02em; text-transform: lowercase; margin-block: 0.15rem 0.45rem; }
.chapter p { font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); font-style: italic; }
.chapter .links { display: flex; gap: 1rem; margin-top: 0.6rem; font-size: 0.9rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--honey); cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

/* Gallery */
.filters { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.5rem; }
.chip {
  font: 400 0.95rem/1 var(--f-display-sc); letter-spacing: 0.04em;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-soft);
  padding: 0.5rem 0.8rem; border-radius: 999px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.gallery-count { color: var(--ink-soft); font-size: var(--step--1); margin-bottom: 1rem; font-variant-numeric: tabular-nums; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 1rem; }
.tile {
  display: flex; flex-direction: column; width: 100%; border: 0; padding: 0; cursor: zoom-in; font: inherit;
  background: var(--plate); border-radius: var(--radius); text-align: left; color: #2b241a;
  box-shadow: 0 0 0 1px var(--rule);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.tile:hover { transform: translateY(-3px) rotate(-0.4deg); box-shadow: 0 0 0 1px var(--rule), 0 14px 26px -16px rgba(60, 40, 0, 0.5); }
.tile-plate { aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 0.9rem 0.9rem 0.3rem; }
.tile-plate img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.tile figcaption { padding: 0.2rem 0.9rem 0.8rem; font: italic 0.86rem/1.4 var(--f-body); color: #62563f; }
.tile .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.tile .tag { display: block; font: normal 0.75rem var(--f-display-sc); letter-spacing: 0.06em; color: #a8650a; margin-bottom: 0.1rem; }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100%; height: 100%; }
.lightbox::backdrop { background: rgba(20, 16, 8, 0.82); }
.lb-inner {
  height: 100%; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.lb-card {
  background: var(--plate); color: #2b241a; border-radius: 6px; width: min(100%, 1000px); max-height: 100%;
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); overflow: hidden; position: relative;
}
@media (max-width: 760px) { .lb-card { grid-template-columns: 1fr; overflow-y: auto; } }
.lb-figure { margin: 0; display: grid; place-items: center; padding: clamp(1rem, 3vw, 2rem); min-height: 0; }
.lb-figure img { max-height: min(70vh, 640px); width: auto; object-fit: contain; }
.lb-text { padding: clamp(1rem, 3vw, 2rem); display: grid; align-content: start; gap: 0.9rem; border-left: 1px solid #e3d7b3; overflow-y: auto; min-width: 0; }
@media (max-width: 760px) { .lb-text { border-left: 0; border-top: 1px solid #e3d7b3; } }
.lb-text .label { color: #a8650a; }
.lb-text blockquote { margin: 0; font: italic 1.12rem/1.55 var(--f-body); }
.lb-text .desc { font-size: 0.92rem; line-height: 1.5; color: #62563f; }
.lb-text .src { font-size: 0.82rem; color: #62563f; }
.lb-text .src a { color: #a8650a; }
.lb-nav { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.lb-btn {
  border: 1px solid #cdbb88; background: #fbf6e6; color: #2b241a; border-radius: 999px;
  font: 400 0.95rem/1 var(--f-display-sc); padding: 0.55rem 0.9rem; cursor: pointer;
}
.lb-btn:hover { background: #f1e6c4; }
.lb-close { position: absolute; top: 0.6rem; right: 0.6rem; width: 2.2rem; height: 2.2rem; padding: 0; display: grid; place-items: center; z-index: 2; }

/* Quotes */
.quotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1.25rem; }
.quote { display: grid; grid-template-rows: auto 1fr auto; gap: 0.8rem; padding: 1.4rem 1.4rem 1.2rem; border-top: 2px solid var(--honey); background: var(--paper); }
.quote .mark { font-family: var(--f-display); font-size: 3rem; line-height: 0.5; color: var(--honey); height: 1.2rem; }
.quote p { font-family: var(--f-display); font-size: 1.32rem; line-height: 1.32; }
.quote cite { font: normal 0.9rem var(--f-display-sc); letter-spacing: 0.05em; color: var(--ink-soft); }

/* Public domain */
.rights { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); }
@media (max-width: 860px) { .rights { grid-template-columns: 1fr; } }
.table-wrap { overflow-x: auto; }
table.status { border-collapse: collapse; width: 100%; font-size: 0.95rem; min-width: 420px; }
.status th, .status td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.status th { font: normal 0.9rem var(--f-display-sc); letter-spacing: 0.05em; color: var(--ink-soft); }
.pill { display: inline-block; font-size: 0.78rem; padding: 0.15rem 0.55rem; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.pill.ok { color: var(--forest); }
.pill.soon { color: var(--honey); }
.pill.no { color: var(--ink-soft); }

/* Footer */
.footer { padding-block: 3rem; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: 0.92rem; }
.footer .wrap { display: grid; gap: 1.2rem; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.footer img { width: 90px; background: var(--plate); border-radius: 50%; padding: 10px; }
.footer p + p { margin-top: 0.5rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
