/* ExtendedTimetable 2 — Halloween season layer.
   Load after tokens.css and components/bundle.css. Everything here applies only under
   data-theme="halloween-light" or data-theme="halloween-dark"; with any other theme it does nothing.
   Decorations are CSS masks filled with tokens, so they follow the theme. They never carry meaning:
   all of them are pseudo-elements, invisible to screen readers and to the no-CSS page. */

[data-theme^="halloween"] {
  --mask-pumpkin: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22%23000000%22%3E %3Cpath d=%22M11.2 5.6c-.1-1.6.5-3 1.8-3.9l1.1 1.1c-.9.7-1.3 1.6-1.2 2.8z%22/%3E %3Cellipse cx=%227.6%22 cy=%2213.6%22 rx=%225.1%22 ry=%227%22/%3E %3Cellipse cx=%2216.4%22 cy=%2213.6%22 rx=%225.1%22 ry=%227%22/%3E %3Cellipse cx=%2212%22 cy=%2213.4%22 rx=%224.6%22 ry=%227.6%22/%3E %3C/svg%3E");
  --mask-bat: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 48 24%22 fill=%22%23000000%22%3E %3Cpath d=%22M24 7.2c.9 0 1.6.6 1.9 1.4l.8-2.1.9 2.5C30.4 6 34.6 4.4 39 5c-1.6 1-2.5 2.6-2.5 4.4 1.9-.7 4.2-.5 5.9.8-2.4.5-4.3 2-5 4.1-2.4-1.4-5.5-1.2-7.6.8-.8-1.6-2.4-2.8-4.2-3.1L24 17.6l-1.6-5.6c-1.8.3-3.4 1.5-4.2 3.1-2.1-2-5.2-2.2-7.6-.8-.7-2.1-2.6-3.6-5-4.1 1.7-1.3 4-1.5 5.9-.8 0-1.8-.9-3.4-2.5-4.4 4.4-.6 8.6 1 11.4 3.5l.9-2.5.8 2.1c.3-.8 1-1.4 1.9-1.4z%22/%3E %3C/svg%3E");
  --mask-bats: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 96 40%22 fill=%22%23000%22%3E%3Cg transform=%22translate%280 12%29 scale%281%29%22%3E%3Cpath d=%22M24 7.2c.9 0 1.6.6 1.9 1.4l.8-2.1.9 2.5C30.4 6 34.6 4.4 39 5c-1.6 1-2.5 2.6-2.5 4.4 1.9-.7 4.2-.5 5.9.8-2.4.5-4.3 2-5 4.1-2.4-1.4-5.5-1.2-7.6.8-.8-1.6-2.4-2.8-4.2-3.1L24 17.6l-1.6-5.6c-1.8.3-3.4 1.5-4.2 3.1-2.1-2-5.2-2.2-7.6-.8-.7-2.1-2.6-3.6-5-4.1 1.7-1.3 4-1.5 5.9-.8 0-1.8-.9-3.4-2.5-4.4 4.4-.6 8.6 1 11.4 3.5l.9-2.5.8 2.1c.3-.8 1-1.4 1.9-1.4z%22/%3E%3C/g%3E%3Cg transform=%22translate%2852 0%29 scale%28.75%29%22%3E%3Cpath d=%22M24 7.2c.9 0 1.6.6 1.9 1.4l.8-2.1.9 2.5C30.4 6 34.6 4.4 39 5c-1.6 1-2.5 2.6-2.5 4.4 1.9-.7 4.2-.5 5.9.8-2.4.5-4.3 2-5 4.1-2.4-1.4-5.5-1.2-7.6.8-.8-1.6-2.4-2.8-4.2-3.1L24 17.6l-1.6-5.6c-1.8.3-3.4 1.5-4.2 3.1-2.1-2-5.2-2.2-7.6-.8-.7-2.1-2.6-3.6-5-4.1 1.7-1.3 4-1.5 5.9-.8 0-1.8-.9-3.4-2.5-4.4 4.4-.6 8.6 1 11.4 3.5l.9-2.5.8 2.1c.3-.8 1-1.4 1.9-1.4z%22/%3E%3C/g%3E%3C/svg%3E");
  --mask-web: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22 fill=%22none%22 stroke=%22%23000000%22 stroke-width=%221.25%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E %3Cpath d=%22M64 0L-3.2 0.0%22/%3E %3Cpath d=%22M64 0L5.1 25.0%22/%3E %3Cpath d=%22M64 0L20.4 46.8%22/%3E %3Cpath d=%22M64 0L42.1 60.1%22/%3E %3Cpath d=%22M64 0L64.0 67.2%22/%3E %3Cpath d=%22M50.0 0.0Q52.8 2.3 51.1 5.5Q54.6 6.6 54.5 10.2Q58.0 9.8 59.2 13.2Q62.0 11.3 64.0 14.0%22/%3E %3Cpath d=%22M36.0 0.0Q41.5 4.6 38.2 10.9Q45.2 13.2 44.9 20.5Q52.0 19.6 54.4 26.3Q60.0 22.6 64.0 28.0%22/%3E %3Cpath d=%22M20.0 0.0Q28.6 7.2 23.5 17.2Q34.4 20.7 34.0 32.2Q45.1 30.8 49.0 41.3Q57.7 35.5 64.0 44.0%22/%3E %3Cpath d=%22M4.0 0.0Q15.8 9.8 8.8 23.4Q23.7 28.2 23.1 43.9Q38.3 41.9 43.5 56.4Q55.5 48.5 64.0 60.0%22/%3E %3C/svg%3E");
  --mask-ghost: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22 %3E %3Cpath d=%22M9 10h.01%22 /%3E %3Cpath d=%22M15 10h.01%22 /%3E %3Cpath d=%22M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z%22 /%3E %3C/svg%3E");
  --mask-graveyard: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 224 84%22 fill=%22%23000%22%3E%3Cpath d=%22M0 84V62Q56 44 112 54T224 50V84z%22/%3E%3Cpath d=%22M36 58V41.5a7.5 7.5 0 0 1 15 0V58z%22/%3E%3Cpath d=%22M62 54V43.5a5.5 5.5 0 0 1 11 0V54z%22/%3E%3Crect x=%22147.9%22 y=%2228%22 width=%224.2%22 height=%2228%22/%3E%3Crect x=%22142.5%22 y=%2235.0%22 width=%2215%22 height=%224.2%22/%3E%3Cpath d=%22M176 54V36.5a8.5 8.5 0 0 1 17 0V54z%22/%3E%3Cpath d=%22M200 52V44.5a4.5 4.5 0 0 1 9 0V52z%22/%3E%3Cpath d=%22M14 62V34M14 46l-7-6M14 40l6-7M20 33l4-3M7 40l-3-5%22 stroke=%22%23000%22 stroke-width=%222.5%22 stroke-linecap=%22round%22 fill=%22none%22/%3E%3C/svg%3E");
  --mask-tombstones: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 160 16%22 fill=%22%23000%22%3E%3Crect x=%220%22 y=%2214%22 width=%22160%22 height=%222%22/%3E%3Cpath d=%22M12 15V9.0a4.0 4.0 0 0 1 8 0V15z%22/%3E%3Crect x=%2246.88%22 y=%223%22 width=%222.24%22 height=%2212%22/%3E%3Crect x=%2244.0%22 y=%226.0%22 width=%228%22 height=%222.24%22/%3E%3Cpath d=%22M90 15V8.0a5.0 5.0 0 0 1 10 0V15z%22/%3E%3Cpath d=%22M130 15V10.5a3.5 3.5 0 0 1 7 0V15z%22/%3E%3Cpath d=%22M26 15l2-5 2 5zM70 15l1.5-4 1.5 4zM110 15l2-6 2 6zM146 15l1.5-4 1.5 4z%22/%3E%3C/svg%3E");
  --mask-spider: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 44%22 fill=%22%23000%22 stroke=%22%23000%22 stroke-linecap=%22round%22%3E%3Crect x=%227.5%22 y=%220%22 width=%221%22 height=%2230%22 stroke=%22none%22/%3E%3Ccircle cx=%228%22 cy=%2229.5%22 r=%222.4%22 stroke=%22none%22/%3E%3Cellipse cx=%228%22 cy=%2235.5%22 rx=%224%22 ry=%224.6%22 stroke=%22none%22/%3E%3Cpath d=%22M5 33L1 29M4.5 35H0.5M5 37.5L1 41M6 39.5L4 43.5M11 33L15 29M11.5 35H15.5M11 37.5L15 41M10 39.5L12 43.5%22 stroke-width=%221.1%22 fill=%22none%22/%3E%3C/svg%3E");
  --mask-pumpkin-outline: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.75%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E %3Cpath d=%22M3 13.5a9 7.5 0 1 0 18 0a9 7.5 0 1 0-18 0z%22/%3E %3Cpath d=%22M12 6.2c-2.6 1.6-3.6 4.4-3.6 7.3s1 5.7 3.6 7.3M12 6.2c2.6 1.6 3.6 4.4 3.6 7.3s-1 5.7-3.6 7.3%22/%3E %3Cpath d=%22M12 6V3.6c0-.9.7-1.6 1.6-1.6%22/%3E %3C/svg%3E");
  --mask-pumpkin-carved: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%221.75%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E %3Cpath d=%22M3 13.5a9 7.5 0 1 0 18 0a9 7.5 0 1 0-18 0z%22/%3E %3Cpath d=%22M12 6V3.6c0-.9.7-1.6 1.6-1.6%22/%3E %3Cpath d=%22M7.6 12l1.8-2.4 1 2.4zM13.6 12l1-2.4 1.8 2.4z%22 stroke-width=%221.25%22/%3E %3Cpath d=%22M7.5 15.2l1.7 1.3 1.4-1.1 1.4 1.3 1.4-1.3 1.4 1.1 1.7-1.3%22/%3E %3C/svg%3E");
  --mask-jack: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22%23000%22%3E %3Cpath fill-rule=%22evenodd%22 d=%22M3 13.5a9 7.5 0 1 0 18 0a9 7.5 0 1 0-18 0zM7.5 12.2L9.5 9.4L10.6 12.2zM13.4 12.2L14.5 9.4L16.5 12.2zM6.8 14.8L8.8 16.3L10.4 15.1L12 16.6L13.6 15.1L15.2 16.3L17.2 14.8L15.6 18.1L8.4 18.1z%22/%3E %3Cpath d=%22M11.1 6.4V3.8c0-1 .8-1.8 1.8-1.8h.8v1.7h-.6c-.3 0-.5.2-.5.5v2.2z%22/%3E %3C/svg%3E");
}

