/* ==========================================================================
   Klara Strand Café — Winter dress
   The same bill, printed for the dark season. Nothing in style.css changes:
   every rule here hangs off <html data-winter="on">, and the Nobel Week Lights
   pieces off data-lights="on", so either comes down by flipping one attribute.
   Inks are added only for snow, ice and the blue hour.
   ========================================================================== */

:root {
  --dusk:  #3E5674;   /* the blue-hour sky: lighter than --navy so the cut still reads */
  --frost: #D3DFE2;   /* the sage band, frozen */
}

/* ------------------------------------------------------------- switches */
html:not([data-winter="on"]) [data-winter-only],
html:not([data-lights="on"]) [data-lights-only],
html[data-lights="on"] [data-lights-hide],
html[data-winter="on"] [data-summer-only] { display: none; }

/* ----------------------------------------------- HERO : THE BLUE HOUR */
html[data-winter="on"] .sheet__scene { background: var(--dusk); }

/* The plate's sky is cut away, so the beams stand BEHIND the skyline and the
   projection lies in front of it. All three share the summer image's box:
   78% of the sheet, anchored bottom-right (see .sheet__scene img). */
.winterscene { position: absolute; right: 0; bottom: 0; width: 78%; height: 78%; }
.winterscene svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.winterscene__plate {
  position: absolute;
  inset: 0;
  background: url("Assets/site/scene-quay-wedge-winter.webp") 100% 100% / cover no-repeat;
}
.winterscene__proj { mix-blend-mode: multiply; }
.winterscene--band { display: none; }

.slide:not(:first-of-type) { opacity: 0; }

/* the winter moment: the lights are switched on, one lamp after another */
.beam { transform-origin: var(--lamp); }
@media (prefers-reduced-motion: no-preference) {
  @keyframes lamp-on {
    from { opacity: 0; transform: scale(0.25, 0.05); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes cast-on { from { opacity: 0; } to { opacity: 1; } }
  /* Then they search the sky. `rotate`, separate from lamp-on's `transform`, so
     the two never fight. Each swing runs out and back (alternate), so there is no
     seam to loop over; negative delays start every beam mid-swing, and unequal
     periods keep the five from ever marching in step. */
  @keyframes sweep { from { rotate: calc(var(--swing) * -1); } to { rotate: var(--swing); } }
  .beam {
    --swing: 5deg;
    animation:
      lamp-on 0.9s cubic-bezier(0.16, 0.84, 0.28, 1) var(--lit) both,
      sweep var(--period) cubic-bezier(0.45, 0, 0.55, 1) var(--phase) infinite alternate;
  }
  .beam:nth-of-type(1) { --lit: 0.30s; --period: 6.5s; --phase: -2.9s; --swing: 4.5deg; }
  .beam:nth-of-type(2) { --lit: 0.45s; --period: 8s;   --phase: -10.6s; --swing: 6deg; }
  .beam:nth-of-type(3) { --lit: 0.60s; --period: 7.2s; --phase: -3.2s; --swing: 5.5deg; }
  .beam:nth-of-type(4) { --lit: 0.75s; --period: 9s;   --phase: -14.5s; }
  .beam:nth-of-type(5) { --lit: 0.90s; --period: 5.8s; --phase: -2.4s; --swing: 6deg; }

  /* the projection changes slide every 5s; 15s a lap, one dissolve per change */
  @keyframes slide { 0%, 29.333% { opacity: 1; } 33.333%, 96% { opacity: 0; } 100% { opacity: 1; } }
  .slide { animation: slide 15s linear infinite; }
  .slide:nth-of-type(2) { animation-delay: -10s; }
  .slide:nth-of-type(3) { animation-delay: -5s; }

  /* held by the stop button, off screen, and in a hidden tab. Switching on is
     never held, or a reader who had stopped the motion would get no lights. */
  .is-still .beam { animation-play-state: running, paused; }
  .is-still .slide { animation-play-state: paused; }
  .winterscene__proj { animation: cast-on 0.6s ease-out 1.2s both; }
}

/* the announcement, a signal pennant flown in the open sky */
.sheet__lights {
  position: absolute;
  z-index: 3;
  top: 1.6rem;
  right: var(--gutter);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.9rem, 1.25vw, 1.12rem);
  line-height: 1.15;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--cream-hi);   /* not yellow: a yellow beam passes behind the swallowtail */
  color: var(--navy);
  padding: 0.85em 2.6em 0.8em 1.1em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 1.3em) 50%, 100% 100%, 0 100%);
  transition: background 0.16s ease-out;
}
.sheet__lights:hover { background: var(--yellow); }
/* the swallowtail clips an outer ring away, so this one is drawn inside */
.sheet__lights:focus-visible { outline-offset: -6px; }
.sheet__lights b { display: block; font-weight: 700; }

