/* Midnight / New Year's Eve — event palette and typography */
:root {
  color-scheme: dark;
  --canvas: #0b1123;
  --surface: #18233c;
  --surface-2: #202c47;
  --border: #35415c;
  --border-strong: #65718b;
  --ink: #fcf7ec;
  --muted: #bec7d6;
  --accent: #ecd29d;
  --accent-hover: #ffe5ae;
  --accent-ink: #18233c;
  --accent-text: #ffe3a7;
  --accent-strong: #ffebbd;
  --accent-soft: #34415e;
  --accent-border: #8d795a;
  --success: #5acb9e;
  --success-ink: #0c2920;
  --success-soft: #1a4338;
  --success-strong: #a9f4d0;
  --warning: #efba73;
  --warning-ink: #392408;
  --warning-soft: #4f3626;
  --warning-strong: #ffe0a8;
  --danger: #ec8a98;
  --danger-ink: #39111b;
  --danger-soft: #512b38;
  --danger-strong: #ffb9c7;
  --chart-1: #ecd29d;
  --chart-2: #a6aedb;
  --chart-3: #78c9be;
  --chart-4: #caa0c9;
  --chart-5: #dd987c;
  --chart-6: #9baed1;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Manrope", "Inter Variable", sans-serif;
  --font-sans: "Manrope", "Inter Variable", sans-serif;
  --font-mono: "Space Mono", "JetBrains Mono Variable", monospace;
  --display-weight: 400;
  --display-tracking: -0.05em;
  --eyebrow-tracking: 0.22em;
  --radius-btn: 999px;
  --radius-card: 30px;
  --radius-input: 16px;
  --border-w: 1px;
  --border-strong-w: 1px;
  --shadow-card: 0 25px 85px rgba(0,0,0,0.22);
  --shadow-raised: 0 18px 55px rgba(0,0,0,0.24);
  --shadow-btn: 0 10px 28px rgba(0,0,0,0.20);
  --card-pad: 1.5rem;
  --caps: uppercase;
  --caps-tracking: 0.18em;
  --btn-weight: 700;
  --measure: 68ch;
  --x-starlight: #f3ddb6;
  --x-aura: #2b3764;
  --x-aura-second: #2a3651;
  --x-spark: #d8bb84;
  --x-clock-panel: #111d36;
  --x-clock-edge: #48526b;
  --x-year-ghost: #242e48;
}
html[data-theme="light"] {
  color-scheme: light;
  --canvas: #f7f0e4;
  --surface: #ffffff;
  --surface-2: #eee5d6;
  --border: #d8cbb6;
  --border-strong: #aa9d8d;
  --ink: #192943;
  --muted: #59677b;
  --accent: #253d63;
  --accent-hover: #344e78;
  --accent-ink: #ffffff;
  --accent-text: #29486d;
  --accent-strong: #203e68;
  --accent-soft: #e2e9f4;
  --accent-border: #a7bbd3;
  --success: #167049;
  --success-ink: #ffffff;
  --success-soft: #d8f1e3;
  --success-strong: #135436;
  --warning: #975708;
  --warning-ink: #ffffff;
  --warning-soft: #fae9c7;
  --warning-strong: #724008;
  --danger: #af3447;
  --danger-ink: #ffffff;
  --danger-soft: #f9dde1;
  --danger-strong: #8c2034;
  --chart-1: #253d63;
  --chart-2: #8a74ac;
  --chart-3: #238e7c;
  --chart-4: #97597e;
  --chart-5: #b57651;
  --chart-6: #647dae;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Manrope", "Inter Variable", sans-serif;
  --font-sans: "Manrope", "Inter Variable", sans-serif;
  --font-mono: "Space Mono", "JetBrains Mono Variable", monospace;
  --display-weight: 400;
  --display-tracking: -0.05em;
  --eyebrow-tracking: 0.22em;
  --radius-btn: 999px;
  --radius-card: 30px;
  --radius-input: 16px;
  --border-w: 1px;
  --border-strong-w: 1px;
  --shadow-card: 0 25px 85px rgba(0,0,0,0.10);
  --shadow-raised: 0 18px 55px rgba(0,0,0,0.13);
  --shadow-btn: 0 10px 28px rgba(0,0,0,0.10);
  --card-pad: 1.5rem;
  --caps: uppercase;
  --caps-tracking: 0.18em;
  --btn-weight: 700;
  --measure: 68ch;
  --x-starlight: #ac8752;
  --x-aura: #e7d8c5;
  --x-aura-second: #ebe5dc;
  --x-spark: #a8743c;
  --x-clock-panel: #fffcf6;
  --x-clock-edge: #d4c4ab;
  --x-year-ghost: #e4dacb;
}
/* The one-screen New Year's celebration */
.midnight-body { margin: 0; font-family: var(--font-body); }
.midnight-scene {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse 52% 38% at 50% 36%, var(--x-aura) 0%, transparent 100%), var(--canvas);
  color: var(--ink);
}
.midnight-stars {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .65;
  background-image:
    radial-gradient(circle, var(--x-starlight) 1px, transparent 1.5px),
    radial-gradient(circle, var(--x-starlight) 1px, transparent 1.5px),
    radial-gradient(circle, var(--x-starlight) 1.4px, transparent 2px);
  background-size: 167px 193px, 283px 263px, 383px 317px;
  background-position: 22px 32px, 123px 85px, 36px 134px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 12%, black 77%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 12%, black 77%, transparent);
}
.midnight-halo { position: absolute; z-index: -1; width: 35vw; height: 35vw; min-width: 300px; min-height: 300px; border: 1px solid var(--x-clock-edge); border-radius: 50%; opacity: .27; pointer-events: none; }
.midnight-halo:before, .midnight-halo:after { content: ""; display: block; position: absolute; border: 1px solid var(--x-clock-edge); border-radius: 50%; inset: 14%; }
.midnight-halo:after { inset: 29%; }
.midnight-halo-left { top: 20%; left: -28vw; }
.midnight-halo-right { top: 10%; right: -28vw; }
.midnight-header {
  width: min(100%, 1440px); margin-inline: auto; padding: 30px 6%;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: relative; z-index: 3;
}
.midnight-brand { color: var(--ink); display: inline-flex; align-items: center; gap: 11px; text-decoration: none; letter-spacing: -.035em; font-size: 17px; font-weight: 800; line-height: 1; }
.midnight-brand-icon { color: var(--accent-text); display: grid; place-items: center; }
.midnight-brand-icon .icon { width: 25px; height: 25px; stroke-width: 1.5; }
.midnight-brand-small { font-weight: 500; opacity: .64; margin-left: 4px; }
.midnight-header-right { display: flex; align-items: center; gap: 23px; }
.midnight-header-date { font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .19em; white-space: nowrap; }
.midnight-theme-toggle { width: 39px; height: 39px; padding: 0; border-radius: 50%; background: var(--surface); color: var(--ink); border: 1px solid var(--border); display: grid; place-items: center; cursor: pointer; transition: background .2s ease, transform .2s ease; }
.midnight-theme-toggle:hover { background: var(--surface-2); transform: translateY(-1px); }
.midnight-theme-toggle .icon { width: 17px; height: 17px; }
.midnight-theme-toggle [data-when="dark"] { display: none; }
html[data-theme="dark"] .midnight-theme-toggle [data-when="dark"] { display: inline-flex; }
html[data-theme="dark"] .midnight-theme-toggle [data-when="light"] { display: none; }
html:not([data-theme="light"]):not([data-theme="dark"]) .midnight-theme-toggle [data-when="dark"] { display: inline-flex; }
html:not([data-theme="light"]):not([data-theme="dark"]) .midnight-theme-toggle [data-when="light"] { display: none; }