/* Pumpkin before the wordmark (sidebar) and the group code (phone top bar) */
[data-theme^="halloween"] .wordmark { display: inline-flex; align-items: center; gap: var(--space-8); }
[data-theme^="halloween"] .wordmark::before,
[data-theme^="halloween"] .topbar-group::before {
  content: ""; flex: none; width: 18px; height: 18px;
  background: var(--halloween-pumpkin);
  -webkit-mask: var(--mask-pumpkin) center / contain no-repeat; mask: var(--mask-pumpkin) center / contain no-repeat;
}

/* Two bats in the sidebar's top corner and in the phone top bar */
[data-theme^="halloween"] .sidebar { position: relative; }
[data-theme^="halloween"] .sidebar::after,
[data-theme^="halloween"] .topbar::after {
  content: ""; position: absolute; pointer-events: none;
  width: 60px; height: 26px;
  background: var(--halloween-violet);
  -webkit-mask: var(--mask-bats) center / contain no-repeat; mask: var(--mask-bats) center / contain no-repeat;
}
[data-theme^="halloween"] .sidebar::after { top: 58px; right: 14px; }
[data-theme^="halloween"] .topbar::after { top: 15px; left: 50%; transform: translateX(-50%); }

/* Now card: a cobweb in the top-right corner, a pumpkin for the state dot, a glow while a class is on */
[data-theme^="halloween"] .now-card { position: relative; overflow: hidden; }
[data-theme^="halloween"] .now-card::after {
  content: ""; position: absolute; top: 0; right: 0; width: 88px; height: 88px; pointer-events: none;
  background: var(--halloween-web);
  -webkit-mask: var(--mask-web) top right / contain no-repeat; mask: var(--mask-web) top right / contain no-repeat;
}
[data-theme^="halloween"] .now-state::before {
  width: 12px; height: 12px; border-radius: 0;
  background: var(--halloween-pumpkin);
  -webkit-mask: var(--mask-pumpkin) center / contain no-repeat; mask: var(--mask-pumpkin) center / contain no-repeat;
}
[data-theme^="halloween"] .now-card.is-now { border-color: var(--accent); box-shadow: 0 10px 40px var(--halloween-glow); }
[data-theme^="halloween"] .now-title { padding-right: 40px; }