/* -------------------------------------------------------- falling snow */
.sheet__snow {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.snowbtn {
  position: absolute;
  z-index: 3;
  right: var(--gutter);
  bottom: 1.2rem;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--cream);
  color: var(--navy);
  border: var(--keyline) solid var(--navy);
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.snowbtn:hover { background: var(--navy); color: var(--cream); }
.snowbtn svg {
  width: 1.5rem; height: 1.5rem;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: square; stroke-linejoin: miter;
}
.snowbtn__off { display: none; }
.snowbtn[aria-pressed="true"] .snowbtn__off { display: inline; }
@media (prefers-reduced-motion: reduce) { .snowbtn { display: none; } }

/* ------------------------------------------------------- settled snow */
html[data-winter="on"] .sheet__kicker,
html[data-winter="on"] .sheet__copy .btn,
html[data-winter="on"] .plate,
html[data-winter="on"] .band { position: relative; }

/* pasted strips, the hero button, and plates carry a cap on their top edge */
html[data-winter="on"] .sheet__kicker::before,
html[data-winter="on"] .sheet__copy .btn::before,
html[data-winter="on"] .plate::before {
  content: "";
  position: absolute;
  left: -3px; right: -3px;
  height: 18px;
  top: -13px;
  background: url("Assets/site/snow-cap-small.svg") 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}
html[data-winter="on"] .plate::before {
  left: -7px; right: -7px;
  height: 32px;
  top: -21px;
  background-image: url("Assets/site/snow-cap.svg");
}
/* the strip sits close under the masthead; give its snow somewhere to lie */
html[data-winter="on"] .sheet__kicker { margin-top: 0.5rem; }

/* snow lying along the head of each flag, and over each coloured band's edge */
html[data-winter="on"] .flag::before,
html[data-winter="on"] .band--red::before,
html[data-winter="on"] .band--green::before,
html[data-winter="on"] .band--sage::before,
html[data-winter="on"] .lights::before,
html[data-winter="on"] .quote::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40px;
  background: url("Assets/site/snow-drift.svg") 0 0 / 1200px 40px repeat-x;
  pointer-events: none;
}
/* no two drifts start at the same place, so the tile is never read as one */
html[data-winter="on"] .flag::before { height: 26px; background-size: 760px 26px; }
html[data-winter="on"] .flag:nth-child(2)::before { background-position-x: -190px; }
html[data-winter="on"] .flag:nth-child(3)::before { background-position-x: -410px; }
html[data-winter="on"] .flag:nth-child(4)::before { background-position-x: -60px; }
html[data-winter="on"] .flag:nth-child(5)::before { background-position-x: -560px; }
html[data-winter="on"] .band--sage::before  { background-position-x: -120px; }
html[data-winter="on"] .band--red::before   { background-position-x: -310px; }
html[data-winter="on"] .band--green::before { background-position-x: -760px; }
html[data-winter="on"] .quote::before       { background-position-x: -530px; }

html[data-winter="on"] .band--sage { background: var(--frost); }

html[data-winter="on"] .foot__ivy {
  background-image: url("Assets/site/illus-ivy-garland-winter.webp");
  opacity: 1;
}

/* ----------------------------------------------- NOBEL WEEK LIGHTS */
.lights {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--navy);
  color: var(--cream);
  padding: clamp(3.2rem, 6vw, 5rem) 0 clamp(2.6rem, 5vw, 4rem);
}
/* three flat beams, rising on the sheet's own diagonal */
.lights__beams { position: absolute; inset: 0; z-index: -1; }
.lights__beams i { position: absolute; inset: 0; background: var(--navy-lo); }
.lights__beams i:nth-child(1) { clip-path: polygon(30% 100%, 31% 100%, 62% 0, 48% 0); }
.lights__beams i:nth-child(2) { clip-path: polygon(56% 100%, 57% 100%, 100% 0, 84% 0); }
.lights__beams i:nth-child(3) { clip-path: polygon(8% 100%, 9% 100%, 24% 0, 12% 0); }

.lights__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(1.8rem, 5vw, 4.5rem);
  align-items: end;
}
.lights h2 { font-size: var(--step-4); color: var(--yellow); margin-bottom: 1.1rem; }
.lights .lede { font-size: var(--step-2); line-height: 1.42; max-width: 34ch; }
.lights__open { margin-top: 0.9rem; color: var(--sage); }

.lights__facts { margin: 0 0 1.5rem; border-top: var(--keyline) solid var(--cream); }
.lights__facts div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(240, 231, 210, 0.35);
}
.lights__facts dt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yellow);
}
.lights__facts dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.3;
}
.lights .offsite { color: var(--sage); }
.lights :focus-visible { outline-color: var(--yellow); }

/* ======================================================== RESPONSIVE */
@media (min-width: 1100px) {
  .sheet__lights { top: calc(var(--mast-h) + 1.6rem); }
  .sheet__snow { top: var(--mast-h); height: calc(100% - var(--mast-h)); }
}

/* the sky is narrow here: wrap the pennant rather than let it run into the yellow */
@media (min-width: 861px) and (max-width: 1099px) {
  .sheet__lights { max-width: 22vw; }
}

@media (max-width: 860px) {
  /* the scene is a box in flow here, not a full-sheet plane: anchor to it */
  html[data-winter="on"] .sheet__scene { position: relative; overflow: hidden; }
  html[data-winter="on"] .sheet__scene,
  html[data-winter="on"] .sheet__yellow,
  html[data-winter="on"] .sheet__navy,
  html[data-winter="on"] .sheet__copy { grid-column: 1; }
  .winterscene--wedge { display: none; }
  .winterscene--band { display: block; width: 100%; height: 100%; }
  .winterscene--band .winterscene__plate {
    background: url("Assets/site/scene-quay-band-winter.webp") 50% 50% / cover no-repeat;
  }
  /* the yellow rule becomes the announcement: same place, now carrying words */
  html[data-lights="on"] .sheet__yellow { height: auto; }
  .sheet__lights b { display: inline; }
  .sheet__lights {
    position: relative;
    top: auto; right: auto;
    grid-row: 2;
    grid-column: 1;
    clip-path: none;
    background: var(--yellow);
    padding: 0.95em clamp(1.6rem, 4vw, 3.2rem) 0.85em;
    font-size: 0.95rem;
    letter-spacing: 0.1em;
  }
  .sheet__lights:hover { background: var(--cream-hi); }
  .snowbtn { bottom: auto; right: 0.75rem; top: calc(50vw - 3.4rem); }
  .lights__grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .lights__facts div { grid-template-columns: 5.2rem 1fr; gap: 0.7rem; }
}

@media print {
  .sheet__snow, .snowbtn { display: none; }
}
