/* ------------------------------------------------------------------
   Layout model
   Every --x/--y/--w/--h/--fs value is in Figma design pixels (the frame
   is 1512px wide). --u converts one design pixel to CSS length, so the
   page renders 1:1 at 1512px and scales down proportionally below that.
   Below 900px, sections switch to a stacked mobile layout.
------------------------------------------------------------------- */

@property --x  { syntax: "*"; inherits: false; }
@property --y  { syntax: "*"; inherits: false; }
@property --w  { syntax: "*"; inherits: false; }
@property --h  { syntax: "*"; inherits: false; }
@property --r  { syntax: "*"; inherits: false; }
@property --fs { syntax: "*"; inherits: false; }
@property --re { syntax: "*"; inherits: false; }

:root {
  --red: #dc323e;
  --ink: #352f2c;
  --pink: #eda79f;
  --blue: #5879a8;
  --sky: #bfd1dc;
  --butter: #f6d992;
  --butter-pill: #f6da91;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.21;
  overflow-x: clip;
}

/* Design uses -6% tracking everywhere; em must resolve per element, not inherit as px */
body, body * { letter-spacing: -0.06em; }

p, h1, h2, ul { margin: 0; }
img { display: block; }
a { color: inherit; }

.frame {
  --u: calc(100cqw / 1512);
  container-type: inline-size;
  position: relative;
  max-width: 1512px;
  margin: 0 auto;
}

/* Absolutely positioned element in design coordinates */
.a {
  position: absolute;
  left: calc(var(--x, 0) * var(--u));
  top: calc(var(--y, 0) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
  font-size: calc(var(--fs) * var(--u));
}

/* (--x, --y) is the element's center; rotate about it */
.ctr { transform: translate(-50%, -50%) rotate(var(--r, 0deg)); }

/* Image cropped to its box (offsets/sizes from the design's image fill) */
.crop { overflow: hidden; }
.crop > img { position: absolute; max-width: none; }

.heading {
  color: var(--red);
  font-size: calc(64 * var(--u));
  font-weight: 900;
  white-space: nowrap;
}

.body-text { font-size: calc(24 * var(--u)); }

section { position: relative; scroll-margin-top: 16px; }

/* ---------------- Nav ---------------- */
/* Open state follows the expanded-nav frame, kept at the collapsed pill's scale */
.nav {
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  position: fixed;
  z-index: 50;
  top: 28px;
  right: max(25px, calc((100vw - 1512px) / 2 + 25px));
  width: 190px;
  height: 42px;
  border-radius: 21px;
  background: var(--red);
  font-size: 16px;
  overflow: hidden;
  transition: height 0.35s var(--ease);
}
.nav.is-open { height: 207px; }

.nav-bar { position: relative; height: 42px; }

.nav-toggle {
  position: absolute;
  inset: 0 auto 0 0;
  width: 96px;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 0 0 17px;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  line-height: 18px;
  cursor: pointer;
}

.nav-chevron {
  position: absolute;
  left: 61px;
  top: 17px;
  width: 12.0898px;
  height: 7.45535px;
  transition: transform 0.35s var(--ease);
}
.nav.is-open .nav-chevron { transform: rotate(180deg); }

.nav-signup {
  position: absolute;
  left: 96px;
  top: 4px;
  width: 90px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 32px;
  background: var(--butter-pill);
  color: var(--red);
  text-decoration: none;
}

.nav-menu {
  position: absolute;
  left: 17px;
  top: 45px;
  display: flex;
  flex-direction: column;
  gap: 13.3px;
  padding: 0;
  list-style: none;
  visibility: hidden;
  transition: visibility 0s linear 0.35s;
}
.nav.is-open .nav-menu { visibility: visible; transition-delay: 0s; }

.nav-menu li {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav.is-open .nav-menu li {
  opacity: 1;
  transform: none;
  transition-duration: 0.3s;
  transition-delay: calc(0.05s + var(--i) * 0.04s);
}
.nav-menu li:nth-child(1) { --i: 0; }
.nav-menu li:nth-child(2) { --i: 1; }
.nav-menu li:nth-child(3) { --i: 2; }
.nav-menu li:nth-child(4) { --i: 3; }
.nav-menu li:nth-child(5) { --i: 4; }

.nav-menu a { color: #fff; text-decoration: none; }

.nav a:hover, .nav-toggle:hover { opacity: 0.85; }
.nav a:focus-visible, .nav-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .nav, .nav *, .nav-menu li { transition-duration: 0s !important; transition-delay: 0s !important; }
}

/* ---------------- Placed items ----------------
   Bakery pastries and tray items are split out of their illustrations so they
   can appear one by one when their .place-group scrolls into view (--d is each
   item's delay). Tray items are set down and lift on hover; pastries fade in. */
/* Only the item art (clipped to its outline) responds to the pointer, not the boxes around it */
.place-group, .place-item, .place-piece { pointer-events: none; }
.place-piece { position: absolute; inset: 0; transition: filter 0.25s ease; }
.place-piece img { width: 100%; height: 100%; pointer-events: auto; }
/* Bases (dish, napkin) stay put; only the things on them lift */
.place-item--base > .place-piece img { pointer-events: none; }

.place-item { transition: scale 0.25s ease, translate 0.25s ease; }
.place-item:has(> .place-piece img:hover) {
  scale: 1.06;
  translate: 0 calc(-4 * var(--u));
}
.place-item:has(> .place-piece img:hover) > .place-piece {
  filter: drop-shadow(0 calc(10 * var(--u)) calc(10 * var(--u)) rgb(0 0 0 / 0.25));
}

.js .place-group:not(.is-placed) .place-item { opacity: 0; }
.place-group.is-placed .place-item {
  animation: place-in 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.1) var(--d) backwards;
}
.place-group.is-placed .place-piece {
  animation: place-in-shadow 0.6s ease-out var(--d) backwards;
}
/* Bakery pastries just fade in, one at a time (script.js sets --d in a random order) */
.place-group--fade.is-placed .place-item { animation: fade-in 0.5s ease var(--d) backwards; }
@keyframes place-in {
  from { opacity: 0; transform: translateY(calc(-40 * var(--u))) scale(1.18) rotate(-4deg); }
  50% { opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes place-in-shadow {
  from { filter: drop-shadow(0 calc(28 * var(--u)) calc(16 * var(--u)) rgb(0 0 0 / 0.3)); }
}
@media (prefers-reduced-motion: reduce) {
  .js .place-group .place-item { opacity: 1; animation: none; }
  .place-group .place-piece { animation: none; }
}

/* ---------------- Hero ---------------- */
.hero { height: calc(985 * var(--u)); }
.hero-stage { position: absolute; inset: 0; }

.lights { max-width: none; }

/* Bakery case: positions are % of the original 2732 × 1771 illustration */
.bakery-sheet, .bakery-sheet > * { position: absolute; }

.chalk-title {
  color: var(--pink);
  font-size: calc(24 * var(--u));
  font-weight: 900;
  line-height: calc(40 * var(--u));
  white-space: nowrap;
}

.chalk-details {
  color: #fff;
  font-size: calc(22 * var(--u));
  line-height: calc(40 * var(--u));
  white-space: nowrap;
  transform: skewX(-2deg);
}

.hero-title { font-size: 1em; }
.hero-title > span {
  left: auto;
  right: calc(170 * var(--u));
  color: var(--red);
  font-weight: 900;
  white-space: nowrap;
}
.hero-title-1 { font-size: calc(108 * var(--u)); }
.hero-title-2 { font-size: calc(96 * var(--u)); }

.sign-up {
  color: var(--red);
  text-decoration: none;
  transition: scale 0.15s ease;
}
.sign-up img {
  position: absolute;
  left: -2.08%;
  top: -4.17%;
  width: 104.17%;
  height: 108.33%;
  max-width: none;
}
.sign-up span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% - 3.7 * var(--u)));
  font-size: calc(48 * var(--u));
  font-weight: 900;
  white-space: nowrap;
}
.sign-up:hover { scale: 1.05; }
.sign-up:focus-visible { outline: 3px solid var(--red); outline-offset: 6px; border-radius: 50%; }

