/* ==========================================================================
   Christmas 2026 theme: string lights, snow, ornaments, jingle-bell button
   and the Christmas menu flipbook. All markup is injected by js/christmas.js,
   so removing the two <link>/<script> tags turns the whole theme off.
   ========================================================================== */

:root {
  --xmas-red: #b3202a;
  --xmas-red-dark: #8a141c;
  --xmas-green: #1f6b3a;
  --xmas-gold: #d8b04a;
}

/* ---------- Twinkling string lights along the header ---------- */
.site-header { position: sticky; }

.xmas-lights {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 24px;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.xmas-lights svg.xmas-wire {
  position: absolute;
  inset: 0 0 auto 0;
  width: 100%;
  height: 14px;
}

.xmas-lights ul {
  list-style: none;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  margin: 0;
  height: 100%;
}

.xmas-lights li {
  position: relative;
  width: 9px;
  height: 14px;
  margin-top: 6px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--bulb);
  box-shadow: 0 2px 10px 2px var(--bulb);
  animation: xmas-twinkle 2.4s ease-in-out infinite;
}

.xmas-lights li:nth-child(even) { margin-top: 9px; }

.xmas-lights li::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 1.5px;
  width: 6px;
  height: 5px;
  border-radius: 2px;
  background: #3b3a36;
}

