/* ============================================================
   Bethany Jayne — set as a printed picture book.
   Each section is a two-page spread: equal outer margins, a gutter
   at the spine, running heads at the top and folios at the foot.
   The illustrations do the decorating; the type stays quiet.
   Colours are sampled from Bethany's artwork: the scribbled
   ultramarine skies, the otters' brown coat and cream belly,
   and Pip's orange.
   ============================================================ */

:root {
  --paper: #fcf7ee;
  --paper-edge: #f1e6d3;
  --mat: #f4ecdf;
  --ink: #1f2340;
  --ink-soft: #3f4260;
  --muted: #6f6a78;
  --accent: #87501a;
  --sky: #1c41a2;
  --sky-deep: #14308a;
  --pip: #e2852a;
  --rule: rgba(31, 35, 64, .15);
  --cover: #11245e;
  --cover-deep: #0b1a48;

  --pad: clamp(1.4rem, 4.5vw, 5rem);
  --gutter: calc(var(--pad) * 2);

  --serif: 'EB Garamond', Garamond, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; color: var(--ink); background: radial-gradient(1200px 700px at 50% -10%, #2a55c4 0%, transparent 70%), linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 100%) fixed; font-family: var(--serif); font-size: 1.2rem; line-height: 1.55; font-variant-numeric: oldstyle-nums; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: rgba(226, 133, 42, .28); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 200; padding: .6rem 1rem; color: var(--paper); background: var(--ink); }
.skip-link:focus { top: 1rem; }

/* ---------- small caps, used for running heads and labels ---------- */
.eyebrow, .work-label span, .contact-item strong, .contact-form label, .button, .text-link, .site-footer, .nav-toggle {
  font-variant-caps: all-small-caps; letter-spacing: .1em;
}

/* ---------- the book ---------- */
.book { position: relative; max-width: 1380px; margin: 2.5rem auto 4.5rem; padding: 12px 12px 18px; border-radius: 6px 6px 8px 8px; background: linear-gradient(90deg, rgba(0, 0, 0, .18), transparent 3%, transparent 97%, rgba(0, 0, 0, .18)), repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px), var(--cover); box-shadow: 0 2px 3px rgba(0, 0, 0, .2), 0 34px 60px -12px rgba(5, 12, 40, .55); }
.book::after { content: ''; position: absolute; z-index: -1; left: calc(50% + 2.2rem); bottom: -3.2rem; width: .9rem; height: 4.4rem; background: var(--pip); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%); }
.book-pages { position: relative; overflow: clip; border-radius: 2px 2px 3px 3px; background: var(--paper); box-shadow: 0 2px 0 var(--paper-edge), 0 3px 0 #d8cfbe, 0 5px 0 var(--paper-edge), 0 6px 0 #d3c9b6; }
.book-pages::after { content: ''; position: absolute; z-index: 60; top: 0; bottom: 0; left: 50%; width: 140px; margin-left: -70px; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(70, 50, 25, .05) 35%, rgba(60, 40, 20, .2) 49.5%, rgba(255, 255, 255, .25) 50%, rgba(60, 40, 20, .16) 50.6%, rgba(70, 50, 25, .05) 65%, transparent); }
.book-pages::before { content: ''; position: absolute; z-index: 60; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(70, 50, 25, .07), transparent 2.5%, transparent 97.5%, rgba(70, 50, 25, .07)); }

/* ---------- running heads ---------- */
.site-header { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; column-gap: var(--gutter); padding: 1.3rem var(--pad) 1.1rem; border-bottom: 1px solid var(--rule); color: var(--muted); background: var(--paper); font-size: 1.05rem; }
@supports (animation-timeline: scroll()) {
  .site-header::after { content: ''; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--sky); transform-origin: 0 50%; transform: scaleX(0); animation: read-progress linear both; animation-timeline: scroll(root block); }
}
@keyframes read-progress { to { transform: scaleX(1); } }
.brand { display: inline-flex; align-items: center; gap: .7rem; justify-self: start; text-decoration: none; color: var(--ink); }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-size: 1.3rem; font-weight: 500; }
.brand-role { color: var(--muted); font-size: .95rem; font-style: italic; }
.brand-mark { width: 2.3rem; height: 2.3rem; border-radius: 50%; object-fit: cover; }
.nav { display: flex; justify-content: flex-end; gap: 2rem; font-size: 1.15rem; }
.nav a { padding: .35rem 0; color: var(--ink-soft); text-decoration: none; text-decoration-thickness: 2px; text-underline-offset: .45em; }
.nav a:hover { color: var(--ink); text-decoration-line: underline; text-decoration-color: var(--rule); }
.nav a[aria-current='page'] { color: var(--ink); text-decoration-line: underline; text-decoration-color: var(--pip); }
.nav-toggle { display: none; justify-self: end; padding: .2rem 0; border: 0; color: var(--ink-soft); background: none; font: inherit; cursor: pointer; }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.08; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 4.6vw, 4.4rem); font-style: italic; }
h2 { font-size: clamp(2.2rem, 3.6vw, 3.3rem); }
p { margin: 0 0 1rem; }
.eyebrow { margin: 0 0 1rem; color: var(--accent); font-size: 1.15rem; font-weight: 500; }
.text-link { color: var(--ink); font-size: 1.1rem; text-decoration-color: var(--rule); text-underline-offset: .3em; }
.text-link:hover { text-decoration-color: currentColor; }
.button { display: inline-block; padding: .5rem 1.3rem .6rem; border: 1px solid var(--ink); color: var(--ink); background: transparent; font: inherit; font-size: 1.1rem; text-decoration: none; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.button:hover { color: var(--paper); background: var(--ink); }
.button-primary { padding: .65rem 1.7rem .75rem; border-color: var(--sky); color: #fff; background: var(--sky); font-size: 1.2rem; }
.button-primary:hover { border-color: var(--sky-deep); background: var(--sky-deep); }

/* ---------- spreads ---------- */
main > section + section { border-top: 1px solid var(--rule); }
.section { position: relative; padding: 6rem var(--pad) 7rem; }
.statement, .about-grid, .contact-grid, .section-intro, .contact-band .section-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gutter); }

/* Title page (home): full-bleed illustration on the left, title on the right */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: clamp(560px, 62vw, 880px); }
.hero-art { position: relative; grid-column: 1; grid-row: 1; }
.hero-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scribble { display: none; }
.hero-copy { grid-column: 2; grid-row: 1; align-self: center; justify-self: center; max-width: 30rem; padding: 4rem var(--pad); text-align: center; }
.hero-copy h1 { font-size: clamp(2.8rem, 4.8vw, 4.6rem); }
.hero-copy h1::after { content: '\2767'; display: block; margin: 1.6rem 0 1.4rem; color: var(--accent); font-size: 1.4rem; font-style: normal; line-height: 1; }
.hero-copy p:not(.eyebrow) { margin: 0 auto 2rem; color: var(--ink-soft); }
.hero-actions { display: flex; justify-content: center; align-items: center; gap: 1.6rem; flex-wrap: wrap; }

/* Chapter openers (inner pages): illustration left, opening text right */
.page-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 1fr auto auto auto 1fr; column-gap: var(--gutter); min-height: clamp(560px, min(62vw, 100vh - 12rem), 880px); }
.page-hero::after { content: ''; grid-column: 1; grid-row: 1 / -1; margin-right: calc(var(--pad) * -1); background: var(--paper-edge) center / cover no-repeat; }
.page-hero > * { grid-column: 2; margin-right: var(--pad); }
.page-hero > .eyebrow { grid-row: 2; }
.page-hero > h1 { grid-row: 3; margin-bottom: 1.6rem; }
.page-hero > p:not(.eyebrow) { grid-row: 4; max-width: 28rem; color: var(--ink-soft); font-size: 1.3rem; font-style: italic; }

/* Section openings */
.section-intro { align-items: end; margin-bottom: 4rem; }
.section-intro p:not(.eyebrow) { max-width: 26rem; margin: 0; color: var(--ink-soft); }

/* Plates */
.work-grid { counter-reset: plate; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) calc(var(--gutter) - 3rem) minmax(0, 1fr) minmax(0, 1fr); gap: 3.5rem 1.5rem; }
.work-grid > :nth-child(4n+1) { grid-column: 1; }
.work-grid > :nth-child(4n+2) { grid-column: 2; }
.work-grid > :nth-child(4n+3) { grid-column: 4; }
.work-grid > :nth-child(4n+4) { grid-column: 5; }
.work-card { counter-increment: plate; margin: 0; }
.work-card img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: contain; padding: 9%; border: 1px solid rgba(31, 35, 64, .08); background: var(--mat); cursor: zoom-in; transition: transform .35s ease, box-shadow .35s ease; }
.work-card img:hover, .work-card img:focus-visible { transform: translateY(-4px); box-shadow: 0 18px 30px -16px rgba(31, 35, 64, .45); }
.work-label { padding-top: .8rem; }
.work-label::before { content: 'Plate ' counter(plate, upper-roman); display: block; color: var(--accent); font-size: .95rem; font-variant-caps: all-small-caps; letter-spacing: .1em; }
.work-label strong { display: block; font-weight: 400; font-style: italic; font-size: 1.25rem; line-height: 1.2; }
.work-label span { display: block; color: var(--muted); font-size: .95rem; }

/* A final row of two plates: one on each page so the spread stays balanced */
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  .work-grid > :nth-child(4n+1):nth-last-child(2) { grid-column: 1 / 3; justify-self: center; width: calc((100% - 1.5rem) / 2); }
  .work-grid > :nth-child(4n+2):last-child { grid-column: 4 / 6; justify-self: center; width: calc((100% - 1.5rem) / 2); }
}

/* Text pages */
.statement-copy p:not(.eyebrow) { max-width: 33rem; color: var(--ink-soft); hyphens: auto; }
.statement-copy h2 { margin-bottom: 1.6rem; }
.statement-copy > p:first-child:not(.eyebrow)::first-letter,
.about-grid .statement-copy h2 + p::first-letter { float: left; margin: .08em .1em 0 0; color: var(--accent); font-size: 3.9em; line-height: .78; }
.note { max-width: 30rem; margin: 2.6rem 0 0; padding-left: 1.4rem; border-left: 1px solid var(--accent); color: var(--ink); font-size: 1.45rem; font-style: italic; line-height: 1.35; }

/* Closing line */
.contact-band .section-inner { align-items: center; }
.contact-band h2 { font-style: italic; }
.contact-band .button { justify-self: start; }

/* About */
.about-grid { align-items: center; }
.portrait { justify-self: center; width: 100%; max-width: 380px; margin: 0; }
.portrait img { width: 100%; height: auto; aspect-ratio: 466 / 504; object-fit: cover; border: 1.1rem solid var(--mat); outline: 1px solid rgba(31, 35, 64, .08); }
.portrait::after { content: 'Bethany Jayne'; display: block; margin-top: .7rem; color: var(--muted); font-size: 1rem; font-style: italic; text-align: center; }

