/* ===== Shop palette ===================================================== */
:root {
  --paper: #fbf4e6;
  --paper-2: #f3e6cc;
  --ink: #2a2118;
  --ink-soft: #5b4a3a;
  --wall: #e9e1c9;
  --wall-dot: #d6ccae;
  --wood-dark: #4a2c18;
  --wood: #7a4a2a;
  --wood-light: #a8703f;
  --back: #3a2416;
  --red: #c8553d;
  --mustard: #e0a526;
  --navy: #2b3a67;
  --sage: #7f9c6b;
  --kraft: #c99a63;

  --base: 230px;                /* height of a "medium portrait" book */
  --radius: 4px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.55 var(--font-body);
  background-color: var(--wall);
  background-image:
    radial-gradient(var(--wall-dot) 1.6px, transparent 1.8px),
    radial-gradient(var(--wall-dot) 1.6px, transparent 1.8px);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
}
img { max-width: 100%; display: block; }
a { color: var(--red); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }

.shop { max-width: 1440px; margin: 0 auto; padding: 0 clamp(12px, 3vw, 40px) 40px; }

/* ===== Awning + sign ==================================================== */
.awning { position: relative; padding-top: 104px; margin-bottom: 28px; }
.awning-stripes, .awning-stripes::after {
  background: repeating-linear-gradient(90deg, var(--red) 0 48px, var(--paper) 48px 96px);
}
.awning-stripes {
  position: absolute; inset: 0 calc(-1 * clamp(12px, 3vw, 40px)) auto; height: 46px; z-index: 1;
}
.awning-stripes::after { /* scalloped edge: one half-circle per stripe */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 24px;
  -webkit-mask: radial-gradient(circle 24px at 24px 0, #000 97%, #0000) 0 0 / 48px 24px repeat-x;
          mask: radial-gradient(circle 24px at 24px 0, #000 97%, #0000) 0 0 / 48px 24px repeat-x;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.08));
}
.shop-sign {
  position: relative; margin: 0 auto; width: fit-content; max-width: 100%;
  padding: 18px 44px 16px; text-align: center;
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  border: 6px solid var(--wood-dark); border-radius: 10px;
  box-shadow: 0 10px 0 -2px rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.2);
  color: #fff3d6;
}
.shop-sign::before, .shop-sign::after { /* hanging chains */
  content: ""; position: absolute; top: -68px; width: 14px; height: 69px; /* top end tucks behind the awning */
  background:
    radial-gradient(circle 5px at 50% calc(100% - 5px), #b5aca3 0 1.5px, #443d38 2px 4.5px, #0000 5px), /* eyelet */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='20' fill='none' stroke-linecap='round'%3E%3Crect x='3' y='1.5' width='8' height='13' rx='4' stroke='%23443d38' stroke-width='2.6'/%3E%3Crect x='3' y='1.5' width='8' height='13' rx='4' stroke='%23a39a92' stroke-width='.8'/%3E%3Cpath d='M7 -8V2M7 12V22' stroke='%23443d38' stroke-width='3.4'/%3E%3Cpath d='M7 -8V2M7 12V22' stroke='%238d847c' stroke-width='1'/%3E%3C/svg%3E") 50% 100% / 14px 20px repeat-y;
}
.shop-sign::before { left: 18%; } .shop-sign::after { right: 18%; }
.shop-sign h1 {
  margin: 0; font: 800 clamp(28px, 4.4vw, 54px)/1.05 var(--font-display);
  font-variation-settings: "SOFT" 100, "opsz" 144; letter-spacing: .01em;
  text-shadow: 0 3px 0 rgba(0,0,0,.25);
}
.shop-sign p { margin: 6px 0 0; font: 600 clamp(18px, 2.2vw, 26px)/1.2 var(--font-hand); color: #ffe3a3; }

/* ===== Layout =========================================================== */
.interior > * { min-width: 0; }
.interior { display: grid; grid-template-columns: minmax(260px, 320px) 1fr; gap: clamp(18px, 2.5vw, 36px); align-items: start; }

/* ===== Sidebar: a corkboard by the till ================================= */
.sidebar { position: sticky; top: 20px; }
.corkboard {
  padding: 22px 20px 26px; border: 10px solid var(--wood); border-radius: 6px;
  background-color: #c08a57;
  background-image: radial-gradient(rgba(0,0,0,.12) 1px, transparent 1.3px), radial-gradient(rgba(255,255,255,.12) 1px, transparent 1.3px);
  background-size: 7px 7px, 11px 11px;
  box-shadow: 0 8px 20px rgba(60,35,15,.25);
}
.polaroid {
  margin: 0 auto 18px; width: 78%; padding: 10px 10px 4px; background: #fff;
  transform: rotate(-3deg); box-shadow: 0 6px 14px rgba(0,0,0,.25); position: relative;
}
.polaroid::before { /* pin */
  content: ""; position: absolute; top: -8px; left: 50%; width: 16px; height: 16px; margin-left: -8px;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff9b84, var(--red) 60%, #7a2a1c);
  box-shadow: 0 3px 3px rgba(0,0,0,.3);
}
.polaroid img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.polaroid figcaption { font: 600 21px/1.4 var(--font-hand); text-align: center; color: var(--ink-soft); padding: 4px 0 2px; }
.about-card {
  background: var(--paper); padding: 18px 20px 20px; transform: rotate(1deg);
  box-shadow: 0 6px 14px rgba(0,0,0,.2);
  border-top: 4px solid #e8a0a0;
}
.about-card h2 { margin: 0 0 6px; font: 800 28px/1.1 var(--font-display); color: var(--navy); }
.about-card .prose { font-size: 16px; line-height: 1.6; }
.about-card .prose p { margin: 0 0 .7em; }
.about-links { list-style: none; padding: 0; margin: 10px 0 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.about-links a { font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  padding: 12px 22px; border-radius: 999px; background: var(--red); color: #fff;
  font-weight: 700; letter-spacing: .02em; box-shadow: 0 4px 0 #8f3826;
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #8f3826; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #8f3826; }
.btn--small { padding: 9px 18px; font-size: 15px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ===== Bookcase ========================================================= */
.bookcase {
  padding: 26px clamp(10px, 2vw, 26px) 10px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.35), transparent 6%, transparent 94%, rgba(0,0,0,.35)),
    repeating-linear-gradient(90deg, var(--back) 0 140px, #3f2818 140px 142px);
  border: 18px solid var(--wood);
  border-image: linear-gradient(180deg, var(--wood-light), var(--wood) 40%, var(--wood-dark)) 1;
  box-shadow: 0 14px 30px rgba(50,28,12,.35), inset 0 0 40px rgba(0,0,0,.4);
}
.shelf { position: relative; margin-bottom: 34px; }
.shelf:last-child { margin-bottom: 14px; }
.shelf-sign { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 14px; }
.shelf-sign h2 {
  margin: 0; padding: 5px 16px 6px; font: 700 19px/1.2 var(--font-display); letter-spacing: .04em;
  color: #3a2a10; background: linear-gradient(180deg, #f3d27a, #c99a3a); border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 0 rgba(0,0,0,.35);
  text-transform: uppercase;
}
.shelf-talker {
  margin: 0; padding: 4px 12px; font: 600 21px/1.2 var(--font-hand); color: var(--ink);
  background: #fff6b8; transform: rotate(-2deg); box-shadow: 0 3px 6px rgba(0,0,0,.3);
}

.shelf-row {
  display: flex; align-items: flex-end; gap: clamp(10px, 1.6vw, 22px);
  padding: 22px 12px 0; min-height: calc(var(--base) + 30px);
  overflow-x: auto; overflow-y: visible; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--wood-light) transparent;
}
.plank {
  height: 22px; margin: 0 -6px; border-radius: 2px;
  background: linear-gradient(180deg, #c48a52 0 5px, var(--wood) 5px 70%, var(--wood-dark));
  box-shadow: 0 10px 14px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.25);
}

/* ===== Books ============================================================ */
.book {
  --h: calc(var(--base) * var(--size, 1));
  position: relative; flex: 0 0 auto; padding: 0; border: 0; cursor: pointer; background: none;
  height: var(--h); scroll-snap-align: start;
  transform-origin: 50% 100%; transform: rotate(var(--tilt, 0deg));
  transition: transform .22s cubic-bezier(.3,1.4,.5,1), filter .2s;
  filter: drop-shadow(4px 0 4px rgba(0,0,0,.35));
}
.book:hover, .book:focus-visible { transform: translateY(-12px) rotate(0deg) scale(1.03); filter: drop-shadow(6px 10px 10px rgba(0,0,0,.45)); z-index: 2; }
.book:focus-visible { outline: 3px dashed var(--mustard); outline-offset: 6px; }

.book--cover { aspect-ratio: 3 / 4; border-radius: 2px 5px 5px 2px; overflow: hidden; background: var(--spine); }
.book--cover.shape--square { aspect-ratio: 1; }
.book--cover.shape--landscape { aspect-ratio: 4 / 3; --h: calc(var(--base) * var(--size, 1) * .78); }
.book--cover.shape--tall { aspect-ratio: 2 / 3; }
.book--cover img { width: 100%; height: 100%; object-fit: cover; }
.book--cover::after { /* binding crease + page sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.35) 0, rgba(255,255,255,.25) 3%, rgba(0,0,0,.12) 5%, transparent 9%, transparent 85%, rgba(255,255,255,.08));
}
.cover-fallback { display: grid; place-items: center; height: 100%; padding: 14px; font: 800 20px/1.1 var(--font-display); color: var(--spine-text); }

.book--spine {
  width: var(--thick); border-radius: 3px 3px 1px 1px;
  background:
    linear-gradient(180deg, transparent 8%, rgba(255,255,255,.25) 8% 9.2%, transparent 9.2% 90.8%, rgba(255,255,255,.25) 90.8% 92%, transparent 92%),
    linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.18) 30%, rgba(0,0,0,.05) 60%, rgba(0,0,0,.3)),
    var(--spine);
}
.book--spine.shape--tall { --h: calc(var(--base) * var(--size, 1) * 1.08); }
.book--spine.shape--portrait { --h: calc(var(--base) * var(--size, 1) * .9); }
.spine-title {
  position: absolute; inset: 14% 0; display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl; text-align: center; text-wrap: balance;
  font: 700 clamp(13px, calc(var(--thick) * .27), 17px)/1.1 var(--font-display); color: var(--spine-text);
  letter-spacing: .02em; overflow: hidden; padding: 0 4px;
}

.sticker {
  position: absolute; bottom: 10px; right: 10px; z-index: 1; display: grid; place-items: center;
  width: 54px; height: 54px; padding: 4px; border-radius: 50%;
  font: 700 19px/0.95 var(--font-hand); text-align: center; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff8a6a, var(--red)); transform: rotate(12deg);
  box-shadow: 0 2px 4px rgba(0,0,0,.35), inset 0 0 0 3px rgba(255,255,255,.35);
}
.book--spine .sticker { top: auto; bottom: 3%; right: 50%; margin-right: -22px; width: 44px; height: 44px; font-size: 16px; }

/* The "your book?" slot: a parcel wrapped in kraft paper */
.book--yours {
  --h: calc(var(--base) * .92);
  aspect-ratio: 3 / 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 3px; overflow: hidden;
  background:
    repeating-linear-gradient(35deg, rgba(255,255,255,.06) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, #d8ad78, var(--kraft) 55%, #b4844f);
}
.yours-string, .yours-string::after {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent calc(50% - 3px), #f4ecd8 calc(50% - 3px) calc(50% + 3px), transparent calc(50% + 3px));
}
.yours-string::after { content: ""; transform: rotate(90deg) scale(1.5); }
.yours-label, .yours-note { position: relative; z-index: 1; background: #fffaf0; padding: 4px 12px; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.yours-label { font: 700 clamp(24px, 2.2vw, 32px)/1.05 var(--font-hand); color: var(--red); transform: rotate(-4deg); border-radius: 2px; }
.yours-note { font: 600 17px/1.1 var(--font-hand); color: var(--ink-soft); transform: rotate(2deg); max-width: 85%; text-align: center; }
.book--yours:hover .yours-label { color: var(--navy); }

/* ===== Modals =========================================================== */
.modal {
  padding: 0; border: 0; background: transparent; color: var(--ink);
  width: min(1120px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); overflow: visible;
}
.modal::backdrop { background: rgba(30, 18, 8, .62); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .28s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-close-form { position: absolute; top: -14px; right: -10px; z-index: 5; margin: 0; }
.modal-close {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  background: var(--red); color: #fff; font-size: 26px; line-height: 1; box-shadow: 0 4px 10px rgba(0,0,0,.35);
}

/* The open book: two pages, a gutter, a hard cover peeking round the edges */
.open-book {
  display: grid; grid-template-columns: 1fr 1fr; position: relative;
  padding: 12px; border-radius: 10px; background: var(--book-cover, var(--navy));
  box-shadow: 0 30px 60px rgba(0,0,0,.45);
  max-height: calc(100dvh - 24px);
  perspective: 2200px;
}
.page { background: var(--paper); min-height: 520px; max-height: calc(100dvh - 48px); overflow: auto; }
.page--left {
  border-radius: 6px 0 0 6px; padding: 26px;
  background: linear-gradient(270deg, rgba(0,0,0,.18), transparent 7%), var(--paper);
  display: flex; align-items: center; justify-content: center;
}
.page--right {
  border-radius: 0 6px 6px 0; padding: 34px 38px 30px;
  background: linear-gradient(90deg, rgba(0,0,0,.16), transparent 6%), var(--paper);
  transform-origin: 0 50%;
}
.modal--book[open] .page--right { animation: page-open .6s cubic-bezier(.2,.8,.2,1); }
@keyframes page-open { from { transform: rotateY(-100deg); filter: brightness(.7); } }

.gallery { width: 100%; }
.gallery-slide { margin: 0; }
.gallery-slide img { width: 100%; max-height: 62dvh; object-fit: contain; border-radius: 3px; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.gallery-slide figcaption { margin-top: 10px; font: 600 22px/1.2 var(--font-hand); text-align: center; color: var(--ink-soft); }
.gallery-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.gallery-nav button {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; cursor: pointer;
  font-size: 26px; line-height: 1; padding-bottom: 4px;
}
.gallery-nav button:hover { background: var(--ink); color: var(--paper); }
.gallery-count { font-weight: 700; color: var(--ink-soft); min-width: 52px; text-align: center; }
.gallery--empty { display: grid; place-items: center; aspect-ratio: 3/4; max-width: 300px; background: var(--spine); border-radius: 4px; }
.gallery--empty span { color: #fff; font: 800 28px/1.1 var(--font-display); padding: 20px; text-align: center; }

.ob-title { margin: 0; font: 800 clamp(28px, 3.4vw, 42px)/1.05 var(--font-display); color: var(--navy); font-variation-settings: "SOFT" 100; }
.ob-subtitle { margin: 6px 0 0; font: 600 24px/1.2 var(--font-hand); color: var(--red); }
.ob-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 16px; padding: 12px 0; border-block: 2px dotted #d8c49e; }
.ob-meta div { min-width: 0; }
.ob-meta dt { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); font-weight: 700; }
.ob-meta dd { margin: 0; font-weight: 700; }
.prose p { margin: 0 0 .9em; }
.prose blockquote { margin: 1em 0; padding: 4px 0 4px 16px; border-left: 4px solid var(--mustard); font-style: italic; color: var(--ink-soft); }
.prose img { border-radius: 4px; margin: 10px 0; }
.ob-tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ob-tags li { padding: 2px 12px; border-radius: 999px; background: var(--paper-2); font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.ob-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.ob-links a {
  padding: 8px 16px; border-radius: 999px; border: 2px solid var(--red); font-weight: 700; text-decoration: none;
}
.ob-links a:hover { background: var(--red); color: #fff; }

/* Contact: a letter with a stamp */
.modal--contact { width: min(620px, calc(100vw - 24px)); }
.letter {
  position: relative; padding: 36px clamp(20px, 5vw, 44px) 30px; border-radius: 4px; overflow: auto; max-height: calc(100dvh - 24px);
  background: var(--paper); box-shadow: 0 30px 60px rgba(0,0,0,.45);
  border-top: 10px solid transparent;
  border-image: repeating-linear-gradient(135deg, var(--red) 0 16px, var(--paper) 16px 26px, var(--navy) 26px 42px, var(--paper) 42px 52px) 10;
}
.letter::after { /* stamp */
  content: "✿"; position: absolute; top: 22px; right: 22px; width: 62px; height: 74px; display: grid; place-items: center;
  font-size: 32px; color: #fff; background: var(--sage); border: 4px dotted var(--paper); outline: 2px solid var(--sage);
  transform: rotate(6deg);
}
.letter h2 { margin: 0 80px 10px 0; font: 800 clamp(26px, 3vw, 34px)/1.1 var(--font-display); color: var(--navy); }
.letter .prose { color: var(--ink-soft); padding-right: 64px; }
.contact-form { display: grid; gap: 14px; margin-top: 16px; }
.field { display: grid; gap: 4px; }
.field span { font: 700 22px/1 var(--font-hand); color: var(--ink); }
.field input, .field select, .field textarea {
  font: inherit; padding: 10px 12px; border: 2px solid #d9c6a2; border-radius: 8px; background: #fffdf7; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(43,58,103,.15); }
.field.has-error input, .field.has-error textarea { border-color: var(--red); }
.field-error { color: var(--red); font-size: 14px; font-weight: 700; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .btn { justify-self: start; margin-top: 4px; }
.form-status { margin: 0; min-height: 1.4em; font-weight: 700; color: var(--red); }
.contact-success { text-align: center; padding: 30px 0 10px; font: 700 30px/1.2 var(--font-hand); color: var(--sage); }

.shop-footer { margin-top: 28px; text-align: center; font: 600 20px/1.3 var(--font-hand); color: var(--ink-soft); }

/* ===== Responsive ======================================================= */
@media (max-width: 960px) {
  .interior { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .corkboard { display: grid; grid-template-columns: 180px 1fr; gap: 18px; align-items: start; }
  .polaroid { width: 100%; margin: 0; }
}
@media (max-width: 760px) {
  :root { --base: 180px; }
  body { font-size: 16px; }
  .corkboard { grid-template-columns: 1fr; }
  .polaroid { width: 70%; max-width: 240px; margin: 0 auto; }
  .letter .prose { padding-right: 0; }
  .letter::after { width: 46px; height: 56px; font-size: 24px; top: 16px; right: 16px; }
  .bookcase { border-width: 10px; padding-inline: 6px; }
  .open-book { grid-template-columns: 1fr; overflow: auto; }
  .page { min-height: 0; max-height: none; overflow: visible; }
  .page--left { border-radius: 6px 6px 0 0; background: var(--paper); padding: 18px; }
  .page--right { border-radius: 0 0 6px 6px; padding: 22px 20px 26px; background: linear-gradient(180deg, rgba(0,0,0,.1), transparent 14px), var(--paper); transform-origin: 50% 0; }
  @keyframes page-open { from { transform: rotateX(70deg); } }
  .gallery-slide img { max-height: 46dvh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
