:root {
  --bg: #fbf7f0;
  --surface: #ffffff;
  --ink: #2b1d17;
  --muted: #7a6a60;
  --line: #eadfd2;
  --red: #a4161a;        /* the dominant color + the action color */
  --red-ink: #ffffff;
  --red-soft: #fbe9e7;
  --green: #1e5631;      /* semantic: aired / watched */
  --star-off: #e6d9cb;
  --radius: 12px;
  --display: "Fraunces", Georgia, serif;
  --body: "Inter", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1210; --surface: #241917; --ink: #f5ece4; --muted: #b3a196; --line: #3a2b26;
    --red: #d63a3e; --red-soft: #3a1c1c; --green: #6fbf8a; --star-off: #4a3832;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1210; --surface: #241917; --ink: #f5ece4; --muted: #b3a196; --line: #3a2b26;
  --red: #d63a3e; --red-soft: #3a1c1c; --green: #6fbf8a; --star-off: #4a3832;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.6 var(--body); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
button, input, select { font: inherit; color: inherit; }

/* masthead */
.masthead { background: #a4161a; color: #fff; }
.masthead__inner { display: flex; align-items: center; gap: 16px; padding-top: 22px; padding-bottom: 16px; }
.logo { font-size: 56px; line-height: 1; flex: none; filter: drop-shadow(0 4px 10px rgb(0 0 0 / .25)); }
.masthead h1 { font: 800 clamp(30px, 5vw, 46px)/1 var(--display); letter-spacing: -0.02em; margin: 0; }
.masthead p { margin: 6px 0 0; opacity: .9; }
.masthead__text { flex: 1; min-width: 0; }
.me { font-size: 15px; text-align: right; }
.me button { background: #fff; color: #a4161a; border: 0; border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; }
.me .link { background: none; color: #fff; padding: 0; text-decoration: underline; font-weight: 400; }

.seasons { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 0; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: #fff; opacity: .85;
  padding: 10px 16px; cursor: pointer; border-radius: 10px 10px 0 0; font-weight: 600; white-space: nowrap; text-decoration: none;
}
.tab[aria-current="true"] { background: var(--bg); color: var(--ink); opacity: 1; }
.tab:hover { opacity: 1; }
/* the year picker looks like tab text with a caret */
.tab--picker { position: relative; }
.tab--picker select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; padding: 0 20px 0 0; cursor: pointer; field-sizing: content; /* width follows the picked year */
}
.tab--picker::after { content: "▾"; position: absolute; right: 16px; pointer-events: none; font-size: 18px; line-height: 1; }
.tab--picker select:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 4px; }
.tab--picker option { color: #2b1d17; background: #fff; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 8px; }
.controls input, .controls select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 16px;
}
.controls input { flex: 1 1 220px; }
.filters { display: contents; }
.filters-toggle { display: none; }
@media (max-width: 700px) {
  .controls input { flex: 1 1 0; min-width: 0; }
  .filters-toggle {
    display: inline-flex; align-items: center; gap: 6px; flex: none; cursor: pointer;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 16px; font-weight: 600;
  }
  .controls--open .filters-toggle { border-color: var(--ink); }
  .filters { display: none; }
  .controls--open .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
  .filters select { width: 100%; min-width: 0; }
}
.filters-toggle__n { background: var(--red); color: var(--red-ink); border-radius: 999px; font-size: 12px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; }
.count { color: var(--muted); font-size: 15px; margin: 0 0 12px; }

/* movie rows */
.movies { list-style: none; margin: 0; padding: 0; }
.movie {
  display: grid; grid-template-columns: 64px 64px minmax(0, 1fr) 200px 250px; gap: 20px; align-items: center;
  padding: 18px 0; border-top: 1px solid var(--line);
}
.movie__date { font-weight: 600; font-size: 15px; line-height: 1.2; }
.movie__date small { display: block; color: var(--muted); font-weight: 400; }
.movie__title { font: 600 21px/1.25 var(--display); letter-spacing: -0.01em; margin: 0; }
.movie__title a { color: inherit; text-decoration: none; }
.movie__title a:hover { text-decoration: underline; }
.poster { display: block; width: 64px; height: 96px; border-radius: 6px; object-fit: cover; background: var(--red-soft); }
.poster--empty { display: grid; place-items: center; font-size: 28px; }
.movie__meta { color: var(--muted); font-size: 15px; margin-top: 2px; }
.movie__meta .aired { color: var(--green); }
.movie__comment { font-size: 15px; margin: 6px 0 0; white-space: pre-line; max-width: 65ch; }
.movie__comment::before { content: "“"; }
.movie__comment::after { content: "”"; }
.upcoming .movie__title { color: var(--muted); }

.family__avg { display: flex; align-items: baseline; gap: 8px; }
.family__avg b { font-size: 15px; }
.family__none { color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 13px; background: var(--red-soft); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.chip--plain { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* stars: grey row of 5 with a red overlay clipped to the score */
.stars { position: relative; display: inline-block; font-size: 22px; line-height: 1; letter-spacing: 2px; color: var(--star-off); }
.stars::before { content: "★★★★★"; }
.stars__fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--red); white-space: nowrap; width: var(--pct, 0%); }
.stars__fill::before { content: "★★★★★"; }
.stars--sm { font-size: 16px; letter-spacing: 1px; }

.mine { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mine__label { font-size: 13px; color: var(--muted); }
/* big, tight stars like Letterboxd: ~44px per star, so each half is a 22px target */
.rater { position: relative; display: inline-block; cursor: pointer; font-size: 44px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.rater .stars { font-size: inherit; letter-spacing: 0; }
.rater[data-preview]::after {
  content: attr(data-preview); position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%);
  font: 600 13px/1 var(--body); background: var(--ink); color: var(--bg); padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.rater__hit { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(10, 1fr); }
.rater__hit button { border: 0; background: transparent; padding: 0; cursor: pointer; }
.rater__hit button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.mine__row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.pill { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: 13px; cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill--poop { font-size: 18px; padding: 0 8px; filter: grayscale(1); opacity: .6; }
.pill--poop[aria-pressed="true"], .pill--poop:hover { filter: none; opacity: 1; background: var(--red-soft); border-color: var(--red); }
.saving { opacity: .5; }

.footer { color: var(--muted); font-size: 15px; padding-top: 32px; padding-bottom: 48px; }
.footer button { background: none; border: 0; padding: 0; color: var(--red); text-decoration: underline; cursor: pointer; font-size: 15px; }

/* login */
dialog { border: 0; border-radius: var(--radius); padding: 28px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(30 10 8 / .55); }
dialog h2 { font: 800 28px/1.1 var(--display); letter-spacing: -0.02em; margin: 0 0 16px; }
.names { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.names label { cursor: pointer; }
.names input { position: absolute; opacity: 0; }
.names span { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; }
.names input:checked + span { background: var(--red); border-color: var(--red); color: var(--red-ink); }
.names input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
dialog label[for="code"] { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
dialog #code { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
.error { color: var(--red); font-size: 15px; min-height: 1.6em; margin: 6px 0; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn { background: var(--red); color: var(--red-ink); border: 0; border-radius: 999px; padding: 10px 20px; font-weight: 600; cursor: pointer; }
.btn--ghost { background: transparent; color: var(--ink); }

@media (max-width: 860px) {
  .movie { grid-template-columns: 56px minmax(0, 1fr); gap: 6px 14px; align-items: start; }
  .movie__date { grid-column: 2; grid-row: 1; color: var(--muted); }
  .movie > .poster, .movie > a { grid-column: 1; grid-row: 1 / span 4; }
  .poster { width: 56px; height: 84px; }
  .movie__main, .movie__family, .movie__mine { grid-column: 2; }
  .masthead__inner { flex-wrap: wrap; gap: 12px; }
  .logo { font-size: 40px; }
  .me { width: 100%; text-align: left; }
}

/* favorites button: grey until it's yours */
.pill--fav { font-size: 18px; padding: 0 8px; filter: grayscale(1); opacity: .6; }
.pill--fav[aria-pressed="true"], .pill--fav:hover { filter: none; opacity: 1; background: var(--red-soft); border-color: var(--red); }
a.chip { color: inherit; text-decoration: none; }
a.chip:hover { text-decoration: underline; }
.me a { color: #fff; }

/* profile page */
.profile { padding-top: 24px; }
.back { color: var(--muted); font-size: 15px; text-decoration: none; }
.back:hover { color: var(--ink); }
.profile__name { font: 800 clamp(36px, 6vw, 52px)/1.05 var(--display); letter-spacing: -0.02em; margin: 12px 0 4px; }
.profile__name small { font: 400 18px var(--body); color: var(--muted); letter-spacing: 0; }
.profile__stats { color: var(--muted); margin: 0 0 28px; }
.profile__h { font: 600 22px/1.2 var(--display); margin: 32px 0 12px; }
.favs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; max-width: 720px; }
.fav { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; min-width: 0; }
.fav img, .fav__empty { width: 100%; aspect-ratio: 2 / 3; border-radius: 8px; object-fit: cover; background: var(--red-soft); }
.fav__empty { display: grid; place-items: center; font-size: 40px; }
.fav--slot .fav__empty { background: transparent; border: 2px dashed var(--line); filter: grayscale(1); opacity: .5; }
.fav__title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.fav__season { color: var(--muted); font-size: 13px; }
.fav--slot .fav__title { color: var(--muted); font-weight: 400; }
@media (max-width: 560px) { .favs { gap: 10px; } .fav__title { font-size: 13px; } }

/* count + CSV download on one line */
.countbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; align-items: baseline; margin-bottom: 12px; }
.countbar .count { margin: 0; }
.export { margin: 0; font-size: 15px; color: var(--muted); }
.export a { color: var(--red); }

.hint { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
dialog #member-name { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
dialog label[for="member-name"] { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.pill--clear { color: var(--muted); }
.pill--clear:hover { color: var(--ink); border-color: var(--ink); }
.filters-toggle__n[hidden] { display: none; }

/* 🎄 cursor on desktop (mouse/trackpad only). Tip of the tree is the click point.
   Links, buttons and text fields keep their usual cursors so clickable stuff still reads as clickable. */
@media (hover: hover) and (pointer: fine) {
  body {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ctext x='2' y='27' font-size='28'%3E%F0%9F%8E%84%3C/text%3E%3C/svg%3E") 16 3, auto;
  }
}

/* family tab sits with the season tabs */

/* the family: stockings hung on a mantel, like the reference art, in the site palette */
.fireplace { max-width: 820px; margin: 28px auto 0; }
.mantel-row { position: relative; margin-bottom: 44px; }
.mantel {
  position: relative; height: 34px; background: #fffaf2; border: 3px solid #2b1d17; border-radius: 4px; z-index: 1;
}
.mantel::after { /* the ledge under the shelf */
  content: ""; position: absolute; left: 14px; right: 14px; top: 100%; height: 10px;
  background: #efe3cf; border: 3px solid #2b1d17; border-top: 0;
}
.mantel__deco { position: absolute; bottom: calc(100% + 1px); font-size: 34px; line-height: 1; }
.mantel__deco--l { left: 12%; }
.mantel__deco--m { left: 50%; transform: translateX(-50%); font-size: 22px; }
.mantel__deco--r { right: 12%; }
.hearth { position: relative; display: flex; justify-content: center; gap: 14px; padding: 0 56px; margin-top: 2px; }
.hearth::before, .hearth::after { /* striped columns at each end */
  content: ""; position: absolute; top: 10px; width: 34px; height: 130px;
  background: repeating-linear-gradient(90deg, #fffaf2 0 5px, #2b1d17 5px 8px); border: 3px solid #2b1d17; border-top: 0;
}
.hearth::before { left: 10px; }
.hearth::after { right: 10px; }
.stocking { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 112px; color: inherit; text-decoration: none; }
.stocking__art { position: relative; display: block; width: 100%; transform-origin: 50% 0; transition: transform .2s; }
.stocking__art svg { display: block; width: 100%; height: auto; }
.stocking:hover .stocking__art, .stocking:focus-visible .stocking__art { transform: rotate(-5deg); }
.stocking__name { /* sits on the white cuff */
  position: absolute; left: 7.3%; width: 74.5%; top: 6.3%; height: 22.5%;
  display: grid; place-items: center; text-align: center; padding: 0 4px;
  font: 700 15px/1.05 var(--display); color: #2b1d17; overflow: hidden; overflow-wrap: anywhere;
}
.stocking__stat { font-size: 13px; color: var(--muted); }
@media (max-width: 520px) {
  .hearth { gap: 8px; padding: 0; }
  .hearth::before, .hearth::after { display: none; }
  .stocking { width: 96px; }
  .stocking__name { font-size: 13px; }
  .mantel__deco { font-size: 28px; }
}

/* small stockings under a profile, to hop between people (name below; the cuff is too small) */
.strip { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.stocking--sm { width: 58px; }
.stocking--sm .stocking__name { position: static; display: block; height: auto; width: auto; padding: 0; margin-top: 2px; font: 600 13px/1.2 var(--body); color: var(--ink); }
.strip__all { align-self: center; color: var(--red); font-size: 15px; }

/* the sleigh: flies up and across after some ratings (see flySleigh) */
.sleigh {
  position: fixed; top: 22vh; left: 0; width: min(520px, 78vw); z-index: 50; pointer-events: none;
  color: var(--ink); animation: sleigh-fly 2.6s cubic-bezier(.4, .1, .6, .9) forwards;
}
.sleigh svg { display: block; width: 100%; height: auto; overflow: visible; }
@keyframes sleigh-fly {
  0%   { transform: translate(-100%, 60px) rotate(-2deg); }
  50%  { transform: translate(calc(50vw - 50%), 0) rotate(-6deg); }
  100% { transform: translate(100vw, -90px) rotate(-10deg); }
}
