/* Christmas theme — everything here is added by js/christmas.js,
   and only between 25/10 and 1/1. The theme itself is html.xmas (button next to the logo). */

/* ── Button next to the logo ─────────────────────────────── */
.xmas-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.xmas-toggle {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  background: var(--white);
  border: 2px solid rgba(212, 47, 47, 0.3);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  animation: xmas-wiggle 6s ease-in-out 2s infinite;
}

.xmas-toggle:hover {
  transform: scale(1.1);
  border-color: rgba(212, 47, 47, 0.6);
}

.xmas-toggle[aria-pressed="true"] {
  border-color: #d42f2f;
  box-shadow: 0 0 0 4px rgba(212, 47, 47, 0.15), 0 0 18px rgba(255, 196, 0, 0.75);
  animation: none;
}

/* a small shake every few seconds so people notice it */
@keyframes xmas-wiggle {
  0%, 86%, 100% { transform: rotate(0); }
  88% { transform: rotate(-16deg); }
  91% { transform: rotate(13deg); }
  94% { transform: rotate(-8deg); }
  97% { transform: rotate(4deg); }
}

/* ── Christmas colours ─────────────────────────────────────
   The brand green and orange become pine green and Christmas red everywhere
   (buttons, icons, numbers, lines all use these two variables). */
html.xmas {
  --primary-green: #1e7b34;
  --primary-orange: #c8102e;
  --gradient-soft: linear-gradient(135deg, rgba(30, 123, 52, 0.07) 0%, rgba(200, 16, 46, 0.07) 100%);
}

/* dark green-to-red hero with white and gold text */
html.xmas .hero {
  margin-bottom: 0; /* the search heading sits below the dark hero, on the light background */
}

