:root {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #b8b8b8;
  --digit-face: #1a1a1a;
  --digit-face-top: #242424;
  --digit-face-bottom: #121212;
  --shell: #0d0d0d;
  --shell-edge: #2a2a2a;
  --glow: rgba(220, 230, 255, 0.55);
  --font-display: "Anton", sans-serif;
  --font-ui: "Montserrat", sans-serif;
}

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

html,
body.beat-the-vat-promo {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
}

body.beat-the-vat-promo {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 50% 35%, rgba(40, 40, 45, 0.35), transparent 70%),
    #000;
}

body.beat-the-vat-promo img {
  max-width: none;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem 2.5rem 1rem;
  position: relative;
  z-index: 10;
}

.logo {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: clamp(0.85rem, 1.4vw, 1.05rem);
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: clamp(1.1rem, 2.2vw, 2rem);
}

.nav a {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  opacity: 0.92;
  transition: opacity 0.2s ease;
}

.nav a:hover {
  opacity: 0.6;
}

.nav-toggle {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: #fff;
}

/* Hero */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1.25rem 2rem;
}

.hero-title {
  margin: 0.6rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.4rem, 10.5vw, 7rem);
  line-height: 0.98;
  letter-spacing: 0.015em;
}

.hero-subtitle {
  margin: 0.3rem 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4.3vw, 2.8rem);
  letter-spacing: 0.03em;
  line-height: 1.05;
}

/* Countdown shell — real frame render with live digits overlaid */
.countdown-shell {
  position: relative;
  margin-top: 2.25rem;
  width: min(780px, 95vw);
  aspect-ratio: 1024 / 406;
  background: url("../img/timer-frame.png") center / 100% 100% no-repeat;
  container-type: inline-size;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.7));
}

/*
  Digit row — each unit is absolutely positioned over a flap well
  measured from timer-frame.png (wells are unevenly spaced):
  well 1: x 130-306, well 2: x 336-512, well 3: x 540-716, well 4: x 740-916
  flap plates: y 72-204 of 406
*/
.countdown {
  position: absolute;
  inset: 0;
  z-index: 1;
  perspective: 900px;
}

/*
  Units span pin-to-pin across each flap assembly (measured from the
  hinge pins in timer-frame.png — the flaps narrow slightly to the right):
  pins: 145-294, 352-501, 557-702, 757-898 of 1024; hinge row y=140 of 406
*/
.unit {
  position: absolute;
  top: 18.2%;
  height: 32.6%;
}

.unit:nth-of-type(1) { left: 14.16%; width: 14.55%; }
.unit:nth-of-type(2) { left: 34.38%; width: 14.55%; }
.unit:nth-of-type(3) { left: 54.39%; width: 14.16%; }
.unit:nth-of-type(4) { left: 73.93%; width: 13.77%; }

.unit-label {
  position: absolute;
  top: calc(100% + 2.2cqw);
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(7px, 1.45cqw, 11px);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #fff;
  white-space: nowrap;
}

/* Two half-flap cards meeting at the centre pin — digits land at 25% / 75% */
.flip-slot {
  position: absolute;
  inset: 4% 0;
  display: flex;
  gap: 0;
}

