/* Colors are defined once as "custom properties" (variables) and reused
   everywhere with var(--name). Red and green are the Renozance red and green
   scales, standing in until the Christmas design system exists. */
:root {
  --red: #8C1515;
  --red-bright: #CD3D3D;
  --red-dark: #691010;
  --red-tint: #F1A4A4;
  --green: #317E3F;
  --green-dark: #255E2F;
  --green-deep: #193F1F;
  --green-tint: #B7E3BF;
  --paper: #FBF8F1;      /* warm off-white page */
  --card: #FFFFFF;
  --ink: #242424;
  --muted: #53565A;
  --line: #DCE1E5;
  /* Gingerbread house. These browns and the icing white are placeholders
     chosen for this page, not part of any design system yet. */
  --ginger: #B8743B;
  --ginger-dark: #8B5226;
  --ginger-deep: #5E3517;
  --icing: #FFF8EC;
  --glow: #F9D777;
  --stone: #B4B7BB;        /* doors that are not open yet */
  --stone-dark: #8D9196;
  --night: #14263F;        /* sky behind the house */
  --fur: #8FC332; --fur-dark: #3F6B17; --fur-light: #C6E678;   /* Grinch green */
  --green-bright: #56BD69; /* roof dots */
  --blue-bright: #30A4FF;  /* roof dots */
  --light: #FEBC11;        /* string lights: the Renozance yellow (Gold base) */
  --title: var(--red);         /* headings and links */
  --title-2: var(--green-dark);
}
/* Dark mode: the same page with the background and text colors swapped for
   dark ones. index.html sets data-theme="dark" on <html> when it is chosen
   in Settings (or when the device itself is set to dark and nothing was chosen). */
:root[data-theme="dark"] {
  --paper: #12161C;
  --card: #1C222B;
  --ink: #EDEFF2;
  --muted: #A9B0B8;
  --line: #333C47;
  --title: #E86767;        /* lighter red and green, readable on dark */
  --title-2: #86D094;
  color-scheme: dark;      /* tells the browser to darken its own parts: scrollbars, text boxes */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; margin: 0; }
small { color: var(--muted); font-weight: normal; }
button, input { font: inherit; }

/* Keyboard users get a clear ring showing which control is active. */
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* ---------- top of page ---------- */

.masthead {
  display: flex;
  flex-wrap: wrap;               /* controls drop below the title on narrow screens */
  gap: 16px 32px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 28px clamp(16px, 4vw, 48px) 20px;
  background: var(--card);
  /* candy-cane stripe along the bottom edge */
  border-bottom: 8px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--red) 0 14px, var(--card) 14px 28px, var(--green) 28px 42px, var(--card) 42px 56px) 8;
}
/* The title font (headings, door numbers) and the subtitle font (tagline,
   door text, weekday row). --sub-scale is how much bigger the subtitle font
   must be to read like normal text: Caveat runs small. */
:root {
  --font-title: "Mountains of Christmas", Georgia, serif; --title-weight: 700; --title-scale: 1;
  --font-sub: "Caveat", "Segoe Print", cursive; --sub-style: normal; --sub-weight: 700; --sub-scale: 1.3;
  --font-num: var(--font-title);
}

.masthead h1 { font-family: var(--font-title); font-weight: var(--title-weight); font-size: calc(clamp(2rem, 6vw, 3.4rem) * var(--title-scale)); line-height: 1.1; color: var(--title); }
.tagline { margin: 4px 0 0; color: var(--title-2); font-family: var(--font-sub); font-style: var(--sub-style); font-weight: var(--sub-weight); font-size: calc(1rem * var(--sub-scale)); line-height: 1.2; }


.masthead { flex-wrap: nowrap; align-items: flex-start; gap: 4px; }
.masthead-text { flex: 1; }
.gear { display: grid; place-items: center; width: 48px; height: 48px; flex: none; }

