/* The Christmas Nook — palette drawn from the doors painting:
   sage/forest greens, warm amber, berry red, cream stone, antique brass, slate. */
:root {
  --sage: #7d9b76;
  --forest: #2f4a3a;
  --forest-deep: #1e3328;
  --amber: #e8a33d;
  --amber-soft: #f6c97b;
  --berry: #a62b25;
  --cream: #f7efdd;
  --stone: #e9e0cb;
  --brass: #b08d4f;
  --slate: #2b3138;
  --ink: #33302a;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(20, 25, 20, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Georgia, "Times New Roman", serif;
  background: linear-gradient(180deg, var(--forest-deep), var(--slate));
  color: var(--ink);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .reader-title, .end-title, .book-text {
  font-family: "Cormorant Garamond", "IM Fell English", Georgia, serif;
}
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.view { min-height: 100vh; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.45em; justify-content: center;
  background: var(--berry); color: #fff; border: 2px solid #7e1f1a;
  border-radius: 999px; padding: 0.8em 1.5em; font-size: 1.05rem;
  box-shadow: 0 4px 0 #7e1f1a, var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  min-height: 52px; text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7e1f1a; }
.btn--big { font-size: 1.3rem; padding: 0.9em 1.8em; min-height: 64px; }
.btn--small { font-size: 0.95rem; padding: 0.5em 1.1em; min-height: 44px; }
.btn--ghost {
  background: rgba(247, 239, 221, 0.12); color: var(--cream);
  border-color: var(--brass); box-shadow: none;
}
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ---------- artwork frames: always WHOLE, never cropped ---------- */
.art-frame {
  background: var(--stone);
  border: 6px solid var(--brass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  margin: 0 auto;
}
.art-frame .art { display: block; width: 100%; height: 100%; object-fit: contain; }
.art-frame--portrait { aspect-ratio: 3 / 4; max-width: 430px; }
.art-frame--wide { aspect-ratio: 3 / 2; max-width: 640px; }

/* ---------- doorway ---------- */
#view-doorway { position: relative; overflow: hidden; padding: 20px 16px 40px; }
#snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.doorway-wrap { position: relative; max-width: 560px; margin: 0 auto; text-align: center; }
.site-title {
  color: var(--cream); font-size: clamp(2.2rem, 8vw, 3.4rem); margin: 0.2em 0 0;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6); letter-spacing: 0.01em;
}
.doorway-sub { color: var(--amber-soft); font-style: italic; font-size: 1.15rem; margin: 0.3em 0 1em; }
#door-frame { cursor: pointer; }
#door-frame.knock-shake { animation: knockshake 0.32s ease; }
@keyframes knockshake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-5px) rotate(-0.4deg); }
  60% { transform: translateX(5px) rotate(0.4deg); }
}
#door-frame.opening { animation: dooropen 0.9s ease forwards; }
@keyframes dooropen {
  0% { filter: brightness(1); transform: scale(1); }
  60% { filter: brightness(1.6); }
  100% { filter: brightness(1.9); transform: scale(1.06); opacity: 0.15; }
}
.plaque {
  position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
  background: linear-gradient(180deg, #c9a45c, var(--brass));
  color: #2e2410; border: 2px solid #7c6234; border-radius: 10px;
  padding: 0.45em 1.1em; box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; line-height: 1.15; min-width: 55%;
}
.plaque-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; }
.plaque-name { font-family: "IM Fell English", Georgia, serif; font-size: 1.5rem; }
.door-knock-hint {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%);
  background: rgba(30, 51, 40, 0.82); color: var(--cream);
  padding: 0.35em 1em; border-radius: 999px; font-style: italic; font-size: 1rem;
  opacity: 0; transition: opacity 0.25s ease; pointer-events: none; white-space: nowrap;
}
.door-knock-hint.show { opacity: 1; }
#doorway-actions { margin-top: 20px; }
.doorway-note { color: var(--cream); opacity: 0.85; min-height: 1.2em; }
.locked-panel {
  margin: 22px auto 0; max-width: 480px; text-align: left;
  background: rgba(247, 239, 221, 0.96); border: 3px solid var(--brass);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.locked-title { font-size: 1.2rem; margin: 0 0 0.4em; color: var(--forest); }
.locked-panel .btn { margin-top: 0.6em; width: 100%; }

/* ---------- nook ---------- */
#view-nook { padding: 18px 14px 44px; }
.nook-wrap { max-width: 760px; margin: 0 auto; }
.nook-head { text-align: center; color: var(--cream); }
.nook-title { font-size: clamp(1.9rem, 7vw, 2.9rem); margin: 0.1em 0 0; text-shadow: 0 2px 10px rgba(0,0,0,0.55); }
.nook-welcome { color: var(--amber-soft); font-style: italic; margin: 0.25em 0 1em; font-size: 1.1rem; }
.fire-frame { margin-bottom: 16px; }
.fire-glow {
  position: absolute; inset: auto 18% 4% 18%; height: 45%;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 166, 48, 0.55), rgba(255, 140, 30, 0.18) 55%, transparent 75%);
  mix-blend-mode: screen; pointer-events: none;
  animation: firepulse 2.6s ease-in-out infinite;
}
@keyframes firepulse {
  0%, 100% { opacity: 0.65; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.07); }
}
.parcel-banner {
  display: flex; gap: 14px; align-items: center;
  background: linear-gradient(180deg, #fdf6e3, var(--stone));
  border: 3px dashed var(--berry); border-radius: var(--radius);
  padding: 12px 16px; margin: 0 auto 20px; max-width: 640px; box-shadow: var(--shadow);
}
.parcel-emoji { font-size: 2rem; }
.parcel-banner p { margin: 0; }
.shelf-section { margin: 18px 0; }
.shelf-heading { color: var(--cream); font-size: 1.45rem; margin: 0 0 10px; text-align: center; }
.shelf-row {
  display: flex; gap: 14px; overflow-x: auto; padding: 8px 4px 14px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.shelf-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px;
}
.book-card {
  scroll-snap-align: start; flex: 0 0 148px;
  background: var(--cream); border: 3px solid var(--brass); border-radius: 14px;
  padding: 8px; text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.shelf-grid .book-card { flex: none; }
.book-card img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--stone);
  border-radius: 8px; display: block;
}
.book-card .book-name { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 700; font-size: 1.02rem; line-height: 1.15; }
.book-card .book-hook { font-size: 0.78rem; font-style: italic; color: #5c5546; line-height: 1.25; flex: 1; }
.book-card .btn { width: 100%; min-height: 48px; font-size: 0.95rem; padding: 0.5em 0.6em; }
.new-ribbon {
  align-self: center; background: var(--berry); color: #fff; font-size: 0.72rem;
  letter-spacing: 0.08em; text-transform: uppercase; border-radius: 999px; padding: 0.15em 0.8em;
}
.nook-foot { display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
#btn-see-all { display: flex; margin: 6px auto 0; }

/* ---------- reader ---------- */
#view-reader { padding: 14px 12px 30px; background: linear-gradient(180deg, var(--forest-deep), #17281f); }
.reader-wrap { max-width: 680px; margin: 0 auto; }
.reader-head { display: flex; align-items: center; gap: 10px; color: var(--cream); margin-bottom: 10px; }
.reader-title { flex: 1; text-align: center; font-size: 1.35rem; margin: 0; }
.reader-pagenum { font-style: italic; color: var(--amber-soft); white-space: nowrap; }
.book {
  background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; border: 4px solid var(--brass);
}
.book-art { max-width: 100%; border-width: 3px; box-shadow: none; }
.book-text {
  font-size: clamp(1.25rem, 4.6vw, 1.6rem); line-height: 1.45;
  padding: 16px 8px 6px; text-align: center; min-height: 4.2em;
  display: flex; align-items: center; justify-content: center;
}
.book-text.title-page { flex-direction: column; gap: 0.2em; }
.book-text .for-name { font-family: "IM Fell English", Georgia, serif; font-size: 1.5em; color: var(--berry); }
.reader-controls {
  display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap;
}
.rctl {
  flex-direction: column; gap: 0; font-size: 1.5rem; line-height: 1.1;
  padding: 0.45em 0.9em; min-width: 76px; min-height: 64px;
}
.rctl span { font-size: 0.78rem; letter-spacing: 0.04em; }
.reader-status { text-align: center; color: var(--amber-soft); font-style: italic; min-height: 1.3em; }

/* ---------- the end ---------- */
#view-end { padding: 24px 14px 44px; }
.end-wrap { max-width: 640px; margin: 0 auto; text-align: center; }
.end-title { color: var(--cream); font-size: clamp(2.4rem, 9vw, 3.6rem); margin: 0.35em 0 0.1em; }
.end-sub { color: var(--amber-soft); font-style: italic; font-size: 1.2rem; }
.end-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 18px; }

/* ---------- grown-ups modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 20, 16, 0.72);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 18px 12px; z-index: 40;
}
.modal-card {
  background: var(--cream); border-radius: var(--radius); border: 4px solid var(--brass);
  max-width: 560px; width: 100%; padding: 22px; box-shadow: var(--shadow); position: relative;
}
.modal-card h2 { margin-top: 0; color: var(--forest); }
.modal-card h3 { color: var(--berry); margin-bottom: 0.3em; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.gu-intro { font-style: italic; color: #5c5546; }
.gu-fix-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.gu-fix-controls input {
  flex: 1; min-width: 180px; font-size: 1.05rem; padding: 0.55em 0.7em;
  border: 2px solid var(--sage); border-radius: 10px; font-family: inherit;
  min-height: 48px;
}
.gu-msg { color: var(--forest); font-style: italic; min-height: 1.2em; }
.gu-note { color: #5c5546; font-style: italic; }
.gu-list { line-height: 1.5; }

@media (max-width: 480px) {
  .book-card { flex-basis: 132px; }
  .reader-head { flex-wrap: wrap; }
  .reader-title { order: 3; flex-basis: 100%; }
}

/* locked books on the peek shelf */
.book-card--locked img { filter: grayscale(0.35) brightness(0.82); }
.book-card--locked { opacity: 0.92; }