/* Contact */
.contact-grid { align-items: start; }
.contact-grid p:not(.eyebrow) { max-width: 30rem; color: var(--ink-soft); }
.contact-list { margin-top: 2.2rem; border-top: 1px solid var(--rule); }
.contact-item { display: grid; grid-template-columns: 8rem 1fr; align-items: baseline; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--rule); }
.contact-item strong { color: var(--muted); font-weight: 400; font-size: 1.05rem; }
.contact-item a { overflow-wrap: break-word; text-decoration-color: var(--rule); text-underline-offset: .25em; }
.contact-item a:hover { color: var(--accent); }
.social-link { display: inline-flex; align-items: center; gap: .5rem; }
.instagram-icon { flex: none; width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.instagram-icon circle:last-child { fill: currentColor; stroke: none; }
.contact-form { display: grid; gap: 1.6rem; max-width: 30rem; }
.contact-form label { display: grid; gap: .2rem; color: var(--muted); font-size: 1.05rem; }
.contact-form input, .contact-form textarea { width: 100%; padding: .35rem 0; border: 0; border-bottom: 1px solid rgba(42, 38, 34, .35); border-radius: 0; color: var(--ink); background: transparent; font: inherit; font-size: 1.2rem; font-variant-caps: normal; letter-spacing: 0; }
.contact-form textarea { min-height: 9.3rem; resize: vertical; line-height: 1.55rem; background: repeating-linear-gradient(transparent 0 calc(1.55rem - 1px), rgba(42, 38, 34, .18) calc(1.55rem - 1px) 1.55rem); background-attachment: local; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-bottom-color: var(--accent); }
.contact-form .button { justify-self: start; margin-top: .4rem; }
.form-success { max-width: 30rem; margin-top: 1.6rem; font-size: 1.35rem; font-style: italic; }
.form-success[hidden] { display: none; }

/* ---------- colophon / The End ---------- */
.site-footer { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto; align-items: end; column-gap: var(--gutter); padding: 5rem var(--pad) 4.5rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 1rem; }
.site-footer > span { grid-column: 1; }
.the-end { grid-column: 2; grid-row: 1 / span 2; align-self: center; justify-self: center; margin: 0; color: var(--ink); font-size: 2rem; font-style: italic; font-variant-caps: normal; letter-spacing: 0; }

/* ---------- folios ---------- */
.page-num { position: absolute; z-index: 4; bottom: 1.6rem; color: var(--muted); font-size: 1rem; pointer-events: none; }
.page-num--left { left: var(--pad); }
.page-num--right { right: var(--pad); }
.hero .page-num--left, .page-hero .page-num--left { display: none; }

/* ---------- turn the page ---------- */
.page-turn { position: absolute; z-index: 70; right: 0; bottom: 0; width: 3.4rem; height: 3.4rem; background: linear-gradient(to top left, var(--cover) 50%, transparent 50%); transition: width .3s ease, height .3s ease; }
.page-turn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to top left, transparent 50%, #e6dccb 50%, var(--paper) 85%); box-shadow: -3px -3px 6px -2px rgba(0, 0, 0, .15); clip-path: polygon(0 0, 100% 0, 0 100%); }
.page-turn:hover, .page-turn:focus-visible { width: 4.8rem; height: 4.8rem; }
.page-turn span { position: absolute; right: 100%; bottom: 1.4rem; margin-right: .7rem; color: var(--ink-soft); font-size: 1.15rem; font-style: italic; white-space: nowrap; }
.page-turn:hover span { color: var(--ink); }

/* ---------- Bethany's characters ---------- */
.pip { display: block; width: 88px; height: auto; margin: 0 auto 1.2rem; transform-origin: 50% 100%; cursor: pointer; animation: pip-land .9s cubic-bezier(.3, 1.35, .5, 1) .25s both, pip-breathe 4.5s ease-in-out 1.4s infinite; }
.pip.is-hopping { animation: pip-hop .65s ease both; }
.section-intro { position: relative; }
.pip--perch { position: absolute; top: -4.4rem; right: 0; width: 64px; margin: 0; animation: pip-breathe 4.5s ease-in-out infinite; }
.contact-band, .contact-section { overflow: clip; }
.peek-otter { position: absolute; z-index: 1; right: calc(var(--pad) * 1.4); bottom: 0; width: clamp(110px, 12vw, 170px); height: auto; transform: translateY(75%) rotate(-8deg); transform-origin: 50% 100%; transition: opacity .6s ease, transform 1.2s cubic-bezier(.2, .9, .25, 1.12) .25s; }
.peek-otter.is-visible { transform: translateY(32%) rotate(-3deg); }
.peek-otter.is-visible:hover { transform: translateY(20%) rotate(2deg); transition-delay: 0s; transition-duration: .5s; }
.peek-otter--left { right: auto; left: var(--pad); transform: translateY(75%) rotate(7deg); }
.peek-otter--left.is-visible { transform: translateY(28%) rotate(3deg); }
.end-otters { grid-column: 2; grid-row: 1; justify-self: center; width: 118px; height: auto; margin-bottom: .6rem; animation: drift 7s ease-in-out infinite; }
.the-end { grid-row: 2; }
.site-footer { grid-template-rows: auto auto; }
@keyframes pip-land { from { opacity: 0; transform: translate(-50px, -70px) rotate(-24deg); } to { opacity: 1; transform: none; } }
@keyframes pip-breathe { 0%, 100% { transform: none; } 50% { transform: scaleY(1.035) rotate(-1.5deg); } }
@keyframes pip-hop { 0% { transform: none; } 30% { transform: translateY(-16px) rotate(-7deg); } 55% { transform: scale(1.04, .93); } 75% { transform: translateY(-5px); } 100% { transform: none; } }
@keyframes drift { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }

/* ---------- previous-page corner ---------- */
.page-turn--back { right: auto; left: 0; background: linear-gradient(to top right, var(--cover) 50%, transparent 50%); }
.page-turn--back::before { background: linear-gradient(to top right, transparent 50%, #e9dcc6 50%, var(--paper) 85%); box-shadow: 3px -3px 6px -2px rgba(0, 0, 0, .15); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.page-turn--back span { right: auto; left: 100%; margin: 0 0 0 .6rem; }

/* ---------- plate viewer ---------- */
.plate-viewer { width: min(94vw, 980px); max-width: none; max-height: 94vh; padding: 0; border: 0; color: var(--ink); background: var(--paper); box-shadow: 0 40px 90px rgba(5, 12, 40, .6); }
.plate-viewer[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; animation: plate-in .35s cubic-bezier(.2, .8, .2, 1); }
.plate-viewer::backdrop { background: rgba(11, 26, 72, .82); backdrop-filter: blur(4px); }
.plate-viewer__figure { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; margin: 0; padding: clamp(1rem, 3vw, 2.2rem) clamp(1rem, 3vw, 2.2rem) 0; }
.plate-viewer__img { width: 100%; height: min(72vh, 760px); object-fit: contain; padding: 4%; background: var(--mat); }
.plate-viewer__caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1rem; padding: 1rem 0 0; }
.plate-viewer__num { color: var(--accent); font-variant-caps: all-small-caps; letter-spacing: .1em; }
.plate-viewer__title { font-weight: 400; font-style: italic; font-size: 1.4rem; }
.plate-viewer__meta { color: var(--muted); font-size: 1rem; font-variant-caps: all-small-caps; letter-spacing: .1em; }
.plate-viewer__controls { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 3vw, 2.2rem) 1.4rem; }
.plate-viewer__controls button { padding: .3rem 0; border: 0; color: var(--ink-soft); background: none; font: inherit; font-size: 1.05rem; font-variant-caps: all-small-caps; letter-spacing: .1em; cursor: pointer; }
.plate-viewer__controls button:hover { color: var(--accent); }
@keyframes plate-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- contents ---------- */
.contents { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gutter); align-items: start; }
.contents-intro { max-width: 24rem; margin-top: 1.2rem; color: var(--ink-soft); }
.contents-list { margin: 0; padding: 0; border-top: 1px solid var(--rule); list-style: none; }
.contents-list a { display: grid; grid-template-columns: 2.6rem auto minmax(1rem, 1fr) auto; align-items: baseline; gap: 1rem; padding: 1.3rem 0 1.2rem; border-bottom: 1px solid var(--rule); text-decoration: none; }
.contents-num { color: var(--accent); font-size: 1.25rem; }
.contents-name { font-size: clamp(1.5rem, 2.2vw, 1.9rem); line-height: 1.15; }
.contents-name small { display: block; margin-top: .2rem; color: var(--muted); font-size: 1.05rem; font-style: italic; }
.contents-leader { align-self: center; border-bottom: 2px dotted rgba(31, 35, 64, .25); transform: translateY(-.4rem); }
.contents-go { color: var(--sky); font-size: 1.4rem; transition: transform .25s ease; }
.contents-list a:hover .contents-name { color: var(--sky); }
.contents-list a:hover .contents-go { transform: translateX(6px); }

/* ---------- footer contents ---------- */
.footer-contents { display: flex; flex-wrap: wrap; gap: .4rem 1.3rem; grid-column: 1; grid-row: 1; align-self: start; font-size: 1.05rem; }
.footer-contents span { width: 100%; color: var(--accent); }
.footer-contents a { color: var(--ink-soft); text-decoration: none; }
.footer-contents a:hover, .footer-contents a[aria-current='page'] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--pip); text-underline-offset: .35em; }

/* ---------- page turn (works in every browser; see site.js) ---------- */
.turn-stage { position: fixed; z-index: 1000; inset: 0; pointer-events: none; perspective: 2400px; }
.turn-under, .turn-leaf { position: absolute; }
.turn-under { overflow: hidden; background: var(--paper); }
.turn-under::after { content: ''; position: absolute; inset: 0; background: linear-gradient(var(--shade-dir, 90deg), rgba(31, 35, 64, .28), transparent 60%); transition: opacity .68s ease; }
.turn-leaf { transform-style: preserve-3d; transition: transform .68s cubic-bezier(.45, .05, .35, 1); will-change: transform; }
.turn-face { position: absolute; inset: 0; overflow: hidden; background: var(--paper); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.turn-face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(var(--shade-dir, 90deg), rgba(31, 35, 64, .3), transparent 70%); opacity: 0; transition: opacity .68s ease; }
.turn-face--back { transform: rotateY(180deg); background: linear-gradient(var(--shade-dir, 90deg), #efe5d3, var(--paper) 30%); }
.turn-face--back::after { opacity: .9; }
.turn-stage.is-turning .turn-face--front::after { opacity: 1; }
.turn-stage.is-turning .turn-face--back::after, .turn-stage.is-turning .turn-under::after { opacity: 0; }
.turn-clone { position: absolute; margin: 0; }
.turn-clone, .turn-clone * { animation: none !important; transition: none !important; }
.turn-clone .site-header { visibility: hidden; }
html.is-arriving .book-pages > * { animation: page-arrive .4s ease both; }
@keyframes page-arrive { from { opacity: 0; } to { opacity: 1; } }

/* ---------- phone tab bar (hidden on larger screens) ---------- */
.tab-bar { display: none; }
.swipe-hint { display: none; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transition: opacity .9s ease; }
.reveal.is-visible { opacity: 1; }

/* ---------- small screens: a single page ---------- */
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  body { font-size: 1.12rem; }
  .book { margin: .6rem .5rem 3.8rem; padding: 6px 6px 12px; }
  .book::after { left: auto; right: 2.4rem; }
  .book-pages::after { display: none; }
  .site-header { grid-template-columns: 1fr auto; padding: 1.1rem 1.25rem; }
  .nav-toggle { display: block; }
  .nav { position: absolute; z-index: 10; top: 100%; right: 1.25rem; display: none; min-width: 12rem; padding: .8rem 1.2rem; border: 1px solid var(--rule); background: var(--paper); box-shadow: 0 10px 24px rgba(42, 38, 34, .12); }
  .nav.is-open { display: grid; gap: .3rem; }
  .hero, .page-hero { grid-template-columns: 1fr; grid-template-rows: auto; min-height: 0; }
  .hero-art { aspect-ratio: 4 / 5; }
  .hero-copy { grid-column: 1; grid-row: 2; padding: 3rem 1.25rem 4rem; }
  .page-hero::after { grid-column: 1; grid-row: 1; margin: 0; aspect-ratio: 4 / 5; }
  .page-hero > * { grid-column: 1; margin-right: 1.25rem; margin-left: 1.25rem; }
  .page-hero > .eyebrow { margin-top: 2.6rem; }
  .page-hero > p:not(.eyebrow) { margin-bottom: 4rem; }
  .section { padding: 4rem 1.25rem 5rem; }
  .statement, .about-grid, .contact-grid, .section-intro, .contact-band .section-inner { grid-template-columns: 1fr; row-gap: 1.6rem; }
  .section-intro { margin-bottom: 2.6rem; }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.4rem 1rem; }
  .work-grid > .work-card { grid-column: auto; }
  .work-label strong { font-size: 1.1rem; }
  .contact-item { grid-template-columns: 1fr; gap: 0; }
  .site-footer { grid-template-columns: 1fr; row-gap: .3rem; padding: 3.5rem 1.25rem 4.5rem; text-align: center; }
  .site-footer > span { grid-column: 1; }
  .the-end { grid-column: 1; margin-bottom: 1.4rem; }
  .page-num--left { display: none; }
  .page-num--right { right: 1.25rem; }
  .page-turn span { bottom: 1rem; }
  .page-turn--back span { display: none; }
  .pip--perch { top: -3.6rem; width: 54px; }
  .peek-otter { width: 110px; }
  .end-otters { grid-column: 1; grid-row: 1; }
  .the-end { grid-row: 2; }
  .site-footer > span { grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transition: none; }
  .pip, .pip--perch, .end-otters { animation: none !important; }
  .peek-otter, .peek-otter--left { transition: none; }
  .work-card img { transition: none; }
}

/* ============================================================
   Phone layout: one page at a time, thumb-friendly controls.
   ============================================================ */
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  body { font-size: 1.15rem; padding-bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
  .book { margin: 0; padding: 0 0 6px; border-radius: 0; box-shadow: none; }
  .book::after { display: none; }
  .book-pages { border-radius: 0; }
  .book-pages::before { display: none; }

  /* Running head: just the name; navigation lives in the tab bar */
  .site-header { position: relative; grid-template-columns: 1fr; padding: .9rem 1.25rem; }
  .site-header::after { display: none; }
  .brand-name { font-size: 1.2rem; }
  .brand-role { font-size: .9rem; }
  .brand-mark { width: 2rem; height: 2rem; }
  .nav-toggle, .nav { display: none !important; }

  .tab-bar { position: fixed; z-index: 900; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--rule); background: var(--paper); box-shadow: 0 -8px 24px rgba(11, 26, 72, .12); }
  .tab-bar a { position: relative; display: grid; place-items: center; align-content: center; gap: .1rem; min-height: 4.4rem; padding: .4rem .2rem; color: var(--muted); font-size: .95rem; line-height: 1.1; text-align: center; text-decoration: none; }
  .tab-bar a b { color: var(--accent); font-size: 1rem; font-weight: 500; }
  .tab-bar a[aria-current='page'] { color: var(--ink); }
  .tab-bar a[aria-current='page']::before { content: ''; position: absolute; top: -1px; right: 22%; left: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--pip); }

  /* Openers: a square illustration so the title arrives sooner */
  .hero-art { aspect-ratio: 1 / 1; }
  .page-hero::after { aspect-ratio: 1 / 1; }
  .hero-copy { padding: 2.2rem 1.25rem 3rem; }
  .pip { width: 72px; }

  /* Contents */
  .contents { grid-template-columns: 1fr; row-gap: 1.6rem; }
  .contents-list a { grid-template-columns: 2rem 1fr auto; padding: 1.1rem 0; }
  .contents-leader { display: none; }

  /* Plates: a swipeable row */
  .work-grid { display: flex; gap: 1rem; margin: 0 -1.25rem; padding: .4rem 1.25rem 1rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 1.25rem; overscroll-behavior-x: contain; scrollbar-width: none; }
  .work-grid::-webkit-scrollbar { display: none; }
  .work-grid > .work-card, .work-grid > .work-card:nth-child(n) { flex: 0 0 80%; width: auto; scroll-snap-align: start; }
  .work-label strong { font-size: 1.25rem; }
  .work-label span { font-size: .9rem; }
  .swipe-hint { display: block; margin: -.4rem 0 1rem; color: var(--muted); font-size: 1rem; font-style: italic; }

  /* Bigger buttons and links */
  .button { min-height: 3rem; padding: .7rem 1.5rem; }
  .contact-item { padding: 1rem 0; }
  .contact-form input { min-height: 2.8rem; }
  .footer-contents { grid-column: 1; grid-row: auto; justify-content: center; margin-top: 1.4rem; }
  .site-footer { padding-bottom: 2.5rem; }

  /* Previous / next chapter as full-width buttons */
  .page-turn, .page-turn--back { position: relative; display: inline-flex; flex-direction: column; justify-content: center; width: 50%; height: auto; min-height: 4.6rem; padding: .7rem 1.25rem; border-top: 1px solid var(--rule); background: none; text-decoration: none; vertical-align: top; }
  .page-turn::before { display: none; }
  .page-turn:hover, .page-turn:focus-visible { width: 50%; height: auto; }
  a.page-turn:only-of-type, a.page-turn:only-of-type:hover { width: 100%; }
  .page-turn span, .page-turn--back span { position: static; display: block; margin: 0; color: var(--ink); font-size: 1.15rem; font-style: normal; white-space: normal; }
  .page-turn { text-align: right; }
  .page-turn--back { text-align: left; border-right: 1px solid var(--rule); }

  /* Plate viewer fills the screen */
  .plate-viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
  .plate-viewer__img { height: 62dvh; }
}

