@import url('https://fonts.googleapis.com/css2?family=Michroma&family=Poppins:wght@400;500;600;700&family=Inter:wght@400;500&display=swap');

/* ==========================================================
   KoiCarta — Estilos globales
   ========================================================== */

:root {
  --font-family: 'Inter', sans-serif;
  --font-heading: 'Poppins', sans-serif;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #4a5263;
  --text-muted: #8a93a3;
  --text-faint: #b4bac4;

  --accent: #ea6e6c;
  --accent-strong: #d95654;
  --accent-soft: #fdf2f2;
  --highlight: #8cc8f5;

  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(234, 110, 108, 0.55);

  --radius: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 4px 12px rgba(15, 23, 42, 0.05);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-family);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Ondas circulares decorativas en las esquinas */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: repeating-radial-gradient(
    circle at center,
    rgba(160, 175, 195, 0.07) 0 2px,
    transparent 2px 26px
  );
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 70%);
  mask-image: radial-gradient(circle, #000 0%, transparent 70%);
  filter: blur(1.5px);
}

body::before {
  top: -200px;
  left: -220px;
}

body::after {
  bottom: -260px;
  right: -240px;
}

/* ==========================================================
   Logo KoiCarta — tipografía oficial Michroma
   ========================================================== */

.brand-logo-michroma {
  font-family: 'Michroma', sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.brand-logo-michroma::after {
  content: "\00A9";
  font-family: var(--font-family, 'Inter', sans-serif);
  font-size: 0.42em;
  font-weight: 500;
  vertical-align: super;
  margin-left: 0.18em;
  opacity: 0.45;
  letter-spacing: 0;
}

.brand-michroma {
  font-family: 'Michroma', sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  font-size: 0.92em;
}

/* ==========================================================
   Selector de país
   ========================================================== */

.country-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px 40px;
}

.country-header {
  text-align: center;
  max-width: 560px;
}

.country-header .brand-logo-michroma {
  display: inline-block;
  margin: 0 0 14px;
  font-size: 2rem;
  line-height: 1.2;
  color: var(--accent);
  text-decoration: none;
}

.country-title {
  margin: 0 0 14px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.2vw, 2.15rem);
  letter-spacing: -0.02em;
  color: #5b6272;
}

.country-subtitle {
  margin: 0 auto;
  max-width: 420px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* Tarjeta de país detectado */
.detected-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 576px;
  margin: 28px 0 24px;
  padding: 14px 14px 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.detected-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.detected-pin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.detected-pin svg {
  width: 14px;
  height: 14px;
}

.btn-continue {
  flex-shrink: 0;
  padding: 9px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.82rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-continue:hover,
.btn-continue:focus-visible {
  background: var(--accent-strong);
  box-shadow: 0 6px 16px rgba(234, 110, 108, 0.3);
  transform: translateY(-1px);
}

/* Banderas */
.flag {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.flag--sm {
  width: 20px;
  height: 20px;
}

/* Grilla de países */
.country-nav {
  width: 100%;
  display: flex;
  justify-content: center;
}

.country-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 864px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.country-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 14px 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.country-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--accent-strong);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.country-card__name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-card__arrow {
  width: 12px;
  height: 12px;
  color: #d3d8df;
  transition: transform 0.2s ease, color 0.2s ease;
}

.country-card:hover,
.country-card:focus-visible {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  outline: none;
}

.country-card:focus-visible {
  box-shadow: var(--shadow-hover), 0 0 0 2px var(--accent);
}

.country-card.is-detected {
  font-weight: 600;
  color: #3e4555;
  border-color: rgba(234, 110, 108, 0.45);
}

.country-card:hover .country-card__arrow,
.country-card:focus-visible .country-card__arrow {
  transform: translateX(3px);
  color: var(--accent-strong);
}

.country-card.is-detected::before {
  opacity: 1;
}

/* Footer */
.country-footer {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.footer-sep {
  opacity: 0.6;
}

.footer-maker {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.footer-maker__logo {
  height: 22px;
  width: auto;
  display: inline-block;
  vertical-align: baseline;
  transform: translateY(1px);
  opacity: 0.75;
  transition: opacity 0.18s ease;
}

.footer-maker:hover .footer-maker__logo {
  opacity: 1;
}

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 900px) {
  .country-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 648px;
  }
}

@media (max-width: 640px) {
  .country-page {
    padding-top: 56px;
  }

  .country-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detected-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .detected-info {
    justify-content: center;
    flex-wrap: wrap;
  }

  .btn-continue {
    text-align: center;
  }
}

@media (max-width: 380px) {
  .country-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
