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

:root {
  --bg-primary: #050e17;
  --bg-secondary: #0e1926;
  --bg-card: #1f2632;
  --bg-card-hover: #353846;
  --text-primary: #cfd8dd;
  --text-secondary: #9eb6cb;
  --accent: #7393aa;
  --accent-light: #95a2ae;
  --accent-glow: rgba(115, 147, 170, 0.3);
  --border: rgba(158, 182, 203, 0.14);
  --glass: rgba(158, 182, 203, 0.06);
  --accent-pink: #e74c8b;
  --accent-purple: #6c63ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

/* === HEADER === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(5, 14, 23, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.header.scrolled {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-pink));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}

.nav a:hover,
.nav a.active {
  color: var(--text-primary);
  background: var(--glass);
}

.nav a.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

@media (max-width: 1200px) {
  .nav a {
    padding: 0.5rem 0.55rem;
    font-size: 0.8rem;
  }
}

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
  background: none;
  border: none;
}

.burger span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.burger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.burger.active span:nth-child(2) {
  opacity: 0;
}
.burger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* === HERO === */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 50%, rgba(231, 76, 139, 0.06) 0%, transparent 50%);
  animation: heroFloat 20s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  background: var(--glass);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
}

.hero-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-light) 50%, var(--accent-pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 3rem;
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-light);
  display: block;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === SECTION === */
.section {
  padding: 5rem 2rem;
  max-width: 1300px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 1rem;
}

.section-desc {
  color: var(--text-secondary);
  max-width: 550px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* === REGION CARDS (index page) === */
.regions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.region-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
  display: block;
}

.region-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 20px 60px rgba(108, 99, 255, 0.15);
}

.region-card-visual {
  height: 150px;
  position: relative;
  overflow: hidden;
}

.region-card-visual::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(transparent, var(--bg-card));
}

.region-visual-russia {
  background: linear-gradient(135deg, #1a1a4e, #4a1942, #c62368);
}
.region-visual-europe {
  background: linear-gradient(135deg, #1e3a5f, #2d6a4f, #40916c);
}
.region-visual-asia {
  background: linear-gradient(135deg, #5c1a1a, #8b2500, #d4a017);
}
.region-visual-africa {
  background: linear-gradient(135deg, #8b6914, #c27c0e, #f4a460);
}
.region-visual-australia {
  background: linear-gradient(135deg, #1a4a5c, #2078a4, #60c5f7);
}
.region-visual-usa {
  background: linear-gradient(135deg, #1a237e, #b71c1c, #e0e0e0);
}
.region-visual-southamerica {
  background: linear-gradient(135deg, #14343b, #00755e, #f4c430);
}
.region-visual-indonesia {
  background: linear-gradient(135deg, #4a0f0f, #c62f2f, #ffb37b);
}
.region-visual-mexico {
  background: linear-gradient(135deg, #123d28, #1f8a4c, #ce1141);
}

.region-visual-emoji {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  z-index: 1;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.3));
}

.region-card-body {
  padding: 1.1rem 1.25rem;
}

.region-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.region-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
}

.region-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.museum-count {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.arrow-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition);
}

.region-card:hover .arrow-icon {
  background: var(--accent);
  border-color: var(--accent);
}

/* === MUSEUM PAGE HEADER === */
.page-hero {
  padding: 8rem 2rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.15;
}

.page-hero-russia::before { background: linear-gradient(135deg, #4a1942, #c62368); }
.page-hero-europe::before { background: linear-gradient(135deg, #1e3a5f, #40916c); }
.page-hero-asia::before { background: linear-gradient(135deg, #8b2500, #d4a017); }
.page-hero-africa::before { background: linear-gradient(135deg, #8b6914, #f4a460); }
.page-hero-australia::before { background: linear-gradient(135deg, #2078a4, #60c5f7); }
.page-hero-usa::before { background: linear-gradient(135deg, #1a237e, #b71c1c); }
.page-hero-southamerica::before { background: linear-gradient(135deg, #14343b, #00755e, #f4c430); }
.page-hero-indonesia::before { background: linear-gradient(135deg, #4a0f0f, #c62f2f); }
.page-hero-mexico::before { background: linear-gradient(135deg, #123d28, #1f8a4c, #ce1141); }

.page-hero-flag {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.page-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  margin-bottom: 1rem;
}

.page-hero p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.1rem;
}

/* === MUSEUM CARDS === */
.museums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 2rem;
}

.museum-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.museum-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(108, 99, 255, 0.2);
}

.museum-image {
  height: 240px;
  position: relative;
  overflow: hidden;
}

.museum-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 1;
}

.museum-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.museum-card:hover .museum-image img {
  transform: scale(1.05);
}

.museum-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
}

.museum-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.35rem 0.9rem;
  background: rgba(5, 14, 23, 0.88);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.museum-body {
  padding: 1.5rem;
}

.museum-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.3px;
}

.museum-city {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.museum-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.museum-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 1.3rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.museum-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--accent-glow);
}

.museum-link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}

.museum-link:hover svg {
  transform: translateX(3px);
}

/* === FOOTER === */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.footer a {
  color: var(--accent);
  transition: var(--transition);
}

.footer a:hover {
  color: var(--accent-light);
}

/* === ANIMATIONS === */
html.js .fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.js .fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
  border-radius: 4px;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  z-index: 20;
  box-shadow: var(--shadow);
}

.search-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
}

.search-result.active,
.search-result:hover {
  background: var(--bg-card-hover);
}

.search-name {
  font-weight: 600;
}

.search-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.search-nothing {
  padding: 0.8rem 1.2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* === BACK TO TOP === */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition);
  border: none;
  box-shadow: 0 4px 20px var(--accent-glow);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

/* === SEARCH (index page) === */
.search-bar {
  max-width: 500px;
  margin: 0 auto 3rem;
  position: relative;
  z-index: 10;
}

.search-bar input {
  width: 100%;
  padding: 0.9rem 1.2rem 0.9rem 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.search-bar input::placeholder {
  color: var(--text-secondary);
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 1rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    transform: translateX(100%);
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    gap: 0.5rem;
    border-left: 1px solid var(--border);
    transition: transform 0.3s ease;
  }

  .nav.open {
    transform: translateX(0);
  }

  .burger {
    display: flex;
  }

  .regions-grid,
  .museums-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    gap: 2rem;
  }

  .section {
    padding: 3rem 1.2rem;
  }

  .museum-image {
    height: 200px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    letter-spacing: -1px;
  }

  .hero p {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  }

  .section-desc {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
  }

  .museum-body {
    padding: 1.2rem;
  }
}
