/* Advent 2026: jaka.mx's black page, Luckiest Guy + Nunito, sun yellow and springs, plus snow. */
@font-face { font-family: "Luckiest Guy"; src: url("../fonts/luckiest-guy-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-wght-normal.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --sun: #ffb700;
  --sun-deep: #ffa600;
  --ink: #000;
  --paper: #fff;
  --muted: #8c8c8c;
  --line: #2a2a2a;
  --red: #e8392f;
  --green: #1d9a57;
  --ice: #5bb4ec;
  --snow: #f4f7fb;
  --spring: linear(0, .067, .231, .444, .664, .862, 1.018, 1.126, 1.186, 1.205, 1.193, 1.16, 1.116, 1.071, 1.03, .998, .975, .962, .958, .96, .967, .976, .985, .993, 1, 1.005, 1.008, 1.009, 1.008, 1.007, 1.005, 1.003, 1.001, 1);
  --spring-soft: linear(0, .098, .306, .531, .726, .871, .965, 1.018, 1.042, 1.046, 1.04, 1.03, 1.02, 1.011, 1.005, 1.001, .999, .998, .998, .999, 1);
}

* { box-sizing: border-box; }
html { overflow-x: clip; scrollbar-color: #3a3a3a #000; }   /* the page's scrollbar dark too, as it shows beside the dialog */
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(120% 70% at 50% 0%, #0c1a2c, #000 70%) no-repeat, #000;
  color: var(--paper);
  font: 500 1rem/1.55 "Nunito", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 4px; border-radius: 10px; }
.wrap { width: min(100% - 32px, 1160px); margin-inline: auto; position: relative; }

/* Falling snow: two repeating dot layers sliding down by exactly one tile, so the loop is seamless */
.snow { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.snow::before, .snow::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--t)); bottom: 0;
  background-image:
    radial-gradient(circle at 20% 30%, #fff 0 var(--r), transparent calc(var(--r) + .6px)),
    radial-gradient(circle at 70% 10%, #fff 0 var(--r), transparent calc(var(--r) + .6px)),
    radial-gradient(circle at 45% 75%, #fff 0 var(--r), transparent calc(var(--r) + .6px)),
    radial-gradient(circle at 90% 60%, #fff 0 var(--r), transparent calc(var(--r) + .6px));
  background-size: var(--t) var(--t);
}
.snow::before { --t: 300px; --r: 1.6px; opacity: .55; animation: fall 26s linear infinite; }
.snow::after { --t: 180px; --r: 1px; opacity: .35; animation: fall 19s linear infinite; }
@keyframes fall { to { transform: translateY(var(--t)); } }
body > :not(.snow, dialog) { position: relative; z-index: 1; }   /* dialog keeps its UA fixed centring */

/* Top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--paper); }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: #161616;
  font-weight: 800; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: transform .5s var(--spring);
}
.pill:not(:disabled) { cursor: pointer; }
.pill:not(:disabled):active { transform: scale(.94); transition-duration: .1s; }
.pill:disabled { color: var(--muted); }
.pill-sun { background: var(--sun); color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--paper); }
.pill-lg { padding: 12px 22px; font-size: 1.05rem; }
.soon { padding: 2px 10px; border: 1px solid var(--sun); border-radius: 999px; color: var(--sun); font-size: .8rem; }

/* Title */
.hero { text-align: center; margin: 8px auto clamp(28px, 5vw, 48px); }
.display, h2, h3 { font-family: "Luckiest Guy", "Nunito", sans-serif; font-weight: 400; }
.display {
  font-size: clamp(3rem, 9vw, 6rem); line-height: 1; margin: 0 0 14px;
  color: var(--paper);
  -webkit-text-stroke: .12em var(--ink); paint-order: stroke fill;
  text-shadow: 0 .09em 0 var(--ink), 0 0 40px rgb(255 183 0 / .35);
}
.display::first-letter { color: var(--sun); }
.hero p { margin: 0 auto; max-width: 36ch; font-weight: 800; font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: #e4e4e4; }

/* The board the doors are cut into: a dark winter night with a snow drift along the top */
.board {
  position: relative;
  padding: clamp(14px, 3vw, 32px);
  padding-top: clamp(26px, 4vw, 44px);
  border: 1px solid var(--line); border-radius: 22px;
  background:
    radial-gradient(circle at 15% 110%, rgb(255 183 0 / .16), transparent 45%),
    radial-gradient(circle at 85% -10%, rgb(91 180 236 / .18), transparent 50%),
    #070c14;
}
.board::before {   /* snow lying on the top edge */
  content: ""; position: absolute; left: -1px; right: -1px; top: -10px; height: 26px;
  border-radius: 22px 22px 0 0;
  background:
    radial-gradient(14px 12px at 14px 100%, transparent 98%, var(--snow)) 0 0 / 28px 100% repeat-x;
  filter: drop-shadow(0 3px 0 rgb(0 0 0 / .35));
}
.doors { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(10px, 1.8vw, 20px); }
@media (max-width: 639.98px) { .doors { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* A door: a recess with the day's picture, and a leaf hinged on the left */
.door {
  position: relative; aspect-ratio: 1;
  padding: 0; border: 0; background: none; cursor: pointer;
  perspective: 700px; --c: var(--sun);
  -webkit-tap-highlight-color: transparent;
}
.door[aria-disabled="true"] { cursor: default; }
.door-inside {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: 12px; border: 3px solid var(--ink);
  background: linear-gradient(#cfe1f3, #f4f7fb 70%);
  box-shadow: inset 0 6px 12px rgb(0 0 0 / .45);
}
.door-inside img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .7s var(--spring-soft); }
.door-tag {   /* a round badge in the top right corner (Jaka, 2 December 2026), the number in its middle */
  position: absolute; right: 8px; top: 8px;
  display: grid; place-items: center; width: 2.2em; height: 2.2em; padding-top: .14em; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--sun); color: var(--ink);
  font: 400 clamp(.85rem, 1.6vw, 1.05rem)/1 "Luckiest Guy", sans-serif;
}
/* no thumbnail: the number alone, big, in the middle */
.door-inside:not(:has(img)) .door-tag {
  left: 50%; right: auto; top: 50%; translate: -50% -50%; width: auto; height: auto; padding: 0;
  border: 0; background: none; color: var(--paper);
  font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1;
  -webkit-text-stroke: .14em var(--ink); paint-order: stroke fill; text-shadow: 0 .08em 0 var(--ink);
}

.door-leaf {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border-radius: 12px; border: 3px solid var(--ink);
  background: var(--c);
  box-shadow: inset 0 0 0 6px var(--c), inset 0 0 0 8px rgb(0 0 0 / .18), inset 0 -10px 0 rgb(0 0 0 / .1);
  transform-origin: 0 50%;
  transition: transform .9s var(--spring), box-shadow .3s;
}
.door-leaf::before {   /* a snow cap on top */
  content: ""; position: absolute; left: -3px; right: -3px; top: -6px; height: 16%;
  background: var(--snow); border: 3px solid var(--ink); border-radius: 10px 10px 40% 40% / 10px 10px 100% 100%;
}
.door-leaf::after {   /* the knob */
  content: ""; position: absolute; right: 9%; top: 52%; width: 9%; aspect-ratio: 1;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--ink);
}
.door-num {
  font: 400 clamp(1.9rem, 4.8vw, 3.4rem)/1 "Luckiest Guy", sans-serif;
  color: var(--paper);
  -webkit-text-stroke: .14em var(--ink); paint-order: stroke fill;
  text-shadow: 0 .08em 0 var(--ink);
  margin: 10% 10% 0 0;   /* nudged left, clear of the knob */
}
.door-red { --c: var(--red); }
.door-green { --c: var(--green); }
.door-ice { --c: var(--ice); }
.door-snow { --c: var(--paper); }
.door-snow .door-leaf::before { background: #dfe9f3; }

/* Open doors stand open on their hinge, swung to the left; today's door opens to the same (Jaka, 2 December 2026) */
.door.is-open .door-leaf { transform: rotateY(-96deg); }
.door.is-today .door-inside { border-color: var(--sun); box-shadow: inset 0 6px 12px rgb(0 0 0 / .45), 0 0 0 3px var(--ink), 0 0 26px 6px rgb(255 183 0 / .65); }
@media (hover: hover) {
  .door.is-open:hover .door-leaf { transform: rotateY(-104deg); }
  .door.is-open:hover .door-inside img { transform: scale(1.07); }
  .door[aria-disabled="true"]:hover .door-leaf { transform: rotateY(-9deg); }
}
.door.is-open:active { transform: scale(.96); transition: transform .12s; }
/* today's door (2 December 2026): only ajar, a peek at the picture, until the first click shines it and flings it wide open
   (calendar.js fling). The light: a white glow and turning rays out of the door, as in the day 2 video */
.door.is-today:not(.flung) .door-leaf { transform: rotateY(-34deg); }
@media (hover: hover) { .door.is-today:not(.flung):hover .door-leaf { transform: rotateY(-44deg); } }
/* today's door is lit white inside, light through the crack; after the fling the white fades and shows the picture */
.door.is-today .door-inside::after { content: ""; position: absolute; inset: 0; background: radial-gradient(#fff 45%, #fff3cf); opacity: 1; transition: opacity .6s ease 1s; }   /* fades once the swing is done */
.door.is-today.flung .door-inside::after { opacity: 0; }
body > .door-burst { position: fixed; z-index: 40; width: 0; height: 0; pointer-events: none; }
.door-burst i { position: absolute; left: 0; top: 0; translate: -50% -50%; border-radius: 50%; }
.door-burst .glow { width: calc(var(--s) * 3); height: calc(var(--s) * 3); background: radial-gradient(closest-side, rgb(255 255 255 / .55) 18%, rgb(255 240 200 / .35) 45%, rgb(255 210 110 / .18) 72%, transparent);   /* see-through: the swing shows */ animation: burst 1.7s ease-out both; }
.door-burst .rays { width: calc(var(--s) * 7); height: calc(var(--s) * 7);
  background: repeating-conic-gradient(rgb(255 255 255 / .32) 0 6deg, transparent 6deg 18deg);
  mask: radial-gradient(closest-side, #000 10%, transparent 70%); -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 70%);
  animation: burst 1.7s ease-out both, spin 1.7s linear both; }
@keyframes burst { 0% { opacity: 0; scale: .2; } 20% { opacity: 1; scale: 1.05; } 60% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 1.15; } }   /* bright through the swing, gone with the white */
@keyframes spin { to { rotate: 40deg; } }

/* Tooltip on a shut door: hover, keyboard focus, or a tap (.nudge) */
.door[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 10px);
  translate: -50% 4px; opacity: 0; pointer-events: none;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--sun);
  font-weight: 800; font-size: .85rem;
  transition: opacity .15s, translate .4s var(--spring);
}
.door[data-tip]:is(:hover, :focus-visible, .nudge)::after { opacity: 1; translate: -50% 0; }
/* keep the edge columns' tooltips on screen */
.doors > .door:nth-child(6n + 1)::after { left: 0; translate: 0 4px; }
.doors > .door:nth-child(6n)::after { left: auto; right: 0; translate: 0 4px; }
.doors > .door:is(:nth-child(6n + 1), :nth-child(6n)):is(:hover, :focus-visible, .nudge)::after { translate: 0 0; }
@media (max-width: 639.98px) {
  .doors > .door:is(:nth-child(6n + 1), :nth-child(6n))::after { left: 50%; right: auto; translate: -50% 4px; }
  .doors > .door:is(:nth-child(6n + 1), :nth-child(6n)):is(:hover, :focus-visible, .nudge)::after { translate: -50% 0; }
  .doors > .door:nth-child(4n + 1)::after { left: 0; right: auto; translate: 0 4px; }
  .doors > .door:nth-child(4n)::after { left: auto; right: 0; translate: 0 4px; }
  .doors > .door:is(:nth-child(4n + 1), :nth-child(4n)):is(:hover, :focus-visible, .nudge)::after { translate: 0 0; }
}

/* Dialog */
dialog {
  width: min(100% - 32px, 780px); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: 22px;
  background: #000; color: var(--paper); overflow: auto;
  /* a slim dark scrollbar on a clear track, so the dialog's corners and dark look aren't broken by the system one */
  scrollbar-width: thin; scrollbar-color: #3a3a3a transparent;
}
/* Safari before scrollbar-color: the same, drawn with the old pseudo-elements */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: 10px; background: #000; }
  ::-webkit-scrollbar-thumb { background: #3a3a3a; border: 3px solid #000; border-radius: 999px; }
  dialog::-webkit-scrollbar { width: 10px; background: transparent; }
  dialog::-webkit-scrollbar-track { background: transparent; margin-block: 18px; }
  dialog::-webkit-scrollbar-thumb { background: #3a3a3a; border: 3px solid #000; border-radius: 999px; }
  dialog::-webkit-scrollbar-thumb:hover { background: #555; }
}
dialog::backdrop { background: rgb(0 0 0 / .7); backdrop-filter: blur(6px); }
.close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer;
}
.view { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(#5d8cc0, #b7cfe8 60%, #f3e6d2); border-bottom: 1px solid var(--line); }
.view canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.view canvas:active { cursor: grabbing; }
.view canvas[hidden] { display: none; }
.view-note {
  position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 24px;
  text-align: center; color: var(--ink); font-weight: 800; font-size: 1.1rem;
}
.view-note[hidden] { display: none; }
.view-hint {
  position: absolute; left: 12px; bottom: 12px; padding: 4px 12px; border-radius: 999px;
  background: rgb(0 0 0 / .55); color: var(--paper); font-weight: 800; font-size: .8rem;
  transition: opacity .4s; pointer-events: none;
}
.view:has(.dragged) .view-hint, .view:has(canvas[hidden]) .view-hint, .view:has(.view-note:not([hidden])) .view-hint { opacity: 0; }
.sheet { padding: 20px 24px 24px; }
.door-day { margin: 0; color: var(--sun); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.sheet h2 { margin: 2px 0 6px; font-size: clamp(1.6rem, 4vw, 2.1rem); line-height: 1.1; }
.door-blurb { margin: 0 0 16px; color: #d6d6d6; font-size: 1.05rem; }
.inside h3 { margin: 0 0 8px; font-size: 1.05rem; color: var(--muted); letter-spacing: .02em; }
.inside ul { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.inside li { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: #111; font-size: .85rem; font-weight: 700; overflow-wrap: anywhere; }
.play-link { margin: 8px 0 0 6px; }
.play-link[hidden] { display: none; }
.licence { margin: 14px 0 0; color: var(--muted); font-size: .85rem; font-weight: 700; }

/* Footer */
.foot { margin-top: 64px; padding-block: 32px; border-top: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: .92rem; }
.foot p { margin: 0 0 6px; }
.foot a { color: var(--paper); }

@media (max-width: 639.98px) {
  .brand span { display: none; }
  .pill { padding: 7px 12px; font-size: .85rem; }
  .view { aspect-ratio: 4 / 3; }
  .sheet { padding: 16px 18px 20px; }
  .door-leaf { border-width: 2px; box-shadow: inset 0 0 0 4px var(--c), inset 0 0 0 5px rgb(0 0 0 / .18), inset 0 -6px 0 rgb(0 0 0 / .1); }
  .door-inside { border-width: 2px; border-radius: 10px; }
  .door-leaf::before { border-width: 2px; }
  .door-tag { right: 5px; top: 5px; }
  .door-num { font-size: 1.55rem; }
  .door-leaf::after { width: 7%; right: 7%; border-width: 1.5px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .bar { animation: rise .6s var(--spring-soft) both; }
  .hero .display { animation: pop .9s var(--spring) both; }
  .door { animation: pop .8s calc(var(--n) * 30ms + .15s) var(--spring) both; }
  /* open doors swing open after the grid lands */
  .door.is-open .door-leaf { animation: swing 1.2s calc(var(--n) * 30ms + .7s) var(--spring) backwards; }   /* not both: a held end pose made hover snap */
  .door.is-today .door-inside { animation: glow 2.4s ease-in-out infinite; }
  .door.nudge .door-leaf { animation: rattle .5s ease-out; }
  dialog[open] { animation: pop .6s var(--spring); }
  dialog[open]::backdrop { animation: fade .25s ease-out; }
}
/* An open door holds the background still (2 December 2026): the backdrop blurs the page behind the dialog, and with
   the snow falling and today's door glowing it had to blur again every frame, which flickered (seen in itch's frame) */
html:has(dialog[open]) .snow::before, html:has(dialog[open]) .snow::after,
html:has(dialog[open]) .door.is-today .door-inside { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .snow::before, .snow::after { animation: none; }
  .door-leaf, .door-inside img, .pill { transition: none; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes pop { from { opacity: 0; transform: scale(.88); } }
@keyframes fade { from { opacity: 0; } }
@keyframes swing { from { transform: none; } }
@keyframes glow { 50% { box-shadow: inset 0 6px 12px rgb(0 0 0 / .45), 0 0 0 3px var(--ink), 0 0 40px 12px rgb(255 183 0 / .8); } }
@keyframes rattle { 20% { transform: rotateY(-12deg); } 45% { transform: rotateY(-3deg); } 70% { transform: rotateY(-8deg); } }
