/* ═══════════════════════════════════════════════════════════════
   AtomClock – Tech-Inspired Dark Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-deep: #020408;
  --bg-mid: #060d18;
  --bg-card: rgba(6, 18, 40, 0.75);
  --accent-cyan: #00d4ff;
  --accent-blue: #0066ff;
  --accent-violet: #7b2fff;
  --accent-glow: rgba(0, 212, 255, 0.18);
  --text-primary: #e8f4ff;
  --text-dim: #7a9abd;
  --text-muted: #3a5068;
  --digit-on: #00e5ff;
  --digit-off: #061520;
  --border-glow: rgba(0, 212, 255, 0.25);
  --font-display: 'Orbitron', monospace;
  --font-body: 'Inter', sans-serif;
  --radius-card: 16px;
  --transition: 0.25s ease;
}

/* ── Light Mode Overrides ───────────────────────────────────── */
body.light-mode {
  --bg-deep: #eef4fb;
  --bg-mid: #dce8f5;
  --bg-card: rgba(255, 255, 255, 0.82);
  --accent-cyan: #0099cc;
  --accent-blue: #0055cc;
  --accent-violet: #6a1fd0;
  --accent-glow: rgba(0, 153, 204, 0.15);
  --text-primary: #0a1a2e;
  --text-dim: #2a4a6e;
  --text-muted: #6a8aaa;
  --digit-on: #0077aa;
  --digit-off: #c8ddef;
  --border-glow: rgba(0, 153, 204, 0.3);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ── Animated grid background ───────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridShift 20s linear infinite;
  pointer-events: none;
}

@keyframes gridShift {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 50px 50px;
  }
}

/* ── Particles ──────────────────────────────────────────────── */
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent-cyan);
  opacity: 0;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% {
    opacity: 0;
    transform: translateY(100vh) scale(0);
  }

  10% {
    opacity: 0.6;
  }

  90% {
    opacity: 0.15;
  }

  100% {
    opacity: 0;
    transform: translateY(-10vh) scale(1);
  }
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: relative;
  z-index: 10;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
  background: rgba(2, 4, 8, 0.8);
  backdrop-filter: blur(12px);
  transition: background 0.4s ease, border-color 0.4s ease;
}

body.light-mode .site-header {
  background: rgba(238, 244, 251, 0.88);
  border-bottom-color: rgba(0, 153, 204, 0.15);
}

/* ── Theme Toggle Button ─────────────────────────────────────── */
.theme-toggle {
  position: absolute;
  top: 50%;
  right: 1.5rem;
  transform: translateY(-50%);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid var(--border-glow);
  border-radius: 50px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-primary);
  backdrop-filter: blur(8px);
  transition:
    background 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle:hover {
  background: rgba(0, 212, 255, 0.18);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.25);
  transform: translateY(-50%) scale(1.07);
}

.theme-toggle-icon {
  display: inline-block;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.light-mode .theme-toggle {
  background: rgba(0, 153, 204, 0.1);
  border-color: rgba(0, 153, 204, 0.35);
}

body.light-mode .theme-toggle:hover {
  background: rgba(0, 153, 204, 0.22);
  box-shadow: 0 0 16px rgba(0, 153, 204, 0.3);
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 1.6rem;
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 8px var(--accent-cyan));
  animation: rotateHex 8s linear infinite;
}

@keyframes rotateHex {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.logo-accent {
  color: var(--accent-cyan);
}

.header-tagline {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 300;
}

/* ── Main ───────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 5;
}

/* ── Hero Section (German clock) ────────────────────────────── */
.hero-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(0, 102, 255, 0.12) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: pulseGlow 4s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  from {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 24px;
  padding: 3rem 4rem;
  backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.08),
    0 20px 80px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  max-width: 800px;
  width: 100%;
}

.clock-container::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  border-radius: 2px;
}

.clock-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}

.country-flag {
  font-size: 1.2rem;
}

.utc-tag {
  background: rgba(0, 212, 255, 0.12);
  border: 1px solid rgba(0, 212, 255, 0.25);
  color: var(--accent-cyan);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-family: var(--font-display);
}

