/* ═══════════════════════════════════════════════════════════
   TOKENS & RESET
═══════════════════════════════════════════════════════════ */
:root {
  --red:        #cd2f00;
  --red-dark:   #8f2000;
  --cyan:       #189395;
  --text:       #000000;
  --bg:         #faf8f2;
  --cream:      #fdf6e3;
  --cream-dark: #f0e8d0;

  --font-title: 'Oleo Script', cursive;
  --font-body:  'Alegreya Sans', sans-serif;

  --book-w:     380px;
  --book-h:     530px;
  --spine-w:    20px;

  /* How far right the book travels when opening.
     Inner page appears in the space vacated to the left. */
  --open-shift: 210px;

  --dur-tilt:   0.65s;
  --dur-flip:   0.72s;
  --delay-flip: 0.42s;
  --ease-flip:  cubic-bezier(0.77, 0, 0.175, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text);
}

/* Mobile hidden on desktop */
.mobile-wrap { display: none; }


/* ═══════════════════════════════════════════════════════════
   SCENE — perspective root
═══════════════════════════════════════════════════════════ */
.scene {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
  perspective-origin: 50% 46%;
  overflow: hidden;
}


/* ═══════════════════════════════════════════════════════════
   BOOK — 3D object
═══════════════════════════════════════════════════════════ */
.book {
  position: relative;
  width: var(--book-w);
  height: var(--book-h);
  transform-style: preserve-3d;
  transform: rotateY(-28deg) rotateX(6deg);
  transition:
    transform var(--dur-tilt) cubic-bezier(0.4, 0, 0.2, 1),
    translate var(--dur-tilt) cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  cursor: default;
}

.book.is-open {
  transform: rotateY(0deg) rotateX(0deg);
  translate: var(--open-shift) 0 0;
}


/* ── Spine (left face) ── */
.book-spine {
  position: absolute;
  top: 0;
  left: calc(-1 * var(--spine-w));
  width: var(--spine-w);
  height: 100%;
  background: linear-gradient(to bottom, var(--red-dark) 0%, var(--red) 40%, var(--red-dark) 100%);
  transform-origin: right center;
  transform: rotateY(-90deg);
  backface-visibility: hidden;
}


/* ── Back cover ── */
.book-back {
  position: absolute;
  inset: 0;
  background: var(--cream-dark);
  border: 3px solid var(--red);
  transform: rotateY(180deg);
  backface-visibility: hidden;
}


/* ── Front cover (rotates open) ── */
.book-cover {
  position: absolute;
  inset: 0;
  background: var(--cream);
  border: 3px solid var(--red);
  /* double-line inner border effect */
  box-shadow:
    inset 0 0 0 8px var(--cream),
    inset 0 0 0 10px var(--red),
    /* outer depth shadow */
    -14px 8px 0 -1px var(--red-dark),
    -26px 18px 48px rgba(0, 0, 0, 0.32);

  transform-origin: left center;
  transform: rotateY(0deg);
  backface-visibility: hidden;

  /* base transition — no delay (used when closing) */
  transition: transform var(--dur-flip) var(--ease-flip);

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Cover open state — delay flip until book has straightened */
.book.is-open .book-cover {
  transform: rotateY(-162deg);
  transition: transform var(--dur-flip) var(--ease-flip) var(--delay-flip);
}


/* ── Peek animation ── */
@keyframes peek {
  0%   { transform: rotateY(0deg); }
  30%  { transform: rotateY(-24deg); }
  58%  { transform: rotateY(-20deg); }
  78%  { transform: rotateY(-24deg); }
  100% { transform: rotateY(0deg); }
}

.book.is-peeking .book-cover {
  animation: peek 0.75s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}


/* ── Cover interior ── */
.cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.75rem;
  padding: 2rem 1.75rem;
  text-align: center;
  width: 100%;
}


/* ═══════════════════════════════════════════════════════════
   INNER PAGE PANEL (not in 3D transform context)
═══════════════════════════════════════════════════════════ */
.inner-page {
  position: absolute;
  /* Sits to the left of where the book will be when open.
     Book open center = 50% + open-shift/2 = 50% + 105px
     Book left edge   = 50% + 105px - book-w/2 = 50% + 105px - 190px = 50% - 85px
     Inner page right edge should be ~10px left of book left edge: 50% - 95px
     Inner page left edge: 50% - 95px - book-w = 50% - 95px - 380px = 50% - 475px */
  right: calc(50% + 85px);
  top: 50%;
  transform: translateY(-50%) translateX(18px);
  width: var(--book-w);
  height: var(--book-h);

  background: var(--cream);
  border: 3px solid var(--red);
  box-shadow:
    inset 0 0 0 8px var(--cream),
    inset 0 0 0 10px var(--red);

  opacity: 0;
  pointer-events: none;
  display: none;

  transition:
    opacity 0.38s ease,
    transform 0.38s ease;
}

.inner-page.is-visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(-50%) translateX(0);
  transition-delay: calc(var(--delay-flip) + var(--dur-flip) * 0.55);
}

.inner-page-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 0 1.5rem 1.5rem;
  /* scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--red) var(--cream);
}

.inner-page-scroll::-webkit-scrollbar { width: 5px; }
.inner-page-scroll::-webkit-scrollbar-track { background: var(--cream); }
.inner-page-scroll::-webkit-scrollbar-thumb { background: var(--red); border-radius: 2px; }


/* ═══════════════════════════════════════════════════════════
   COVER TITLE
═══════════════════════════════════════════════════════════ */
.cover-title {
  font-family: var(--font-title);
  line-height: 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05em;
}