.midnight-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 42px 24px 46px; position: relative; z-index: 1; width: 100%; }
.midnight-hero { text-align: center; position: relative; z-index: 2; }
.midnight-kicker { display: inline-flex; justify-content: center; align-items: center; gap: 12px; color: var(--accent-text); font-size: 10px; font-weight: 800; letter-spacing: .22em; margin-bottom: 26px; }
.midnight-kicker-star { font-size: 12px; line-height: 1; }
.midnight-hero h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(4.2rem, 8.2vw, 9.5rem); line-height: .98; letter-spacing: -.055em; text-wrap: balance; }
.midnight-hero em { color: var(--accent-text); font-weight: 400; }
.midnight-subtitle { color: var(--muted); margin: 27px 0 0; font-size: clamp(13px, 1.2vw, 16px); line-height: 1.7; letter-spacing: .015em; }

.midnight-countdown-wrap { position: relative; width: min(100%, 1060px); margin-top: 62px; }
.midnight-ghost-year { font-family: var(--font-body); font-size: clamp(135px, 27vw, 370px); font-weight: 800; line-height: 1; letter-spacing: -.105em; text-align: center; pointer-events: none; position: absolute; inset-inline: 0; top: -0.68em; color: var(--x-year-ghost); user-select: none; z-index: -1; }
.midnight-clock { background: color-mix(in srgb, var(--x-clock-panel) 89%, transparent); border: 1px solid var(--x-clock-edge); box-shadow: var(--shadow-card), inset 0 1px 0 color-mix(in srgb, var(--ink) 12%, transparent); border-radius: 26px; overflow: hidden; position: relative; -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.midnight-clock:before { content: ""; position: absolute; top: 0; left: 10%; right: 10%; height: 1px; background: linear-gradient(90deg, transparent, var(--x-starlight), transparent); opacity: .8; pointer-events: none; }
.midnight-clock-bar { padding: 23px 32px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.midnight-live { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.midnight-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 12%, transparent); animation: live-pulse 2.5s infinite; }
.midnight-clock-target { color: var(--accent-text); font-size: 10px; font-weight: 800; letter-spacing: .18em; white-space: nowrap; }
.midnight-timer { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); align-items: stretch; padding: 21px 18px 39px; }
.midnight-time-part { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 8px 10px 5px; }
.midnight-time-part + .midnight-time-part { border-left: 1px solid var(--border); }
.midnight-number { display: block; color: var(--ink); font-family: var(--font-body); font-weight: 800; font-size: clamp(48px, 6.8vw, 103px); line-height: 1.1; letter-spacing: -.085em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.midnight-seconds .midnight-number { color: var(--accent-text); }
.midnight-number.is-ticking { animation: digit-tick .3s ease-out; }
.midnight-unit { font-size: 10px; margin-top: 17px; color: var(--muted); letter-spacing: .24em; font-weight: 800; }
.midnight-clock-bottom { min-height: 53px; background: color-mix(in srgb, var(--surface-2) 49%, transparent); border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 10px 32px; gap: 15px; }
.midnight-clock-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; letter-spacing: .025em; }
.midnight-small-icon { width: 15px; height: 15px; stroke-width: 1.75; flex: 0 0 auto; }
.midnight-clock-ornament { color: var(--accent-text); font-size: 15px; letter-spacing: .35em; white-space: nowrap; }
.midnight-celebration[hidden] { display: none; }
.midnight-celebration { position: relative; padding: 35px 24px 65px; min-height: 230px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; text-align: center; color: var(--ink); }
.midnight-celebration strong { font: 400 clamp(50px, 8vw, 99px)/1 var(--font-display); letter-spacing: -.04em; color: var(--accent-text); }
.midnight-celebration span:last-child { color: var(--muted); font-size: 14px; }
.midnight-celebration-spark { color: var(--accent-text); letter-spacing: .6em; }
.midnight-scene.is-celebrating .midnight-timer { display: none; }
.midnight-scene.is-celebrating .midnight-clock-target { display: none; }
.midnight-scene.is-celebrating .midnight-live { color: var(--accent-text); }
.midnight-scene.is-celebrating .midnight-live-dot { background: var(--accent-text); }
.midnight-actions { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 36px; min-height: 148px; }
.midnight-little-note { margin: 0 0 20px; font-size: 10px; color: var(--muted); font-weight: 800; letter-spacing: .17em; }
.midnight-dot-separator { padding-inline: 5px; color: var(--accent-text); }
.midnight-share { appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 22px; border: 1px solid var(--border-strong); border-radius: 100px; background: color-mix(in srgb, var(--surface) 55%, transparent); color: var(--ink); font: 700 12px var(--font-body); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.midnight-share:hover { transform: translateY(-2px); border-color: var(--accent-text); background: var(--surface-2); }
.midnight-share:focus-visible, .midnight-theme-toggle:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
.midnight-share-status { margin: 9px 0 0; min-height: 15px; color: var(--muted); font-size: 11px; }
.midnight-footer { width: min(100%, 1440px); margin-inline: auto; padding: 21px 6% 25px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .19em; }
.midnight-footer-right { display: flex; align-items: center; gap: 7px; }
.midnight-footer-right span { color: var(--accent-text); }
.midnight-no-script { position: relative; text-align: center; padding: 10px; font-size: 12px; color: var(--muted); }

.midnight-firework { position: absolute; width: 150px; height: 150px; border: 1px dashed var(--x-spark); border-radius: 50%; opacity: .2; z-index: 0; pointer-events: none; transform: scale(.9); }
.midnight-firework::before, .midnight-firework::after { content: ""; position: absolute; inset: 23px; border: 1px dashed var(--x-spark); border-radius: 50%; }
.midnight-firework::after { inset: 51px; background: var(--x-spark); opacity: .33; }
.midnight-firework-a { top: 23%; left: 8%; }
.midnight-firework-b { right: 7%; top: 29%; width: 105px; height: 105px; }
.midnight-firework-c { bottom: 16%; right: 17%; width: 52px; height: 52px; }
.midnight-scene.is-celebrating .midnight-firework { opacity: .75; animation: celebrate-burst 2s ease-in-out infinite; }
.midnight-scene.is-celebrating .midnight-firework-b { animation-delay: -.7s; }
.midnight-scene.is-celebrating .midnight-firework-c { animation-delay: -1.4s; }

@keyframes digit-tick { from { opacity: .55; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--success) 5%, transparent); } }
@keyframes celebrate-burst { 0%,100% { transform: scale(.55) rotate(0); opacity: .2; } 45% { transform: scale(1.3) rotate(35deg); opacity: .9; } }
@media (max-width: 760px) {
  .midnight-header { padding: 24px 5%; }
  .midnight-main { padding: 46px 16px 25px; }
  .midnight-hero h1 { font-size: clamp(59px, 10vw, 78px); }
  .midnight-countdown-wrap { margin-top: 57px; }
  .midnight-number { font-size: clamp(47px, 10vw, 78px); }
  .midnight-clock-bar { padding: 22px 22px 8px; }
  .midnight-timer { padding: 28px 8px 39px; }
  .midnight-time-part { padding-inline: 3px; }
  .midnight-clock-bottom { padding-inline: 22px; }
  .midnight-halo-left { left: -260px; }
  .midnight-halo-right { right: -260px; }
}
@media (max-width: 540px) {
  .midnight-brand { font-size: 14px; }
  .midnight-header-date { display: none; }
  .midnight-main { justify-content: flex-start; padding-top: 55px; }
  .midnight-kicker { font-size: 8px; letter-spacing: .15em; margin-bottom: 22px; gap: 7px; }
  .midnight-hero h1 { font-size: clamp(62px, 14vw, 83px); }
  .midnight-subtitle { max-width: 285px; margin: 22px auto 0; font-size: 13px; }
  .midnight-countdown-wrap { margin-top: 61px; }
  .midnight-ghost-year { font-size: 37vw; top: -.57em; }
  .midnight-clock { border-radius: 23px; }
  .midnight-clock-bar { padding: 21px 19px 6px; }
  .midnight-live, .midnight-clock-target { font-size: 8px; letter-spacing: .1em; }
  .midnight-timer { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0; padding: 12px 18px 29px; }
  .midnight-time-part { padding: 14px 5px; }
  .midnight-time-part + .midnight-time-part { border-left: 0; }
  .midnight-time-part:nth-child(2n) { border-left: 1px solid var(--border); }
  .midnight-time-part:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .midnight-number { font-size: clamp(58px, 18vw, 93px); }
  .midnight-unit { margin-top: 5px; font-size: 9px; }
  .midnight-clock-bottom { padding: 14px 20px; }
  .midnight-clock-note { font-size: 10px; }
  .midnight-clock-ornament { display: none; }
  .midnight-little-note { font-size: 9px; line-height: 1.9; }
  .midnight-actions { padding-top: 25px; }
  .midnight-footer { flex-direction: column; justify-content: center; gap: 9px; font-size: 8px; text-align: center; }
  .midnight-firework-a { left: -85px; }
  .midnight-firework-b { right: -55px; }
}
@media (prefers-reduced-motion: reduce) {
  .midnight-live-dot, .midnight-number.is-ticking, .midnight-scene.is-celebrating .midnight-firework { animation: none !important; }
  .midnight-share, .midnight-theme-toggle { transition: none; }
}