:root {
  --ink: #262626;
  --ink-soft: #4a5553;
  --muted: #5b6664;
  --paper: #ffffff;
  --paper-grey: #f3f2f3;
  --line: #d9e2df;
  --teal: #297887;
  --teal-deep: #1d5a66;
  --night: #0e2a30;
  --mist: #cfe0d9;
  --gold: #f2cf8a;
  --gold-pale: #fdf0cd;
  --wrap: 1120px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--ink);
  font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--teal); }
a:hover { color: var(--teal-deep); }

button { font-family: inherit; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.stage :focus-visible, .explain :focus-visible { outline-color: var(--teal); }

.sprite { position: absolute; width: 0; height: 0; }

.page { container-type: inline-size; overflow-x: hidden; }

.wrap { position: relative; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 70% at 50% 68%, #1b4c55 0%, #0e2a30 64%);
  color: var(--paper-grey);
}

.snow { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.flake {
  position: absolute;
  border-radius: 50%;
  background: #ffffff;
  animation: snow linear infinite;
}

@keyframes snow { from { top: -2%; } to { top: 102%; } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.is-paused .flake, .is-paused .bulb, .is-paused .spine--today, .is-paused .play::before { animation-play-state: paused; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 24px 0;
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--mist); text-decoration: none; }
.brand__mark { width: 30px; height: 33px; display: block; }
.brand__word { width: 104px; height: 15px; display: block; }

.outline-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1.5px solid var(--mist);
  border-radius: 12px;
  color: var(--paper-grey);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.outline-link:hover { color: var(--paper-grey); background: rgba(207, 224, 217, 0.12); }

.intro { display: flex; flex-direction: column; gap: 20px; padding: 36px 0 44px; min-width: 0; }

.kicker {
  margin: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 15px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

.intro h1 {
  margin: 0;
  max-width: 16em;
  font-size: clamp(32px, 5cqw, 64px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.lede { margin: 0; max-width: 34em; font-size: clamp(16px, 1.5cqw, 19px); color: var(--mist); }

/* ---------- String of lights ---------- */

.lights { display: flex; height: 44px; border-top: 1px solid rgba(207, 224, 217, 0.4); }
.light { flex: 1; display: flex; flex-direction: column; align-items: center; }
.light__wire { width: 1px; background: rgba(207, 224, 217, 0.4); }
.bulb {
  width: 7px;
  height: 9px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  animation: twinkle ease-in-out infinite;
}

/* ---------- Shelf ---------- */

.shelf { display: flex; flex-wrap: wrap; row-gap: 30px; }

.shelf__half {
  flex: 1 1 340px;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 22px 0 0;
  border-bottom: 6px solid var(--mist);
}
.shelf__half--first { padding-right: 6px; }

.bookend {
  flex: none;
  height: clamp(72px, 11cqw, 150px);
  aspect-ratio: 60 / 150;
  display: block;
  opacity: 0.4;
}
.bookend--first { margin-right: 6px; }
.bookend--last { margin-left: 6px; }

.spine {
  flex: 1 1 0;
  min-width: 0;
  /* The minimum holds the longest name on the tallest book (a name is never cut) */
  height: calc(clamp(220px, 21cqw, 290px) * var(--h, 1));
  margin: 0;
  padding: 10px 0 12px;
  border: 0;
  border-radius: 3px 3px 0 0;
  /* Lighter than the glow behind the shelf, so a closed book still reads as a book */
  background: linear-gradient(#2d616b, #24525b);
  color: #c4d8d4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* A book leans out a little under the pointer, the way a finger tips it from a shelf */
@media (hover: hover) {
  .spine:not(:disabled):not(.spine--picked):hover { transform: translateY(-6px); }
}

.spine--cover-0 { background: #cfe0d9; color: #1d2b2b; }
.spine--cover-1 { background: #7dbaba; color: #10272b; }
.spine--cover-2 { background: #f3f2f3; color: #297887; }
/* Today's book glows like a lit window and breathes slowly; --ring keeps the picked outline through the animation */
.spine--today {
  --ring: 0 0 0 0 transparent;
  background: linear-gradient(#fdf0cd, #f2cf8a);
  color: #3a2a08;
  box-shadow: var(--ring), 0 0 30px 2px rgba(242, 207, 138, 0.55);
  animation: glow 3.2s ease-in-out infinite alternate;
}
.spine--picked { transform: translateY(-14px); box-shadow: 0 0 0 2px #f3f2f3; }
.spine--today.spine--picked { --ring: 0 0 0 2px #f3f2f3; box-shadow: var(--ring), 0 0 30px 2px rgba(242, 207, 138, 0.55); }

@keyframes glow {
  from { box-shadow: var(--ring), 0 0 22px 0 rgba(242, 207, 138, 0.4); }
  to { box-shadow: var(--ring), 0 0 38px 6px rgba(242, 207, 138, 0.7); }
}
.spine:disabled { cursor: default; }

.spine--skeleton { background: rgba(207, 224, 217, 0.12); animation: twinkle 1.8s ease-in-out infinite; cursor: default; }

.spine__day {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(11px, 1.1cqw, 14px);
  font-weight: 500;
  line-height: 1;
}

.spine__label {
  flex: 1;
  min-height: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: clamp(10px, 0.95cqw, 13px);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  /* Every name starts at the same height above the shelf (a button centres its text otherwise) */
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
}

.wave { position: relative; display: block; width: 100%; height: 64px; margin-top: 36px; }

/* ---------- Panel ---------- */

.stage { display: block; background: var(--paper); }
.wrap--stage { padding-top: 40px; padding-bottom: 72px; min-height: 120px; }
.panel[hidden] { display: none; }

/* A picked day scrolls to here, with a little air above */
.panel { scroll-margin-top: 24px; }

.panel__body { display: flex; flex-direction: column; gap: 32px; }

.day-nav { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.day-nav__step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.day-nav__step--prev::before, .day-nav__step--next::after {
  content: '';
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.day-nav__step--next::after { border-width: 1.5px 1.5px 0 0; }
span.day-nav__step::before, span.day-nav__step::after { content: none; }
@media (hover: hover) {
  .day-nav__step:hover { color: var(--teal-deep); }
  .day-nav__step--prev:hover::before { transform: translateX(-3px) rotate(45deg); }
  .day-nav__step--next:hover::after { transform: translateX(3px) rotate(45deg); }
}

/* A picked day arrives: it does not swap */
.panel > *:not(.day-nav) { animation: arrive 0.35s ease both; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel__head { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--teal); }
.panel h2 {
  margin: 0;
  max-width: 20em;
  font-size: clamp(28px, 3.4cqw, 46px);
  font-weight: 300;
  line-height: 1.12;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.nowrap { white-space: nowrap; }
.teacher { margin: 0; font-size: 18px; font-weight: 500; }

.panel__cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 32px 48px; }

.player {
  flex: 3 1 460px;
  min-width: 0;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: var(--night);
  color: var(--paper-grey);
  display: flex;
  align-items: center;
  justify-content: center;
}
.player__poster, .player__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.player__poster { background: var(--night); }
.player__shade { position: absolute; inset: 0; background: linear-gradient(rgba(14, 42, 48, 0.1), rgba(8, 24, 28, 0.55)); }

.play {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--gold);
  color: var(--night);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 36px 6px rgba(242, 207, 138, 0.35);
}
.play svg { width: 34px; height: 34px; }
.play[disabled] { cursor: progress; opacity: 0.8; }
/* A ring leaves the button now and then: the one thing on the page that asks to be pressed */
.play::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  animation: halo 2.6s ease-out infinite;
  pointer-events: none;
}
.play[disabled]::before { animation: none; opacity: 0; }
@keyframes halo { from { transform: scale(1); opacity: 0.7; } 70%, to { transform: scale(1.45); opacity: 0; } }
@media (hover: hover) {
  .play { transition: transform 0.2s ease; }
  .play:not([disabled]):hover { transform: scale(1.05); }
}

.player__error {
  position: relative;
  max-width: 24em;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.player__error p { margin: 0; }

.facts { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.facts__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); column-gap: 20px; }
.fact { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line); min-width: 0; }
.fact__name { font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.fact__value { font-size: 15px; overflow-wrap: break-word; }

.app-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 16px; background: var(--paper-grey); }
.app-card p { margin: 0; font-size: 17px; font-weight: 500; }
.stores { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
/* Two equal columns: each code is exactly as wide as the button under it */
.store { flex: 1 1 140px; max-width: 168px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
/* Dark modules on a white tile; the padding is the code's quiet zone (about four modules) */
.store__qr {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  padding: 16px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  fill: var(--ink);
}
.store__button { justify-content: center; gap: 9px; padding: 0 12px; }
.store__mark { width: 18px; height: 18px; flex: none; fill: currentColor; }
/* A code is for a second screen: on a phone, or by touch, the button itself is the way */
@container (max-width: 700px) { .store__qr { display: none; } }
@media (hover: none) and (pointer: coarse) { .store__qr { display: none; } }

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover { color: #ffffff; background: #3a3a3a; }
.button--light { background: var(--gold); color: var(--night); }
.button--light:hover { background: var(--gold-pale); color: var(--night); }

.locked { display: flex; flex-wrap: wrap; align-items: center; gap: 40px 56px; }
.locked__text { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.locked__day, .closing__year {
  flex: 1 1 380px;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  background: var(--night);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(96px, 13cqw, 180px);
  line-height: 1;
}

.closing__year { font-size: clamp(72px, 10cqw, 140px); letter-spacing: 0.04em; }

.note { margin: 0; font-size: 17px; max-width: 34em; }
.note-box { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }

/* ---------- After the year: the explainer no longer applies ---------- */

.is-ended .explain { display: none; }

/* ---------- Explainer and footer ---------- */

.explain { background: var(--paper-grey); }
.wrap--explain { padding-top: 64px; padding-bottom: 64px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px 40px; }
.explain__item { display: flex; flex-direction: column; gap: 8px; padding-top: 18px; border-top: 2px solid var(--ink); }
.explain h3 { margin: 0; font-size: 19px; font-weight: 500; }
.explain p { margin: 0; color: var(--ink-soft); }

.footer { background: var(--ink); color: var(--paper-grey); }
.wrap--footer { padding-top: 44px; padding-bottom: 56px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px 40px; }
.footer__word { width: 104px; height: 15px; display: block; color: var(--mist); }
.footer__nav { display: flex; flex-wrap: wrap; gap: 4px 28px; font-size: 14px; }
.footer__nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--paper-grey); text-underline-offset: 4px; }
.footer__legal { margin: 0; font-size: 13px; color: var(--mist); }

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .play { width: 68px; height: 68px; }
  /* Three and two: no link left alone on a row */
  .footer__nav { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; }
}

/* ---------- Reduced motion: nothing moves ---------- */

@media (prefers-reduced-motion: reduce) {
  .flake, .bulb, .spine--skeleton, .spine--today, .panel > *:not(.day-nav), .play::before { animation: none !important; }
  * { transition: none !important; }
}
