/* Book Swap Picnic: shared styles for /bookswap and /bookswap/confirmed.
   Same brand as the dinner pages (plum, cream, Hussar, Arimo, Kawaii RT),
   warmed up with blush, kraft and sage, paper grain, wavy edges and polaroids. */
:root {
  --plum:        #6F2A3D;
  --plum-dark:   #4A1A28;
  --plum-deeper: #24101A;
  --cream:       #F6EBDD;
  --paper:       #FFF8EF;
  --blush:       #F2DAD5;
  --blush-deep:  #E9C3BC;
  --kraft:       #E6CFAE;
  --kraft-deep:  #C9A57A;
  --sage:        #B7BD9C;
  --sage-light:  #E3E5D2;
  --ink:         rgba(74, 26, 40, 0.82);
  --line:        rgba(111, 42, 61, 0.16);
  --on-plum:     rgba(246, 235, 221, 0.88);

  --pad: 1.25rem;
  --wrap: 1120px;
  --section-y: 4.5rem;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 14px 34px rgba(74, 26, 40, 0.10);
  --shadow-sm: 0 6px 18px rgba(74, 26, 40, 0.08);

  --text-hero: clamp(2.5rem, 9.5vw, 4.75rem);
  --text-h2:   clamp(1.875rem, 5.5vw, 3rem);
  --text-h3:   clamp(1.1875rem, 2.6vw, 1.375rem);
  --text-lead: clamp(1.0625rem, 2.2vw, 1.25rem);

  /* Light paper grain, drawn by the browser (no image file) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.29 0 0 0 0 0.1 0 0 0 0 0.16 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Hand-drawn wave for section edges */
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 24' preserveAspectRatio='none'%3E%3Cpath d='M0 24V13C15 3 25 3 40 12S65 22 80 12 105 3 120 12V24Z'/%3E%3C/svg%3E");
}
@media (min-width: 640px)  { :root { --pad: 2rem; } }
@media (min-width: 1024px) { :root { --pad: 3rem; --section-y: 6.5rem; } }

