:root {
  --bg: #FBF6EE;
  --surface: #FFFFFF;
  --accent: #FBAD41;
  --accent-deep: #F6821F;
  --accent-strong: #C65D00;
  --ink: #3A2E24;
  --ink-soft: #5C5045;
  --ink-faint: #8A7D6E;
  --line: #EADFCF;
  --line-strong: #F6DDB6;
  --tint: #FFF4E2;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(198, 93, 0, 0.18);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-strong); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.05rem;
}

.brand svg { width: 32px; height: 32px; }

.site-header nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.75rem);
}

.site-header nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
}

.site-header nav a:hover { color: var(--accent-strong); }

.nav-cta {
  background: var(--accent);
  color: #231206 !important;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
}

.nav-cta:hover { background: var(--accent-strong); color: #fff !important; }

/* ---------- Layout ---------- */

main { max-width: 1160px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }

.section { padding: clamp(3rem, 8vw, 5.5rem) 0 1rem; }

.section-head { max-width: 640px; margin-bottom: 2rem; }

.eyebrow {
  color: var(--accent-strong);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0.6rem 0 1.2rem;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  letter-spacing: -0.025em;
  margin: 0.5rem 0 0.75rem;
}

.section-head p, .hero-copy p {
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.hero-copy strong { color: var(--ink); }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
  padding: clamp(3rem, 8vw, 6rem) 0 2rem;
}

.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.8rem; }

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary { background: var(--accent); color: #231206; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }

.btn-secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn-secondary:hover { border-color: var(--accent-strong); color: var(--accent-strong); }

.hero-art {
  position: relative;
  height: 320px;
  display: grid;
  place-items: center;
}

.orb, .orb-core {
  border-radius: 50%;
  position: absolute;
}

.orb-core {
  width: 110px;
  height: 110px;
  background: var(--accent);
  box-shadow: 0 0 60px rgba(251, 173, 65, 0.55);
  animation: pulse 4s ease-in-out infinite;
}

.orb-1 { width: 220px; height: 220px; border: 1.5px dashed var(--line-strong); animation: spin 40s linear infinite; }
.orb-2 { width: 320px; height: 320px; border: 1.5px dashed var(--line-strong); animation: spin 60s linear infinite reverse; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(251, 173, 65, 0.14), transparent 70%); }

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0 0;
}

.stat {
  background: var(--surface);
  padding: 1.4rem 1rem;
  text-align: center;
  display: grid;
  gap: 0.15rem;
  align-content: center;
}

.stat-value {
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.stat-label { font-size: 0.82rem; line-height: 1.4; color: var(--ink-faint); font-weight: 600; }

/* ---------- Network map ---------- */

.network-tools {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

#city-search {
  flex: 1;
  min-width: 260px;
  max-width: 460px;
  padding: 0.8rem 1.2rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}

#city-search:focus { border-color: var(--accent-strong); }

.search-count { font-size: 0.9rem; color: var(--ink-faint); font-weight: 600; }

.region-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.chip {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chip b { color: var(--accent-strong); margin-left: 0.2rem; }
.chip:hover { border-color: var(--accent); background: var(--tint); }
.chip:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.chip.active { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.chip.active b { color: #FFE9CC; }

.map-card {
  position: relative;
  background: radial-gradient(ellipse at 50% 35%, #FFFDF9 0%, #FFF4E2 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#world-map {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

#world-map.zoomed { cursor: grab; touch-action: none; }
#world-map.dragging { cursor: grabbing; }

#world-map .land { fill: #EADFCF; stroke: none; }
#world-map .borders { fill: none; stroke: #FBF6EE; stroke-width: 0.6; stroke-linejoin: round; }

#world-map .dot {
  fill: var(--accent-deep);
  fill-opacity: 0.85;
  stroke: #fff;
  stroke-width: 0.35;
  paint-order: stroke;
  cursor: pointer;
  transition: opacity 0.25s ease, fill 0.15s ease;
}

#world-map .dot:hover { fill: var(--accent-strong); fill-opacity: 1; }
#world-map .dot.dim { opacity: 0.13; }
#world-map .dot.hit { fill: var(--accent-strong); fill-opacity: 1; }

#world-map .pulse {
  fill: var(--accent);
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: ping 2.8s ease-out infinite;
}

@keyframes ping {
  0% { transform: scale(0.5); opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0; }
}

.map-controls {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.35rem;
}

.map-controls button {
  font: inherit;
  font-weight: 700;
  min-width: 36px;
  height: 36px;
  padding: 0 0.7rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.map-controls button:hover:not(:disabled) { border-color: var(--accent-strong); color: var(--accent-strong); }
.map-controls button:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.map-controls button:disabled { opacity: 0.45; cursor: default; }
.map-controls .reset { font-size: 0.85rem; }

.map-legend {
  position: absolute;
  left: 0.9rem;
  bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
}

.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-deep); }
.legend-sep { width: 1px; height: 12px; background: var(--line); }
.legend-hint { color: var(--ink-faint); font-weight: 500; }

.map-tooltip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink);
  color: #F7F1E6;
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
  display: grid;
  box-shadow: 0 8px 20px -8px rgba(58, 46, 36, 0.5);
}

.map-tooltip[hidden] { display: none; }
.map-tooltip span { color: var(--accent); font-size: 0.74rem; font-weight: 600; }


/* ---------- Product flashcards ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.flashcard {
  perspective: 1200px;
  height: 320px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  display: block;
  width: 100%;
}

.flashcard:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 4px;
  border-radius: var(--radius);
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.flashcard-face.back {
  transform: rotateY(180deg);
  background: var(--ink);
  border-color: var(--ink);
  color: #F7F1E6;
}

.flashcard-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--tint);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
}

.flashcard-icon svg { width: 26px; height: 26px; }

.flashcard-face h3 {
  font-size: 1.2rem;
  letter-spacing: -0.015em;
  margin-bottom: 0.5rem;
}

.flashcard-face .short {
  color: var(--ink-soft);
  font-size: 0.95rem;
  flex: 1;
}

.flashcard-hint {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.flashcard-face.back .desc {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #E4D9C8;
  flex: 1;
}

.flashcard-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.flashcard-actions a {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 999px;
}

.flashcard-actions .demo-link { background: var(--accent); color: #231206; }
.flashcard-actions .demo-link:hover { background: var(--accent-strong); color: #fff; }

.flashcard-actions .official-link { border: 1.5px solid rgba(247, 241, 230, 0.35); color: #F7F1E6; }
.flashcard-actions .official-link:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding: 2rem clamp(1rem, 4vw, 3rem) 2.5rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.site-footer p + p { margin-top: 0.5rem; }
.site-footer a { color: var(--accent-strong); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.footer-links a { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  
}

@media (max-width: 700px) {
  .map-card { display: flex; flex-direction: column; }
  .map-controls { position: static; justify-content: flex-end; padding: 0.6rem 0.75rem 0; }
  .map-legend { position: static; background: none; border-radius: 0; padding: 0.5rem 0.9rem 0.8rem; }
  .legend-sep, .legend-hint { display: none; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .site-header nav a:not(.nav-cta) { display: none; }
  .flashcard { height: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flashcard-inner { transition: none; }
  .orb-core, .orb-1, .orb-2 { animation: none; }
  .btn { transition: none; }
}