/* ── Digital Clock Digits ───────────────────────────────────── */
.digital-clock {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.clock-segment {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 8.5rem);
  font-weight: 900;
  width: 1ch;
  text-align: center;
  color: var(--digit-on);
  text-shadow:
    0 0 20px rgba(0, 229, 255, 0.9),
    0 0 60px rgba(0, 229, 255, 0.5),
    0 0 120px rgba(0, 229, 255, 0.25);
  line-height: 1;
  /* Simulate LCD off-segments */
  position: relative;
  transition: color 0.05s;
}

.clock-colon {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 10vw, 7.5rem);
  font-weight: 900;
  color: var(--accent-cyan);
  line-height: 1;
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.8);
  animation: blinkColon 1s step-end infinite;
  margin: 0 0.1rem;
  padding-bottom: 0.15em;
}

@keyframes blinkColon {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.15;
  }
}

/* ── Date ───────────────────────────────────────────────────── */
.date-display {
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 2vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── Millisecond bar ────────────────────────────────────────── */
.ms-bar-wrapper {
  width: 100%;
  height: 4px;
  background: rgba(0, 212, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.ms-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
  transition: width 0.05s linear;
}

.ms-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* ── Accuracy badge ─────────────────────────────────────────── */
.accuracy-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(0, 229, 100, 0.08);
  border: 1px solid rgba(0, 229, 100, 0.2);
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00e564;
  display: inline-block;
}

.badge-dot.pulse {
  animation: badgePulse 1.5s ease-in-out infinite;
}

@keyframes badgePulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 229, 100, 0.6);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(0, 229, 100, 0);
  }
}

/* ── World Section ──────────────────────────────────────────── */
.world-section {
  padding: 2rem 2rem 5rem;
  max-width: 1400px;
  margin: 0 auto;
  /* 3D perspective container for the spatial zoom */
  perspective: 1200px;
  perspective-origin: 50% 40%;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue), var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.section-sub {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ── 3D Globe Visualization ─────────────────────────────────────────────── */
#globeViz {
  width: 100%;
  height: 600px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(0, 212, 255, 0.05) 0%, transparent 70%);
  border: 1px solid var(--border-glow);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 40px rgba(0, 212, 255, 0.05);
  margin-top: 1rem;
}

/* Globe HTML Markers */
.globe-marker {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  min-width: 120px;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  transform: translate(-50%, -50%);
  /* Center on coordinate */
}

.globe-marker:hover {
  transform: translate(-50%, -50%) scale(1.05);
  border-color: rgba(0, 212, 255, 0.6);
  z-index: 10;
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.6),
    0 0 15px color-mix(in srgb, var(--card-accent, var(--accent-cyan)) 30%, transparent);
}

.globe-marker.accent-a {
  --card-accent: var(--accent-cyan);
}

.globe-marker.accent-b {
  --card-accent: #ff6b6b;
}

.globe-marker.accent-c {
  --card-accent: #ffd166;
}

.globe-marker.accent-d {
  --card-accent: #a8ff78;
}

.globe-marker.accent-e {
  --card-accent: #c471ed;
}

.globe-marker::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, var(--accent-cyan));
  opacity: 0.6;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.marker-header {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.marker-flag {
  font-size: 0.9rem;
  line-height: 1;
}

.marker-name {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.marker-time {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.marker-utc {
  position: absolute;
  top: -10px;
  right: -5px;
  font-family: var(--font-display);
  font-size: 0.5rem;
  padding: 0.15rem 0.3rem;
  border-radius: 6px;
  background: rgba(0, 212, 255, 0.15);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--text-primary);
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid rgba(0, 212, 255, 0.08);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  background: rgba(2, 4, 8, 0.9);
}

.footer-logo {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .clock-container {
    padding: 2rem 1.5rem;
    border-radius: 16px;
  }

  .digital-clock {
    gap: 0.15rem;
  }

  .clock-colon {
    margin: 0;
  }

  .city-card {
    min-width: 130px;
    padding: 0.9rem 1rem;
  }

  .city-time {
    font-size: 1.3rem;
  }
}

@media (max-width: 400px) {
  .city-cloud {
    gap: 0.7rem;
  }

  .city-card {
    min-width: 110px;
    max-width: 160px;
  }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.25);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.5);
}