/* Fullscreen viewer with pastel themes and holiday variants */

:root {
  --bg-1: #f7f5ff;
  --bg-2: #e6f7ff;
  --ink: #243342;
  --muted: #64748b;
  --accent-1: #96d1c7;
  --accent-2: #ffd6e8;
  --panel-bg: rgba(255, 255, 255, 0.65);
  --panel-border: rgba(0, 0, 0, 0.08);
}

/* Themes set via CSS variables from JS */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
  color: var(--ink);
  background: linear-gradient(145deg, var(--bg-1) 0%, var(--bg-2) 100%);
  overflow-x: hidden;
  transition: background 0.6s ease;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}

.mode-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  transition: transform 0.15s ease, backdrop-filter 0.15s ease;
  backdrop-filter: blur(8px);
}

.mode-toggle:hover {
  transform: translateY(-1px);
}

.mode-toggle:active {
  transform: translateY(0);
}

.center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2vh;
  position: relative;
  z-index: 3;
  animation: page-in 0.8s ease both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status {
  color: var(--muted);
  font-weight: 600;
  font-size: clamp(14px, 1.6vw, 20px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 18px;
}

.days-wrap {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: min(62vh, 88vw);
}

.days {
  display: inline-block;
  font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 120px;
  /* JS will resize */
  font-weight: 900;
  line-height: 1;
  background-image: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  letter-spacing: -0.03em;
  will-change: font-size;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.07));
  animation: count-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes count-in {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

.quote {
  position: relative;
  margin-top: 8px;
  font-size: clamp(15px, 2vw, 26px);
  color: var(--ink);
  opacity: 0.92;
  padding: 18px 28px;
  max-width: min(860px, 90vw);
  border-radius: 20px;
  font-family: 'Nunito Sans', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.5;
  word-break: break-word;
  hyphens: auto;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, opacity 0.2s;
  animation: quote-in 0.9s ease 0.3s both;
}

@keyframes quote-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 0.92; transform: translateY(0); }
}

@keyframes quote-fade {
  0%   { opacity: 0; transform: translateY(6px) scale(0.98); }
  100% { opacity: 0.92; transform: translateY(0) scale(1); }
}

.quote.quote-fade {
  animation: quote-fade 0.35s ease both;
}

.quote:hover,
.quote:focus-visible {
  transform: translateY(-2px);
  opacity: 1;
  outline: none;
}

.quote:active {
  transform: scale(0.98);
}

.quote::after {
  content: "✨ tap for a new quote";
  position: absolute;
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(10px, 1.1vw, 13px);
  color: var(--muted);
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.3s;
  pointer-events: none;
}

.quote:hover::after,
.quote:focus-visible::after {
  opacity: 0.7;
}

/* Holiday decorative badges */
.badge {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 0;
}

/* Karnataka flag: two horizontal stripes */
[data-theme="karnataka"] .badge::before {
  content: "";
  display: inline-block;
  width: 56px;
  height: 38px;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  background: linear-gradient(#ffd500 50%, #e01e37 50%);
  animation: float 5s ease-in-out infinite;
}

/* Diwali lamp (emoji) */
[data-theme="diwali"] .badge::after {
  content: "🪔";
  font-size: 26px;
  filter: saturate(0.9) brightness(1.05);
  animation: float 6s ease-in-out infinite;
}

/* Christmas decorations */
[data-theme="christmas"] .badge::after {
  content: "🎅 🎄 🎄";
  font-size: 24px;
  animation: float 7s ease-in-out infinite;
}

/* New Year fireworks */
[data-theme="newyear"] .badge::after {
  content: "🎆 🎇 🎆";
  font-size: 22px;
  animation: float 7s ease-in-out infinite;
}

/* Decorative themed images */
.decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.d-decor {
  position: absolute;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}

[data-theme="diwali"] .d-decor.diwali {
  opacity: 1;
}

[data-theme="christmas"] .d-decor.christmas {
  opacity: 1;
}

[data-theme="newyear"] .d-decor.newyear {
  opacity: 1;
}

.diya {
  width: 96px;
  animation: flicker 1.8s infinite ease-in-out;
}

.diya-left {
  bottom: 20px;
  left: 18px;
}

.diya-right {
  bottom: 20px;
  right: 18px;
  animation-delay: .6s;
}

.candle {
  width: 60px;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 10px);
  animation: flicker 1.5s infinite ease-in-out;
}