/* Candy-corn stripes on the accent progress bars (not on subject bars) */
[data-theme^="halloween"] .now-time .bar > span,
[data-theme^="halloween"] .grade-total .bar > span {
  background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, var(--halloween-candy) 8px 16px);
}

/* Empty states get a ghost instead of the section icon */
[data-theme^="halloween"] .empty .glyph { background: var(--halloween-violet-subtle); }
[data-theme^="halloween"] .empty .glyph > svg { display: none; }
[data-theme^="halloween"] .empty .glyph::before {
  content: ""; width: 24px; height: 24px; background: var(--halloween-violet);
  -webkit-mask: var(--mask-ghost) center / contain no-repeat; mask: var(--mask-ghost) center / contain no-repeat;
}

/* Today's dots in the day strip become tiny pumpkins */
[data-theme^="halloween"] .day.is-today .dots i {
  width: 6px; height: 6px; border-radius: 0; margin-top: -1px;
  -webkit-mask: var(--mask-pumpkin) center / contain no-repeat; mask: var(--mask-pumpkin) center / contain no-repeat;
}


/* A spider hanging from the Now card's cobweb */
[data-theme^="halloween"] .now-card::before {
  content: ""; position: absolute; top: 0; right: 52px; width: 12px; height: 34px; pointer-events: none; z-index: 1;
  background: var(--halloween-violet);
  -webkit-mask: var(--mask-spider) top center / contain no-repeat; mask: var(--mask-spider) top center / contain no-repeat;
  transform-origin: top center; animation: hw-spider 3.2s ease-in-out infinite alternate;
}

