/* THE INFINITE TIMEKEEPER — style.css */

:root {
  --bg: #04030a;
  --violet-deep: #1a0a3d;
  --violet: #7a3cff;
  --cyan: #27e8ff;
  --text: #efedff;
  --muted: #9d98c8;
  --glass: rgba(22, 12, 48, 0.58);
  --line: rgba(122, 92, 255, 0.34);
  --amber: #ffb547;
  --radius: 22px;
  --font-digital: "Orbitron", "Segoe UI", system-ui, -apple-system, "Roboto", sans-serif;
  --font-bn: "Noto Sans Bengali", "Nirmala UI", "Kalpurush", "Siyam Rupali", system-ui, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-bn), system-ui, sans-serif;
  overflow-x: hidden;
}

/* Static atmosphere (no animation = cheap on budget phones) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(70% 45% at 50% -5%, rgba(122, 60, 255, 0.38), transparent 70%),
    radial-gradient(55% 40% at 100% 35%, rgba(39, 232, 255, 0.10), transparent 70%),
    radial-gradient(60% 45% at 0% 85%, rgba(90, 30, 190, 0.28), transparent 70%),
    var(--bg);
}

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

.stage {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.top { text-align: center; padding: 8px 4px 0; }

.top h1 {
  margin: 0;
  font-family: var(--font-digital);
  font-weight: 700;
  font-size: clamp(1.15rem, 4.6vw, 2rem);
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(0.78rem, 2.8vw, 0.95rem);
  line-height: 1.5;
}

/* Glass panels */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(39, 232, 255, 0.05) inset,
    0 10px 40px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(122, 60, 255, 0.16);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* ---------- Clock ---------- */
.clock {
  padding: clamp(16px, 4vw, 34px) clamp(10px, 3vw, 30px) clamp(14px, 3vw, 26px);
  border-color: rgba(39, 232, 255, 0.38);
}

.unit-label {
  display: block;
  font-family: var(--font-digital);
  font-weight: 500;
  font-size: clamp(0.68rem, 2.5vw, 0.9rem);
  letter-spacing: 0.28em;
  color: var(--cyan);
  text-align: center;
  padding-left: 0.28em; /* optical centering for tracked text */
}

.day-block { text-align: center; }

.day-fit {
  width: 100%;
  overflow: hidden;       /* safety net; JS scales the font so nothing is ever cut */
  text-align: center;
  padding: 6px 0 4px;
}

.day {
  display: inline-block;
  white-space: nowrap;
  font-family: var(--font-digital);
  font-weight: 900;
  font-size: clamp(2.4rem, 17vw, 7rem); /* replaced by JS fit */
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 22px rgba(39, 232, 255, 0.5), 0 0 60px rgba(122, 60, 255, 0.45);
}

.small-units {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 2.5vw, 18px);
  margin-top: clamp(10px, 2.5vw, 20px);
}

.unit {
  padding: clamp(10px, 2.4vw, 16px) 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(8, 4, 24, 0.55);
  text-align: center;
  min-width: 0;
}

.value {
  display: block;
  margin-top: 4px;
  font-family: var(--font-digital);
  font-weight: 700;
  font-size: clamp(1.7rem, 7.5vw, 3.1rem);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.since {
  margin: clamp(12px, 2.5vw, 20px) 0 0;
  text-align: center;
  font-size: clamp(0.72rem, 2.6vw, 0.88rem);
  line-height: 1.5;
  color: var(--muted);
}

.clock.stale .day,
.clock.stale .value { opacity: 0.45; }

.clock.estimated .value,
.clock.estimated .day { color: #fff3dd; }

/* ---------- Status ---------- */
.status { padding: 14px clamp(14px, 3vw, 24px); }

.status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-family: var(--font-digital);
  font-weight: 500;
  font-size: clamp(0.66rem, 2.4vw, 0.82rem);
  letter-spacing: 0.1em;
  color: var(--violet);
  max-width: 100%;
}

.badge .dot {
  width: 9px; height: 9px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.badge[data-state="synced"] { color: var(--cyan); }
.badge[data-state="synced"] .dot { animation: pulse 2.4s ease-in-out infinite; }
.badge[data-state="estimated"] { color: var(--amber); }
.badge[data-state="waiting"] { color: #b79bff; }

@keyframes pulse { 50% { opacity: 0.35; } }

.bd-now {
  font-size: clamp(0.78rem, 2.8vw, 0.92rem);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status-detail {
  margin: 10px 0 0;
  font-size: clamp(0.76rem, 2.7vw, 0.9rem);
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ---------- Bengali ---------- */
.bengali {
  padding: clamp(18px, 4vw, 38px) clamp(16px, 4vw, 40px);
}

.bengali h2 {
  margin: 0 0 14px;
  font-family: var(--font-bn);
  font-weight: 700;
  font-size: clamp(1.25rem, 5vw, 1.8rem);
  line-height: 1.5;
  color: var(--cyan);
}

.bengali p {
  margin: 0 0 1.05em;
  font-size: clamp(1rem, 3.6vw, 1.15rem);
  line-height: 2;
  max-width: 68ch;
}

.bengali p:last-child { margin-bottom: 0; }

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 4px 8px 0;
}

.noscript {
  position: fixed; left: 0; right: 0; bottom: 0;
  margin: 0; padding: 12px; text-align: center;
  background: #2a0f5c; color: #fff;
}

/* ---------- Larger screens ---------- */
@media (min-width: 720px) {
  .stage { padding-left: 24px; padding-right: 24px; gap: 22px; }
  .small-units { gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .badge[data-state="synced"] .dot { animation: none; }
}