html.xmas .hero-gradient {
  background: linear-gradient(135deg, #0b3d22 0%, #14532d 45%, #7f1d1d 100%);
}

html.xmas .hero-pattern {
  background-image:
    radial-gradient(circle at 25% 25%, rgba(255, 213, 79, 0.16) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(239, 68, 68, 0.22) 0%, transparent 50%);
  background-size: 100% 100%; /* one glow over the whole hero: tiles showed hard seams on the dark background */
}

html.xmas .hero-title-main {
  background: linear-gradient(135deg, #ffffff 0%, #ffe082 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

html.xmas .hero-title-sub {
  color: var(--white);
}

html.xmas .hero-description {
  color: rgba(255, 255, 255, 0.85);
}

html.xmas .search-section {
  padding-top: var(--spacing-lg);
}

/* red / white / green ribbon along the top of every card */
html.xmas :is(.job-card, .trade-card)::before {
  height: 5px;
  transform: scaleX(1);
  background: repeating-linear-gradient(135deg, #c8102e 0 10px, #ffffff 10px 16px, #1e7b34 16px 26px, #ffffff 26px 32px);
}

/* pine-green footer with a red and gold line on top */
html.xmas .main-footer {
  background:
    linear-gradient(#c8102e, #c8102e) top / 100% 4px no-repeat,
    linear-gradient(#ffd54f, #ffd54f) 0 4px / 100% 2px no-repeat,
    #0b3d22;
}

html.xmas .footer-column a:hover {
  color: #ffd54f; /* red on pine green was too hard to read */
}

/* keep the countdown bar's space from the first paint, so the page doesn't jump when it appears */
html.xmas .main-nav {
  margin-bottom: 44px;
}

html.xmas .main-nav:has(+ .xmas-bar) {
  margin-bottom: 0;
}

/* the open phone menu sits above the lights */
html.xmas .nav-menu {
  z-index: 1;
}

/* ── Festive buttons ──────────────────────────────────────────
   A gold shine across the main buttons every few seconds, the icon rings like a bell
   on hover, and candy-cane stripes on the light buttons. */
html.xmas :is(.contact-btn, .job-card-link, .highlight-card-btn, .apply-phone, .trade-card-call, .trade-cta-btn) {
  background:
    linear-gradient(105deg, transparent 20%, rgba(255, 241, 196, 0.6) 50%, transparent 80%) -100% 0 / 50% 100% no-repeat,
    var(--gradient-primary);
  animation: xmas-shine 6s ease-in-out infinite;
}

html.xmas .shadow-job .job-card-link {
  animation: none;
}

@keyframes xmas-shine {
  0%, 70% { background-position: -100% 0, 0 0; }
  100% { background-position: 200% 0, 0 0; }
}

html.xmas :is(.contact-btn, .job-card-link, .highlight-card-btn, .apply-btn, .trade-card-call, .trade-cta-btn, .back-btn):hover i {
  transform-origin: 50% 0;
  animation: xmas-ring 0.7s ease-in-out;
}

@keyframes xmas-ring {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(18deg); }
  40% { transform: rotate(-14deg); }
  60% { transform: rotate(9deg); }
  80% { transform: rotate(-5deg); }
}

html.xmas :is(.reset-filters, .back-btn):hover {
  color: #b71c1c;
  background-color: var(--white);
  background-image: linear-gradient(-45deg, #fde0e0 25%, transparent 25%, transparent 50%, #fde0e0 50%, #fde0e0 75%, transparent 75%);
  background-size: 24px 24px;
  animation: xmas-candy 0.8s linear infinite;
}

@keyframes xmas-candy {
  to { background-position: 24px 0; }
}

/* ── Music button (next to the 🎄) ───────────────────────── */
.xmas-music {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  line-height: 1;
  background: var(--white);
  border: 2px solid rgba(46, 125, 50, 0.3);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), border-color var(--transition-base);
}

.xmas-music:hover {
  transform: scale(1.1);
}

.xmas-music[aria-pressed="true"] {
  border-color: #2e7d32;
  animation: xmas-bob 0.9s ease-in-out infinite alternate;
}

@keyframes xmas-bob {
  to { transform: translateY(-2px) rotate(-6deg); }
}

/* ── Santa hat on the logo ───────────────────────────────── */
html.xmas .main-nav .logo {
  position: relative;
}

.xmas-hat {
  position: absolute;
  left: -8%;
  top: -20%;
  width: 28%;
  transform: rotate(-20deg);
  transform-origin: 70% 90%;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.15));
  animation: xmas-sway 2.8s ease-in-out infinite alternate;
}

@keyframes xmas-sway {
  from { transform: rotate(-25deg); }
  to { transform: rotate(-14deg); }
}

.xmas-hat svg {
  width: 100%;
  height: auto;
}

/* ── Lights along the bottom of the menu ─────────────────── */
html.xmas .main-nav::before,
html.xmas .main-nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 14px;
  pointer-events: none;
  animation: xmas-twinkle 1.4s steps(1) infinite;
}

html.xmas .main-nav::before {
  background:
    radial-gradient(circle at 10px 8px, #e53935 0 4px, transparent 4.5px) 0 0 / 80px 14px repeat-x,
    radial-gradient(circle at 50px 8px, #43a047 0 4px, transparent 4.5px) 0 0 / 80px 14px repeat-x,
    linear-gradient(#2e5d32, #2e5d32) 0 3px / 100% 1px no-repeat;
}

html.xmas .main-nav::after {
  background:
    radial-gradient(circle at 30px 8px, #fbc02d 0 4px, transparent 4.5px) 0 0 / 80px 14px repeat-x,
    radial-gradient(circle at 70px 8px, #1e88e5 0 4px, transparent 4.5px) 0 0 / 80px 14px repeat-x;
  animation-delay: 0.7s;
}

@keyframes xmas-twinkle {
  0% { opacity: 1; filter: brightness(1.25) saturate(1.2); }
  50% { opacity: 0.45; filter: none; }
}

/* ── Countdown bar under the menu ────────────────────────── */
.xmas-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  padding: 0.75rem var(--spacing-sm) 0.5rem;
  background: linear-gradient(90deg, #1e5631 0%, #2e7d32 35%, #b71c1c 65%, #8e1414 100%);
  color: var(--white);
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: center;
}

.xmas-bar strong {
  color: #ffd54f;
  font-variant-numeric: tabular-nums;
}

/* ── Snow ─────────────────────────────────────────────────── */
.xmas-snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  z-index: 1500;
  pointer-events: none;
}

/* ── Pop-up ───────────────────────────────────────────────── */
.xmas-popup {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto; /* a phone held sideways is shorter than the card: scroll instead of cutting it */
  padding: var(--spacing-md);
  background: rgba(17, 24, 39, 0.55);
  animation: xmas-fade 0.25s ease-out;
}

.xmas-popup [hidden] {
  display: none !important;
}

.xmas-popup-card {
  margin: auto; /* centred when it fits, scrollable from the top when it doesn't */
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-2xl);
  text-align: center;
  animation: xmas-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.xmas-popup-card:focus {
  outline: none;
}

.xmas-popup-cta:focus-visible,
.xmas-popup-dismiss:focus-visible {
  outline: 3px solid #b71c1c; /* gold was hard to see on white */
  outline-offset: 3px;
}

.xmas-popup-close:focus-visible {
  outline: 3px solid #ffd54f; /* on the dark green header */
  outline-offset: 3px;
}

.xmas-popup-head {
  position: relative;
  overflow: hidden;
  padding: 1.75rem 1.5rem 1.375rem;
  background: linear-gradient(135deg, #1e5631 0%, #2e7d32 40%, #b71c1c 100%);
  color: var(--white);
}

.xmas-popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  z-index: 1;
}

.xmas-popup-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.xmas-popup-emoji {
  display: block;
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 0.625rem;
  position: relative;
}

.xmas-popup-title {
  position: relative;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1.25;
}

.xmas-flake {
  position: absolute;
  top: -1.5rem;
  color: rgba(255, 255, 255, 0.75);
  animation: xmas-fall linear infinite;
  pointer-events: none;
}

@keyframes xmas-fall {
  to { transform: translateY(13rem) rotate(200deg); }
}

.xmas-countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding: 1.25rem 1.25rem 0.25rem;
}

.xmas-countdown div {
  padding: 0.625rem 0.25rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
}

.xmas-countdown b {
  display: block;
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.2;
  color: #b71c1c;
  font-variant-numeric: tabular-nums;
}

.xmas-countdown span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.xmas-popup-text {
  padding: 0.75rem 1.5rem 0;
  color: var(--gray-600);
  font-size: 1rem;
}

.xmas-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem 1.5rem 1.5rem;
}

.xmas-popup-cta {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #2e7d32 0%, #c62828 100%);
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.xmas-popup-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.xmas-popup-dismiss {
  padding: 0.5rem;
  color: var(--gray-500);
  font-weight: 600;
}

.xmas-popup-dismiss:hover {
  color: var(--gray-700);
}

@keyframes xmas-fade {
  from { opacity: 0; }
}

@keyframes xmas-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
}

/* ── Phones ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .xmas-toggle,
  .xmas-music {
    width: 36px;
    height: 36px;
    font-size: 1.125rem;
  }

  .xmas-brand {
    gap: 0.5rem;
  }

  .xmas-bar {
    font-size: 0.875rem;
  }

  .xmas-countdown b {
    font-size: 1.375rem;
  }

  html.xmas .main-nav {
    margin-bottom: 42px; /* the countdown bar's height on phones */
  }
}

/* ── Tablets held upright: make room for 🎄 / 🎵 so the menu still fits ── */
@media (min-width: 769px) and (max-width: 1020px) {
  .xmas-brand ~ .nav-menu {
    gap: 1rem;
  }

  .xmas-brand ~ .nav-actions :is(.contact-btn, .back-btn) span {
    display: none;
  }

  .xmas-brand ~ .nav-actions :is(.contact-btn, .back-btn) {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    justify-content: center;
  }
}

/* ── Less motion for people who asked their device for it ── */
@media (prefers-reduced-motion: reduce) {
  .xmas-toggle,
  .xmas-music[aria-pressed="true"],
  .xmas-hat,
  html.xmas .main-nav::before,
  html.xmas .main-nav::after,
  html.xmas :is(.contact-btn, .job-card-link, .highlight-card-btn, .apply-phone, .trade-card-call, .trade-cta-btn),
  html.xmas :is(.reset-filters, .back-btn):hover,
  html.xmas :is(.contact-btn, .job-card-link, .highlight-card-btn, .apply-btn, .trade-card-call, .trade-cta-btn, .back-btn):hover i,
  .xmas-flake,
  .xmas-popup,
  .xmas-popup-card {
    animation: none;
  }
}