/* A small bat after every page title */
[data-theme^="halloween"] .page-head h1::after {
  content: ""; display: inline-block; width: 26px; height: 13px; margin-left: 10px; vertical-align: 0.55em;
  background: var(--halloween-violet);
  -webkit-mask: var(--mask-bat) center / contain no-repeat; mask: var(--mask-bat) center / contain no-repeat;
  animation: hw-flap 2.6s ease-in-out infinite alternate;
}

/* Desktop: a moonlit graveyard above the sidebar footer (hidden when the sidebar is too short for it) */
[data-theme^="halloween"] .sidebar-foot { position: relative; }
[data-theme^="halloween"] .sidebar-foot::before {
  content: ""; position: absolute; left: -12px; right: -12px; bottom: 100%; height: 84px; pointer-events: none;
  background: var(--halloween-hill);
  -webkit-mask: var(--mask-graveyard) bottom center / 100% auto no-repeat; mask: var(--mask-graveyard) bottom center / 100% auto no-repeat;
}
[data-theme^="halloween"] .sidebar-foot::after {
  content: ""; position: absolute; right: 22px; bottom: calc(100% + 54px); width: 26px; height: 26px; border-radius: 50%; pointer-events: none;
  background: var(--halloween-moon); box-shadow: 0 0 18px 4px var(--halloween-glow);
}
@media (max-height: 760px) {
  [data-theme^="halloween"] .sidebar-foot::before, [data-theme^="halloween"] .sidebar-foot::after { display: none; }
}

/* Phone: tombstones peeking over the bottom bar */
[data-theme^="halloween"] .bottom-nav::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 16px; pointer-events: none;
  background: var(--halloween-hill);
  -webkit-mask: var(--mask-tombstones) bottom left / 160px 16px repeat-x; mask: var(--mask-tombstones) bottom left / 160px 16px repeat-x;
}

/* Homework status: pumpkins instead of circles. Not started = a plain pumpkin, in progress = carved,
   done = a lit jack-o'-lantern (accent body, candle glow through the face). The words stay in the sr-only text and title. */
