/* Barnaby of Bramble Bay — storybook styles */
@font-face { font-family: "Poppins"; src: url("/fonts/poppins-bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Caladea"; src: url("/fonts/caladea-regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Caladea"; src: url("/fonts/caladea-italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Caladea"; src: url("/fonts/caladea-bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --paper: #fff8ea;
  --parchment: #f6ead0;
  --parchment-deep: #ecdcb8;
  --ink: #33291f;
  --ink-soft: #5c4b3b;
  --teal: #2f6a6e;
  --teal-dark: #214e51;
  --gold: #f6c21c;
  --coral: #d8432b;
  --sea: #4f8fa6;
  --bramble: #5b3a6b;
  --radius: 22px;
  --shadow: 0 2px 0 var(--ink), 0 10px 24px rgba(51, 41, 31, .14);
  --wrap: 1120px;
  --display: "Poppins", "Trebuchet MS", system-ui, sans-serif;
  --body: "Caladea", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 1.15rem/1.6 var(--body);
  background-color: var(--paper);
  /* soft paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .18 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-dark); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--coral); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.3rem, 7vw, 4rem); }
h2 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
p { margin: 0 0 1em; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 12px; color: var(--paper); }

/* ---------- header ---------- */
.site-header { background: var(--paper); border-bottom: 3px solid var(--ink); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-size: 1.08rem; line-height: 1.1; }
.brand img { width: 46px; height: 46px; }
.brand:hover { color: var(--ink); }
.brand small { display: block; font-family: var(--body); font-style: italic; font-size: .82rem; color: var(--ink-soft); }
.nav-toggle { display: none; font: 700 1rem var(--display); background: var(--gold); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a { display: block; padding: 8px 12px; border-radius: 999px; font-family: var(--display); font-size: .95rem; text-decoration: none; color: var(--ink); }
.site-nav a:hover { background: var(--parchment); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.js .nav-toggle { display: none; }
@media (max-width: 900px) {
  .js .nav-toggle { display: inline-block; }
  .js .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 3px solid var(--ink); padding: 8px 16px 16px; }
  .js .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; }
  .site-nav a { font-size: 1.1rem; padding: 12px 14px; }
  html:not(.js) .site-header .wrap { flex-wrap: wrap; padding-bottom: 8px; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 700 1.05rem/1 var(--display); text-decoration: none; padding: 15px 24px; border-radius: 999px; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); transition: transform .12s, box-shadow .12s; cursor: pointer; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { color: #fff; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { color: var(--ink); }
.btn-light { background: var(--paper); color: var(--ink); }
.btn-light:hover { color: var(--ink); }
.btn-sm { font-size: .9rem; padding: 10px 16px; box-shadow: 0 3px 0 var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- sections ---------- */
.section { padding: clamp(48px, 8vw, 88px) 0; }
.section-parchment { background: var(--parchment); }
.section-teal { background: var(--teal); color: #fff; }
.section-teal a:not(.btn) { color: #fff; }
.eyebrow { font-family: var(--display); text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; color: var(--coral); margin-bottom: .4em; }
.section-teal .eyebrow { color: var(--gold); }
.lead { font-size: clamp(1.2rem, 2.6vw, 1.45rem); color: var(--ink-soft); }
.centre { text-align: center; }
.centre .btn-row { justify-content: center; }
.narrow { max-width: 720px; margin-inline: auto; }
/* wavy shoreline dividers */
.wave { display: block; width: 100%; height: 34px; color: var(--parchment); }
.wave-teal { color: var(--teal); }
.wave-flip { transform: rotate(180deg); }
.wave + .section, .section + .wave { margin-top: -1px; }

/* ---------- hero ---------- */
.hero { padding: clamp(36px, 7vw, 80px) 0 clamp(40px, 6vw, 70px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; align-items: center; }
@media (min-width: 860px) { .hero .wrap { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); } }
.hero h1 span { display: block; color: var(--teal); }
.hero-tag { font-size: clamp(1.25rem, 2.8vw, 1.55rem); font-style: italic; margin-bottom: .6em; }
.hero-sub { color: var(--ink-soft); margin-bottom: 1.6em; }
.book-tilt { width: 88%; max-width: 440px; margin-inline: auto; transform: rotate(2.5deg); border: 4px solid var(--ink); border-radius: 6px 14px 14px 6px; box-shadow: 10px 12px 0 var(--parchment-deep), 10px 12px 0 3px var(--ink); background: #fff; }

/* ---------- cards / books ---------- */
.grid { display: grid; gap: 24px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.card-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-body p { margin: 0; }
.card h3 { margin: 0; }
.card .btn-row { margin-top: auto; padding-top: 6px; }
.card-cover { border-bottom: 3px solid var(--ink); }
.book-num { font-family: var(--display); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--coral); }
.book { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; padding: 32px 0; border-top: 3px dashed var(--parchment-deep); }
.book:first-of-type { border-top: 0; }
@media (min-width: 820px) { .book { grid-template-columns: 340px 1fr; } }
.book-cover { border: 4px solid var(--ink); border-radius: 6px 14px 14px 6px; box-shadow: 8px 10px 0 var(--parchment-deep), 8px 10px 0 3px var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 14px; }
.chips li { font: 700 .82rem var(--display); background: var(--parchment); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px; }
.buy { display: grid; gap: 10px; margin-top: 12px; }
.buy-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.buy-row strong { font-family: var(--display); font-size: .9rem; min-width: 96px; }
.peek { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.peek img { border: 3px solid var(--ink); border-radius: 14px; }

/* ---------- framed images ---------- */
.frame { border: 4px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: #fff; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: center; }
@media (min-width: 860px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* ---------- video facade ---------- */
.video { position: relative; aspect-ratio: 16 / 9; border: 4px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: var(--ink); box-shadow: var(--shadow); }
.video button { all: unset; cursor: pointer; position: absolute; inset: 0; display: block; }
.video button img { width: 100%; height: 100%; object-fit: cover; }
.video button::after { content: ""; position: absolute; left: 50%; top: 50%; width: 88px; height: 62px; transform: translate(-50%, -50%); border-radius: 18px; background: var(--coral) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M8 5v14l11-7z'/%3E%3C/svg%3E") center / 44px no-repeat; border: 3px solid var(--ink); }
.video button:focus-visible::after { outline: 3px solid var(--gold); outline-offset: 4px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- characters ---------- */
.portrait { width: 160px; height: 160px; border-radius: 50%; border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--parchment-deep); object-fit: cover; background: #fff; }
.gang { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 22px; text-align: center; }
.gang a { text-decoration: none; color: var(--ink); font-family: var(--display); }
.gang .portrait { width: 140px; height: 140px; margin: 0 auto 10px; transition: transform .15s; }
.gang a:hover .portrait { transform: rotate(-4deg) scale(1.04); }
.character { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: center; padding: 32px 0; border-top: 3px dashed var(--parchment-deep); }
.character:first-of-type { border-top: 0; }
@media (min-width: 720px) { .character { grid-template-columns: 220px 1fr; gap: 36px; } .character .portrait { width: 220px; height: 220px; } }
.character .portrait { margin-inline: auto; }
.appears { font-size: .98rem; color: var(--ink-soft); }
.appears strong { font-family: var(--display); font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.later { display: flex; align-items: center; gap: 16px; background: var(--parchment); border: 2px solid var(--ink); border-radius: 18px; padding: 12px 16px; margin-top: 14px; }
.later img { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--ink); flex: none; }
.later p { margin: 0; font-size: 1rem; }

/* ---------- story reader ---------- */
.reader { margin-top: 10px; }
.page { margin: 0 0 40px; }
.page figure { margin: 0; }
.page-text { background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); padding: 20px 24px; margin-top: 18px; font-size: clamp(1.15rem, 2.6vw, 1.35rem); box-shadow: var(--shadow); }
.page-text p:last-child { margin: 0; }
.page-num { font-family: var(--display); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; color: var(--coral); margin: 0 0 8px; }
.reader-controls { display: none; }
.js .reader .page { display: none; margin: 0; }
.js .reader .page.current { display: block; animation: turn .35s ease-out; }
.js .reader-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 6px; }
.reader-progress { font-family: var(--display); }
.reader-dots { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }
.reader-dots span { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); }
.reader-dots span.on { background: var(--teal); }
.btn[disabled] { opacity: .45; pointer-events: none; }
@keyframes turn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.cliff { text-align: center; background: var(--gold); border: 4px solid var(--ink); border-radius: var(--radius); padding: 30px 22px; box-shadow: var(--shadow); margin-top: 26px; }
.cliff h2 { margin-bottom: .3em; }
.cliff .btn-row { justify-content: center; margin-top: 16px; }

/* ---------- gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; list-style: none; margin: 0; padding: 0; }
.gallery button { all: unset; cursor: zoom-in; display: block; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: #fff; transition: transform .15s; }
.gallery button:hover { transform: rotate(-1deg) translateY(-3px); }
.gallery button:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
.gallery figcaption { padding: 10px 14px; font-size: 1rem; background: var(--paper); border-top: 3px solid var(--ink); }
.gallery figcaption em { display: block; font-size: .88rem; color: var(--ink-soft); }
.gallery figure { margin: 0; }
dialog.lightbox { border: 4px solid var(--ink); border-radius: var(--radius); padding: 0; max-width: min(96vw, 1000px); background: var(--paper); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
dialog.lightbox::backdrop { background: rgba(33, 26, 20, .78); }
.lightbox img { width: 100%; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.lightbox-bar p { margin: 0; flex: 1 1 200px; }

/* ---------- author ---------- */
.author-photo { width: 220px; height: 220px; border-radius: 50%; border: 4px solid var(--ink); object-fit: cover; margin-inline: auto; box-shadow: 0 8px 0 var(--parchment-deep); }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.contact-list a { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 14px 18px; text-decoration: none; color: var(--ink); font-family: var(--display); box-shadow: 0 3px 0 var(--ink); }
.contact-list a:hover { background: var(--parchment); }
.contact-list span { font-family: var(--body); color: var(--ink-soft); font-size: .95rem; display: block; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: var(--paper); padding: 44px 0 30px; margin-top: 0; }
.site-footer a { color: var(--paper); }
.site-footer a:hover { color: var(--gold); }
.footer-grid { display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.site-footer h2 { font-size: 1.1rem; color: var(--gold); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer .small { font-size: .9rem; opacity: .85; margin-top: 30px; border-top: 1px solid rgba(255, 248, 234, .25); padding-top: 18px; }

/* ---------- 404 ---------- */
.lost { text-align: center; padding: 70px 0 90px; }
.lost img { width: 240px; margin: 0 auto 20px; border-radius: 50%; border: 4px solid var(--ink); }

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