.santa {
  top: 16px;
  right: 18px;
  width: 84px;
  animation: float 6s ease-in-out infinite;
}

.tree {
  bottom: 16px;
  left: 16px;
  width: 90px;
  animation: float 7s ease-in-out infinite;
}

.fireworks {
  width: 90px;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  animation: twinkle 1.8s ease-in-out infinite;
}

.fireworks.f2 {
  top: 18%;
  left: 70%;
  animation-delay: .9s;
}

@keyframes flicker {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(255, 170, 0, .6)) brightness(1);
    transform: translateY(10px) scale(1);
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(255, 190, 60, .9)) brightness(1.05);
    transform: translateY(10px) scale(1.03);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes twinkle {
  0%, 100% { opacity: .6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* Snow, confetti, petals */
.snowflake {
  position: absolute;
  top: -10%;
  width: var(--sz, 8px);
  height: var(--sz, 8px);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .6));
  opacity: .9;
  animation: snow-fall var(--dur, 12s) linear infinite;
  left: var(--left, 50%);
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, .7));
}

@keyframes snow-fall {
  0% { transform: translateY(0) translateX(0); }
  100% { transform: translateY(120vh) translateX(var(--drift, 20px)); }
}

.confetti {
  position: absolute;
  top: -10%;
  width: var(--w, 6px);
  height: var(--h, 10px);
  background: var(--c, #ff9aa2);
  opacity: .9;
  transform: rotate(var(--rot, 0deg));
  animation: confetti-fall var(--dur, 8s) linear infinite;
  left: var(--left, 50%);
  border-radius: 2px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .08));
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  100% { transform: translateY(120vh) rotate(calc(var(--rot, 0deg) + 360deg)); }
}

.petal {
  position: absolute;
  top: -10%;
  width: var(--sz, 12px);
  height: var(--sz, 18px);
  background: radial-gradient(circle at 30% 30%, rgba(255, 218, 68, .9), rgba(255, 100, 100, .85));
  border-radius: 60% 40% 60% 40% / 60% 60% 40% 40%;
  transform: rotate(var(--rot, 0deg));
  opacity: .85;
  left: var(--left, 50%);
  animation: petal-fall var(--dur, 10s) ease-in infinite;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .1));
}

@keyframes petal-fall {
  0% { transform: translateY(0) translateX(0) rotate(var(--rot, 0deg)); }
  100% { transform: translateY(120vh) translateX(var(--drift, 30px)) rotate(calc(var(--rot, 0deg) + 60deg)); }
}

/* Diwali lights garland */
.lights {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: flex-start;
  justify-content: space-evenly;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
  z-index: 3;
}

.bulb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 8px;
  box-shadow: 0 0 8px rgba(255, 190, 60, .6);
  animation: blink var(--blink, 2.6s) ease-in-out infinite;
  position: relative;
}

.bulb::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 2px;
  height: 10px;
  background: #b3b3b3;
  transform: translateX(-50%);
  border-radius: 1px;
}

[data-theme="diwali"] .lights {
  opacity: 1;
}

@keyframes blink {
  0%, 100% { filter: brightness(1) saturate(1); opacity: .7; }
  50% { filter: brightness(1.3) saturate(1.2); opacity: 1; }
}

/* Responsive tweaks */
@media (min-width: 1440px) {
  .center { gap: 2vh; }
  .quote  { max-width: 960px; }
}

@media (min-width: 1024px) {
  .center { gap: 1.6vh; }
  .quote { margin-top: 6px; max-width: 800px; }
  .days-wrap { height: min(52vh, 72vw); }
}

@media (max-width: 480px) {
  [data-theme="karnataka"] .badge::before { width: 44px; height: 30px; }
  [data-theme="diwali"] .badge::after { font-size: 20px; }
  [data-theme="christmas"] .badge::after { font-size: 18px; }
  [data-theme="newyear"] .badge::after { font-size: 18px; }
  .diya { width: 72px; }
  .candle { width: 48px; }
  .santa { width: 70px; }
  .tree { width: 76px; }
  .fireworks, .fireworks.f2 { width: 72px; }
  .quote { padding: 12px 16px; border-radius: 14px; }
}

@media (max-width: 768px) {
  .quote { padding: 14px 20px; border-radius: 16px; }
}

@media (max-width: 360px) {
  .status { font-size: 11px; padding: 4px 12px; }
  .quote  { padding: 10px 14px; font-size: 13px; }
}
