:root {
  --bg: #0b1a2e;
  --bg-2: #12294a;
  --surface: #16335c;
  --surface-2: #1d4173;
  --text: #f6f2ea;
  --muted: #a9b8cc;
  --red: #c8323c;
  --green: #1f8a5b;
  --gold: #e8b84a;
  --radius: 14px;
  --font-heading: 'Mountains of Christmas', Georgia, serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%) fixed, var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  line-height: 1.1;
  margin: 0 0 0.5rem;
}

a {
  color: var(--gold);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header / footer */
.site-header {
  padding-top: 1.25rem;
  padding-bottom: 1rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  color: var(--text);
  text-decoration: none;
}

.logo span {
  color: var(--gold);
}

.site-footer {
  padding-top: 2rem;
  padding-bottom: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--muted);
  text-underline-offset: 3px;
}

.footer-links a:hover,
.footer-links a[aria-current='page'] {
  color: var(--text);
}

/* Legal pages */
.prose {
  max-width: 720px;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.prose h1 {
  font-size: clamp(2.4rem, 7vw, 3.4rem);
}

.prose h2 {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 800;
  margin: 2rem 0 0.5rem;
}

.prose p,
.prose li {
  color: #d5dde8;
}

.prose ul {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose strong {
  color: var(--text);
}

.updated {
  margin-top: 0;
  font-size: 0.9rem;
  color: var(--muted) !important;
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 0 2.5rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.5rem);
  color: var(--text);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.lead {
  max-width: 36rem;
  margin: 0.75rem auto 0;
  font-size: 1.15rem;
  color: var(--muted);
}

.status {
  display: inline-block;
  margin: 1.5rem 0 0;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: rgba(232, 184, 74, 0.12);
  border: 1px solid rgba(232, 184, 74, 0.4);
  color: var(--gold);
  font-weight: 800;
  min-height: 1em;
}

.status:empty {
  display: none;
}

/* Calendars */
.section-title {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 1.25rem;
}

.card {
  --accent: var(--gold);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 4px solid var(--accent);
  position: relative;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:not(.soon):hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.card h3 {
  font-size: 2rem;
  color: var(--accent);
  padding-right: 3rem; /* room for the heart */
}

/* Title row: the calendar's icon in a tinted badge, then the title. */
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 3rem; /* room for the heart */
}
.card-head h3 {
  margin: 0;
  padding-right: 0;
}
.cal-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 18%, rgba(0, 0, 0, 0.25));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.cal-icon svg {
  width: 44px;
  height: 44px;
}

.card h3 a {
  color: inherit;
  text-decoration: none;
}

.card h3 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.card .tagline {
  margin: -0.5rem 0 0;
  font-weight: 800;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.cta {
  margin-top: auto;
  align-self: flex-start;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: var(--red);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  transition: background 0.15s ease;
}

.cta:hover {
  background: #d9434d;
}

/* Favourite heart (top right of each card) */
.heart {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.heart:hover {
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
}

.heart:active {
  transform: scale(0.9);
}

.heart-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

.is-fav .heart {
  color: #ff5a6e;
}

.is-fav .heart-icon {
  fill: currentColor;
  animation: pop 0.3s ease;
}

@keyframes pop {
  50% {
    transform: scale(1.3);
  }
}

/* Big heart that pops over the card on double-tap */
.burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  fill: #ff5a6e;
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
  animation: burst 0.8s ease forwards;
}

@keyframes burst {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  25% {
    transform: scale(1.15);
    opacity: 1;
  }
  45% {
    transform: scale(0.95);
  }
  80% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.1);
    opacity: 0;
  }
}

/* All / Favourites switch */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-head .section-title {
  margin: 0;
}

.views {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.views a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.views a:hover {
  color: var(--text);
}

.views a[aria-current='page'] {
  background: var(--surface-2);
  color: var(--text);
}

.count {
  min-width: 1.4em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: #ff5a6e;
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: center;
}

.count:empty {
  display: none;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  max-width: calc(100% - 2rem);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, 150%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.card.soon {
  border-top-color: rgba(255, 255, 255, 0.2);
  border-style: dashed;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 220px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.card.soon h3 {
  color: var(--muted);
  font-size: 1.6rem;
  padding-right: 0;
}

/* About */
.about {
  margin-top: 3rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.facts li {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.facts strong {
  display: block;
  color: var(--text);
}

/* Snowfall: two layers of dots drifting down */
.snow,
.snow::after {
  position: fixed;
  inset: -100vh 0 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 140px 90px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(3px 3px at 260px 160px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(2px 2px at 90px 220px, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(3px 3px at 210px 280px, rgba(255, 255, 255, 0.6), transparent);
  background-size: 300px 300px;
  animation: snow 30s linear infinite;
  opacity: 0.5;
}

.snow::after {
  content: '';
  inset: 0;
  background-size: 420px 420px;
  animation-duration: 45s;
  opacity: 0.7;
}

@keyframes snow {
  to {
    transform: translateY(100vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .snow,
  .snow::after {
    animation: none;
  }

  .card,
  .heart,
  .toast {
    transition: none;
  }

  .is-fav .heart-icon,
  .burst {
    animation: none;
  }

  .burst {
    display: none;
  }
}

.card.soon .cta {
  align-self: center;
  margin-top: 0.5rem;
}