[data-theme^="halloween"] .status-check > svg, [data-theme^="halloween"] .segmented [data-status] > svg { display: none; }
[data-theme^="halloween"] .status-check::before, [data-theme^="halloween"] .status-check::after,
[data-theme^="halloween"] .segmented [data-status]::before, [data-theme^="halloween"] .segmented [data-status]::after {
  content: ""; grid-area: 1 / 1; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: var(--mask-pumpkin-outline) center / contain no-repeat; mask: var(--mask-pumpkin-outline) center / contain no-repeat;
}
[data-theme^="halloween"] .status-check::after, [data-theme^="halloween"] .segmented [data-status]::after { content: none; }
[data-theme^="halloween"] .segmented [data-status] { display: inline-grid; grid-template-columns: 16px auto; column-gap: var(--space-6); align-items: center; }
[data-theme^="halloween"] .segmented [data-status]::before, [data-theme^="halloween"] .segmented [data-status]::after { width: 16px; height: 16px; grid-area: 1 / 1; }
[data-theme^="halloween"] .status-check[data-status="in_progress"]::before, [data-theme^="halloween"] .segmented [data-status="in_progress"]::before {
  -webkit-mask-image: var(--mask-pumpkin-carved); mask-image: var(--mask-pumpkin-carved);
}
[data-theme^="halloween"] .status-check[data-status="done"]::after, [data-theme^="halloween"] .segmented [data-status="done"]::after {
  content: ""; background: var(--accent);
  -webkit-mask: var(--mask-jack) center / contain no-repeat; mask: var(--mask-jack) center / contain no-repeat;
}
[data-theme^="halloween"] .status-check[data-status="done"]::before, [data-theme^="halloween"] .segmented [data-status="done"]::before {
  -webkit-mask: none; mask: none; border-radius: 50%; transform: scale(.62) translateY(2px);
  background: var(--halloween-candy); box-shadow: 0 0 10px 3px var(--halloween-glow);
}
[data-theme^="halloween"] .status-check[data-status="in_progress"], [data-theme^="halloween"] .status-check[data-status="done"] { color: var(--accent); }
[data-theme^="halloween"] .segmented [data-status="not_started"][aria-pressed="true"] { color: var(--text); }
[data-theme^="halloween"] .segmented [data-status="in_progress"][aria-pressed="true"], [data-theme^="halloween"] .segmented [data-status="done"][aria-pressed="true"] { color: var(--text); }
[data-theme^="halloween"] .segmented [data-status="in_progress"][aria-pressed="true"]::before { background: var(--accent); }
[data-theme^="halloween"] .segmented [data-status="done"][aria-pressed="false"]::after { background: var(--text-secondary); }

/* Motion: slow and small; all of it stops with prefers-reduced-motion */
[data-theme^="halloween"] .sidebar::after, [data-theme^="halloween"] .topbar::after { animation: hw-drift 4s ease-in-out infinite alternate; }
[data-theme^="halloween"] .now-card.is-now .now-state::before, [data-theme^="halloween"] .status-check[data-status="done"]::before { animation: hw-flicker 3s steps(1, end) infinite; }
[data-theme^="halloween"] .empty .glyph::before { animation: hw-float 2.4s ease-in-out infinite alternate; }
@keyframes hw-drift { from { translate: 0 0; } to { translate: 3px -3px; } }
@keyframes hw-flap { from { scale: 1 1; } to { scale: 1 0.82; } }
@keyframes hw-spider { from { translate: 0 -6px; } to { translate: 0 2px; } }
@keyframes hw-float { from { translate: 0 1px; } to { translate: 0 -2px; } }
@keyframes hw-flicker { 0%, 100% { opacity: 1; } 42% { opacity: .7; } 46% { opacity: 1; } 71% { opacity: .8; } 74% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  [data-theme^="halloween"] *, [data-theme^="halloween"] *::before, [data-theme^="halloween"] *::after { animation: none !important; }
}

@media (forced-colors: active) {
  [data-theme^="halloween"] .wordmark::before, [data-theme^="halloween"] .topbar-group::before, [data-theme^="halloween"] .sidebar::after, [data-theme^="halloween"] .topbar::after, [data-theme^="halloween"] .now-card::after, [data-theme^="halloween"] .now-card::before, [data-theme^="halloween"] .page-head h1::after, [data-theme^="halloween"] .sidebar-foot::before, [data-theme^="halloween"] .sidebar-foot::after, [data-theme^="halloween"] .bottom-nav::before { display: none; }
}