/*
  Flip card — static faces are transparent so the frame image's real flap
  plates show through; only the animated flaps carry a matching face colour.
*/
.flip-card {
  position: relative;
  flex: 1;
  height: 100%;
  font-family: "Oswald", var(--font-display);
  font-weight: 500;
  font-size: 9.6cqw;
  line-height: 1;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-perspective: 400px;
  perspective: 400px;
  isolation: isolate;
  /* Promote a stable compositor layer on iOS */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.flip-card .base,
.flip-card .flap {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

.flip-card .base.top {
  top: 0;
}

.flip-card .base.bottom {
  bottom: 0;
}

.flip-card .base .digit,
.flip-card .flap .digit {
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f3f3f3;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.85);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.flip-card .base.top .digit,
.flip-card .flap.top .digit {
  top: 0;
}

.flip-card .base.bottom .digit,
.flip-card .flap.bottom .digit {
  bottom: 0;
}

/*
  Hinge mask — sits above the animating flaps (z-index 7 > flipping z-index 4)
  and blends with the frame image's own dark hinge line. Hides the digit
  sliver that peeks out at the seam mid-flip.
*/
.flip-card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  /* translateZ lifts the mask in front of the rotating flaps (preserve-3d) */
  transform: translateY(-1.5px) translateZ(2px);
  background: linear-gradient(
    180deg,
    rgba(8, 8, 8, 0.7),
    rgba(0, 0, 0, 0.95) 50%,
    rgba(8, 8, 8, 0.7)
  );
  z-index: 7;
  pointer-events: none;
}

.flip-card .flap {
  z-index: 3;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transform-origin: center bottom;
  /* Avoid iOS painting a white clear before the first animated frame */
  will-change: transform, opacity;
}

/* Animated flaps are opaque, colour-matched to the image's flap plates */
.flip-card .flap.top {
  top: 0;
  background: linear-gradient(180deg, #242424 0%, #181818 100%);
  border-radius: 0.35cqw 0.35cqw 0 0;
  transform-origin: bottom center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.9);
  box-shadow: 0 5px 8px rgba(0, 0, 0, 0.4);
  -webkit-transform: rotateX(0deg);
  transform: rotateX(0deg);
}

.flip-card .flap.bottom {
  bottom: 0;
  background: linear-gradient(180deg, #1d1d1d 0%, #121212 100%);
  border-radius: 0 0 0.35cqw 0.35cqw;
  transform-origin: top center;
  /* Edge-on + invisible until the top flap finishes — prevents iOS flash */
  -webkit-transform: rotateX(90deg);
  transform: rotateX(90deg);
  opacity: 0;
  z-index: 2;
}

.flip-card.flipping .flap.top {
  -webkit-animation: flipTop 0.45s ease-in forwards;
  animation: flipTop 0.45s ease-in forwards;
  z-index: 4;
}

.flip-card.flipping .flap.bottom {
  -webkit-animation: flipBottom 0.45s ease-out 150ms forwards;
  animation: flipBottom 0.45s ease-out 150ms forwards;
  z-index: 4;
}

@-webkit-keyframes flipTop {
  0% {
    -webkit-transform: rotateX(0deg);
    transform: rotateX(0deg);
  }
  100% {
    -webkit-transform: rotateX(-90deg);
    transform: rotateX(-90deg);
  }
}

@keyframes flipTop {
  0% {
    -webkit-transform: rotateX(0deg);
    transform: rotateX(0deg);
  }
  100% {
    -webkit-transform: rotateX(-90deg);
    transform: rotateX(-90deg);
  }
}

@-webkit-keyframes flipBottom {
  0%,
  49.9% {
    -webkit-transform: rotateX(90deg);
    transform: rotateX(90deg);
    opacity: 0;
  }
  50% {
    -webkit-transform: rotateX(90deg);
    transform: rotateX(90deg);
    opacity: 1;
  }
  100% {
    -webkit-transform: rotateX(0deg);
    transform: rotateX(0deg);
    opacity: 1;
  }
}

@keyframes flipBottom {
  0%,
  49.9% {
    -webkit-transform: rotateX(90deg);
    transform: rotateX(90deg);
    opacity: 0;
  }
  50% {
    -webkit-transform: rotateX(90deg);
    transform: rotateX(90deg);
    opacity: 1;
  }
  100% {
    -webkit-transform: rotateX(0deg);
    transform: rotateX(0deg);
    opacity: 1;
  }
}

/* Date panel — overlays the blank lower plate in the frame image */
.date-panel {
  position: absolute;
  left: 11.5%;
  right: 11.5%;
  top: 64%;
  height: 22%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8cqw;
}

.countdown-date {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(11px, 2.5cqw, 20px);
  letter-spacing: 0.18em;
}

.offer-rule {
  width: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4cqw;
  margin: 0;
  font-size: clamp(7px, 1.4cqw, 11px);
  font-weight: 600;
  letter-spacing: 0.24em;
}

.offer-rule::before,
.offer-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
}

/* Terms & CTAs */
.terms {
  margin-top: 1.85rem;
  max-width: 640px;
}

.terms p {
  margin: 0.2rem 0;
  font-size: clamp(0.78rem, 1.5vw, 0.92rem);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: #f0f0f0;
}

.terms-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.terms-link:hover,
.terms-link:focus-visible {
  opacity: 1;
}

/* Terms modal */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  background: #0c0c0c;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  color: #f2f2f2;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.4rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.modal-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: #fff;
  color: #000;
}

.modal-body {
  padding: 1.15rem 1.4rem 1.5rem;
  overflow-y: auto;
  text-align: left;
}

.terms-list {
  margin: 0;
  padding: 0 0 0 1.25rem;
}

.terms-list li {
  margin: 0 0 0.75rem;
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.5;
  color: #e8e8e8;
}

.terms-list li:last-child {
  margin-bottom: 0;
}

body.beat-the-vat-promo.modal-open {
  overflow: hidden;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.7rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 0.85rem 1.4rem;
  border: 1px solid #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn:hover {
  background: #fff;
  color: #000;
}

/* Footer */
.site-footer {
  padding: 1.5rem 1rem 2rem;
}

.footer-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.footer-line {
  width: 42px;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.vf-badge {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

@media (max-width: 720px) {
  .site-header {
    padding: 1.25rem 1.1rem;
  }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 1rem;
    left: 1rem;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: #0a0a0a;
    border: 1px solid #333;
  }

  .nav.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .btn {
    min-width: 150px;
    flex: 1 1 150px;
  }
}
