/* =========================================================
   FATHER'S DAY — NAVY, SADDLE BROWN & STEEL THEME VARIABLES
   ========================================================= */
:root {
  --bg-navy: #0a1524;
  --bg-slate: #16263b;
  --leather: #8c532c;
  --leather-light: #c47d47;
  --steel: #9cb0c7;
  --steel-bright: #e4ecf5;
  --muted: rgba(228, 236, 245, 0.7);

  --card-bg: linear-gradient(165deg, rgba(28, 45, 68, 0.88), rgba(13, 24, 40, 0.94));
  --card-border: rgba(156, 176, 199, 0.36);

  --font-slab: "Alfa Slab One", Georgia, serif;
  --font-condensed: "Oswald", Impact, sans-serif;
  --font-ui: "Inter", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% 20%, #1d3350 0%, var(--bg-slate) 42%, var(--bg-navy) 100%);
  color: var(--steel-bright);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Subtle Blueprint Grid Texture */
.workshop-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(156, 176, 199, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(156, 176, 199, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
}

/* Controls */
.controls {
  position: fixed;
  top: clamp(14px, 2.5vw, 24px);
  right: clamp(14px, 2.5vw, 24px);
  z-index: 25;
  display: flex;
  gap: 8px;
}

.ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  border: 1.5px solid var(--card-border);
  background: rgba(15, 28, 46, 0.85);
  color: var(--steel-bright);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.ctrl-btn svg { width: 18px; height: 18px; }
.ctrl-btn:hover, .ctrl-btn:focus-visible {
  transform: translateY(-2px);
  border-color: var(--leather-light);
  background: rgba(140, 83, 44, 0.45);
  outline: none;
}
.ctrl-btn[aria-pressed="true"] {
  background: var(--leather);
  border-color: var(--leather-light);
  color: #fff;
}

#sound-btn .icon-on { display: none; }
#sound-btn[aria-pressed="true"] .icon-on { display: block; }
#sound-btn[aria-pressed="true"] .icon-off { display: none; }
#fullscreen-btn .icon-compress { display: none; }
body.is-fullscreen #fullscreen-btn .icon-compress { display: block; }
body.is-fullscreen #fullscreen-btn .icon-expand { display: none; }

.toast {
  position: fixed;
  top: 70px;
  right: clamp(14px, 2.5vw, 24px);
  z-index: 30;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(14, 26, 42, 0.96);
  border: 1px solid var(--leather-light);
  color: var(--steel-bright);
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Stage */
.stage {
  position: relative;
  z-index: 10;
  width: min(940px, 92vw);
  padding: clamp(32px, 5vh, 56px) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(20px, 3vh, 32px);
}

.vintage-crest {
  padding: 16px clamp(20px, 4vw, 44px);
  border-top: 3px double var(--leather-light);
  border-bottom: 3px double var(--leather-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.crest-stars {
  font-family: var(--font-condensed);
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  color: var(--leather-light);
}

.title {
  font-family: var(--font-slab);
  font-size: clamp(2.4rem, 7vw, 4.9rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--steel-bright);
  text-shadow: 0 5px 0 rgba(10, 21, 36, 0.9), 0 10px 30px rgba(0, 0, 0, 0.6);
}

.eyebrow {
  font-family: var(--font-condensed);
  font-size: 0.96rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--steel);
}

.milestone-badge {
  margin-top: 8px;
  padding: 6px 20px;
  background: var(--leather);
  border: 1px solid var(--leather-light);
  color: #fff;
  font-family: var(--font-condensed);
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Riveted Vintage Steel Cards */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2.2vw, 22px);
  width: 100%;
}

.badge-card {
  position: relative;
  padding: clamp(22px, 3.4vw, 36px) 10px clamp(16px, 2.4vw, 24px);
  border-radius: 10px;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-top: 5px solid var(--leather-light);
  box-shadow:
    0 20px 42px rgba(5, 11, 20, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.rivet {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e6eef7, #5b6e84);
}
.rivet.tl { top: 9px; left: 9px; }
.rivet.tr { top: 9px; right: 9px; }
.rivet.bl { bottom: 9px; left: 9px; }
.rivet.br { bottom: 9px; right: 9px; }

.badge-card:hover {
  transform: translateY(-4px);
  border-color: var(--steel);
}

body.final-ten .badge-card[data-unit="seconds"] {
  transform: scale(1.08);
  border-color: var(--leather-light);
  box-shadow: 0 0 42px rgba(196, 125, 71, 0.55);
}

.digits {
  display: inline-flex;
  justify-content: center;
  font-family: var(--font-condensed);
  font-size: clamp(2.5rem, 6.8vw, 5.2rem);
  font-weight: 700;
  line-height: 1.04;
  color: #ffffff;
}

.digit-slot {
  position: relative;
  display: inline-block;
  width: 0.58em;
  height: 1.12em;
  overflow: hidden;
}

.digit-char {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.digit-char.enter { transform: translateY(75%); opacity: 0; }
.digit-char.active {
  transform: translateY(0%);
  opacity: 1;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.26s ease;
}
.digit-char.exit {
  transform: translateY(-75%);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.22s ease;
}

.unit-label {
  font-family: var(--font-condensed);
  font-size: 0.85rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--leather-light);
}

.final-pulse {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-slab);
  font-size: clamp(10rem, 30vw, 24rem);
  color: rgba(196, 125, 71, 0.16);
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}
.final-pulse.pop { animation: forgePop 0.9s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes forgePop {
  0% { opacity: 0; transform: scale(0.7); }
  25% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.22); }
}

/* Progress */
.progress-wrap {
  width: min(580px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-condensed);
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
}

#progress-percent { color: var(--leather-light); font-weight: 700; }

.progress-track {
  height: 10px;
  border-radius: 4px;
  background: rgba(156, 176, 199, 0.14);
  border: 1px solid rgba(156, 176, 199, 0.3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--leather), var(--leather-light), var(--steel-bright));
  transition: width 0.8s ease;
}

.fact-line {
  max-width: 58ch;
  min-height: 2.8em;
  font-size: clamp(0.95rem, 1.65vw, 1.12rem);
  line-height: 1.55;
  color: var(--muted);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.fact-line.fading { opacity: 0; transform: translateY(5px); }

/* Celebration */
.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 21, 36, 0.86);
  backdrop-filter: blur(8px);
}
.celebration[hidden] { display: none; }

.celebration-card {
  max-width: 660px;
  padding: clamp(32px, 6vw, 56px) clamp(24px, 5vw, 48px);
  border-radius: 14px;
  background: linear-gradient(160deg, #1b304b, #0c1829);
  border: 2px solid var(--leather-light);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.celebration-title {
  font-family: var(--font-slab);
  font-size: clamp(2.2rem, 6.4vw, 4.2rem);
  color: var(--steel-bright);
  text-transform: uppercase;
}

.celebration-sub {
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  color: var(--steel);
  max-width: 40ch;
}

.celebration-hint {
  margin-top: 6px;
  font-family: var(--font-condensed);
  font-size: 0.84rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--leather-light);
}

@media (max-width: 680px) {
  .countdown { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  .final-pulse.pop { animation: none !important; }
  .digit-char.active, .digit-char.exit, .fact-line, .progress-fill { transition: none !important; }
}