/* ============================================================
   Environments: every chapter is its own ecosystem, taken from
   the worlds in Bethany's drawings.
   ============================================================ */
:root { --primary: var(--sky); --primary-deep: var(--sky-deep); --env-bg: linear-gradient(180deg, var(--sky), var(--sky-deep)); }
.env-river { --env-bg: radial-gradient(1200px 700px at 50% -10%, #2a55c4 0%, transparent 70%), linear-gradient(180deg, #1c41a2 0%, #14308a 100%); }
.env-meadow { --env-bg: linear-gradient(180deg, #5f93d3 0%, #9cc4ec 38%, #cfe4f4 54%, #7fbd5c 55%, #4f9a3a 75%, #2f7a2a 100%); --cover: #2c5a26; --cover-deep: #1d4219; --paper: #fbfaf1; --paper-edge: #ebebd6; --mat: #eef1df; --accent: #3f6b1d; --primary: #2f7a2a; --primary-deep: #22601e; }
.env-rainforest { --env-bg: radial-gradient(#ffe58a 1.3px, transparent 1.9px) 0 0 / 46px 46px, radial-gradient(rgba(255, 243, 176, .7) 1px, transparent 1.6px) 23px 23px / 46px 46px, radial-gradient(900px 600px at 20% 0%, #4fb07a, transparent 70%), linear-gradient(180deg, #2f8a5a 0%, #145236 100%); --cover: #123f2b; --cover-deep: #0b2d1e; --paper: #f9fbf3; --paper-edge: #e5eedc; --mat: #e8f1e1; --accent: #1f6b45; --primary: #1d6b47; --primary-deep: #145236; }
.env-den { --env-bg: radial-gradient(900px 600px at 50% 0%, #b5763a, transparent 70%), linear-gradient(180deg, #6b3f17 0%, #3e230b 100%); --cover: #3f2410; --cover-deep: #2b180a; --paper: #fdf6ea; --paper-edge: #f1e2cb; --mat: #f4e7d3; --accent: #87501a; --primary: #87501a; --primary-deep: #6a3d12; }
body { background: var(--env-bg); background-attachment: fixed; }
.button-primary { border-color: var(--primary); background: var(--primary); }
.button-primary:hover { border-color: var(--primary-deep); background: var(--primary-deep); }
.contents-go, .contents-list a:hover .contents-name { color: var(--primary); }

/* Quiet ambient life in each environment */
body::before { content: ''; position: fixed; z-index: 0; inset: 0; pointer-events: none; }
.book, .env-label, .cover-wrap { position: relative; z-index: 1; }
.env-river::before { background: repeating-linear-gradient(172deg, rgba(255, 255, 255, .045) 0 2px, transparent 2px 70px); animation: river-flow 40s linear infinite; }
.env-meadow::before { background: radial-gradient(120px 38px at 12% 14%, rgba(255, 255, 255, .85), transparent 70%), radial-gradient(170px 46px at 62% 9%, rgba(255, 255, 255, .8), transparent 70%), radial-gradient(110px 34px at 88% 22%, rgba(255, 255, 255, .7), transparent 70%); animation: clouds 60s ease-in-out infinite alternate; }
.env-rainforest::before { background: radial-gradient(#fff6c4 1.4px, transparent 2px) 11px 31px / 92px 92px, radial-gradient(#ffe58a 1.2px, transparent 1.8px) 57px 7px / 120px 120px; animation: twinkle 5s ease-in-out infinite alternate; }
.env-den::before { background: radial-gradient(700px 420px at 50% 0%, rgba(255, 196, 120, .35), transparent 70%); animation: glow 7s ease-in-out infinite alternate; }
@keyframes river-flow { to { background-position: 0 700px; } }
@keyframes clouds { to { transform: translateX(6vw); } }
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes glow { from { opacity: .55; } to { opacity: 1; } }

.env-label { margin: 1.3rem 0 0; color: rgba(255, 255, 255, .9); font-size: 1.05rem; font-variant-caps: all-small-caps; letter-spacing: .28em; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.env-label span::before, .env-label span::after { content: ''; display: inline-block; width: 2.4rem; height: 1px; margin: 0 .9rem; background: currentColor; opacity: .6; vertical-align: middle; }
.book { width: min(1380px, calc(100% - 2 * clamp(0rem, 3.5vw, 3.5rem))); margin-top: 1rem; }

/* ============================================================
   Character profiles (Characters chapter)
   ============================================================ */
.cast-index { display: flex; flex-wrap: wrap; gap: .6rem 1.6rem; margin: 1.6rem 0 0; padding: 0; list-style: none; font-size: 1.25rem; }
.cast-index a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.cast-index a:hover { color: var(--primary); border-color: currentColor; }
.cast-index span { margin-right: .45rem; color: var(--accent); font-size: 1rem; font-variant-caps: all-small-caps; letter-spacing: .1em; }
.character { scroll-margin-top: 5rem; }
.character-spread { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gutter); align-items: center; }
.character-stage { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 5; margin: 0; overflow: hidden; }
[data-habitat='river'] .character-stage { background: radial-gradient(circle at 28% 18%, #3f6fd8, transparent 60%), repeating-linear-gradient(172deg, rgba(255, 255, 255, .06) 0 2px, transparent 2px 46px), linear-gradient(160deg, #1c41a2, #14308a); }
[data-habitat='rainforest'] .character-stage { background: radial-gradient(#ffe58a 1.4px, transparent 2px) 0 0 / 38px 38px, radial-gradient(circle at 70% 20%, #7fd19a, transparent 60%), linear-gradient(160deg, #3fa66b, #1d6b47); }
[data-habitat='studio'] .character-stage { background: linear-gradient(rgba(31, 35, 64, .05) 1px, transparent 1px) 0 0 / 100% 28px, var(--mat); }
.character-figure { width: 58%; height: auto; filter: drop-shadow(0 22px 18px rgba(5, 12, 40, .35)); animation: drift 7s ease-in-out infinite; }
.character-figure--pip { width: 50%; }
.character-figure--cat { width: 62%; padding: 4%; background: #fff; filter: none; box-shadow: 0 18px 30px -14px rgba(31, 35, 64, .45); animation: none; }
.character-stage figcaption { position: absolute; bottom: 1rem; left: 1.2rem; color: rgba(255, 255, 255, .9); font-size: 1rem; font-variant-caps: all-small-caps; letter-spacing: .14em; }
[data-habitat='studio'] .character-stage figcaption { color: var(--muted); }
.character-sheet h2 { font-size: clamp(2.6rem, 4.4vw, 4rem); font-style: italic; }
.character-meta { margin: .6rem 0 1.4rem; color: var(--muted); font-style: italic; }
.character-sheet > p:not(.eyebrow):not(.character-meta) { max-width: 32rem; color: var(--ink-soft); }
.character-notes { display: grid; gap: 0; max-width: 32rem; margin: 1.8rem 0 0; border-top: 1px solid var(--rule); }
.character-notes div { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.character-notes dt { color: var(--accent); font-variant-caps: all-small-caps; letter-spacing: .1em; }
.character-notes dd { margin: 0; }
.character-plates { margin-top: 4.5rem; }
.plates-title { margin: 0 0 1.6rem; color: var(--accent); font-size: 1.15rem; font-variant-caps: all-small-caps; letter-spacing: .12em; }

/* ============================================================
   The front cover (home)
   ============================================================ */
.cover-page { min-height: 100vh; }
.cover-wrap { display: grid; justify-items: center; padding: 2rem 1rem 4rem; }
.cover-book { position: relative; width: min(500px, 80vw); margin-right: 2.6rem; }
.cover-book::before { content: ''; position: absolute; z-index: 0; inset: 1.2% -2.4% -2% 4%; border-radius: 0 8px 8px 0; background: repeating-linear-gradient(0deg, #f6efe0 0 2px, #ddd1bb 2px 3px); box-shadow: 0 34px 60px -10px rgba(5, 12, 40, .6); }
.cover { position: relative; z-index: 2; display: block; aspect-ratio: 3 / 4; border-radius: 4px 10px 10px 4px; color: #f6e7c1; text-decoration: none; background: linear-gradient(90deg, rgba(0, 0, 0, .38) 0, rgba(255, 255, 255, .1) 2.4%, rgba(0, 0, 0, .22) 4.4%, transparent 8%), repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px), repeating-linear-gradient(0deg, rgba(0, 0, 0, .03) 0 1px, transparent 1px 3px), var(--cover); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 2px 3px rgba(0, 0, 0, .25); transform-origin: left center; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.cover:hover, .cover:focus-visible { transform: perspective(1800px) rotateY(-10deg); }
.cover-frame { position: absolute; inset: 6.5% 7% 6% 12%; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; justify-items: center; padding: 6% 7% 5%; border: 1.5px solid rgba(233, 211, 161, .6); outline: 1px solid rgba(233, 211, 161, .25); outline-offset: 5px; text-align: center; }
.cover-kicker, .cover-subtitle, .cover-open { color: #e9d3a1; font-size: 1rem; font-variant-caps: all-small-caps; letter-spacing: .22em; }
.cover-title { margin: .2em 0 .45em; color: #f6e7c1; font-size: clamp(2.3rem, 5.6vw, 3.5rem); font-style: italic; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.cover-window { position: relative; width: 74%; height: 100%; border: 4px solid #e9d3a1; border-radius: 50% 50% 6px 6px / 34% 34% 6px 6px; box-shadow: 0 0 0 5px rgba(0, 0, 0, .18), inset 0 0 18px rgba(0, 0, 0, .3); }
.cover-window img:first-child { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.cover-pip { position: absolute; top: -13%; right: -16%; width: 34%; height: auto; transform-origin: 50% 100%; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .3)); animation: pip-breathe 4.5s ease-in-out infinite; }
.cover-subtitle { margin-top: 1.1em; }
.cover-open { margin-top: .9em; padding: .35em 1.2em .45em; border: 1px solid rgba(233, 211, 161, .7); transition: background-color .25s ease; }
.cover:hover .cover-open { background: rgba(233, 211, 161, .16); }
.cover-tabs { position: absolute; z-index: 1; top: 12%; right: -4.6rem; display: grid; gap: .55rem; }
.cover-tabs a { display: block; width: 3.6rem; padding: 1rem .5rem 1rem 1.2rem; border-radius: 0 9px 9px 0; color: #fff; font-size: 1.05rem; text-decoration: none; writing-mode: vertical-rl; box-shadow: 0 6px 12px -4px rgba(0, 0, 0, .35); transition: transform .25s ease; }
.cover-tabs a:hover, .cover-tabs a:focus-visible { transform: translateX(6px); }
.cover-tabs b { font-weight: 500; opacity: .8; margin-bottom: .4rem; }
.tab-meadow { background: #2f7a2a; }
.tab-rainforest { background: #1d6b47; }
.tab-den { background: #87501a; }
.cover-hint { margin: 2.4rem 0 0; color: rgba(255, 255, 255, .82); font-style: italic; text-align: center; }

/* Opening the cover reveals its endpaper */
.turn-stage.is-cover .turn-face--back { background: radial-gradient(rgba(255, 255, 255, .5) 1.2px, transparent 1.8px) 0 0 / 22px 22px, #dbe4f4; }

@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .env-label { margin: 0; padding: .5rem 1rem; color: #f6e7c1; background: var(--cover); text-shadow: none; }
  .env-label span::before, .env-label span::after { width: 1.2rem; margin: 0 .6rem; }
  .book { width: 100%; margin-top: 0; }
  .character-spread { grid-template-columns: 1fr; row-gap: 2rem; }
  .character-plates { margin-top: 3rem; }
  .character-notes div { grid-template-columns: 6.5rem 1fr; }
  .cover-wrap { padding: 1.6rem 1rem 2rem; }
  .cover-book { width: min(400px, 84vw); margin-right: 0; }
  .cover-book::before { inset: 1.2% -2.6% -1.6% 4%; }
  .cover-tabs { position: static; display: flex; justify-content: center; gap: .4rem; margin-top: 1.4rem; }
  .cover-tabs a { width: auto; padding: .6rem .9rem; border-radius: 8px; writing-mode: horizontal-tb; font-size: 1rem; }
  .cover-tabs b { margin: 0 .3rem 0 0; }
  .cover-hint { margin-top: 1.2rem; font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none !important; }
  .character-figure, .cover-pip { animation: none !important; }
  .cover { transition: none; }
}

/* Solid base colour under each environment, so long pages never show white */
html:has(body.env-river) { background: #14308a; }
html:has(body.env-meadow) { background: #2f7a2a; }
html:has(body.env-rainforest) { background: #145236; }
html:has(body.env-den) { background: #3e230b; }

/* Chapter openers drawn from each environment */
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .cover-book::before { display: none; }
  .cover { box-shadow: 3px 3px 0 #f6efe0, 4px 4px 0 #ddd1bb, 6px 6px 0 #f6efe0, 7px 7px 0 #d3c6ad, 0 24px 40px -8px rgba(5, 12, 40, .6); }
}

/* ============================================================
   Phone refinements
   ============================================================ */
h2 + p:not(.eyebrow) { margin-top: 1rem; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  /* The environment name sits in the running head instead of its own strip */
  .env-label { position: absolute; z-index: 40; top: .95rem; right: 1rem; margin: 0; padding: .3rem .75rem .35rem; border-radius: 999px; font-size: .9rem; letter-spacing: .16em; }
  .env-label span::before, .env-label span::after { display: none; }
  .site-header { padding-right: 9rem; }
  .cover-page .env-label { position: static; display: inline-block; margin: .9rem auto 0; }
  .cover-page { text-align: center; }
  .cover-page .cover-wrap { text-align: left; padding-top: 1rem; }

  /* Openers: shorter illustration so the chapter title is on the first screen */
  .hero-art, .page-hero::after { aspect-ratio: 4 / 3; }
  .page-hero > .eyebrow { margin-top: 1.6rem; }
  .page-hero > h1 { margin-bottom: 1rem; }
  .page-hero > p:not(.eyebrow) { margin-bottom: 2.4rem; font-size: 1.15rem; }

  /* Less empty scrolling */
  .section { padding: 3rem 1.25rem 3.4rem; }
  .page-num { display: none; }
  .section-intro { margin-bottom: 1.8rem; }
  .character-plates { margin-top: 2.2rem; }
  .character-stage { aspect-ratio: 4 / 3; }
  .character-figure { width: auto; height: 80%; }
  .character-figure--cat { height: 82%; }
  .character-sheet h2 { font-size: 2.6rem; }

  /* Footer: the tab bar already lists the chapters */
  .footer-contents { display: none; }
  .site-footer { padding: 2.6rem 1.25rem 1.6rem; }
  .end-otters { width: 92px; }
  .the-end { font-size: 1.7rem; margin-bottom: .8rem; }

  /* Previous / next: a small label above the chapter name */
  .page-turn span small { display: block; margin-bottom: .1rem; color: var(--muted); font-size: .95rem; font-variant-caps: all-small-caps; letter-spacing: .1em; }

  /* Keep the otter clear of the contact form button */
  .peek-otter--left { display: none; }
  .contact-band .section-inner { padding-right: 6.5rem; }
}
/* ============================================================
   Environments painted from Bethany's own artwork
   ============================================================ */
body::before { display: none; }
.env-river { --env-bg: linear-gradient(rgba(10, 24, 82, .28), rgba(10, 24, 82, .42)), url('./assets/backdrops/river.jpg') center / cover; --cover: #11245e; --cover-deep: #0b1a48; --paper: #fbf8f1; --mat: #f1ece1; --accent: #87501a; --primary: #1c41a2; --primary-deep: #14308a; }
.env-meadow { --env-bg: linear-gradient(rgba(255, 255, 255, .05), rgba(20, 50, 20, .18)), url('./assets/backdrops/meadow.jpg') center / cover; }
.env-forest { --env-bg: linear-gradient(rgba(20, 70, 40, .12), rgba(20, 70, 40, .3)), url('./assets/backdrops/forest.jpg') center / cover; --cover: #245b3c; --cover-deep: #183f29; --paper: #f9fbf4; --paper-edge: #e5eedc; --mat: #e9f2e2; --accent: #2b6a43; --primary: #2c7a4b; --primary-deep: #1f5c38; }
html:has(body.env-forest) { background: #8fcaa0; }
html:has(body.env-meadow) { background: #4f9a3a; }
.env-label { text-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
.tab-river { background: #1c41a2; }
.tab-forest { background: #2c7a4b; }

/* Chapter openers use the real paintings, not cut-outs on gradients */

/* ============================================================
   Drawings that lift off the page, with room to breathe
   ============================================================ */
.work-grid { row-gap: 4.5rem; }
.plate-frame { display: grid; place-items: center; aspect-ratio: 4 / 5; padding: 7% 6%; }
.work-card .plate-frame img { width: auto; height: auto; max-width: 100%; max-height: 100%; min-height: 0; aspect-ratio: auto; padding: 0; border: .45rem solid #fff; background: #fff; object-fit: contain; box-shadow: 0 1px 2px rgba(31, 35, 64, .12), 0 10px 18px -10px rgba(31, 35, 64, .35), 0 30px 50px -28px rgba(31, 35, 64, .5); transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease; }
.work-card .plate-frame img:hover, .work-card .plate-frame img:focus-visible { transform: translateY(-8px) rotate(-.6deg); box-shadow: 0 2px 4px rgba(31, 35, 64, .14), 0 18px 28px -12px rgba(31, 35, 64, .4), 0 46px 70px -30px rgba(31, 35, 64, .55); }
.work-label { padding-top: .2rem; text-align: center; }

.character { padding-top: 7.5rem; padding-bottom: 8rem; }
.character-stage { padding: 0; overflow: visible; background: none !important; }
.character-art { display: block; width: 86%; height: auto; border: .6rem solid #fff; box-shadow: 0 2px 4px rgba(31, 35, 64, .14), 0 22px 40px -18px rgba(31, 35, 64, .5), 0 60px 90px -50px rgba(31, 35, 64, .55); }
.character-stage figcaption { position: static; margin-top: 1.4rem; color: var(--muted); text-align: center; }
.character-stage { aspect-ratio: auto; }
[data-habitat='studio'] .character-figure--cat { width: 70%; padding: 5%; border: .6rem solid #fff; box-shadow: 0 2px 4px rgba(31, 35, 64, .14), 0 22px 40px -18px rgba(31, 35, 64, .5); }
.portrait img { box-shadow: 0 22px 40px -20px rgba(31, 35, 64, .45); }

@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .work-grid { row-gap: 1rem; }
  .plate-frame { padding: 6% 5%; }
  .work-card .plate-frame img { border-width: .3rem; }
  .character { padding-top: 3.4rem; padding-bottom: 3.8rem; }
  .character-art { width: 92%; }
  .character-stage figcaption { margin-top: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .work-card .plate-frame img { transition: none; }
}

/* ============================================================
   Chapters: About, The Otters, Pip, Russell's Adventure, Contact
   High-quality artwork for every opener.
   ============================================================ */
.about-page .page-hero::after { background: url('./assets/art/otter-waving-1280.webp') center / cover no-repeat; }
.otters-page .page-hero::after { background: url('./assets/art/otters-stone-1280.webp') center / cover no-repeat; }

/* Russell's chapter: warm sketchbook paper until the artwork arrives */
.env-sketch { --env-bg: repeating-linear-gradient(0deg, transparent 0 39px, rgba(90, 70, 40, .07) 39px 40px), linear-gradient(180deg, #e9e1d1, #d5c8b1); --cover: #5f4b37; --cover-deep: #463626; --paper: #fcf8f0; --mat: #f2eadc; --accent: #7a5332; --primary: #6b4a2a; --primary-deep: #523820; }
.env-sketch .env-label { color: #5f4b37; text-shadow: none; }
/* Contact: the last page, under the river at dusk */
.env-dusk { --env-bg: linear-gradient(rgba(8, 16, 50, .5), rgba(8, 16, 50, .68)), url('./assets/backdrops/river.jpg') center / cover; --cover: #0e1d4c; --cover-deep: #08133a; --paper: #fbf8f1; --mat: #f1ece1; --accent: #87501a; --primary: #1c41a2; --primary-deep: #14308a; }
html:has(body.env-sketch) { background: #d5c8b1; }
html:has(body.env-dusk) { background: #0e1d4c; }
.tab-sketch { background: #6b4a2a; }
.tab-dusk { background: #0e1d4c; }

/* Placeholder plates for artwork still to come */
.plate-pending { display: block; width: 76%; aspect-ratio: 3 / 4; border: 2px dashed rgba(70, 52, 32, .25); background: repeating-linear-gradient(-45deg, transparent 0 11px, rgba(70, 52, 32, .05) 11px 12px); }
.work-card--pending .work-label strong { color: var(--muted); }

/* Plates follow straight on from each character profile */
main > section + .plates-section { border-top: 0; padding-top: 0; }

/* Six chapters in the navigation */
.nav { gap: 1.35rem; font-size: 1.08rem; }
.cover-tabs { gap: .4rem; top: 8%; }
.cover-tabs a { padding: .75rem .45rem .75rem 1.2rem; font-size: 1rem; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .tab-bar { grid-template-columns: repeat(6, 1fr); }
  .tab-bar a { font-size: .82rem; padding: .4rem 0; }
  .cover-tabs { flex-wrap: wrap; }
  .cover-tabs a { padding: .55rem .75rem; }
}
.nav a { white-space: nowrap; }
.nav { gap: 1.2rem; font-size: 1.04rem; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .env-sketch .env-label { color: #f6e7c1; }
  .cover-tabs { display: none; }
}

/* ============================================================
   Front cover: Bethany's lighthouse painting
   ============================================================ */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.env-sea { --env-bg: linear-gradient(rgba(6, 22, 52, .25), rgba(6, 22, 52, .45)), url('./assets/backdrops/sea.jpg') center / cover; --cover: #123b6b; --cover-deep: #0c2a4f; }
html:has(body.env-sea) { background: #123b6b; }
.cover-book { width: min(520px, 78vw, calc((100vh - 9rem) * 1240 / 1754)); }
.cover--art { aspect-ratio: 1240 / 1754; overflow: hidden; background: #123b6b; }
.cover-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
/* the spine: a soft crease and shading down the left edge, plus a gentle sheen */
.cover--art::before { content: ''; position: absolute; z-index: 2; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(90deg, rgba(0, 0, 0, .42) 0, rgba(255, 255, 255, .16) 2.6%, rgba(0, 0, 0, .2) 4.6%, transparent 9%), linear-gradient(115deg, rgba(255, 255, 255, .1) 0%, transparent 35%, transparent 70%, rgba(0, 0, 0, .12) 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), inset -2px 0 4px rgba(0, 0, 0, .18); }
.cover--art .cover-open { position: absolute; z-index: 3; left: 50%; bottom: 5.5%; transform: translateX(-50%); margin: 0; padding: .45em 1.3em .55em; border: 1px solid rgba(246, 231, 193, .85); color: #f6e7c1; background: rgba(8, 30, 60, .55); backdrop-filter: blur(2px); white-space: nowrap; }
.cover--art:hover .cover-open, .cover--art:focus-visible .cover-open { background: rgba(8, 30, 60, .78); }
.turn-stage.is-cover .turn-face--back { background: radial-gradient(rgba(255, 255, 255, .45) 1.2px, transparent 1.8px) 0 0 / 22px 22px, #d7e6f2; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .cover-book { width: min(400px, 84vw, calc((100svh - 12rem) * 1240 / 1754)); }
  .cover--art .cover-open { font-size: .9rem; }
}

/* Front cover: the lighthouse painting framed in a gold-edged box on the cloth cover */
.cover-book { width: min(500px, 80vw, calc((100vh - 9rem) * 3 / 4)); }
.cover--boxed .cover-frame { grid-template-rows: auto minmax(0, 1fr) auto auto; padding: 5.5% 7% 5%; }
.cover-box { position: relative; height: calc(100% - 1.8em); max-width: 100%; aspect-ratio: 1240 / 1754; margin: .9em 0; border: 4px solid #e9d3a1; border-radius: 3px; box-shadow: 0 0 0 5px rgba(0, 0, 0, .2), 0 10px 22px -8px rgba(0, 0, 0, .55); overflow: hidden; }
.cover-box .cover-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover--boxed .cover-subtitle { margin-top: 0; }
.cover--boxed .cover-open { margin-top: .8em; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .cover-book { width: min(400px, 84vw, calc((100svh - 12rem) * 3 / 4)); }
  .cover--boxed .cover-kicker, .cover--boxed .cover-subtitle, .cover--boxed .cover-open { font-size: .85rem; letter-spacing: .16em; }
}

/* Page turn in two exact halves: front face until 90 degrees, back face after */
.turn-leaf { transition: none; }
.turn-stage.is-turning .turn-leaf { animation: leaf-forward .7s both; }
.turn-stage.is-turning.is-backward .turn-leaf { animation-name: leaf-backward; }
.turn-face--back { visibility: hidden; }
.turn-stage.is-turning .turn-face--front { animation: face-first-half .7s linear both; }
.turn-stage.is-turning .turn-face--back { animation: face-second-half .7s linear both; }
@keyframes leaf-forward {
  0% { transform: rotateY(0deg); animation-timing-function: cubic-bezier(.5, 0, .9, .55); }
  50% { transform: rotateY(-90deg); animation-timing-function: cubic-bezier(.1, .45, .5, 1); }
  100% { transform: rotateY(-180deg); }
}
@keyframes leaf-backward {
  0% { transform: rotateY(0deg); animation-timing-function: cubic-bezier(.5, 0, .9, .55); }
  50% { transform: rotateY(90deg); animation-timing-function: cubic-bezier(.1, .45, .5, 1); }
  100% { transform: rotateY(180deg); }
}
@keyframes face-first-half { 0%, 49.9% { visibility: visible; } 50%, 100% { visibility: hidden; } }
@keyframes face-second-half { 0%, 49.9% { visibility: hidden; } 50%, 100% { visibility: visible; } }

/* ============================================================
   Typography: sizes that scale with the page, a comfortable line
   length, no hyphen splits, and balanced spreads
   ============================================================ */
p, li, dd { text-wrap: pretty; }
.statement-copy p:not(.eyebrow) { hyphens: manual; }
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  body { font-size: clamp(1.15rem, .95rem + .4vw, 1.35rem); line-height: 1.6; }
  h1, .page-hero > h1 { font-size: clamp(2.8rem, 1.6rem + 2.7vw, 4.7rem); line-height: 1.05; }
  h2 { font-size: clamp(2.2rem, 1.5rem + 1.8vw, 3.5rem); line-height: 1.1; }
  .character-sheet h2 { font-size: clamp(2.8rem, 1.8rem + 2.3vw, 4.3rem); }
  .eyebrow, .plates-title { font-size: clamp(1.02rem, .9rem + .25vw, 1.2rem); }
  .page-hero > p:not(.eyebrow) { max-width: 30rem; font-size: clamp(1.25rem, 1rem + .5vw, 1.5rem); line-height: 1.45; }
  .statement-copy p:not(.eyebrow), .character-sheet > p:not(.eyebrow):not(.character-meta), .section-intro p:not(.eyebrow), .contact-grid p:not(.eyebrow) { max-width: 34rem; }
  .character-meta { font-size: 1.05em; }
  .character-notes dt { font-size: 1.05rem; }
  .note { font-size: clamp(1.4rem, 1.1rem + .6vw, 1.75rem); }
  .work-label::before { font-size: 1rem; }
  .work-label strong { font-size: clamp(1.2rem, 1rem + .35vw, 1.4rem); }
  .work-label span { font-size: 1rem; }
  .contact-form label, .contact-item strong { font-size: 1.1rem; }
  /* Balance each two-page spread: headings and text meet in the middle */
  .statement, .about-grid, .character-spread, .contact-band .section-inner { align-items: center; }
  .statement > :first-child h2 { max-width: 14ch; }
  .page-hero > h1 { max-width: 13ch; }
}
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .eyebrow, .plates-title { font-size: 1.02rem; }
  .work-label strong { font-size: 1.2rem; }
  .work-label span, .work-label::before { font-size: .95rem; }
  .page-hero > p:not(.eyebrow) { font-size: 1.2rem; line-height: 1.45; }
}

/* ---------- fixes from the accessibility audit ---------- */
html:not(.js) .reveal { opacity: 1; transform: none; }
.character .character-stage figcaption { color: var(--ink-soft); }
.page-turns { position: static; }
/* 404: a page torn out of the book, an otter looking for it, and the contents page. */
.missing-page .page-hero::after { content: none; }
.missing-hero { grid-template-rows: 1fr auto auto auto auto 1fr; }
.missing-hero > .missing-art { grid-column: 1; grid-row: 1 / -1; position: relative; overflow: hidden; margin: 0 calc(var(--pad) * -1) 0 0; min-height: 420px; background: repeating-linear-gradient(0deg, transparent 0 33px, rgba(90, 70, 40, .12) 33px 34px), radial-gradient(circle at 50% 45%, #f7f1e4, #e7dcc7); }
.torn-stub { position: absolute; top: 0; bottom: 0; right: 0; width: 26%; background: linear-gradient(90deg, rgba(90, 70, 40, .10), transparent 40%), var(--paper); box-shadow: -2px 0 6px rgba(70, 52, 32, .12); clip-path: polygon(14% 0, 100% 0, 100% 100%, 9% 100%, 0 96%, 11% 92%, 3% 88%, 13% 84%, 5% 79%, 15% 75%, 2% 70%, 12% 66%, 4% 61%, 16% 57%, 6% 52%, 14% 48%, 1% 43%, 11% 39%, 5% 34%, 15% 30%, 3% 25%, 12% 21%, 6% 16%, 16% 12%, 2% 7%, 10% 3%); }
.missing-scrawl { position: absolute; top: 22%; left: 12%; margin: 0; color: rgba(70, 52, 32, .55); font-style: italic; line-height: 1; transform: rotate(-6deg); text-align: center; }
.missing-scrawl span { display: block; font-size: 1.5rem; }
.missing-scrawl b { display: block; margin: .1em 0; font-size: clamp(4.5rem, 8vw, 7.5rem); font-weight: 400; letter-spacing: .02em; color: rgba(70, 52, 32, .38); }
.missing-otter { position: absolute; left: 14%; bottom: -6%; width: clamp(150px, 19vw, 250px); height: auto; transform-origin: 50% 100%; animation: otter-search 5s ease-in-out 1s infinite; }
@keyframes otter-search { 0%, 100% { transform: rotate(-4deg); } 30% { transform: rotate(5deg) translateY(-6px); } 55% { transform: rotate(-2deg); } 75% { transform: rotate(3deg) translateY(-3px); } }
.missing-hero > p:not(.eyebrow) { max-width: 30rem; }
.missing-contents { grid-row: 5; max-width: 30rem; margin-top: 2.2rem; }
.missing-contents__title { margin: 0 0 .5rem; color: var(--accent); font-size: 1.05rem; font-variant-caps: all-small-caps; letter-spacing: .14em; }
.missing-contents ol { margin: 0 0 2rem; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.missing-contents li a { display: flex; align-items: baseline; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.missing-contents li b { flex: 0 0 2.2rem; color: var(--accent); font-weight: 500; font-size: 1rem; letter-spacing: .06em; }
.missing-contents li span { font-size: 1.2rem; }
.missing-contents li i { flex: 1; min-width: 1.5rem; border-bottom: 2px dotted rgba(70, 52, 32, .3); transform: translateY(-.3em); }
.missing-contents li em { color: var(--ink-soft); font-size: 1rem; white-space: nowrap; }
.missing-contents li a:hover span, .missing-contents li a:focus-visible span { text-decoration: underline; text-decoration-color: var(--pip); text-underline-offset: .3em; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .missing-hero > .missing-art { grid-row: 1; margin: 0; min-height: 0; aspect-ratio: 4 / 3; }
  .missing-contents { grid-row: auto; margin-bottom: 3rem; margin-top: 0; }
  .missing-otter { left: auto; right: 30%; width: clamp(120px, 32vw, 190px); }
  .missing-scrawl { top: 18%; left: 7%; }
  .missing-scrawl b { font-size: clamp(3.4rem, 15vw, 5.5rem); }
}
@media (prefers-reduced-motion: reduce) { .missing-otter { animation: none; } }

/* ============================================================
   Layouts for every device
   - phones (upright and sideways): one page at a time, tab bar
   - tablets upright (600-900px): one page, wider margins, plate grid
   - tablets sideways, laptops, desktops: the two-page spread
   - large monitors: a bigger book
   ============================================================ */

/* Tablets held upright: roomier single page */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
  .site-header { padding: 1.1rem 2.5rem; }
  .env-label { right: 2.5rem; }
  .section { padding: 4.5rem 3.5rem 5rem; }
  .section-inner, .statement, .about-grid, .contact-grid, .section-intro, .character-spread { max-width: 40rem; margin-left: auto; margin-right: auto; }
  .page-hero::after, .hero-art { aspect-ratio: 3 / 2; }
  .page-hero > * { margin-left: 3.5rem; margin-right: 3.5rem; }
  .page-hero > h1 { font-size: 3.6rem; max-width: 14ch; }
  .character-stage { max-width: 30rem; margin: 0 auto; }
  .character-sheet h2 { font-size: 3.4rem; }
  /* plates as a grid rather than a swipe row */
  .work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.4rem 2rem; margin: 0; padding: 0; overflow: visible; }
  .work-grid > .work-card, .work-grid > .work-card:nth-child(n) { flex: none; width: auto; }
  .swipe-hint { display: none; }
  .portrait { max-width: 22rem; }
  .cover-book { width: min(460px, 70vw, calc((100svh - 13rem) * 3 / 4)); }
}

/* Phones turned sideways: short openers, slim tab bar, cover sized to the height */
@media (max-height: 540px) and (orientation: landscape) {
  body { padding-bottom: calc(3.3rem + env(safe-area-inset-bottom)); }
  .tab-bar a { min-height: 3.3rem; flex-direction: row; }
  .hero-art, .page-hero::after { aspect-ratio: auto; height: 62vh; }
  .section { padding: 2.6rem max(1.25rem, env(safe-area-inset-left)) 3rem; }
  .site-header, .page-hero > * { padding-left: max(0rem, env(safe-area-inset-left)); }
  .section-inner, .statement, .about-grid, .contact-grid, .section-intro, .character-spread { max-width: 42rem; margin-left: auto; margin-right: auto; }
  .character-stage { max-width: 18rem; margin: 0 auto; }
  .work-grid > .work-card, .work-grid > .work-card:nth-child(n) { flex: 0 0 34%; }
  .cover-wrap { padding-top: .6rem; }
  .cover-book { width: min(230px, 40vw, calc((100svh - 7.5rem) * 3 / 4)); }
  .cover-hint { display: none; }
}

/* Mid-size screens with the two-page spread: header on one line, never colliding */
@media (min-width: 901px) and (max-width: 1180px) {
  .site-header { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; }
  .nav { gap: .95rem; font-size: 1rem; }
  .work-grid { column-gap: 1rem; }
}

/* Large monitors: a bigger book and cover */
@media (min-width: 1800px) and (min-height: 900px) {
  .book { width: min(1640px, calc(100% - 8rem)); }
  .cover-book { width: min(640px, calc((100vh - 10rem) * 3 / 4)); }
  .cover-tabs a { font-size: 1.15rem; padding: 1rem .55rem 1rem 1.3rem; }
}
/* Phones sideways: let the cover painting fill the cover, shorter openers */
@media (max-height: 540px) and (orientation: landscape) {
  .cover--boxed .cover-kicker, .cover--boxed .cover-subtitle { display: none; }
  .cover--boxed .cover-frame { grid-template-rows: minmax(0, 1fr) auto; padding: 6% 7% 5%; }
  .cover--boxed .cover-box { height: 100%; margin: 0; }
  .cover--boxed .cover-open { margin-top: .6em; font-size: .78rem; letter-spacing: .12em; padding: .3em .8em .4em; }
  .cover-book { width: min(260px, 40vw, calc((100svh - 6.5rem) * 3 / 4)); }
  .hero-art, .page-hero::after { height: 48vh; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .hero-art, .page-hero::after { height: 34vh; }
  .page-hero > .eyebrow { margin-top: 1rem; }
  .page-hero > h1 { font-size: 2.2rem; }
}

/* ============================================================
   Installed web app (added to a home screen)
   ============================================================ */
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }
@media (display-mode: standalone), (display-mode: fullscreen) {
  /* clear the notch / status bar and the home indicator */
  body { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .site-header { top: env(safe-area-inset-top); }
  .tab-bar { padding-bottom: max(env(safe-area-inset-bottom), .4rem); }
  .cover-wrap { min-height: calc(100svh - env(safe-area-inset-top) - 4.4rem); align-content: center; }
  /* app-like: chrome text isn't selectable, artwork can't be dragged out */
  .tab-bar, .site-header, .page-turn, .cover-tabs, .env-label { -webkit-user-select: none; user-select: none; }
  img { -webkit-user-drag: none; -webkit-touch-callout: none; }
}

/* ============================================================
   Speed
   ============================================================ */
/* The environment painting sits on its own fixed layer (handled by the
   graphics chip) instead of a fixed background, which many phones repaint
   on every scroll. */
body { background: none; }
body::after { content: ''; position: fixed; z-index: -1; inset: 0; background: var(--env-bg); transform: translateZ(0); pointer-events: none; }

/* Chapter openers: the high-resolution painting on large screens, a lighter one on phones */
.pip-page .page-hero::after { background: url('./assets/art/pip-scene-1280.webp') center / cover no-repeat; }
.contact-page .page-hero::after { background: url('./assets/art/otters-scene-1280.webp') center / cover no-repeat; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .about-page .page-hero::after { background-image: url('./assets/art/otter-waving-1280.webp'); }
  .otters-page .page-hero::after { background-image: url('./assets/art/otters-stone-1280.webp'); }
  .pip-page .page-hero::after { background-image: url('./assets/art/pip-scene-1280.webp'); }
  .contact-page .page-hero::after { background-image: url('./assets/art/otters-scene-1280.webp'); }
}
/* Sections below the fold skip rendering work until they are scrolled near */
main > section + section { content-visibility: auto; contain-intrinsic-size: auto 900px; }
/* environment label: readable over any painting */
.env-label span { display: inline-block; padding: .25rem .9rem .3rem; border-radius: 999px; color: #fff; background: rgba(10, 22, 50, .62); text-shadow: none; }
.env-sketch .env-label span { background: rgba(70, 52, 32, .78); }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) { .env-label span { padding: 0; background: none; } }
/* the cat keeps its own proportions */
.character-figure--cat, [data-habitat='studio'] .character-figure--cat { height: auto !important; aspect-ratio: auto; }
/* phones: lighter environment paintings (they sit mostly behind the page) */
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .env-sea { --env-bg: linear-gradient(rgba(6, 22, 52, .25), rgba(6, 22, 52, .45)), url('./assets/backdrops/sea-800.jpg') center / cover; }
  .env-river { --env-bg: linear-gradient(rgba(10, 24, 82, .28), rgba(10, 24, 82, .42)), url('./assets/backdrops/river-800.jpg') center / cover; }
  .env-meadow { --env-bg: linear-gradient(rgba(255, 255, 255, .05), rgba(20, 50, 20, .18)), url('./assets/backdrops/meadow-800.jpg') center / cover; }
  .env-forest { --env-bg: linear-gradient(rgba(20, 70, 40, .12), rgba(20, 70, 40, .3)), url('./assets/backdrops/forest-800.jpg') center / cover; }
  .env-dusk { --env-bg: linear-gradient(rgba(8, 16, 50, .5), rgba(8, 16, 50, .68)), url('./assets/backdrops/river-800.jpg') center / cover; }
}
/* Turning page: fade the front face out at the halfway point (opacity also hides
   any child that sets its own visibility), and only then show the blank back. */
.turn-face--front .page-turns, .turn-face--front .page-turn { display: none; }
.turn-face--back { visibility: visible; opacity: 0; }
.turn-stage.is-turning .turn-face--front { animation: face-out .7s step-end both; }
.turn-stage.is-turning .turn-face--back { animation: face-in .7s step-end both; }
@keyframes face-out { 0% { opacity: 1; } 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes face-in { 0% { opacity: 0; } 49% { opacity: 0; } 50%, 100% { opacity: 1; } }

/* ============================================================
   The lighthouse shines: a soft lantern glow and a slow sweeping
   beam over the cover painting
   ============================================================ */
.cover-beam { position: absolute; left: 45.2%; top: 36.4%; width: 0; height: 0; pointer-events: none; }
.cover-beam::before { content: ''; position: absolute; left: -2.6rem; top: -2.6rem; width: 5.2rem; height: 5.2rem; border-radius: 50%; background: radial-gradient(circle, rgba(255, 246, 196, .95) 0, rgba(255, 236, 150, .55) 22%, rgba(255, 230, 140, 0) 70%); mix-blend-mode: screen; animation: lantern-glow 6s ease-in-out infinite; }
.cover-beam::after { content: ''; position: absolute; left: -16rem; top: -1.3rem; width: 32rem; height: 2.6rem; background: linear-gradient(90deg, rgba(255, 244, 190, 0) 0, rgba(255, 244, 190, .55) 46%, rgba(255, 250, 220, .7) 50%, rgba(255, 244, 190, .55) 54%, rgba(255, 244, 190, 0) 100%); clip-path: polygon(0 0, 47% 42%, 53% 42%, 100% 0, 100% 100%, 53% 58%, 47% 58%, 0 100%); mix-blend-mode: screen; transform-origin: 50% 50%; animation: lantern-sweep 6s linear infinite; }
@keyframes lantern-glow { 0%, 100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.12); } }
/* the beam turns round the lantern: wide when facing sideways, narrowing to nothing as it faces away */
@keyframes lantern-sweep { 0% { transform: scaleX(1); opacity: .75; } 25% { transform: scaleX(0); opacity: .2; } 50% { transform: scaleX(-1); opacity: .75; } 75% { transform: scaleX(0); opacity: .2; } 100% { transform: scaleX(1); opacity: .75; } }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .cover-beam::before { left: -1.6rem; top: -1.6rem; width: 3.2rem; height: 3.2rem; }
  .cover-beam::after { left: -10rem; top: -.8rem; width: 20rem; height: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cover-beam::before { animation: none; opacity: .8; }
  .cover-beam::after { display: none; }
}
/* warmer lamp light so it reads against the pale sky */
.cover-beam::before { mix-blend-mode: normal; background: radial-gradient(circle, rgba(255, 238, 150, .95) 0, rgba(255, 214, 90, .6) 24%, rgba(255, 214, 90, 0) 70%); }
.cover-beam::after { mix-blend-mode: normal; background: linear-gradient(90deg, rgba(255, 220, 110, 0) 0, rgba(255, 220, 110, .5) 40%, rgba(255, 236, 160, .75) 50%, rgba(255, 220, 110, .5) 60%, rgba(255, 220, 110, 0) 100%); }

/* ============================================================
   The next page under the turning leaf (drawn by site.js before
   the turn starts), so the book opens onto the real next page.
   ============================================================ */
.turn-dest { position: absolute; overflow: hidden; background: var(--env-bg); transform: translate(0, 0); pointer-events: none; }
.turn-dest, .turn-dest * { animation: none !important; transition: none !important; }
.turn-dest .reveal { opacity: 1; }
.turn-stage.has-dest:not(.is-cover) .turn-face--back { background: var(--paper); }
/* turning off the cover: the first page shows through as the cover lifts */
/* arriving after the turn: the page was already showing, so nothing fades in */
html.is-turned .reveal { opacity: 1; transition: none; }
/* ============================================================
   Polish: small phones, keyboard focus and reduced motion
   ============================================================ */
/* Small phones: keep the chapter name from running over "Children's book illustrator" */
@media (max-width: 420px) {
  body:not(.cover-page) .env-label, .turn-dest:not(.cover-page) .env-label { right: .75rem; padding-left: .65rem; padding-right: .65rem; letter-spacing: .12em; }
}
@media (max-width: 360px) {
  body:not(.cover-page) .env-label, .turn-dest:not(.cover-page) .env-label { right: .5rem; font-size: .78rem; letter-spacing: .06em; }
}
/* A thicker underline on the contact form, so focus is not shown by colour alone */
.contact-form input:focus-visible, .contact-form textarea:focus-visible { box-shadow: 0 2px 0 var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .plate-viewer[open] { animation: none; }
  html.is-arriving .book-pages > * { animation: none; }
}
/* Russell and the missing page: one pill in the running head, not a pill inside a pill */
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) { .env-sketch .env-label span { background: none; } }
/* Opening the cover onto the first page: the inside of the cover fades away
   as it settles, so it never lies over the page that has just appeared. */

/* Bookshelf: every project at a glance, grouped by how finished it is.
   A quiet touch of purple, Bethany's favourite colour, marks the shelves. */
.bookshelf { --plum: #6d4c9c; }
.bookshelf .section-intro { margin-bottom: 3rem; }
.shelf { margin-top: 2.4rem; }
.shelf-label { margin: 0 0 1rem; color: var(--plum); font-size: 1.15rem; font-variant-caps: all-small-caps; letter-spacing: .12em; }
.shelf-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.2rem 2.2rem; margin: 0; padding: 0 1.4rem; list-style: none; border-bottom: 14px solid #b77a45; box-shadow: 0 10px 0 -4px #8a5428; }
.shelf-book { display: grid; justify-items: start; gap: .1rem; width: min-content; padding-bottom: .9rem; color: var(--ink); text-decoration: none; }
.shelf-cover { display: block; height: 190px; border: .4rem solid #fff; background: var(--mat); box-shadow: 0 2px 4px rgba(31, 35, 64, .14), 0 16px 26px -14px rgba(31, 35, 64, .5); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.shelf-cover img { width: auto; height: 100%; max-width: none; }
.shelf-book:hover .shelf-cover, .shelf-book:focus-visible .shelf-cover { transform: translateY(-8px) rotate(-1.5deg); box-shadow: 0 2px 4px rgba(31, 35, 64, .14), 0 18px 28px -14px rgba(109, 76, 156, .55); }
.shelf-title { margin-top: .7rem; font-style: italic; font-size: 1.1rem; line-height: 1.25; min-width: 9rem; }
.shelf-meta { color: var(--muted); font-size: .95rem; line-height: 1.3; font-variant-caps: all-small-caps; letter-spacing: .08em; }
.shelf-book:hover .shelf-title { text-decoration: underline; text-decoration-color: var(--plum); text-underline-offset: .3em; }
.shelf-book--pending .shelf-cover { display: flex; align-items: center; justify-content: center; overflow: hidden; width: 150px; border: 2px dashed rgba(109, 76, 156, .4); background: repeating-linear-gradient(-45deg, transparent 0 11px, rgba(109, 76, 156, .07) 11px 12px); box-shadow: none; }
.shelf-pending { color: rgba(109, 76, 156, .55); font-size: 2.6rem; font-style: italic; line-height: 1; letter-spacing: .04em; }
@media (max-width: 760px) {
  .shelf-row { gap: 1rem 1.2rem; padding: 0 .6rem; }
  .shelf-cover { height: 120px; border-width: .3rem; }
  .shelf-book--pending .shelf-cover { width: 100px; }
  .shelf-pending { font-size: 1.9rem; }
  .shelf-title { min-width: 6.5rem; font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { .shelf-cover { transition: none; } }

/* Email and Instagram in every colophon. */
.footer-links { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; grid-column: 1; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--pip); text-underline-offset: .35em; }

/* ============================================================
   Placement by device: each layout sized for its screen
   ============================================================ */

/* Smallest phones: the running head stays on two tidy lines */
@media (max-width: 380px) {
  .site-header { padding-right: 6.8rem; }
  .brand { gap: .55rem; }
  .brand-name { font-size: 1.12rem; }
  .brand-role { font-size: .8rem; white-space: nowrap; }
}

/* Phones and tablets held upright: the cover sits in the middle of the
   space between the running head and the tab bar */
@media (max-width: 900px) and (orientation: portrait) {
  .cover-page .cover-wrap { min-height: calc(100svh - 4.4rem - env(safe-area-inset-bottom) - 3.9rem); align-content: center; padding-top: 1rem; padding-bottom: 1.6rem; }
  .cover-hint { max-width: 22rem; margin-left: auto; margin-right: auto; text-wrap: balance; }
}
/* short phones: the cover fills the screen, the tab bar is the hint */
@media (max-width: 599px) and (max-height: 700px) {
  .cover-page .cover-wrap { padding-top: .4rem; padding-bottom: 4.4rem; }
  .cover-hint { display: none; }
  .cover-book { width: min(400px, 84vw, calc((100svh - 10.5rem) * 3 / 4)); }
}

/* Tablets upright: a larger cover, a centred tab bar, titles that use the width */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
  .cover-book { width: min(540px, 72vw, calc((100svh - 15rem) * 3 / 4)); }
  .tab-bar { padding-left: max(0px, calc((100% - 42rem) / 2)); padding-right: max(0px, calc((100% - 42rem) / 2)); }
  .page-hero > h1 { max-width: 17ch; }
  .page-hero > p:not(.eyebrow) { max-width: 32rem; }
}
/* Tablets upright and phones sideways: the finished books share one shelf */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait), (max-height: 540px) and (orientation: landscape) {
  .shelf-row { gap: 1.2rem 1.6rem; padding: 0 1rem; }
  .shelf-cover { height: 150px; }
  .shelf-title { min-width: 7.5rem; }
  .shelf-book--pending .shelf-title { min-width: 9.5rem; }
  .shelf-book--pending .shelf-cover { width: 120px; }
}

/* Phones turned sideways: the cover sized to the height, and chapter
   openers laid out like a spread, picture beside the title */
@media (max-height: 540px) and (orientation: landscape) {
  .cover-page .env-label { display: none; }
  .cover-page .cover-wrap { min-height: calc(100svh - 3.3rem - env(safe-area-inset-bottom)); align-content: center; padding: .9rem 1rem; }
  .cover-book { width: min(300px, 40vw, calc((100svh - 3.3rem - env(safe-area-inset-bottom) - 1.8rem) * 3 / 4)); }
  .page-hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: 1fr auto auto auto 1fr; column-gap: clamp(1.5rem, 4vw, 2.5rem); min-height: calc(100svh - 3.3rem - env(safe-area-inset-bottom) - 4.2rem); }
  .page-hero::after { grid-column: 1; grid-row: 1 / -1; height: auto; aspect-ratio: auto; }
  .page-hero > * { grid-column: 2; margin-left: 0; margin-right: calc(max(.9rem, env(safe-area-inset-right)) + 4rem); }
  .page-hero > .eyebrow { margin-top: 1.4rem; }
  .page-hero > h1 { max-width: 16ch; font-size: clamp(1.9rem, 4vw, 2.4rem); }
  .page-hero > p:not(.eyebrow) { margin-bottom: 1.4rem; font-size: 1.05rem; }
  /* the missing page: torn stub beside the apology and the contents */
  .missing-hero { grid-template-rows: 1fr auto auto auto auto 1fr; }
  .missing-hero > .missing-art { grid-column: 1; grid-row: 1 / -1; aspect-ratio: auto; min-height: 0; }
  .missing-contents { grid-row: 5; margin-top: 1.2rem; margin-bottom: 1.6rem; }
  .missing-hero .missing-scrawl { top: 14%; left: 8%; }
  .missing-hero .missing-otter { left: auto; right: 8%; top: 9.5rem; bottom: auto; width: clamp(110px, 17vw, 170px); }
}

/* Single-page layouts: the colophon is centred as one block */
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .footer-links { justify-content: center; }
  .site-footer > span { text-wrap: balance; }
}

/* The two-page spread: leave the right margin clear for the
   accessibility button so it never sits on the page */
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  .book { width: min(1380px, calc(100% - 2 * 4.5rem)); }
  .cover-book { width: min(500px, 80vw, calc((100vh - 12.5rem) * 3 / 4)); }
}

/* Large monitors: a bigger book and cover, still with room to breathe */
@media (min-width: 1800px) and (min-height: 900px) {
  .book { max-width: none; width: min(1640px, calc(100% - 9rem)); }
  .cover-book { width: min(720px, calc((100vh - 12.5rem) * 3 / 4)); }
}
@media (min-width: 2300px) and (min-height: 1200px) {
  .book { width: min(1840px, calc(100% - 12rem)); }
  .cover-book { width: min(820px, calc((100vh - 12.5rem) * 3 / 4)); }
}
/* very large monitors: everything set in rem grows a step, so the type
   keeps its proportion to the bigger book */
@media (min-width: 2300px) and (min-height: 1200px) {
  html { font-size: 112.5%; }
}

/* ============================================================
   One book: every chapter is a page of the same book, so the
   binding and the paper are the same throughout (the colours of
   the front cover). Only the world around the book changes.
   ============================================================ */
body[class*='env-'], .turn-dest[class*='env-'], .turn-world[class*='env-'] { --cover: #123b6b; --cover-deep: #0c2a4f; --paper: #fbf8f1; --paper-edge: #f1e6d3; --mat: #f1ece1; }
/* While the page turns, the next chapter's world fades in behind the book. */
.turn-world { position: fixed; z-index: -1; inset: 0; background: var(--env-bg); opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.turn-world.is-showing { opacity: 1; }
/* the world's painting sits at the very back, under the fading next one */
body::after { z-index: -2; }

/* Opening the cover: the cover swings open onto a blank first page, then the
   page grows to the size of the open book and the first chapter appears on it. */
.turn-stage.is-cover > .turn-dest { opacity: 0; }
.turn-stage.is-cover .turn-under { box-shadow: 0 10px 30px -12px rgba(5, 12, 40, .5); }
.turn-stage.is-cover .turn-under { box-shadow: 0 0 0 10px var(--cover), 0 24px 40px -12px rgba(5, 12, 40, .55); }
/* the first chapter drawn while still on the cover must not pick up the cover's own layout rules */
.cover-page .turn-dest:not(.cover-page) { text-align: start; }
.cover-page .turn-dest:not(.cover-page) .env-label { display: block; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .cover-page .turn-dest:not(.cover-page) .env-label { position: absolute; margin: 0; }
}
/* The next page in a page turn sits inside the current page's <body>, so the
   current chapter's opener art would otherwise win whenever its rule comes
   later in this file (most turns backwards). Pin each chapter's art to its own page. */
.turn-dest .page-hero::after { content: ''; display: block; color: inherit; font-size: inherit; font-style: inherit; background: var(--paper-edge) center / cover no-repeat; }
.turn-dest.about-page .page-hero::after { background-image: url('./assets/art/otter-waving-1280.webp'); }
.turn-dest.otters-page .page-hero::after { background-image: url('./assets/art/otters-stone-1280.webp'); }
.turn-dest.pip-page .page-hero::after { background-image: url('./assets/art/pip-scene-1280.webp'); }
.turn-dest.contact-page .page-hero::after { background-image: url('./assets/art/otters-scene-1280.webp'); }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .turn-dest.about-page .page-hero::after { background-image: url('./assets/art/otter-waving-1280.webp'); }
  .turn-dest.otters-page .page-hero::after { background-image: url('./assets/art/otters-stone-1280.webp'); }
  .turn-dest.pip-page .page-hero::after { background-image: url('./assets/art/pip-scene-1280.webp'); }
  .turn-dest.contact-page .page-hero::after { background-image: url('./assets/art/otters-scene-1280.webp'); }
}
/* Running heads: the name sits on the left page and the contents on the right
   page, lined up with the chapter text below and never crossing the spine. */
@media (min-width: 901px) {
  .nav { justify-self: start; justify-content: space-between; width: 100%; max-width: 34rem; gap: .7rem; font-size: 1.04rem; }
}
/* Where the contents would not fit on the right page, fold them into a menu. */
@media (min-width: 901px) and (max-width: 1220px) {
  .site-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gutter); }
  .nav-toggle { display: block; justify-self: start; }
  .nav { position: absolute; z-index: 10; top: 100%; left: calc(50% + var(--gutter) / 2 - 1.2rem); right: auto; display: none; width: auto; min-width: 12rem; padding: .8rem 1.2rem; border: 1px solid var(--rule); background: var(--paper); box-shadow: 0 10px 24px rgba(42, 38, 34, .12); }
  .nav.is-open { display: grid; gap: .3rem; }
}
/* The cover painting fades in once it has loaded (with the lighthouse's beam), instead of popping in. */
html.js .cover-box .cover-art:not(.is-loaded), html.js .cover-box:has(.cover-art:not(.is-loaded)) .cover-beam { opacity: 0; }
html.js .cover-box .cover-art, html.js .cover-box .cover-beam { transition: opacity .45s ease; }
.turn-dest .cover-box .cover-art, .turn-clone .cover-box .cover-art, .turn-dest .cover-box .cover-beam, .turn-clone .cover-box .cover-beam { opacity: 1 !important; }
/* Bookshelf, refined: one shelf on each page of the spread, so nothing sits
   across the spine. Every book is the same height and stands on the plank,
   with its label on the shelf edge below; the books scale to fit the page. */
.shelf { container-type: inline-size; }
.shelf-row { --h: clamp(52px, calc((100cqi - 6.4rem) / 3.3), 170px); position: relative; flex-wrap: nowrap; align-items: flex-start; gap: 0 1.6rem; padding: 0 .6rem; border-bottom: 0; box-shadow: none; }
.shelf-row::before { content: ''; position: absolute; z-index: 0; left: 0; right: 0; top: var(--h); height: 12px; border-radius: 1px; background: linear-gradient(#c58a55, #b77a45 45%, #a86d3b); box-shadow: 0 5px 0 -1px #8a5428, 0 14px 14px -10px rgba(60, 35, 15, .45); }
.shelf-book { position: relative; z-index: 1; width: min-content; padding-bottom: 0; }
.shelf-cover { height: var(--h); transform-origin: 50% 100%; }
.shelf-book:hover .shelf-cover, .shelf-book:focus-visible .shelf-cover { transform: translateY(-6px); }
.shelf-title { min-width: 0; margin-top: calc(12px + 5px + .75rem); font-size: 1.05rem; }
.shelf-book--pending .shelf-cover { width: calc(var(--h) * .8); }
.shelf-pending { font-size: calc(var(--h) * .24); }
@media (min-width: 901px) {
  .bookshelf .section-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gutter); align-items: start; }
  .bookshelf .section-intro { grid-column: 1 / -1; }
  .bookshelf .shelf { margin-top: 0; }
}
@media (max-width: 760px) {
  .shelf-row { --h: clamp(56px, calc((100cqi - 5.4rem) / 3.4), 150px); gap: 0 1rem; padding: 0 .3rem; }
  .shelf-title { font-size: .98rem; }
  .shelf-meta { font-size: .85rem; }
}
.shelf-book--pending { width: max-content; max-width: 12rem; }
/* Chapter label above the book: one label for every chapter, in the navy of
   the binding with a cream hairline, so it no longer takes its colour from
   whatever painting happens to be behind it. */
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  .env-label, .env-sketch .env-label { color: #f6e7c1; text-shadow: none; }
  .env-label span, .env-sketch .env-label span { color: #f6e7c1; background: var(--cover); box-shadow: inset 0 0 0 1px rgba(246, 231, 193, .28), 0 4px 14px -6px rgba(5, 12, 40, .55); }
}

/* Desktop cover: the whole cover fits on screen, with no stray scrollbar. */
@media (min-width: 901px) and (min-height: 541px) {
  .cover-page { display: flow-root; }
  .cover-page .cover-wrap { padding-bottom: 2rem; }
}

/* The cover's label is a welcome line rather than a chapter name: no pill,
   cream lettering with hairlines either side, her name in italic. */
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  body.cover-page > .env-label span { padding: 0; color: #f6e7c1; background: none; box-shadow: none; text-shadow: 0 1px 3px rgba(5, 12, 40, .55); }
  body.cover-page > .env-label em { font-size: 1.3em; font-style: italic; font-variant-caps: normal; letter-spacing: .03em; }
}

/* ---------- Design pass (Nov 2026) ---------- */
/* One navy for every main button, the same as the binding and the labels,
   so each chapter reads as a page of the same book. */
.button-primary { border-color: #123b6b; color: #f6e7c1; background: #123b6b; }
.button-primary:hover { border-color: #0b2a4f; color: #fff; background: #0b2a4f; }

/* Pip's two book pages are landscape: give them landscape mounts and let
   them fill the page instead of sitting small in portrait frames. */
.work-grid--wide .plate-frame { aspect-ratio: 4 / 3; padding: 4% 3%; }
.work-card .work-grid--wide .plate-frame img, .work-grid--wide .work-card .plate-frame img { width: 100%; }
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  .work-grid--wide > .work-card:nth-child(n) { width: min(100%, 32rem); }
}

/* Footer: the contents read as words, not tiny capitals. */
.footer-contents a { font-variant-caps: normal; font-size: 1.12rem; letter-spacing: .01em; }
.site-footer > span:first-of-type { font-style: italic; font-variant-caps: normal; font-size: 1.05rem; letter-spacing: .01em; }

/* ---------- Depth (Nov 2026) ----------
   The closed book leans gently toward the pointer with a soft light moving
   across its board; plates tilt as you move over them; the open book has a
   thicker block of pages and sits higher above the world. Pointer-driven
   parts only run with a mouse, and never with reduced motion. */
.cover-book { --rx: 0deg; --ry: 0deg; transform: perspective(1600px) rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.cover-book.is-tilting { transition: transform .15s ease-out; }
.cover::after { content: ''; position: absolute; z-index: 3; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(70% 55% at var(--gx, 30%) var(--gy, 20%), rgba(255, 246, 222, .16), transparent 70%); opacity: var(--glare, .55); transition: opacity .5s ease; }
.cover-book.is-tilting .cover::after { --glare: 1; }
.turn-stage .cover-book, .turn-dest .cover-book { transform: none; }

.work-card .plate-frame { perspective: 900px; }
.work-card .plate-frame img.is-tilting { transform: translateY(-8px) rotateX(var(--px, 0deg)) rotateY(var(--py, 0deg)); transition: transform .12s ease-out, box-shadow .3s ease; }

@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  .book { box-shadow: 0 2px 3px rgba(0, 0, 0, .2), 0 18px 30px -14px rgba(5, 12, 40, .45), 0 50px 90px -20px rgba(5, 12, 40, .6); }
  .book-pages { box-shadow: 0 2px 0 var(--paper-edge), 0 3px 0 #d8cfbe, 0 5px 0 var(--paper-edge), 0 6px 0 #d3c9b6, 0 8px 0 var(--paper-edge), 0 9px 0 #cfc4af, 0 11px 0 var(--paper-edge), 0 12px 0 #cabfa8; }
  /* the pages curve down into the spine and up to the fore-edge */
  .book-pages::before { background: linear-gradient(90deg, rgba(70, 50, 25, .1), rgba(255, 255, 255, .0) 3%, transparent 46%, rgba(255, 255, 255, .25) 48.5%, transparent 50%, rgba(255, 255, 255, .25) 51.5%, transparent 54%, transparent 97%, rgba(70, 50, 25, .1)); }
}
@media (prefers-reduced-motion: reduce) { .cover-book, .work-card .plate-frame img.is-tilting { transition: none; } }
html.a11y-reduce-motion .cover-book { transform: none; transition: none; }

/* ---------- Cover, bookbound finish (Nov 2026) ----------
   Gold-foil lettering pressed into the cloth, gilt corner ornaments on the
   frame, a gilt mount for the painting, raised bands on the spine and a
   bevelled board edge. */
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  .cover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -3px 4px -1px rgba(0, 0, 0, .3), inset -3px 0 4px -2px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(255, 255, 255, .06), 0 2px 3px rgba(0, 0, 0, .25); }
}
.cover::before { content: ''; position: absolute; z-index: 1; left: 1.2%; width: 3.4%; top: 6%; bottom: 6%; pointer-events: none; background:
  linear-gradient(180deg, transparent 0 4%, rgba(222, 190, 120, .7) 4% calc(4% + 1px), transparent calc(4% + 1px) calc(4% + 4px), rgba(222, 190, 120, .7) calc(4% + 4px) calc(4% + 5px), transparent calc(4% + 5px) calc(96% - 5px), rgba(222, 190, 120, .7) calc(96% - 5px) calc(96% - 4px), transparent calc(96% - 4px) calc(96% - 1px), rgba(222, 190, 120, .7) calc(96% - 1px) 96%, transparent 96%); }
.cover-frame { border-color: rgba(222, 190, 120, .75); outline-color: rgba(222, 190, 120, .32);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23dcbc78' stroke-width='1.2'%3E%3Cpath d='M2 22V2h20'/%3E%3Cpath d='M7 14c0-4 3-7 7-7'/%3E%3C/g%3E%3Ccircle cx='7' cy='7' r='2' fill='%23dcbc78'/%3E%3C/svg%3E") left 7px top 7px / 38px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23dcbc78' stroke-width='1.2'%3E%3Cpath d='M38 22V2H18'/%3E%3Cpath d='M33 14c0-4-3-7-7-7'/%3E%3C/g%3E%3Ccircle cx='33' cy='7' r='2' fill='%23dcbc78'/%3E%3C/svg%3E") right 7px top 7px / 38px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23dcbc78' stroke-width='1.2'%3E%3Cpath d='M2 18v20h20'/%3E%3Cpath d='M7 26c0 4 3 7 7 7'/%3E%3C/g%3E%3Ccircle cx='7' cy='33' r='2' fill='%23dcbc78'/%3E%3C/svg%3E") left 7px bottom 7px / 38px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23dcbc78' stroke-width='1.2'%3E%3Cpath d='M38 18v20H18'/%3E%3Cpath d='M33 26c0 4-3 7-7 7'/%3E%3C/g%3E%3Ccircle cx='33' cy='33' r='2' fill='%23dcbc78'/%3E%3C/svg%3E") right 7px bottom 7px / 38px no-repeat; }
.cover-box { border-color: #d9b96f; border-image: linear-gradient(135deg, #f4e3b0, #c19449 30%, #f1dca3 55%, #a8803d 80%, #e9d3a1) 1; box-shadow: 0 0 0 5px rgba(0, 0, 0, .22), inset 0 0 0 1px rgba(0, 0, 0, .25), 0 10px 22px -8px rgba(0, 0, 0, .55); }
html:not(.a11y-high-contrast) .cover-kicker, html:not(.a11y-high-contrast) .cover-subtitle, html:not(.a11y-high-contrast) .cover-open { color: transparent; background-image: linear-gradient(180deg, #f8e9bd 0%, #e2c27c 45%, #b88d44 55%, #ecd394 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .45)); }
html:not(.a11y-high-contrast) .cover-open { border-color: rgba(222, 190, 120, .8); }
html:not(.a11y-high-contrast) .cover:hover .cover-open, html:not(.a11y-high-contrast) .cover:focus-visible .cover-open { background: linear-gradient(180deg, #fff6d8 0%, #f0d48e 50%, #fbe9b8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; border-color: rgba(240, 212, 142, .95); box-shadow: 0 0 14px -2px rgba(240, 205, 120, .35), inset 0 0 10px -2px rgba(240, 205, 120, .25); }
.cover-open { position: relative; }
.cover-open::after { content: ''; position: absolute; inset: 0; z-index: -1; background: rgba(233, 211, 161, 0); transition: background-color .25s ease; }
.cover:hover .cover-open::after, .cover:focus-visible .cover-open::after { background: rgba(233, 211, 161, .12); }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .cover-frame { background-size: 24px, 24px, 24px, 24px; background-position: left 5px top 5px, right 5px top 5px, left 5px bottom 5px, right 5px bottom 5px; }
}

/* Closed book: the pages sit inside the boards, as on a real hardback, so
   only a sliver of page edge shows at the fore-edge, with the back board
   just behind it. Nothing sticks out below the cover. */
.cover-book::before { inset: 1.8% -1.5% 1.8% 4%; border-radius: 0 4px 4px 0; box-shadow: none; }
.cover-book::after { content: ''; position: absolute; z-index: -1; inset: .3% -2.3% -.5% 3%; border-radius: 0 10px 10px 0; background: linear-gradient(90deg, #0d2d55, #0f3360 60%, #0b2748); box-shadow: inset -1px 0 0 rgba(255, 255, 255, .08), 0 34px 60px -10px rgba(5, 12, 40, .6); }
.turn-stage .cover-book::after, .turn-dest .cover-book::after { display: none; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .cover-book::after { display: none; }
  .cover { box-shadow: 2px 0 0 -3px #f6efe0, 3px 0 0 -3px #ddd1bb, 4px 0 0 -3px #f6efe0, 5px 0 0 -3px #d3c6ad, 7px 1px 0 -1px #0f3360, 0 24px 40px -8px rgba(5, 12, 40, .6); }
}

/* The email address is long: let it wrap rather than run off a narrow phone. */
.footer-links a, .contact-item a { overflow-wrap: anywhere; }

/* ============================================================
   Russell's Adventure: the finished book
   ============================================================ */
.env-shore { --env-bg: linear-gradient(rgba(6, 22, 52, .1), rgba(6, 22, 52, .38)), url('./assets/backdrops/sea.jpg') center / cover; --cover: #123b6b; --cover-deep: #0c2a4f; --accent: #7a4f26; }
html:has(body.env-shore) { background: #123b6b; }
body.russell-page > .book .page-hero::after, .turn-dest.russell-page .page-hero::after { content: ''; display: block; color: inherit; font-size: inherit; font-style: inherit; background: #b9d6ee url('./assets/art/russell-cover-2560.webp') 100% 100% / auto 160% no-repeat; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
}
.character-art--wide { width: 100%; }
.film-frame { margin: 0; align-self: center; }
.film-copy > p:first-child::first-letter { all: unset; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) { .film-frame { margin-top: 1.6rem; } }
.film-frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: .6rem solid #fff; background: #e9e6df; object-fit: cover; box-shadow: 0 2px 4px rgba(31, 35, 64, .14), 0 22px 40px -18px rgba(31, 35, 64, .5), 0 60px 90px -50px rgba(31, 35, 64, .45); }
.film-frame figcaption { margin-top: 1rem; color: var(--ink-soft); font-size: 1rem; font-style: italic; text-align: center; }
.show-photo img { aspect-ratio: 3 / 4; object-position: center 30%; }
.show-photo::after { content: 'Russell\2019s Adventure on show'; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .film-frame video { border-width: .3rem; }
}

/* ============================================================
   Every screen: keep clear of the notch, Dynamic Island,
   rounded corners and the home indicator. The page is drawn
   edge to edge (viewport-fit=cover), so these insets apply in
   Safari as well as the installed app; they are 0 elsewhere.
   ============================================================ */
:root { --safe-top: env(safe-area-inset-top, 0px); --safe-right: env(safe-area-inset-right, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px); }
body { padding-top: var(--safe-top); padding-left: var(--safe-left); padding-right: var(--safe-right); }
/* a solid strip behind the status bar, so pages never scroll underneath the clock or the Dynamic Island */
html::before { content: ''; position: fixed; z-index: 1001; top: 0; right: 0; left: 0; height: var(--safe-top); background: var(--cover, #123b6b); pointer-events: none; }
html:has(body.env-meadow)::before { background: #2c5a26; }
html:has(body.env-forest)::before { background: #245b3c; }
html:has(body.env-river)::before { background: #11245e; }
html:has(body.env-dusk)::before { background: #0e1d4c; }
html:has(body.env-sketch)::before { background: #5f4b37; }
html:has(body.env-sea)::before, html:has(body.env-shore)::before { background: #123b6b; }
.site-header { top: var(--safe-top); }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  /* the running head is not sticky on phones, so it must not be pushed down a second time */
  .site-header, .turn-dest .site-header { top: 0 !important; }
  /* the chapter label sits in the running head, below the status bar */
  body:not(.cover-page) > .env-label { top: calc(var(--safe-top) + .95rem); }
  .tab-bar { padding-left: var(--safe-left); padding-right: var(--safe-right); padding-bottom: max(var(--safe-bottom), .35rem); }
  body { padding-bottom: calc(4.4rem + max(var(--safe-bottom), .35rem)); }
  /* the plate viewer fills the screen, so keep its picture and buttons inside the safe area */
  .plate-viewer { padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
  .plate-viewer__img { height: calc(62dvh - var(--safe-top) - var(--safe-bottom)); }
  /* narrow phones: the six chapter tabs share the width evenly and never spill */
  .tab-bar a { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-height: 540px) and (orientation: landscape) {
  body { padding-bottom: calc(3.3rem + max(var(--safe-bottom), .35rem)); }
  .section { padding-left: 1.25rem; padding-right: 1.25rem; }
  .site-header, .page-hero > * { padding-left: 0; }
}
@media (max-width: 900px) and (orientation: portrait) {
  .cover-page .cover-wrap { min-height: calc(100svh - var(--safe-top) - 4.4rem - max(var(--safe-bottom), .35rem) - 3.9rem); }
}
@media (max-width: 360px) {
  .tab-bar a { font-size: .74rem; }
}
/* The next page drawn during a page turn gets the same safe-area padding as
   the real page, so it lands exactly where the page then loads (no jump). */
.turn-dest { box-sizing: border-box; padding-top: var(--safe-top); padding-left: var(--safe-left); padding-right: var(--safe-right); }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  .turn-dest:not(.cover-page) > .env-label { top: calc(var(--safe-top) + .95rem); }
}

/* Page loads: sections on screen when a page opens are drawn straight away;
   only those further down fade in (site.js marks them .is-pending). */
.reveal { opacity: 1; transition: none; }
.reveal.is-pending { opacity: 0; transition: opacity .9s ease; }
.reveal.is-pending.is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .reveal.is-pending { opacity: 1; transition: none; } }
html.a11y-reduce-motion .reveal.is-pending { opacity: 1; transition: none; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) {
  body.russell-page > .book .page-hero::after, .turn-dest.russell-page .page-hero::after { background-image: url('./assets/art/russell-cover-1920.webp'); }
}

/* Two flip-through films side by side: one on each page of the spread */
.film-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gutter); row-gap: 2rem; }
@media (max-width: 900px), (max-height: 540px) and (orientation: landscape) { .film-pair { grid-template-columns: 1fr; } }
/* Pip's opener: the full ADHD with Pip cover (the sharpest Pip artwork), shown
   whole as a mounted plate on a soft wash of its own colours. */
body.pip-page > .book .page-hero::after, .turn-dest.pip-page .page-hero::after { background: var(--mat) url('./assets/art/pip-opener-1280.webp') center / 92% auto no-repeat; }

/* ============================================================
   Every device: fit and finish (PR #49)
   ============================================================ */
/* Bookshelf: three landscape picture books always fit the shelf,
   so the last one is never cut off on tablets and small laptops */
.shelf-row:has(> li:nth-child(3)) { --h: min(clamp(52px, calc((100cqi - 6.4rem) / 3.3), 170px), calc((100cqi - 1.2rem - 3.2rem) / 4.45)); }
@media (max-width: 760px) {
  .shelf-row:has(> li:nth-child(3)) { --h: min(clamp(56px, calc((100cqi - 5.4rem) / 3.4), 150px), calc((100cqi - .6rem - 2rem) / 4.45)); }
}
/* Contact details: on a narrow page the label sits above the address,
   so the email and Instagram never break in the middle of a word */
.contact-list { container-type: inline-size; }
@container (max-width: 27rem) {
  .contact-item { grid-template-columns: 1fr; gap: .15rem; }
  .contact-item strong { font-size: .85rem; letter-spacing: .14em; }
}
/* The smallest phones: "Russell" alone in the chapter label,
   so it never runs into "Children's book illustrator" */
@media (max-width: 374px) { .env-label .label-more { display: none; } }
/* Phones turned sideways: numeral and name side by side in a slimmer tab bar */
@media (max-height: 540px) and (orientation: landscape) {
  body { padding-bottom: calc(2.8rem + env(safe-area-inset-bottom)); }
  .tab-bar a { display: flex; justify-content: center; align-items: center; gap: .35rem; min-height: 2.8rem; padding-top: .2rem; padding-bottom: .2rem; }
}
/* Desktop contents links: a larger target for mouse and touch screens */
@media (min-width: 901px) { .nav a { padding-left: .2rem; padding-right: .2rem; } }
.env-label .label-more { display: inline; padding: 0; border-radius: 0; background: none; box-shadow: none; }
@media (max-width: 374px) { .env-label .label-more { display: none; } }
.env-label .label-more::before, .env-label .label-more::after { content: none; display: none; }

/* ============================================================
   The book in the hand (interactive book pass)
   ============================================================ */
/* Desktop: the next and previous chapters stick out from the page edges as
   paper tabs, like the tabs on the cover, so the page can be turned from
   anywhere in a chapter. Purple only on the arrow, as a quiet accent. */
.edge-tab { display: none; }
@media (min-width: 901px) and (min-height: 541px) {
  .edge-tab { position: fixed; z-index: 60; top: 50%; display: flex; flex-direction: column; align-items: center; gap: .55rem; width: 2.5rem; padding: 1rem 0 1.1rem; color: var(--ink); font-size: 1rem; line-height: 1; text-decoration: none; letter-spacing: .04em; white-space: nowrap; background: linear-gradient(90deg, var(--paper-edge), var(--paper) 45%); box-shadow: 0 6px 14px -6px rgba(5, 12, 40, .55), inset 0 0 0 1px rgba(31, 35, 64, .06); opacity: .92; transform: translate(0, -50%); transition: width .25s cubic-bezier(.2, .8, .2, 1), transform .3s ease, opacity .3s ease, box-shadow .25s ease; }
  .edge-tab--next { border-radius: 0 9px 9px 0; }
  .edge-tab--prev { border-radius: 9px 0 0 9px; background: linear-gradient(270deg, var(--paper-edge), var(--paper) 45%); }
  .edge-tab__name { writing-mode: vertical-rl; font-variant-caps: all-small-caps; font-size: 1.1rem; letter-spacing: .12em; }
  .edge-tab--prev .edge-tab__name { transform: rotate(180deg); }
  .edge-tab__arrow { width: 1rem; height: 1rem; color: #6d4c9c; transition: transform .25s ease; }
  .edge-tab:hover, .edge-tab:focus-visible { width: 2.9rem; opacity: 1; box-shadow: 0 10px 20px -8px rgba(5, 12, 40, .6), inset 0 0 0 1px rgba(31, 35, 64, .08); }
  .edge-tab--next:hover .edge-tab__arrow { transform: translateX(2px); }
  .edge-tab--prev:hover .edge-tab__arrow { transform: translateX(-2px); }
  /* out of the way while a page turns, and once the corner links are in view */
  .edge-tab.is-resting, .is-turning-page .edge-tab { opacity: 0; pointer-events: none; }
  .edge-tab--next.is-resting, .is-turning-page .edge-tab--next { transform: translate(-100%, -50%); }
  .edge-tab--prev.is-resting, .is-turning-page .edge-tab--prev { transform: translate(100%, -50%); }
}
@media (prefers-reduced-motion: reduce) { .edge-tab, .edge-tab__arrow { transition: none; } }
html.a11y-reduce-motion .edge-tab, html.a11y-reduce-motion .edge-tab__arrow { transition: none; }
.turn-clone .edge-tab, .turn-dest .edge-tab { display: none; }

/* Phones: the edge of the next page follows a sideways swipe; once it is
   pulled far enough it turns navy, and letting go turns the page. */
.swipe-peek { position: fixed; z-index: 950; top: 50%; --pull: 0; pointer-events: none; }
.swipe-peek span { display: block; padding: .8rem 1.1rem .85rem; color: var(--ink); font-size: 1.15rem; line-height: 1.15; white-space: nowrap; background: var(--paper); box-shadow: 0 10px 26px -8px rgba(5, 12, 40, .5), inset 0 0 0 1px rgba(31, 35, 64, .08); transition: background-color .18s ease, color .18s ease; }
.swipe-peek small { display: block; margin-bottom: .15rem; color: var(--muted); font-size: .8rem; font-variant-caps: all-small-caps; letter-spacing: .14em; transition: color .18s ease; }
.swipe-peek--next { right: 0; transform: translate(calc((1 - var(--pull)) * 100%), -50%); }
.swipe-peek--next span { border-radius: 12px 0 0 12px; text-align: right; }
.swipe-peek--prev { left: 0; transform: translate(calc((var(--pull) - 1) * 100%), -50%); }
.swipe-peek--prev span { border-radius: 0 12px 12px 0; }
.swipe-peek { opacity: 0; transition: opacity .2s ease; }
.swipe-peek.is-showing { opacity: 1; }
.swipe-peek.is-ready span { color: #fff; background: var(--cover); }
.swipe-peek.is-ready small { color: rgba(255, 255, 255, .75); }
/* a soft shadow along the screen edge, as if the page were lifting */
.swipe-peek::before { content: ''; position: fixed; top: -50vh; bottom: -50vh; width: 3.5rem; opacity: calc(var(--pull) * .9); pointer-events: none; }
.swipe-peek--next::before { right: 0; background: linear-gradient(270deg, rgba(31, 35, 64, .16), transparent); }
.swipe-peek--prev::before { left: 0; background: linear-gradient(90deg, rgba(31, 35, 64, .16), transparent); }

/* Desktop: the plates are a spread of their own, so a section's title never
   sits under the page numbers of the spread before it */
@media (min-width: 901px) and (min-height: 541px), (min-width: 901px) and (orientation: portrait) {
  main > section + .plates-section { border-top: 1px solid var(--rule); padding-top: 4.5rem; }
}

/* Tablets held upright: the chapter's opening words line up with the
   centred column of every page after them */
@media (min-width: 600px) and (max-width: 900px) and (orientation: portrait) {
  .page-hero > :not(.page-num) { margin-left: max(0px, calc((100% - 40rem) / 2)); }
}