.xmas-lights li:nth-child(4n+1) { --bulb: #e8323c; animation-delay: 0s; }
.xmas-lights li:nth-child(4n+2) { --bulb: #f2c544; animation-delay: .6s; }
.xmas-lights li:nth-child(4n+3) { --bulb: #2fae5c; animation-delay: 1.2s; }
.xmas-lights li:nth-child(4n+4) { --bulb: #4aa3f0; animation-delay: 1.8s; }

@keyframes xmas-twinkle {
  0%, 100% { opacity: 1; box-shadow: 0 2px 12px 3px var(--bulb); }
  50%      { opacity: .35; box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Falling snow ---------- */
.xmas-snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ---------- Hanging ornaments in the hero ---------- */
.hero, .page-hero { position: relative; }

.xmas-ornaments {
  position: absolute;
  inset: 0 0 auto 0;
  height: 0;
  pointer-events: none;
  z-index: 1;
}

.xmas-ornament {
  position: absolute;
  top: 0;
  width: 2px;
  transform-origin: top center;
  animation: xmas-sway 4s ease-in-out infinite alternate;
}

.xmas-ornament .string {
  display: block;
  width: 2px;
  height: var(--len, 80px);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(193, 154, 61, .2), var(--gold));
}

.xmas-ornament svg {
  display: block;
  width: var(--size, 46px);
  height: auto;
  margin-left: calc(var(--size, 46px) / -2 + 1px);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .18));
}

@keyframes xmas-sway {
  from { transform: rotate(-6deg); }
  to   { transform: rotate(6deg); }
}

/* ---------- "Open Christmas Menu" ribbon ----------
   A satin ribbon with notched ends and gold stitching. Used twice: inline
   at the top of the homepage hero, and floating at the bottom of every page. */
.xmas-ribbon {
  position: relative;
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  filter: drop-shadow(0 6px 8px rgba(90, 14, 20, .28));
  transition: transform .2s ease;
}

.xmas-ribbon:hover { transform: translateY(-2px); }
.xmas-ribbon:focus-visible { outline: 2px solid var(--xmas-gold); outline-offset: 6px; }

.xmas-ribbon-body {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6rem;
  height: 50px;
  padding: 0 2.4rem;
  background: linear-gradient(180deg, #c42b35 0%, #a71e28 48%, #8c1720 100%);
  color: #fff;
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 50%, 100% 100%, 0 100%, 16px 50%);
}

/* Gold stitching along the top and bottom edges */
.xmas-ribbon-body::before {
  content: "";
  position: absolute;
  inset: 5px 20px;
  border-top: 1px dashed rgba(240, 205, 120, .85);
  border-bottom: 1px dashed rgba(240, 205, 120, .85);
  pointer-events: none;
}

.xmas-ribbon .text {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.xmas-ribbon .text em {
  font-style: italic;
  color: #f6d98a;
}

.xmas-ribbon svg {
  flex: none;
  width: 24px;
  height: 24px;
  transform-origin: 50% 8%;
  animation: xmas-ring 3s ease-in-out infinite;
}


/* Inline version in the homepage hero */
.xmas-ribbon.is-hero {
  display: table;
  margin: -1rem auto 2rem;
  z-index: 2;
  animation: xmas-ribbon-drop .7s cubic-bezier(.3, 1.4, .5, 1) .2s both;
}

/* Floating version, bottom centre of every page */
.xmas-ribbon.is-floating {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  translate: -50% 0;
  z-index: 60;
  animation:
    xmas-ribbon-rise .6s ease-out .4s both,
    xmas-nudge 7s ease-in-out 3s infinite;
  transition: opacity .25s ease, visibility .25s;
}

.xmas-ribbon.is-floating .xmas-ribbon-body { height: 44px; padding: 0 2rem; }
.xmas-ribbon.is-floating .text { font-size: 1rem; }
.xmas-ribbon.is-floating svg { width: 21px; height: 21px; }

.xmas-ribbon.is-floating.is-hidden { animation: none; opacity: 0; visibility: hidden; pointer-events: none; }

@keyframes xmas-ribbon-drop {
  from { opacity: 0; transform: translateY(-18px) rotate(-2deg); }
  to   { opacity: 1; transform: none; }
}

@keyframes xmas-ribbon-rise {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: none; }
}

@keyframes xmas-nudge {
  0%, 90%, 100% { transform: none; }
  92% { transform: translateY(-6px) rotate(-1.5deg); }
  95% { transform: translateY(0) rotate(1.5deg); }
  97% { transform: rotate(-.5deg); }
}

@keyframes xmas-ring {
  0%, 55%, 100% { transform: rotate(0); }
  60% { transform: rotate(24deg); }
  65% { transform: rotate(-22deg); }
  70% { transform: rotate(16deg); }
  75% { transform: rotate(-12deg); }
  80% { transform: rotate(7deg); }
  85% { transform: rotate(-3deg); }
}

/* ---------- Music toggle (bottom left) ---------- */
.xmas-music {
  position: fixed;
  left: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 61;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--xmas-gold);
  border-radius: 3px;
  background: #fffdf9;
  color: var(--xmas-red);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(90, 14, 20, .18);
  transition: background .2s, color .2s;
}

.xmas-music:hover { background: #fff4dc; }
.xmas-music:focus-visible { outline: 2px solid var(--xmas-gold); outline-offset: 3px; }

.xmas-music .note { width: 22px; height: 22px; grid-area: 1 / 1; }

/* Diagonal line through the note while the music is off */
.xmas-music .slash {
  grid-area: 1 / 1;
  width: 28px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 0 0 1.5px #fffdf9;
  transform: rotate(-45deg);
}

/* Little equaliser bars while it plays */
.xmas-music .bars {
  grid-area: 1 / 1;
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}
.xmas-music .bars i {
  width: 4px;
  height: 100%;
  background: currentColor;
  transform-origin: bottom;
  animation: xmas-eq 1.1s ease-in-out infinite;
}
.xmas-music .bars i:nth-child(2) { animation-delay: -.4s; }
.xmas-music .bars i:nth-child(3) { animation-delay: -.75s; }

.xmas-music.is-on { background: var(--xmas-red); color: #f6d98a; border-color: var(--xmas-gold); }
.xmas-music.is-on .note,
.xmas-music.is-on .slash { display: none; }
.xmas-music.is-on .bars { display: flex; }

@keyframes xmas-eq {
  0%, 100% { transform: scaleY(.3); }
  50%      { transform: scaleY(1); }
}

/* ---------- Christmas menu flipbook ---------- */
.xmas-book {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(760px, 96vw);
  height: min(96vh, 1060px);
  max-height: 96vh;
  max-width: 96vw;
  padding: 0;
  border: 3px solid var(--xmas-gold);
  border-radius: 3px;
  background: #fffdf9;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

.xmas-book::backdrop {
  background: rgba(40, 8, 12, .72);
  backdrop-filter: blur(3px);
}

.xmas-book[open] { display: flex; flex-direction: column; animation: xmas-pop .35s ease-out; }

@keyframes xmas-pop {
  from { opacity: 0; transform: scale(.92) translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.xmas-book-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem .8rem .6rem 1.1rem;
  background: linear-gradient(135deg, var(--xmas-red) 0%, var(--xmas-red-dark) 100%);
  color: #fff;
}

.xmas-book-head h2 {
  font-size: 1.15rem;
  color: #fff;
  margin: 0;
}

.xmas-book-head .actions { display: flex; align-items: center; gap: .4rem; }

.xmas-book-head a.dl {
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  padding: .4rem .8rem;
  border: 1px solid rgba(255, 231, 166, .7);
  border-radius: 2px;
  white-space: nowrap;
}
.xmas-book-head a.dl:hover { background: rgba(255, 255, 255, .12); }

.xmas-book-head button.close {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 2px;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.xmas-book-head button.close:hover { background: rgba(255, 255, 255, .28); }

.xmas-book-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1ebe0;
  overflow: auto;
  touch-action: pan-y pinch-zoom;
}

.xmas-book-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  transition: opacity .25s ease, transform .25s ease;
}

.xmas-book-stage img { cursor: zoom-in; }

/* Zoomed in: the page is drawn larger and the stage scrolls both ways */
.xmas-book-stage.is-zoomed { display: block; touch-action: auto; }
.xmas-book-stage.is-zoomed img {
  width: min(1200px, 220%);
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}
.xmas-book-stage.is-zoomed .xmas-nav { display: none; }

.xmas-book-foot .hint {
  margin-left: .8rem;
  font-size: .78rem;
  color: var(--ink-soft);
  font-style: italic;
}

.xmas-book-stage img.is-turning { opacity: 0; transform: translateX(var(--dir, 20px)); }

.xmas-book-stage .xmas-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 46px;
  height: 46px;
  border: 1px solid var(--xmas-gold);
  border-radius: 2px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(179, 32, 42, .92);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
  z-index: 2;
}
.xmas-book-stage .xmas-nav svg { width: 24px; height: 24px; display: block; }
.xmas-book-stage .xmas-nav:hover { background: var(--xmas-red); }
.xmas-book-stage .xmas-nav.prev { left: .6rem; }
.xmas-book-stage .xmas-nav.next { right: .6rem; }
.xmas-book-stage .xmas-nav:disabled { opacity: 0; pointer-events: none; }

.xmas-book-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem;
  background: #fffdf9;
  border-top: 1px solid var(--gold-soft);
}

.xmas-book-foot button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 0;
  transform: rotate(45deg);
  background: var(--gold-soft);
  cursor: pointer;
  transition: transform .2s, background .2s;
}
.xmas-book-foot button[aria-current="true"] { background: var(--xmas-red); transform: rotate(45deg) scale(1.35); }

.xmas-book-foot .count {
  margin-left: .6rem;
  font-size: .85rem;
  color: var(--ink-soft);
  min-width: 3.2em;
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .xmas-lights li { width: 7px; height: 11px; }
  .xmas-lights li:nth-child(n+19) { display: none; }

  .xmas-ornament:nth-child(n+3) { display: none; }
  .xmas-ornament { --size: 28px !important; }
  /* Short strings so the baubles stay above the page titles */
  .xmas-ornament:nth-child(1) { --len: 34px !important; left: 3% !important; }
  .xmas-ornament:nth-child(2) { --len: 18px !important; left: 95% !important; }

  .xmas-ribbon .text { font-size: 1rem; }
  .xmas-ribbon-body { height: 46px; padding: 0 2rem; }
  .xmas-ribbon.is-hero { margin: -1.5rem auto 1.6rem; }
  /* Sit a little left of centre so it clears the back-to-top button */
  .xmas-ribbon.is-floating { left: calc(50% - 1.5rem); }
  .xmas-music { left: auto; right: 1rem; bottom: calc(1rem + 44px + .6rem + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; }
  .xmas-ribbon.is-floating .xmas-ribbon-body { height: 42px; padding: 0 1.7rem; }
  .xmas-ribbon.is-floating .text { font-size: .95rem; }

  .xmas-book { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: none; }
  .xmas-book-head h2 { font-size: 1rem; }
  /* Arrows move into the bottom bar so they never cover the menu text */
  .xmas-book-stage .xmas-nav {
    position: fixed;
    top: auto;
    bottom: calc(7px + env(safe-area-inset-bottom, 0px));
    translate: none;
    width: 38px;
    height: 38px;
  }
  .xmas-book-stage.is-zoomed .xmas-nav { display: grid; }
  .xmas-book-stage .xmas-nav svg { width: 20px; height: 20px; }
  .xmas-book-foot { padding: .75rem 3.4rem calc(.75rem + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; row-gap: .2rem; }
  .xmas-book-foot .hint { flex-basis: 100%; margin: 0; text-align: center; font-size: .72rem; }
}

/* ---------- Respect reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .xmas-lights li,
  .xmas-ornament,
  .xmas-ribbon,
  .xmas-ribbon svg,
  .xmas-music .bars i,
  .xmas-book[open] { animation: none; }
  .xmas-snow { display: none; }
}