@font-face { font-family: 'Hussar'; src: url('fonts/HussarBold.woff2') format('woff2'), url('fonts/HussarBold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Arimo'; src: url('fonts/Arimo-VariableFont_wght.woff2') format('woff2'), url('fonts/Arimo-VariableFont_wght.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Kawaii RT'; src: url('fonts/KawaiiRT-MonaShine.woff2') format('woff2'), url('fonts/KawaiiRT-MonaShine.ttf') format('truetype'); font-display: swap; }
@font-face {
  font-family: 'Hussar Fallback'; src: local('Georgia Bold'), local('Georgia');
  ascent-override: 90%; descent-override: 35%; line-gap-override: 0%; size-adjust: 119%;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Arimo', Arial, 'Helvetica Neue', sans-serif;
  font-size: 1.0625rem; line-height: 1.6;
  background: var(--cream) var(--grain); color: var(--plum);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font-family: inherit; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 3px; }
.on-plum :focus-visible { outline-color: var(--cream); }

/* ─── Type ─── */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.h1, .h2, .h3 { font-family: 'Hussar', 'Hussar Fallback', Georgia, serif; font-weight: 700; text-wrap: balance; }
.h1 { font-size: var(--text-hero); line-height: 1.02; letter-spacing: -0.025em; margin-bottom: 1rem; }
.h2 { font-size: var(--text-h2); line-height: 1.08; letter-spacing: -0.02em; margin-bottom: 1rem; }
.h3 { font-size: var(--text-h3); line-height: 1.2; margin-bottom: 0.375rem; }
.lead { font-size: var(--text-lead); line-height: 1.6; color: var(--ink); max-width: 36rem; text-wrap: pretty; }
.accent { font-family: 'Kawaii RT', 'Arimo', sans-serif; font-weight: 400; letter-spacing: 0.01em; }
.label {
  display: inline-block; font-family: 'Kawaii RT', 'Arimo', sans-serif;
  font-size: 1.125rem; line-height: 1.3; margin-bottom: 0.75rem; color: var(--plum);
}
.center { text-align: center; }
.center .lead { margin-left: auto; margin-right: auto; }

/* ─── Sections and wavy edges ─── */
.sec { position: relative; padding: var(--section-y) 0; }
.sec--blush { background: var(--blush) var(--grain); }
.sec--kraft { background: var(--kraft) var(--grain); }
.sec--sage  { background: var(--sage-light) var(--grain); }
.sec--plum  { background: var(--plum); color: var(--cream); }
.sec--plum .lead { color: var(--on-plum); }
/* The wave sits on top of a section and takes that section's colour */
.wavy::before {
  content: ''; position: absolute; left: 0; right: 0; top: -21px; height: 22px;
  background: inherit; pointer-events: none;
  -webkit-mask: var(--wave) 0 0 / 120px 22px repeat-x; mask: var(--wave) 0 0 / 120px 22px repeat-x;
}
.wavy { z-index: 1; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 54px; padding: 0 1.75rem;
  border-radius: 999px; border: none; cursor: pointer;
  background: var(--plum); color: var(--cream);
  font-family: 'Arimo', sans-serif; font-size: 1rem; font-weight: 700; letter-spacing: 0.01em;
  text-decoration: none; text-align: center;
  box-shadow: 0 8px 22px rgba(74, 26, 40, 0.22);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--plum-deeper);
  transform: translateX(-101%); transition: transform 0.45s cubic-bezier(0.77, 0, 0.18, 1);
}
.btn:hover::before { transform: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--light { background: var(--cream); color: var(--plum); box-shadow: 0 8px 26px rgba(0,0,0,0.25); }
.btn--light::before { background: #fff; }
.btn--ghost { background: transparent; color: var(--plum); border: 1.5px solid var(--plum); box-shadow: none; }
.btn--ghost::before { background: var(--plum); }
.btn--ghost:hover { color: var(--cream); }
.btn--block { width: 100%; }
@media (min-width: 640px) { .btn--block { width: auto; } }
.btn.is-soldout { white-space: normal; line-height: 1.3; padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* ─── Header ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: var(--wrap); margin: 0 auto; padding: 1rem var(--pad) 0;
}
.topbar img { height: clamp(2rem, 5vw, 2.5rem); width: auto; }
.back-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.875rem; font-weight: 700; text-decoration: none; color: var(--plum);
  padding: 0.5rem 0.875rem; border-radius: 999px; background: rgba(111,42,61,0.07);
  transition: background 0.2s;
}
.back-link:hover { background: rgba(111,42,61,0.14); }

/* ─── Image slots with a soft placeholder when the file is missing ───
   Every <img> sits in a .ph box. If the image fails to load, its onerror
   adds .is-missing to the box, the image hides and the box shows the
   filename (or, on perk cards, a plum icon). */
.ph { position: relative; overflow: hidden; background: var(--blush); }
.ph > img { width: 100%; height: 100%; object-fit: cover; }
.ph.is-missing > img { visibility: hidden; }
.ph.is-missing::after {
  content: attr(data-file); position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; padding: 1rem; text-align: center;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; color: rgba(111,42,61,0.6);
  background: repeating-linear-gradient(135deg, rgba(255,255,255,0.25) 0 10px, transparent 10px 20px);
}
.ph .ph-icon { display: none; }
.ph.is-missing .ph-icon {
  display: block; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 3.25rem; height: 3.25rem; color: var(--plum);
}
.ph.has-icon.is-missing::after { content: none; }

/* ─── Polaroid + tape ─── */
.polaroid {
  position: relative; background: #fffdf8; padding: 0.75rem 0.75rem 3rem;
  border-radius: 4px; box-shadow: 0 18px 40px rgba(74,26,40,0.18), 0 2px 6px rgba(74,26,40,0.08);
  transform: rotate(-2.5deg);
  transition: transform 0.4s cubic-bezier(0.22,1,0.36,1);
}
.polaroid .ph { border-radius: 2px; }
.polaroid figcaption, .polaroid .cap {
  position: absolute; left: 0; right: 0; bottom: 0.75rem; text-align: center;
  font-family: 'Kawaii RT', 'Arimo', sans-serif; font-size: 1.125rem; color: var(--plum);
}
.tape::before {
  content: ''; position: absolute; z-index: 2; top: -14px; left: 50%;
  width: 96px; height: 28px; transform: translateX(-50%) rotate(-4deg);
  background: rgba(230, 207, 174, 0.82);
  /* torn ends */
  clip-path: polygon(2% 0, 98% 0, 100% 20%, 97% 40%, 100% 60%, 97% 80%, 99% 100%, 1% 100%, 3% 80%, 0 60%, 3% 40%, 0 20%);
}
.tape--corner::before { top: -10px; left: auto; right: -18px; width: 80px; transform: rotate(35deg); }
@media (hover: hover) { .polaroid:hover { transform: rotate(-1deg) translateY(-4px); } }

/* ─── Note card (lined paper, handwritten title) ─── */
.note-card {
  position: relative; background: var(--paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 2.15rem, rgba(111,42,61,0.10) 2.15rem calc(2.15rem + 1px));
  background-position: 0 3.6rem;
  border-radius: var(--radius-sm); padding: 1.75rem 1.5rem 1.5rem 2.25rem;
  box-shadow: var(--shadow);
}
.note-card::after {
  /* red margin line, like a notebook page */
  content: ''; position: absolute; top: 0; bottom: 0; left: 1.25rem; width: 1px; background: rgba(111,42,61,0.25);
}

/* ─── Scroll reveal (only when JS runs) ─── */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1); }
.js [data-reveal].on { opacity: 1; transform: none; }
.js .polaroid[data-reveal].on { transform: rotate(-2.5deg); }
[data-reveal-delay="1"] { transition-delay: 0.08s !important; }
[data-reveal-delay="2"] { transition-delay: 0.16s !important; }
[data-reveal-delay="3"] { transition-delay: 0.24s !important; }

/* ─── Footer ─── */
footer {
  background: var(--plum-deeper); color: var(--on-plum);
  padding: 2.5rem 0 calc(2.5rem + env(safe-area-inset-bottom));
  font-size: 0.9375rem;
}
.footer-row { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.footer-brand { font-family: 'Hussar', Georgia, serif; font-size: 1.125rem; color: var(--cream); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
.footer-links a { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; padding: 0.25rem 0; }
.footer-links a:hover { color: var(--cream); text-decoration: underline; }
.footer-links svg { width: 15px; height: 15px; }
.footer-pages {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(246,235,221,0.14);
  font-size: 0.875rem;
}
.footer-pages a { text-decoration: none; padding: 0.25rem 0; }
.footer-pages a:hover { color: var(--cream); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