/* ---------------- Overview ---------------- */
.overview { height: calc(982 * var(--u)); }

.overview-text { font-size: calc(24 * var(--u)); }
.overview-text p:first-child { margin-bottom: calc(3 * 1.21em); }
.overview-text p:nth-child(2) { margin-bottom: 1.21em; }

.tray-rim { background: var(--blue); border-radius: calc(32 * var(--u)); }
.tray-bed { background: var(--sky); border-radius: calc(32 * var(--u)); }

.handle img {
  position: absolute;
  left: -6.57%;
  top: -1%;
  width: 106.57%;
  height: 102%;
  max-width: none;
}
.handle--flip { transform: translate(-50%, -50%) rotate(166.63deg) scaleY(-1); }

.tray-label { pointer-events: none; white-space: nowrap; }
.tray-label.center { text-align: center; }
.tray-label.lh30 { line-height: calc(30 * var(--u)); }
.tray-label.xb { font-weight: 800; }

.receipt { color: #000; white-space: nowrap; }
.receipt ul { padding: 0; list-style: disc; }
.receipt li { margin-left: calc(24 * var(--u)); }
.receipt .gap { margin-top: 1.21em; }

/* ---------------- Schedule ---------------- */
.schedule { height: calc(1011 * var(--u)); }

.menu-card { background: var(--pink); }
.menu-card-inner { border: calc(6 * var(--u)) solid var(--red); }
.menu-card-title {
  color: var(--red);
  font-size: calc(64 * var(--u));
  font-weight: 900;
  text-align: center;
}

.menu-list-box { border: calc(5 * var(--u)) solid var(--red); }
.menu-line { border-bottom: calc(5 * var(--u)) solid var(--red); }

.menu-item { white-space: nowrap; }
.menu-item--right { left: auto; right: calc(85 * var(--u)); text-align: right; }
.menu-item .time { font-size: calc(48 * var(--u)); font-weight: 900; }
.menu-item .what { margin-top: calc(7 * var(--u)); font-size: calc(24 * var(--u)); }

/* ---------------- Prizes ---------------- */
.prizes { height: calc(300 * var(--u)); }

/* ---------------- FAQ ---------------- */
.faq { padding: calc(218 * var(--u)) 0 calc(111 * var(--u)); }

.faq-list {
  position: static;
  width: calc(1170.65 * var(--u));
  margin-left: calc(174.67 * var(--u));
}

.faq details { border-bottom: calc(3 * var(--u)) solid var(--red); }
.faq details:last-child { border-bottom: 0; }

.faq summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(27 * var(--u)) calc(17.32 * var(--u)) calc(12.8 * var(--u)) 0;
  color: var(--red);
  font-size: calc(32 * var(--u));
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary { text-indent: calc(-2.67 * var(--u)); }
.faq summary::after {
  content: "";
  flex: none;
  width: calc(32 * var(--u));
  height: calc(32 * var(--u));
  background: url("assets/faq-chevron.svg") no-repeat center calc(10.67 * var(--u)) / calc(16 * var(--u)) calc(9.87 * var(--u));
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(180deg); }
.faq summary:hover { opacity: 0.85; }
.faq summary:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

.faq-answer {
  margin: 0 0 calc(24 * var(--u));
  padding-left: 1.2em;
  font-size: calc(20 * var(--u));
  line-height: 1.4;
}
.faq-answer li + li { margin-top: calc(6 * var(--u)); }
.faq-answer a { color: var(--red); }

/* ---------------- Sponsors ---------------- */
.sponsors { height: calc(684 * var(--u)); }
.sponsors-heading {
  position: absolute;
  top: calc(75 * var(--u));
  left: 0;
  right: 0;
  text-align: center;
}
.sponsor-logo {
  display: block;
  width: calc(220 * var(--u));
  height: calc(220 * var(--u));
  transition: scale 0.15s ease;
}
.sponsor-logo img { width: 100%; height: 100%; object-fit: contain; }
.sponsor-logo:hover { scale: 1.04; }
.sponsor-logo:focus-visible { outline: 2px solid var(--red); outline-offset: 6px; }

/* ---------------- Footer ---------------- */
.footer { background: var(--blue); }
.footer-inner { aspect-ratio: 1512 / 300; }
.footer-made, .footer-col { color: var(--butter); font-size: calc(16 * var(--u)); }
.footer-col {
  left: auto;
  right: calc((1512 - var(--re)) * var(--u));
  padding: 0;
  list-style: none;
  text-align: right;
}
.footer-col-title { margin-bottom: 1.21em; }
.footer-col a { color: #fff; text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }

/* ---------------- Mobile ---------------- */
@media (max-width: 899px) {
  .nav { top: 12px; right: 12px; }

  /* Hero: crop to the illustrated area so it reads larger; leave room for the nav */
  .hero { --u: calc(100cqw / 1250); height: calc(910 * var(--u) + 48px); overflow: hidden; }
  .hero-stage { top: 48px; left: calc(-130 * var(--u)); right: auto; width: calc(1512 * var(--u)); }

  .heading { font-size: 40px; }

  .overview, .schedule, .prizes, .sponsors { height: auto; padding: 48px 20px; }
  .overview > .heading, .overview-text, .prizes > .a, .sponsors-heading {
    position: static;
    width: auto;
    height: auto;
  }
  .overview-text, .prizes .body-text { margin-top: 20px; font-size: 18px; }
  .overview-text p:first-child { margin-bottom: 1.21em; }

  .tray {
    --u: calc((100cqw - 40px) / 927.57);
    position: relative;
    left: auto;
    top: auto;
    margin-top: 24px;
  }

  .schedule { display: flex; flex-direction: column; align-items: center; gap: 24px; }
  .menu-card, .menu-list {
    --u: calc((100cqw - 40px) / 628);
    position: relative;
    left: auto;
    top: auto;
  }
  .menu-card { height: calc(560 * var(--u)); }
  .menu-card-inner { height: calc(520 * var(--u)); }
  .menu-card-title { top: calc(70 * var(--u)); }
  .menu-card-icon { top: calc(290 * var(--u)); }

  .faq { padding: 48px 20px; }
  .faq > .heading { position: static; }
  .faq-list { --u: 0.6px; width: auto; margin: 16px 0 0; }
  .faq-answer { font-size: 16px; }

  .sponsor-logos { display: flex; justify-content: center; gap: 16px; margin-top: 32px; }
  .sponsor-logo { position: static; width: 28%; height: auto; aspect-ratio: 1; }

  .footer-inner {
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: space-between;
    gap: 24px 16px;
    padding: 32px 20px 48px;
  }
  .footer-made { grid-column: 1 / -1; }
  .footer-made, .footer-col { position: static; font-size: 15px; text-align: left; }
}