.control { display: grid; gap: 4px; font-size: 0.9rem; font-weight: 600; }
.control input[type="text"] { padding: 8px 10px; border: 1px solid var(--muted); border-radius: 6px; width: min(27rem, 100%); min-height: 44px; }
.control-toggle { grid-template-columns: auto 1fr; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.control-toggle input { width: 24px; height: 24px; accent-color: var(--green); }

/* ---------- header and footer stay put; pop-ups fit between ---------- */

/* app.js measures the header and footer into --head and --foot. */
:root { --head: 120px; --foot: 60px; }
body { min-height: 100dvh; display: flex; flex-direction: column; }
body > * { flex: none; }
.masthead { position: sticky; top: 0; z-index: 100; }
/* The footer always lies along the bottom of the window ("margin-top: auto"
   pushes it there when the page is shorter than the window). */
.footer { position: sticky; bottom: 0; z-index: 100; margin-top: auto; background: var(--paper); border-top: 1px solid var(--line); }
#scrim { position: fixed; inset: var(--head) 0 var(--foot); background: rgba(0, 0, 0, 0.55); }
dialog { position: fixed; inset: calc(var(--head) + 12px) 0 calc(var(--foot) + 12px); margin: auto; max-height: calc(100dvh - var(--head) - var(--foot) - 24px); overflow: hidden auto; }

/* ---------- settings panel and the name question ---------- */

/* The panel is a <dialog> pinned to the right edge, full height. When it
   opens, the slide-in animation moves it in from off-screen. */
.drawer {
  inset: var(--head) 0 var(--foot) auto; margin: 0;
  width: min(380px, 92vw); height: auto; max-height: none;
  padding: 0; border: 0; border-left: 8px solid var(--red);
  background: var(--card); color: var(--ink);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
}
.drawer[open] { animation: slide-in 260ms ease-out; }
@keyframes slide-in { from { transform: translateX(100%); } }
.drawer-body { display: grid; gap: 20px; padding: 12px 24px 24px; }
.drawer-note { margin: 0; color: var(--muted); font-size: 0.85rem; }

.ask {
  width: min(420px, 92vw); padding: 24px;
  border: 0; border-top: 8px solid var(--green); border-radius: 12px;
  background: var(--card); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.ask h2 { color: var(--title-2); }
.ask p { margin: 6px 0 14px; color: var(--muted); }
.ask input { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--muted); border-radius: 6px; }
.ask-buttons { display: flex; gap: 12px; margin-top: 16px; }
.button.plain { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.button.plain:hover { background: var(--paper); }

/* ---------- today / summary banner ---------- */

/* A caption under the street, no wider than one house. */
.hero {
  width: min(100% - 32px, 720px);
  margin: 20px auto 28px;
  padding: 14px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 8px solid var(--red);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}
.hero h2 { font-size: 1.45rem; color: var(--title); }
/* The caption's sentence and the footer use the tagline's font (Caveat),
   at a lighter weight than the bold tagline. */
.hero p, .footer { font-family: var(--font-sub); font-weight: 500; font-size: calc(1rem * var(--sub-scale)); line-height: 1.25; }
.hero p { margin: 4px 0 0; color: var(--muted); }

.button {
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 150ms ease;
}
.button[hidden] { display: none; }
.button:hover { background: var(--red-dark); }
.button.green { background: var(--green); }
.button.green:hover { background: var(--green-dark); }

/* ---------- the gingerbread house ---------- */

/* The street is a night scene across the full width of the page. A wider
   window shows more houses, not bigger ones. Sizes that several parts must
   agree on are defined once here as variables. */
.street {
  --gutter: clamp(8px, 2vw, 20px);     /* gap between a house and the edge of its plot */
  --pad-x: clamp(6px, 2vw, 22px);      /* wall padding left and right of the doors */
  --pad-y: clamp(8px, 2vw, 22px);      /* wall padding above and below the doors */
  --gap: clamp(4px, 1.3vw, 14px);      /* gap between doors */
  position: relative;
  background: linear-gradient(#0E1B30, #1D3557);
  overflow: hidden;                    /* houses walked past slide out of view here */
}
/* The long sky picture. One house is 400 sky units wide. app.js sets how many
   units the picture has (--units), how wide its starry margin is (--margin)
   and which house is on show (--at); from those, the picture is slid so that
   its part for that house sits in the middle of the street. Each house moves
   it by only 100 units, a quarter of a house, so the sky drifts by slowly. */
.sky {
  --unit: calc(var(--plot) / 400);
  position: absolute; top: 0; left: 0;
  width: calc(var(--units, 4800) * var(--unit));
  transform: translateX(calc(50cqw - (var(--margin, 0) + 200 + 100 * var(--at, 0)) * var(--unit)));
  transition: transform 0ms ease-in-out; pointer-events: none;
}
.sky svg { display: block; width: 100%; height: auto; }
/* Falling snow. There are two layers: one behind the houses and one (.front)
   in front of them. app.js fills each with flakes; every flake <i> falls
   from top to bottom while the dot inside it <b> sways from side to side. */
.snowfall { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.snowfall.front { z-index: 2; }
.snowfall i { position: absolute; top: -12px; animation: fall linear infinite; }
.snowfall b { display: block; border-radius: 50%; background: #fff; animation: sway ease-in-out infinite alternate; }
@keyframes fall { to { top: 100%; } }
@keyframes sway { from { transform: translateX(-16px); } to { transform: translateX(16px); } }

/* The lane is a row of plots standing on the same ground line. A plot is
   720px wide, and only shrinks when the window is too narrow for that
   ("cqw" is 1% of the street's width, so 90cqw leaves a strip of the
   neighbours showing on a phone). app.js says which plot in the row is the
   one on show (--at), and the row is slid so that plot sits in the middle. */
.street { container-type: inline-size; touch-action: pan-y; }   /* pan-y: sideways swipes are ours, scrolling stays the browser's */
/* round(...) snaps sizes and positions to whole pixels. Without it the plots
   can land on fractions of a pixel, which shows up as hairline gaps
   between neighbouring yards. */
.sky, .lane { --plot: round(down, min(720px, 90cqw), 1px); }
.lane {
  --cell: calc((var(--plot) - 2 * var(--gutter) - 12px - 2 * var(--pad-x) - 6 * var(--gap)) / 7);   /* one door's width */
  --sky: calc(var(--plot) * 0.1);          /* open sky above the tallest house */
  --yard: clamp(84px, calc(var(--plot) * 0.19), 150px);
  --rows: 6;                               /* rows of the tallest house; app.js sets the real number */
  position: relative; z-index: 1;
  display: flex; align-items: flex-end;
  transform: translateX(round(calc(50cqw - (var(--at, 0) + 0.5) * var(--plot)), 1px));
}
.plot {
  position: relative;
  flex: 0 0 var(--plot); min-width: 0;
  /* Room for the tallest house: sky + roof + eaves + weekday row + rows of
     doors + yard + pavement. Shorter houses simply get more sky above. */
  min-height: calc(var(--sky) + (var(--plot) - 2 * var(--gutter)) * 0.34 + 86px
    + var(--rows) * var(--cell) * 4 / 3 + (var(--rows) - 1) * var(--gap) + 2 * var(--pad-y)
    + var(--yard) + var(--pavement));
  display: flex; flex-direction: column; justify-content: flex-end;
}
/* The neighbours look exactly like any other house; a click on one walks to it. */
.plot:not(.is-here) { cursor: pointer; }
.house { margin-inline: var(--gutter); }

/* Roof: two triangles cut out with clip-path. The back one is icing; the
   front one is slightly smaller, so the icing shows as a line along the
   roof's edge. The front one is sprinkled with dots in four colors: each
   radial-gradient draws one color, shifted so the dots never overlap. */
.roof { position: relative; aspect-ratio: 5 / 1.7; }
.roof::before, .roof::after { content: ""; position: absolute; inset: 0; }
.roof::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); background: var(--icing); }
.roof::after {
  clip-path: polygon(50% 7%, 96.5% 100%, 3.5% 100%);
  background:
    radial-gradient(circle, var(--icing) 15%, transparent 17%) 0 0 / 40px 40px,
    radial-gradient(circle, var(--red-bright) 15%, transparent 17%) 20px 20px / 40px 40px,
    radial-gradient(circle, var(--green-bright) 15%, transparent 17%) 20px 0 / 40px 40px,
    radial-gradient(circle, var(--blue-bright) 15%, transparent 17%) 0 20px / 40px 40px,
    var(--ginger-deep);
}

/* The chimney stands behind the roof (z-index: -1), so the roof's slope
   cuts across its base. It can be on either side, and comes in brick,
   metal and stone. ::before is the snow-covered cap on top. */
.chimney { position: absolute; z-index: -1; left: 17%; top: 12%; width: 9%; height: 56%; }
.chimney.right { left: auto; right: 17%; }
.chimney::before {
  content: "";
  position: absolute; left: -14%; right: -14%; top: 0; height: 13%;
  border-radius: 4px 4px 2px 2px; background: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.chimney-0 { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='16'%3E%3Crect width='20' height='16' fill='%23A8452E'/%3E%3Cpath d='M0 .75h20M0 8.75h20M5 0v8M15 8v8' stroke='%23E3D2BF' stroke-width='1.5'/%3E%3C/svg%3E"); }   /* brick */
.chimney-1 { width: 5.5%; background: linear-gradient(90deg, #6F7780, #D5DAE0 45%, #7C858F); }           /* a metal flue */
.chimney-1.right { right: 19%; }
.chimney-1::before { left: -30%; right: -30%; background: linear-gradient(90deg, #6F7780, #D5DAE0 45%, #7C858F); border-top: 3px solid #fff; }
.chimney-2 {                                                                                             /* stone */
  background:
    radial-gradient(ellipse, #B4BBC3 52%, transparent 56%) 0 0 / 22px 15px,
    radial-gradient(ellipse, #9AA3AD 52%, transparent 56%) 11px 7.5px / 22px 15px,
    #6F7780;
}
/* Four more roofs. Which one a house gets is decided by its year (app.js). */
/* scalloped shingles piped in icing */
.roof-1::after {
  background:
    radial-gradient(circle 18px at 50% 100%, transparent 14px, var(--icing) 14.5px 17px, transparent 17.5px) 0 0 / 36px 36px,
    radial-gradient(circle 18px at 50% 100%, transparent 14px, var(--icing) 14.5px 17px, transparent 17.5px) 18px 18px / 36px 36px,
    var(--ginger-deep);
}
/* peppermint stripes */
.roof-2::after { background: repeating-linear-gradient(-45deg, var(--red) 0 18px, var(--icing) 18px 26px); }
/* thick snow with sprinkles */
.roof-3::after {
  background:
    radial-gradient(circle, var(--red-bright) 12%, transparent 14%) 0 0 / 46px 46px,
    radial-gradient(circle, var(--green-bright) 12%, transparent 14%) 23px 12px / 46px 46px,
    radial-gradient(circle, var(--blue-bright) 12%, transparent 14%) 11px 30px / 46px 46px,
    radial-gradient(circle, var(--light) 12%, transparent 14%) 34px 36px / 46px 46px,
    #F4F8FC;
}
.roof-3::before { background: var(--ginger-deep); }      /* a dark edge, since the roof itself is white */
/* an evergreen roof with an icing lattice and a glossy gumdrop, in four colors
   in turn, in every diamond (one tile drawn in SVG, repeated) */
.roof-4::after { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='144' height='72' viewBox='0 0 144 72'%3E%3Crect width='144' height='72' fill='%2324632F'/%3E%3Cg fill='%231C5026'%3E%3Cpath d='M36 0l36 36-36 36L0 36zM108 0l36 36-36 36-36-36z'/%3E%3C/g%3E%3Cpath d='M0 36L36 0l72 72 36-36M0 36l36 36L108 0l36 36' fill='none' stroke='%23FFF8EC' stroke-width='6'/%3E%3Ccircle cx='36' cy='37.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='36' cy='36' r='12' fill='%23E2444A'/%3E%3Ccircle cx='32' cy='32' r='3' fill='%23fff' fill-opacity='.75'/%3E%3Ccircle cx='108' cy='37.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='108' cy='36' r='12' fill='%23FEBC11'/%3E%3Ccircle cx='104' cy='32' r='3' fill='%23fff' fill-opacity='.75'/%3E%3Ccircle cx='72' cy='1.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='72' cy='0' r='12' fill='%2330A4FF'/%3E%3Ccircle cx='68' cy='-4' r='3' fill='%23fff' fill-opacity='.75'/%3E%3Ccircle cx='72' cy='73.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='72' cy='72' r='12' fill='%2330A4FF'/%3E%3Ccircle cx='68' cy='68' r='3' fill='%23fff' fill-opacity='.75'/%3E%3Ccircle cx='0' cy='1.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='0' cy='0' r='12' fill='%23F48FB1'/%3E%3Ccircle cx='-4' cy='-4' r='3' fill='%23fff' fill-opacity='.75'/%3E%3Ccircle cx='144' cy='1.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='144' cy='0' r='12' fill='%23F48FB1'/%3E%3Ccircle cx='140' cy='-4' r='3' fill='%23fff' fill-opacity='.75'/%3E%3Ccircle cx='0' cy='73.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='0' cy='72' r='12' fill='%23F48FB1'/%3E%3Ccircle cx='-4' cy='68' r='3' fill='%23fff' fill-opacity='.75'/%3E%3Ccircle cx='144' cy='73.5' r='12' fill='%230F2E16'/%3E%3Ccircle cx='144' cy='72' r='12' fill='%23F48FB1'/%3E%3Ccircle cx='140' cy='68' r='3' fill='%23fff' fill-opacity='.75'/%3E%3C/svg%3E") 50% 0 / 104px 52px, #24632F; }

/* The mailbox in the front yard is a button that opens the year picker. */
.mailbox {
  border: 0; padding: 0; background: none; font: inherit; color: inherit;
  position: relative; z-index: 2;
  align-self: end; justify-self: center;
  height: 78%; margin-bottom: 6%;            /* planted a little way back from the pavement */
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
}
.mailbox-box {
  position: relative;
  /* at least 44px tall and wide: the usual minimum for a comfortable tap */
  display: grid; place-items: center; min-height: 44px; min-width: 44px;
  padding: clamp(5px, 1.2vw, 10px) clamp(5px, 1.2vw, 12px) clamp(2px, 0.6vw, 6px);
  border: clamp(2px, 0.4vw, 3px) solid var(--icing);
  border-radius: 50% 50% 6px 6px / 70% 70% 6px 6px;    /* domed top */
  background: var(--red);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.mailbox-year { font: var(--title-weight) clamp(1rem, 2.6vw, 1.6rem) var(--font-title); color: var(--icing); }   /* the title font, like a painted house number */

/* The year picker: a box to type in, then a grid of year buttons that
   scrolls if it ever grows taller than half the screen. */
/* The header of a small pop-up (year picker, How it works). Written as
   ".viewer-bar.ask-bar" so it wins over the video pop-up's .viewer-bar
   padding, which comes later in this file: the heading lines up with the
   text below it. The close X sits in the box's top-right corner. */
.viewer-bar.ask-bar { padding: 0 36px 12px 0; }
.ask-bar .icon-button { position: absolute; top: 6px; right: 6px; padding: 2px 10px; }
.year-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px;
  max-height: 50vh; overflow-y: auto; margin: 14px -3px 0; padding: 3px;   /* the padding leaves room for focus rings; the negative margin keeps the buttons in line with the type box */
}
.year-list p { grid-column: 1 / -1; }
.year-choice {
  min-height: 44px;
  border: 2px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink);
  font: var(--title-weight) 1.6rem/1 var(--font-title);   /* like the year on the mailbox; big, as its curly numbers run small */
  cursor: pointer;
}
.year-choice:hover { border-color: var(--muted); }
.year-choice[aria-current="true"] { background: var(--red); border-color: var(--red); color: #fff; }   /* the year on show */
/* The flag lies flat until the mouse (or keyboard focus) is on the mailbox,
   then swings up, the way a real one signals "mail inside". */
.mailbox-flag {
  position: absolute; right: 12%; bottom: 55%;
  width: clamp(2px, 0.4vw, 3px); height: 75%;
  background: var(--icing);
  transform-origin: bottom center; transform: rotate(90deg);
  transition: transform 250ms ease;
}
.mailbox-flag::after {
  content: "";
  position: absolute; top: 0; left: 100%;
  width: clamp(7px, 1.6vw, 13px); height: clamp(5px, 1.1vw, 9px);
  background: var(--light);
}
.mailbox:hover .mailbox-flag, .mailbox:focus-within .mailbox-flag { transform: rotate(0deg); }
/* candy-cane post */
.mailbox-post {
  flex: 1; width: clamp(6px, 1.3vw, 11px);
  background: repeating-linear-gradient(-45deg, var(--icing) 0 6px, var(--red-bright) 6px 12px);
  border-radius: 0 0 3px 3px;
}

/* Under the roof: icing dripping off its edge (a row of half-circles), and
   below that a string of yellow lights. */
.eaves {
  position: relative;
  height: 40px;
  background:
    radial-gradient(circle at 50% 0, var(--icing) 68%, transparent 70%) 0 0 / 28px 16px repeat-x,
    linear-gradient(var(--ginger-deep), var(--ginger-deep)) 0 21px / 100% 2px no-repeat,   /* the wire */
    var(--ginger-dark);
  border-top: 6px solid var(--icing);
}
/* The bulbs are their own layer so they can twinkle without the icing fading. */
/* The string repeats four bulbs, whose colors are the variables --b1 to --b4.
   Each house sets them differently (the .lights-N rules below); color-mix
   makes the half-transparent halo around each bulb from its own color. */
.eaves {
  --b1: var(--light); --b2: var(--light); --b3: var(--light); --b4: var(--light);   /* all warm yellow */
}
.lights-1 { --b1: var(--red-bright); --b2: var(--green-bright); --b3: var(--blue-bright); --b4: var(--light); }   /* multicolor */
.lights-2 { --b1: #FFFFFF; --b2: #BFE3FF; --b3: #FFFFFF; --b4: #BFE3FF; }                                         /* icy white and blue */
.lights-3 { --b1: var(--red-bright); --b2: var(--green-bright); --b3: var(--red-bright); --b4: var(--green-bright); }   /* red and green */
.lights-4 { --b1: var(--blue-bright); --b2: #FFFFFF; --b3: var(--light); --b4: #FFFFFF; }                        /* blue, white and gold */
.eaves::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle, #FFF8E0 1.5px, var(--b1) 5px, color-mix(in srgb, var(--b1) 55%, transparent) 6px, transparent 12px) 0 13px / 112px 26px repeat-x,
    radial-gradient(circle, #FFF8E0 1.5px, var(--b2) 5px, color-mix(in srgb, var(--b2) 55%, transparent) 6px, transparent 12px) 28px 13px / 112px 26px repeat-x,
    radial-gradient(circle, #FFF8E0 1.5px, var(--b3) 5px, color-mix(in srgb, var(--b3) 55%, transparent) 6px, transparent 12px) 56px 13px / 112px 26px repeat-x,
    radial-gradient(circle, #FFF8E0 1.5px, var(--b4) 5px, color-mix(in srgb, var(--b4) 55%, transparent) 6px, transparent 12px) 84px 13px / 112px 26px repeat-x;
  animation: twinkle 1.8s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.6; } to { opacity: 1; } }
/* Blinking lights (a choice in Settings): every light goes slowly on and off,
   neighbouring ones in turn. One blink takes 3.6 seconds, far slower than
   anything that bothers people sensitive to flashing. Lights in a drawing
   carry the class light and light-0, -1 or -2; along the eaves, one layer
   holds every second bulb and the other layer the rest. */
@keyframes blink { 0%, 38% { opacity: 1; } 50%, 88% { opacity: 0.12; } 100% { opacity: 1; } }
.is-blinking .light { animation: blink 3.6s ease-in-out infinite; }
.is-blinking .light-1 { animation-delay: -1.2s; }
.is-blinking .light-2 { animation-delay: -2.4s; }
/* Inside (and at the town hall) the four colors take turns: one is off while
   three are on, and as one comes back on the next goes off. Each is off for a
   quarter of the round (1.2 seconds), and fades out as another fades in. */
@keyframes blink-turns { 0% { opacity: 1; } 7.5%, 25% { opacity: 0.12; } 32.5%, 100% { opacity: 1; } }
.is-blinking .room .light { animation-name: blink-turns; animation-duration: 4.8s; }
.is-blinking .room .light-3 { animation-delay: -3.6s; }
.is-blinking .eaves::before { content: ""; position: absolute; inset: 0; }
.is-blinking .eaves::after {
  background:
    radial-gradient(circle, #FFF8E0 1.5px, var(--b1) 5px, color-mix(in srgb, var(--b1) 55%, transparent) 6px, transparent 12px) 0 13px / 112px 26px repeat-x,
    radial-gradient(circle, #FFF8E0 1.5px, var(--b3) 5px, color-mix(in srgb, var(--b3) 55%, transparent) 6px, transparent 12px) 56px 13px / 112px 26px repeat-x;
}
.is-blinking .eaves::before {
  background:
    radial-gradient(circle, #FFF8E0 1.5px, var(--b2) 5px, color-mix(in srgb, var(--b2) 55%, transparent) 6px, transparent 12px) 28px 13px / 112px 26px repeat-x,
    radial-gradient(circle, #FFF8E0 1.5px, var(--b4) 5px, color-mix(in srgb, var(--b4) 55%, transparent) 6px, transparent 12px) 84px 13px / 112px 26px repeat-x;
}
.is-blinking .eaves::before { animation: blink 3.6s ease-in-out -1.8s infinite; }
.is-blinking .eaves::after { animation: blink 3.6s ease-in-out infinite; }
.is-blinking .yard-2::after { animation: blink 3.6s ease-in-out infinite; }      /* the lights along a front path */

.weekdays, .calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));   /* always a 7-day week, Sunday first, all columns equal */
  gap: var(--gap);
  padding-inline: var(--pad-x);
  border-inline: 6px solid var(--icing);
}
.weekdays {
  padding-block: 6px;
  background: var(--ginger-dark); color: var(--icing);
  font-family: var(--font-sub); font-style: var(--sub-style); font-weight: var(--sub-weight);
  font-size: calc(clamp(0.78rem, 2.1vw, 1.1rem) * var(--sub-scale)); line-height: 1.2; letter-spacing: 0.04em; text-align: center;
}
.calendar { padding-block: var(--pad-y); background: var(--ginger); }

/* Every spot on the wall has the same door-shaped proportions. */
.door, .window, .front-door { aspect-ratio: 3 / 4; }

/* Each door is two layers stacked on top of each other:
   .door-inside (what is behind the door) and .door-front (the door itself).
   Opening = rotating the front layer around its left edge, like a hinge. */
.door {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 700px;            /* gives the swing a 3-D look */
  /* Lets the door's text and icons be sized by the door's own width:
     1cqw = 1% of it, so they keep their places on every screen size. */
  container-type: inline-size;
}
.door-inside, .door-front {
  position: absolute; inset: 0;
  border-radius: 50% 50% 6px 6px / 30% 30% 6px 6px;   /* arched top, square bottom */
}
.door-inside {
  background: var(--ginger-deep) center / cover no-repeat;
  box-shadow: inset 0 0 0 3px var(--ginger-deep), inset 0 6px 18px rgba(0, 0, 0, 0.5);
  display: grid; place-items: end center;
  overflow: hidden;
}
/* One small icing dot on the front of the door per link behind it. */
.door-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 4.5cqw; gap: round(4.5cqw, 1px); max-width: 62%; margin-top: -1cqw; }   /* tucked up close under the number */
/* Each dot is a whole number of pixels, so every row is drawn the same
   (a size like 5.4px can be rounded differently from one row to the next).
   flex: none stops a full row from squeezing its dots. The first width and
   height are for browsers that don't know round(). */
.door-dots i { flex: none; width: 7cqw; height: 7cqw; width: round(7cqw, 1px); height: round(7cqw, 1px); border-radius: 50%; background: var(--icing); }
.door-front {
  background: var(--red);
  color: #fff;
  /* piped-icing trim just inside the edge of the door */
  box-shadow: inset 0 0 0 clamp(2px, 0.5vw, 4px) var(--icing), 0 2px 5px rgba(0, 0, 0, 0.3);
  /* The text starts just under the arch rather than in the middle, so the
     icons at the bottom corners have room. */
  display: flex; flex-direction: column; align-items: center; padding-top: 13cqw;
}
/* The hinge: on the left edge. */
.door-front, .door-behind { transform-origin: left center; transition: transform 450ms cubic-bezier(.2, .7, .2, 1), box-shadow 450ms ease; }

.door.is-green .door-front { background: var(--green); }
.door-month, .door-note { font-family: var(--font-sub); font-style: var(--sub-style); font-weight: var(--sub-weight); line-height: 1; }
.door-month { font-size: calc(18cqw * var(--sub-scale)); letter-spacing: 0.06em; opacity: 0.92; }
/* The number is 52% of the door's width. */
.door-num { font-family: var(--font-num); font-size: 52cqw; line-height: 0.95; font-weight: 700; margin-top: -1cqw; }   /* close under the month */
.door-note { font-size: calc(11cqw * var(--sub-scale)); margin-top: 2cqw; }
/* Bottom corners: the holiday (left) and a theme (right), in icing lines. */
.door-icon { position: absolute; bottom: 6%; width: 25cqw; height: 25cqw; color: var(--icing); }
.door-icon.holiday { left: 9%; }
.door-icon.theme-1 { right: 9%; }
.door-icon.theme-2 { right: 37%; }   /* a second genre icon sits just left of the first */
/* Every icon (doors, legend, pop-up) is drawn in lines of the text colour. */
/* display: block, or on phones a line of text (taller than the icon) pushes it down out of the door. */
svg.ico { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* A furry green arm in a Santa sleeve marks a Grinch Endorsed (adults only) video before
   opening: it reaches out from inside and dangles a candy cane, to lure visitors in. It has
   no words; the pop-up says "Grinch Endorsed" on the video, and the legend explains the
   arm. The forearm and the cane are part of the door's front, so they swing with it. The
   upper arm sits in .door-behind, a layer just behind the front that swings the same way,
   so only the bit past the door's edge shows. "Today" moves to the other corner. */
.door-behind { position: absolute; inset: 0; }
/* Brighter fur than the video's band, and a dark outline (four hard shadows,
   one each way) around the whole arm, so it stands out on red and green doors. */
.door-arm {
  --fur: #D3F23F; --fur-light: #F6FFB8; --fur-dark: #14290A;
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
  filter: drop-shadow(1cqw 0 0 var(--fur-dark)) drop-shadow(-1cqw 0 0 var(--fur-dark)) drop-shadow(0 1cqw 0 var(--fur-dark)) drop-shadow(0 -1cqw 0 var(--fur-dark));
}
/* The candy cane swings from his fist (a switch in Settings). */
.door-cane { transform-origin: 39% 42.75%; }
.is-swinging .door-cane { animation: cane 2.4s ease-in-out infinite; }
@keyframes cane { 0%, 100% { transform: rotate(-11deg); } 50% { transform: rotate(11deg); } }
.door.is-today.is-rated::after { right: auto; left: -6px; }
/* Filled parts of an icon. Not scoped to .door-icon: the icons are copies
   (<use>), and their styles come from where the original is defined. */
svg .solid { fill: currentColor; stroke: none; }

/* Revealed doors stand slightly ajar and swing wide on hover / keyboard focus. */
.door.is-open :is(.door-front, .door-behind) { transform: rotateY(-22deg); }
.door.is-open:is(:hover, :focus-visible) :is(.door-front, .door-behind) { transform: rotateY(-62deg); }
.door.is-open:is(:hover, :focus-visible) .door-front { box-shadow: inset 0 0 0 clamp(2px, 0.5vw, 4px) var(--icing), 8px 4px 14px rgba(0, 0, 0, 0.35); }

.door.is-today { outline: clamp(2px, 0.5vw, 4px) solid var(--glow); outline-offset: 3px; border-radius: 8px; }
.door.is-today::after {
  content: "Today";
  position: absolute; top: -10px; right: -6px; z-index: 1;
  padding: 1px 8px; border-radius: 999px;
  background: var(--glow); color: var(--ginger-deep);
  font-size: clamp(0.55rem, 1.4vw, 0.75rem); font-weight: 700;
}

/* Everything behind it is Grinch Endorsed and Santa's Nice Kids List is on:
   Santa hugs it shut with both arms, and squeezes a little tighter when it is touched. */
.door.is-wrapped:is(:hover, :focus-visible) .door-arm { transform: scale(0.96, 1.02); }
.door.is-wrapped .door-arm { transition: transform 250ms ease; }

/* Shut doors cannot be clicked. */
.door.is-locked, .door.is-shut { cursor: default; }
/* Days still to come: the whole door is greyed out. */
.door.is-locked .door-front {
  background: var(--stone); color: #3A3D40;
  box-shadow: inset 0 0 0 clamp(2px, 0.5vw, 4px) var(--stone-dark);
}


/* Any spot without a link door is a window into a room (drawn in art.js).
   It has no date on it and is not a button. */
.window { display: grid; place-items: center; }
.window svg { width: 88%; filter: drop-shadow(0 0 5px rgba(249, 215, 119, 0.5)); }   /* warm glow */

/* The house's own front door. It is pushed down by the wall's bottom
   padding so that it stands on the ground. */
.front-door { position: relative; transform: translateY(var(--pad-y)); }
/* Drawn a fifth larger than its spot, growing upward and outward from the ground. */
.front-door svg { position: absolute; bottom: 0; left: -10%; width: 120%; height: auto; }

/* ---------- front yard and road ---------- */

/* The yard repeats the wall's seven columns, so the path sits exactly under
   the front door. Everything in it stands on the bottom edge. */
.yard {
  position: relative;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0 var(--gap);   /* minmax(0, ...) keeps all seven equal even when the mailbox is wider than its column */
  align-items: end;
  height: var(--yard);
  padding-inline: calc(var(--gutter) + 6px + var(--pad-x));
  background: linear-gradient(#EEF4FA, #D3E1EE);     /* snow */
}
/* snow drifted up against the bottom of the wall */
.yard::before {
  content: "";
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 100%; height: 8px;
  background: radial-gradient(circle at 50% 100%, #EEF4FA 68%, transparent 70%) 0 0 / 34px 8px repeat-x;
}
/* A strip along the street edge that differs from year to year. */
.yard::after { content: ""; position: absolute; inset: auto 0 0; height: clamp(6px, 1.2vw, 10px); }
.yard-0::after { background: repeating-linear-gradient(-45deg, var(--icing) 0 7px, var(--red-bright) 7px 14px); }   /* candy-cane kerb */
.yard-1::after {                                                                                                    /* gumdrops */
  background:
    radial-gradient(circle at 50% 100%, var(--red-bright) 62%, transparent 66%) 0 0 / 48px 100% repeat-x,
    radial-gradient(circle at 50% 100%, var(--green-bright) 62%, transparent 66%) 16px 0 / 48px 100% repeat-x,
    radial-gradient(circle at 50% 100%, var(--blue-bright) 62%, transparent 66%) 32px 0 / 48px 100% repeat-x;
}
.yard-2::after { background: radial-gradient(circle, var(--light) 2.5px, rgba(254, 188, 17, 0.4) 3.5px, transparent 5px) 0 0 / 30px 100% repeat-x; }   /* path lights */
.yard-3::after { background: repeating-linear-gradient(90deg, var(--ginger-dark) 0 5px, transparent 5px 14px); height: clamp(10px, 2vw, 16px); }    /* low picket fence */

.yard > * { grid-row: 1; position: relative; z-index: 1; }
/* A decoration stands somewhere in the depth of the yard: --back (set per
   item by app.js) is how far up from the pavement edge it stands, --size
   shrinks the ones further back a little, and a soft shadow sits under it. */
.yard-item { height: calc(58% * var(--size, 1)); bottom: var(--back, 10%); }
/* Shrubs planted against the wall under a window: at the very top of the
   yard, reaching a little way up the wall. */
.shrub { align-self: start; transform: translateY(-45%); }
.shrub svg { display: block; width: 100%; height: auto; }
.yard-item svg { display: block; width: 100%; height: 100%; overflow: visible; }
.yard-item::after {
  content: "";
  position: absolute; z-index: -1; left: 12%; right: 12%; bottom: -5%; height: 12%;
  border-radius: 50%; background: rgba(110, 140, 170, 0.35);
}
/* Candy canes along both edges of the walkway: small near the door, larger
   near the pavement. The right-hand ones are mirrored. */
.path-canes { align-self: stretch; z-index: 2; }
.path-canes span { position: absolute; }
.path-canes svg, .kerb-cane svg { display: block; width: 100%; height: auto; }
.path-canes .flip svg { transform: scaleX(-1); }
/* ...or a row of them along the pavement, one on each line between columns. */
.kerb-cane { z-index: 2; width: 26%; justify-self: start; transform: translate(calc(-50% - var(--gap) / 2), -6%); }
/* The walkway: a strip cut to a shape that is narrow at the door and wider
   at the pavement. The element is made wider than its column (the negative
   margins) so the pavement end has room to slide sideways: --lean, set per
   house by app.js, shifts it left or right for the perspective slant. */
.yard-path {
  --shift: calc(var(--lean, 0) * 25%);       /* the strip is 4 door-widths wide, so one door-width is 25% */
  align-self: stretch; margin-inline: -150%;
  clip-path: polygon(42% 0, 58% 0, calc(62.5% + var(--shift)) 100%, calc(37.5% + var(--shift)) 100%);
}
/* Four surfaces; app.js picks one per house. */
.path-0 {                                              /* tan cookie stones */
  background:
    radial-gradient(ellipse, #D9B48A 55%, transparent 58%) 0 0 / 40px 22px,
    radial-gradient(ellipse, #D9B48A 55%, transparent 58%) 20px 11px / 40px 22px,
    #B58A5E;
}
.path-1 { background: linear-gradient(#9AA3AD 0 2px, transparent 2px) 0 0 / 100% 24px, #CDD1D6; }     /* concrete slabs */
/* Brick: a tiny picture of two rows of bricks, repeated. (A "data:" address
   holds the picture right here in the style sheet instead of in a file.) */
.path-2 { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='16'%3E%3Crect width='20' height='16' fill='%23A8452E'/%3E%3Cpath d='M0 .75h20M0 8.75h20M5 0v8M15 8v8' stroke='%23E3D2BF' stroke-width='1.5'/%3E%3C/svg%3E"); }
.path-3 {                                              /* asphalt */
  background:
    radial-gradient(circle, #6B727C 1px, transparent 1.4px) 0 0 / 11px 13px,
    radial-gradient(circle, #353B44 1px, transparent 1.4px) 5px 7px / 13px 11px,
    #4A515C;
}

/* A fenced house has a fence on each property line. The drawing is wide,
   with the house end of the fence in its middle, and translateX centres
   that middle exactly on the edge of the plot, half-way between this house
   and the one next door. The perspective slant is in the drawing itself
   (art.js), so the pickets stay upright. pointer-events: none lets clicks
   pass through the empty parts of the wide drawing to the yard beneath. */
.fence { position: absolute; z-index: 3; left: 0; top: 0; bottom: 0; transform: translateX(-50%); pointer-events: none; }
.fence.right { left: auto; right: 0; transform: translateX(50%); }
.fence svg { display: block; height: 100%; width: auto; }

/* The distant hills behind a house: a picture as wide as the plot, standing
   on the top edge of the yard, behind everything else in the plot. They
   show in the gaps between houses. */
.backdrop { position: absolute; z-index: -1; left: 0; right: 0; bottom: calc(var(--yard) + var(--pavement)); }
.backdrop svg { display: block; width: 100%; height: auto; }

/* Past the ends of the street: open country instead of a house. */
.plot.field { cursor: default; }
.plot.field[data-spot]:not(.is-here) { cursor: pointer; }      /* the two stretches with a sign can be walked to */
.meadow svg { display: block; width: 100%; height: auto; }
.field .yard::before { display: none; }

/* From the yard outward: the sidewalk, a planted strip, the kerb and the street. */
.lane { --pavement: 90px; }
.pavement { height: var(--pavement); display: flex; flex-direction: column; }
/* warm grey paving slabs, so the sidewalk does not blend into the snowy yards */
.sidewalk {
  height: 22px;
  background: linear-gradient(90deg, #8F8A80 0 2px, transparent 2px) 0 0 / 46px 100% repeat-x, #BDB7AB;
  border-top: 2px solid #8F8A80;
}
/* The strip between sidewalk and street differs from house to house (.verge-N).
   Plants are drawn by ::before, which is taller than the strip so that
   bushes can stand up in front of the sidewalk. */
.verge { position: relative; height: 28px; background: #EEF4FA; border-bottom: 4px solid #8D96A0; }   /* the border is the kerb */
.verge::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; }
/* 0: snow-covered lawn, a few blades poking through */
.verge-0::before { background: radial-gradient(ellipse, #7FA36B 40%, transparent 45%) 9px 24px / 38px 7px repeat-x; }
/* 1: a green lawn patch with snow at its edges */
.verge-1 { background: linear-gradient(#EEF4FA 0 5px, #5E9B55 5px 23px, #EEF4FA 23px); }
.verge-1::before { background: radial-gradient(ellipse, #EEF4FA 45%, transparent 50%) 14px 22px / 62px 9px repeat-x; }
/* 2: a couple of snow-capped bushes on a snowy strip */
.verge-2::before {
  background:
    radial-gradient(ellipse 15px 6px at 50% 22%, #fff 96%, transparent) 22% 100% / 60px 34px no-repeat,
    radial-gradient(ellipse 28px 30px at 50% 100%, #2F7A3C 97%, transparent) 22% 100% / 60px 34px no-repeat,
    radial-gradient(ellipse 13px 5px at 50% 24%, #fff 96%, transparent) 71% 100% / 52px 28px no-repeat,
    radial-gradient(ellipse 24px 25px at 50% 100%, #3C8A48 97%, transparent) 71% 100% / 52px 28px no-repeat;
}
/* 3: a row of red flowers in a green bed */
.verge-3 { background: linear-gradient(#EEF4FA 0 4px, #4E8A4A 4px 24px, #EEF4FA 24px); }
.verge-3::before {
  background:
    radial-gradient(circle, var(--light) 2px, var(--red-bright) 2.5px 6px, transparent 6.5px) 0 20px / 34px 16px repeat-x,
    radial-gradient(circle, var(--light) 2px, #fff 2.5px 5px, transparent 5.5px) 17px 14px / 34px 16px repeat-x;
}
/* 4: a low hedge along the whole strip, dusted with snow */
.verge-4::before {
  background:
    radial-gradient(ellipse 12px 5px at 50% 26%, #fff 96%, transparent) 0 100% / 44px 30px repeat-x,
    radial-gradient(ellipse 23px 27px at 50% 100%, #2F7A3C 97%, transparent) 0 100% / 44px 30px repeat-x;
}
.tarmac { flex: 1; background: linear-gradient(90deg, #E9EEF3 55%, transparent 55%) 0 50% / 46px 3px repeat-x, #3B4350; }   /* the street and its dashed line */

/* "How it works" opens under the buttons in the top right corner and
   unrolls downward, instead of sitting in the middle of the screen. */
#info { inset: calc(var(--head) + 6px) 12px auto auto; margin: 0; transform-origin: top right; }
#info[open] { animation: unroll 220ms ease-out; }
@keyframes unroll { from { transform: scaleY(0.2); opacity: 0; } }
/* the steps listed in it */
.info-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; }

/* ---------- the pop-up viewer ---------- */

.viewer {
  width: min(960px, 96vw, max(340px, calc((100dvh - var(--head) - var(--foot) - 240px) * 16 / 9)));   /* narrower on a short screen, so the video fits between header and footer */
  padding: 0;
  border: 0;
  border-top: 8px solid var(--red);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.viewer-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 4px 24px; }
.viewer-bar h2 { color: var(--title-2); font-size: 1.5rem; }
/* Every pop-up's heading, and the caption under the street, use the title font. */
.hero h2, .viewer-bar h2, .ask h2 { font-family: var(--font-title); font-weight: var(--title-weight); }
/* The date with an arrow each side for the previous and next day. */
.day-nav { display: flex; align-items: center; gap: 4px; min-width: 0; margin-left: -12px; }
.day-arrow {
  border: 0; border-radius: 8px; background: none; color: var(--title-2);
  font-size: 2rem; line-height: 1; padding: 0 10px 4px; cursor: pointer;
}
.day-arrow:hover:not(:disabled) { background: var(--green-tint); }
.day-arrow:disabled { opacity: 0.25; cursor: default; }
.icon-button { border: 0; background: none; font-size: 2rem; line-height: 1; padding: 4px 12px; cursor: pointer; color: var(--muted); border-radius: 8px; }
.icon-button:hover { background: var(--paper); color: var(--ink); }

.deck-wrap { display: grid; grid-template-columns: auto 1fr auto; align-items: center; }
/* The deck is a row of slides, each exactly as wide as the deck, in a
   sideways-scrolling strip. "scroll-snap" makes it always stop on a whole
   slide, which is what gives the swipe-between-cards feel on phones. */
.deck {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.deck::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; padding: 8px 8px 16px; min-width: 0; }

.deck-arrow {
  width: 44px; height: 72px; margin: 0 4px;
  border: 0; border-radius: 10px;
  background: var(--paper); color: var(--title-2);
  font-size: 2.4rem; line-height: 1; cursor: pointer;
}
.deck-arrow:hover:not(:disabled) { background: var(--green-tint); }
.deck-arrow:disabled { opacity: 0.25; cursor: default; }
.deck-wrap.single .deck-arrow { visibility: hidden; width: 12px; margin: 0; }

.deck-dots { display: flex; justify-content: center; gap: 8px; padding: 0 0 16px; }
.deck-dots:empty { padding-bottom: 4px; }
.dot { width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 2px solid var(--green); background: none; cursor: pointer; }
.dot[aria-current="true"] { background: var(--green); }

.media {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--green-deep) center / cover no-repeat;
  display: grid; place-items: center;
}
.media iframe { width: 100%; height: 100%; border: 0; background: #fff; }
/* "Grinch Endorsed" band of green fur across the video's top-right corner,
   so a grown-up can see at a glance before playing it with kids around. It
   sits on a wrapper around the video box, because the player replaces what
   is inside the box. */
.media-wrap { position: relative; overflow: hidden; border-radius: 8px; }
/* Sized in em, so the font size alone sets the size of the whole band. */
.rated-ribbon {
  position: absolute; top: 2.12em; right: -2.7em; z-index: 1;   /* its middle is 3.3em from the top and from the right, so the words sit in the middle */
  display: grid; place-items: center; width: 12em; height: 2.36em; transform: rotate(45deg);
  font: var(--title-weight) clamp(0.9rem, 3.4vw, 1.3rem)/1 var(--font-title); color: #12290A;
  pointer-events: none;
}
.rated-ribbon svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45)); }
.rated-ribbon b { position: relative; font-weight: inherit; white-space: nowrap; }
.media-card { margin: 16px; padding: 20px 24px; max-width: 34rem; border-radius: 10px; background: rgba(255, 255, 255, 0.95); color: #242424; text-align: center; }
.media-card p { margin: 0 0 12px; }

.slide-info { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-start; padding: 14px 4px 0; }
/* The song's details take the room left beside the votes, so a long title
   wraps onto a second line instead of pushing the votes below. Only when
   there's less than 16rem beside them (phones) do the votes go underneath. */
.slide-info > :first-child { flex: 1 1 16rem; min-width: 0; }
.slide-info h3 { font-size: 1.35rem; }
.slide-artist { margin: 2px 0 0; color: var(--muted); }
/* One link: the address, opening in a new tab (the arrow says so). */
.slide-link { display: inline-block; margin-top: 8px; color: var(--title); font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }

/* The song's holiday and genres / themes, as small bubbles under the artist. */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px 2px 7px; border-radius: 999px;
  background: var(--green); color: #fff;
  font-size: 0.8rem; font-weight: 600;
}
.tag svg { width: 16px; height: 16px; }
.tag.holiday { background: var(--red); color: #fff; }

/* The icon legend, in the "How it works" pop-up. */
#info { width: min(560px, 92vw); }
.legend-title { margin: 20px 0 4px; font-family: var(--font-title); font-weight: var(--title-weight); font-size: 1.5rem; color: var(--title-2); }   /* same as "How it works" */
.legend-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; }
/* the longer labels share the full width evenly, one below the other on a phone */
.legend-wide { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 16px; }
/* Section names in the tagline's font, in capitals (Caveat has no true small capitals). */
.legend-list h4 {
  grid-column: 1 / -1; margin: 6px 0 -2px; color: var(--muted);
  font-family: var(--font-sub); font-style: var(--sub-style); font-weight: 500;
  font-size: calc(0.7rem * var(--sub-scale)); text-transform: uppercase; letter-spacing: 0.06em;
}
.legend-item { display: flex; align-items: center; gap: 10px; }   /* same size as the bullet points */
.legend-icon {
  flex: none; position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 5px;
  border-radius: 8px; background: var(--red); color: var(--icing);
  container-type: inline-size; overflow: hidden;   /* so the sample sash is sized and trimmed like a door's */
}
.legend-icon .door-arm { inset: 0; width: 34px; height: 34px; }   /* the same arm at the same tilt, filling the tile (the elbow is off the edge) */
.legend-dots { display: flex; gap: 3px; }
.legend-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--icing); }
/* The "this is a newer video of the same song" marker and its pop-up note. */
.swap { position: relative; display: inline-block; margin-left: 8px; vertical-align: top; margin-top: 6px; }
.swap-button {
  width: 24px; height: 24px; padding: 0;
  border: 2px solid var(--green); border-radius: 50%;
  background: var(--card); color: var(--title-2);
  font: italic 700 0.9rem Georgia, serif; line-height: 1; cursor: pointer;
}
.swap-button:hover, .swap-button[aria-expanded="true"] { background: var(--green); color: #fff; }
.swap-note {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 2;
  width: min(280px, 70vw); padding: 10px 12px;
  border: 1px solid var(--green-tint); border-left: 4px solid var(--green); border-radius: 6px;
  background: var(--card); color: var(--ink);
  font-size: 0.875rem; line-height: 1.4;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
/* The note is hidden until the icon is hovered, focused, or tapped open. */
.swap-note { display: none; }
.swap:hover .swap-note, .swap-button:focus-visible + .swap-note, .swap-button[aria-expanded="true"] + .swap-note { display: block; }

.votes { display: flex; gap: 8px; }
.vote {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 14px;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink);
  font-weight: 600; cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.vote:hover { border-color: var(--muted); }
.vote.up[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.vote.down[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }

/* The permission slip: the last slide of a day with picks Santa holds back. */
.permission { position: relative; max-width: 34rem; margin: 0 auto; padding: 4px 4px 8px; text-align: center; }
.permission-arm { display: block; width: 130px; height: 44px; margin: 0 auto 4px; overflow: visible; }
.permission h3 { font-family: var(--font-title); font-weight: var(--title-weight); font-size: 1.6rem; color: var(--title-2); }
.permission > p { margin: 6px 0 12px; }
.permission-paper {
  padding: 14px 18px; border: 2px solid var(--fur-dark); border-radius: 4px; transform: rotate(-0.6deg);
  background: #FFFDF4; color: #2A241B; text-align: left; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.permission-paper h4 { margin: 0 0 6px; text-align: center; font-family: var(--font-title); font-weight: var(--title-weight); font-size: 1.15rem; color: #255E2F; }
.permission-paper p { margin: 0 0 4px; font-family: var(--font-sub); font-weight: 500; font-size: 1.3rem; line-height: 1.35; }
.permission-paper input {
  width: min(8em, 100%); padding: 2px 6px; border: 0; border-bottom: 2px dashed var(--fur-dark);
  background: none; color: #691010; font: inherit; font-weight: 700; color-scheme: light;
}
.permission-paper input::placeholder { color: #8A7D66; font-weight: 500; }
.permission > .error:empty { margin: 0 0 12px; }
.permission-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.permission-off { margin-top: 12px; padding: 6px 8px; border: 0; background: none; color: var(--muted); font-size: 0.875rem; text-decoration: underline; cursor: pointer; }
.permission-off:hover { color: var(--ink); }
/* The label over a door Santa holds shut (see doorTip). */
.door-tip {
  position: fixed; z-index: 50; width: max-content; max-width: min(280px, 90vw); padding: 10px 12px; pointer-events: none;
  border: 1px solid var(--green-tint); border-left: 4px solid var(--green); border-radius: 6px;
  background: var(--card); color: var(--ink); font-size: 0.9rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.door-tip[hidden] { display: none; }
.footer { padding: 5px 12px 6px; text-align: center; color: var(--muted); font-size: clamp(0.95rem, 3.6vw, 1.2rem); line-height: 1.2; }
.error { color: var(--title); font-weight: 600; }

/* Phones: slimmer arrows; swiping does most of the work there. */
@media (max-width: 560px) {
  .deck-arrow { width: 30px; margin: 0 2px; font-size: 1.8rem; }
  .door-month { letter-spacing: 0.04em; }
  .control input[type="text"] { width: 100%; }
  .controls, .control { width: 100%; }
}

/* People who ask their device for less motion get no swinging or gliding. */
@media (prefers-reduced-motion: reduce) {
  .door-front, .door-behind, .mailbox-flag { transition: none; }
  .eaves::after, .drawer[open], #info[open] { animation: none; }
  .deck { scroll-behavior: auto; }
}