.t-quarter  { font-size: 2.5rem; color: var(--red); }
.t-life     { font-size: 2.15rem; color: var(--cyan); font-style: italic; }
.t-pounder  { font-size: 2.5rem; color: var(--red); }


/* ═══════════════════════════════════════════════════════════
   MENU LIST (cover navigation)
═══════════════════════════════════════════════════════════ */
.menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.menu-item {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--cyan);
  cursor: pointer;
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--cyan);
  border-radius: 2px;
  text-align: center;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  user-select: none;
}

.menu-item::before {
  content: '• ';
  color: var(--red);
}

.menu-item:hover {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
}


/* ═══════════════════════════════════════════════════════════
   CLOSE BUTTON (sticky in scroll container)
═══════════════════════════════════════════════════════════ */
.close-btn {
  position: sticky;
  top: 0;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 -1.5rem 1.25rem;
  width: calc(100% + 3rem);
  padding: 0.55rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--red);
  background: var(--cream);
  border: none;
  border-bottom: 1.5px solid var(--red);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.close-btn:hover {
  background: var(--red);
  color: #fff;
}


/* ═══════════════════════════════════════════════════════════
   PAGE SECTIONS
═══════════════════════════════════════════════════════════ */
.page-section.hidden { display: none; }

.page-title {
  font-family: var(--font-title);
  font-size: 1.9rem;
  color: var(--red);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--red);
}

.page-section h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--cyan);
  margin: 1.1rem 0 0.4rem;
}

.page-section p {
  font-size: 0.93rem;
  line-height: 1.68;
  margin-bottom: 0.65rem;
}

.page-section ul {
  margin: 0 0 0.65rem 1.2rem;
}

.page-section li {
  font-size: 0.93rem;
  line-height: 1.68;
  margin-bottom: 0.2rem;
}


/* ── Chef grid ── */
.chef-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.chef-card {
  padding: 0.7rem;
  border: 1.5px solid var(--red);
  border-radius: 3px;
}

.chef-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--cream-dark);
  border-radius: 2px;
  margin-bottom: 0.5rem;
}

.chef-card h3 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--red);
  margin: 0 0 0.1rem;
}

.chef-card .role {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  margin-bottom: 0.3rem;
}

.chef-card p:last-child {
  font-size: 0.76rem;
  line-height: 1.4;
  color: #555;
  margin-bottom: 0;
}


/* ── Update entries ── */
.update-entry {
  border-left: 3px solid var(--red);
  padding-left: 1rem;
  margin-bottom: 1.4rem;
}

.update-entry time {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--cyan);
  margin-bottom: 0.15rem;
}

.update-entry h3 {
  color: var(--red);
  margin-bottom: 0.3rem;
}

.update-entry p {
  margin-bottom: 0;
}


/* ═══════════════════════════════════════════════════════════
   MOBILE
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html, body {
    overflow: auto;
    height: auto;
  }

  .scene      { display: none; }
  .mobile-wrap {
    display: block;
    position: relative;
    min-height: 100vh;
    background: var(--bg);
  }

  /* ── Ribbons ── */
  .ribbon {
    position: fixed;
    left: 0;
    width: 100%;
    height: 34px;
    z-index: 100;
    /* Red/white checkerboard */
    background-color: var(--red);
    background-image:
      linear-gradient(45deg, #fff 25%, transparent 25%),
      linear-gradient(-45deg, #fff 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #fff 75%),
      linear-gradient(-45deg, transparent 75%, #fff 75%);
    background-size: 17px 17px;
    background-position: 0 0, 0 8.5px, 8.5px -8.5px, -8.5px 0;
  }

  .ribbon-top {
    top: 0;
    transform: translateX(-100%);
    animation: ribbonLeft 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
  }

  .ribbon-bottom {
    bottom: 0;
    transform: translateX(100%);
    animation: ribbonRight 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
  }

  @keyframes ribbonLeft  { to { transform: translateX(0); } }
  @keyframes ribbonRight { to { transform: translateX(0); } }

  /* ── Card ── */
  .mobile-card {
    position: relative;
    margin: 54px 18px 54px;
    min-height: calc(100vh - 108px);
    border: 3px solid var(--red);
    border-radius: 14px;
    box-shadow:
      inset 0 0 0 8px var(--cream),
      inset 0 0 0 10px var(--red);
    background: var(--cream);
    overflow: hidden;
  }

  /* ── Mobile cover ── */
  .mobile-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding: 2.5rem 1.5rem;
    min-height: calc(100vh - 108px);
    text-align: center;
    transition: opacity 0.35s ease, transform 0.35s ease;
  }

  .mobile-cover.is-exiting {
    opacity: 0;
    transform: translateY(-24px);
    pointer-events: none;
  }

  /* ── Mobile page ── */
  .mobile-page {
    padding: 0 1.25rem 2rem;
    animation: mobileIn 0.38s ease forwards;
  }

  .mobile-page.hidden { display: none; }

  @keyframes mobileIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* mobile close button full-width sticky */
  .mobile-page .close-btn {
    width: calc(100% + 2.5rem);
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    justify-content: flex-start;
    border-radius: 0;
  }
}
