/* =========================================================
   DICCIONARIO DE MINERALES — Vives de la Cortada
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500&display=swap');

/* ─── Modo oscuro (por defecto) ─── */
:root {
  --bg:        #1a1814;
  --bg-2:      #211f1a;
  --bg-3:      #28251e;
  --bg-4:      #312e26;
  --gold:      #c9a84c;
  --gold-2:    #e8cc7a;
  --cream:     #ede7d5;
  --text:      #c8c0ac;
  --text-dim:  #7a7468;
  --border:    rgba(201,168,76,0.15);
  --border-2:  rgba(201,168,76,0.07);
  --shadow:    rgba(0,0,0,0.4);
  --logo-filter: invert(1) brightness(0.82);
  --logo-filter-footer: invert(1) brightness(0.55);
  --grain-opacity: 0.45;
  --font-d: 'Cormorant Garamond', Georgia, serif;
  --font-b: 'DM Sans', sans-serif;
  --r: 2px;
}

/* ─── Modo claro ─── */
html.light {
  --bg:        #f5f0e8;
  --bg-2:      #ece6d8;
  --bg-3:      #e2dace;
  --bg-4:      #d8cfc0;
  --gold:      #9a7530;
  --gold-2:    #b8922e;
  --cream:     #2a2418;
  --text:      #4a4438;
  --text-dim:  #8a7e6e;
  --border:    rgba(154,117,48,0.2);
  --border-2:  rgba(154,117,48,0.1);
  --shadow:    rgba(0,0,0,0.12);
  --logo-filter: invert(0) brightness(0.2);
  --logo-filter-footer: invert(0) brightness(0.35);
  --grain-opacity: 0.18;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.75;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}

/* Grano de textura */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  transition: opacity 0.35s ease;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
sub { font-size: 0.75em; }

/* ─── Transiciones suaves al cambiar tema ─── */
.site-header, .props-card, .mineral-section, .buy-block,
.mineral-card, .search-dropdown, .topbar, .site-footer,
.alpha-btn, .btn-tienda, .btn-precios, .social-btn {
  transition: background 0.35s ease, border-color 0.35s ease,
              color 0.35s ease, box-shadow 0.35s ease;
}

/* ─── Topbar tienda ─── */
.topbar {
  background: var(--gold);
  color: var(--bg);
  text-align: center;
  padding: 0.55rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.topbar a {
  color: var(--bg);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: opacity 0.2s;
}
.topbar a:hover { opacity: 0.7; }

/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(26,24,20,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
html.light .site-header {
  background: rgba(245,240,232,0.95);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  height: 68px;
  gap: 1.5rem;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  text-decoration: none;
}
.site-logo img {
  height: 36px;
  width: auto;
  filter: var(--logo-filter);
  transition: filter 0.3s;
}
.site-logo:hover img { filter: invert(1) brightness(1); }
html.light .site-logo:hover img { filter: invert(0) brightness(0); }

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text .l1 {
  font-family: var(--font-d);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--cream);
}
.logo-text .l2 {
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Buscador header */
.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}
.header-search input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--cream);
  font-family: var(--font-b);
  font-size: 0.82rem;
  padding: 0.55rem 2.4rem 0.55rem 1rem;
  outline: none;
  transition: border-color 0.2s, background 0.35s, color 0.35s;
}
.header-search input::placeholder { color: var(--text-dim); }
.header-search input:focus { border-color: var(--gold); }

.hs-btn {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  transition: color 0.2s;
  padding: 0;
}
.hs-btn:hover { color: var(--gold); }

/* Dropdown resultados */
.search-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0; right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  z-index: 400;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 32px var(--shadow);
}
.search-dropdown.open { display: block; }

.sd-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
.sd-item:last-child { border-bottom: none; }
.sd-item:hover { background: var(--bg-3); }

.sd-thumb {
  width: 38px; height: 38px;
  object-fit: cover;
  border-radius: 1px;
  flex-shrink: 0;
  filter: saturate(0.8);
}
.sd-name { font-size: 0.87rem; color: var(--cream); font-weight: 400; }
.sd-sub  { font-size: 0.7rem; color: var(--text-dim); letter-spacing: 0.05em; }
.sd-empty {
  padding: 0.9rem 1rem;
  font-size: 0.83rem;
  color: var(--text-dim);
  text-align: center;
}

/* Nav header */
.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-shrink: 0;
}
.header-nav a {
  font-size: 0.74rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.2s;
}
.header-nav a:hover { color: var(--gold); }

.btn-tienda {
  background: var(--gold) !important;
  color: var(--bg) !important;
  padding: 0.45rem 1.1rem !important;
  font-weight: 500 !important;
  border-radius: var(--r);
}
.btn-tienda:hover { background: var(--gold-2) !important; color: var(--bg) !important; }

/* ─── Botón modo oscuro/claro ─── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,76,0.06);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 16px; height: 16px; }

/* En modo oscuro mostramos sol (para cambiar a claro) */
.icon-sun  { display: block; }
.icon-moon { display: none; }
html.light .icon-sun  { display: none; }
html.light .icon-moon { display: block; }

/* ─── Hero mineral ─── */
.mineral-hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 4rem 2rem 2.5rem;
  animation: fadeUp 0.55s ease both;
}
.breadcrumb {
  font-size: 0.71rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.breadcrumb a { color: var(--gold); transition: color 0.2s; }
.breadcrumb a:hover { color: var(--gold-2); }

.hero-layout {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2.5rem;
}
.mineral-name {
  font-family: var(--font-d);
  font-size: clamp(3.5rem, 8vw, 7.5rem);
  font-weight: 300;
  line-height: 0.88;
  letter-spacing: -0.01em;
  color: var(--cream);
}
.hero-meta { padding-bottom: 0.4rem; text-align: right; }
.mineral-formula {
  font-family: var(--font-d);
  font-size: 1.4rem;
  font-style: italic;
  color: var(--gold);
  display: block;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}
.mineral-tag {
  display: inline-block;
  font-size: 0.67rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.22rem 0.75rem;
  border-radius: var(--r);
}

/* ─── Galería ─── */
.mineral-gallery {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 2rem 0;
  display: grid;
  gap: 0.9rem;
  animation: fadeUp 0.55s 0.08s ease both;
}
.mineral-gallery.cols-1 { grid-template-columns: 1fr; max-width: 640px; }
.mineral-gallery.cols-2 { grid-template-columns: 1fr 1fr; }
.mineral-gallery.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.gallery-item {
  aspect-ratio: 4/3;
  overflow: hidden;
  position: relative;
  background: var(--bg-3);
}
.gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid var(--border);
  pointer-events: none;
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.88) brightness(0.9);
  transition: transform 0.7s ease, filter 0.4s;
}
.gallery-item:hover img {
  transform: scale(1.05);
  filter: saturate(1.05) brightness(1);
}
html.light .gallery-item img {
  filter: saturate(0.92) brightness(0.97);
}
html.light .gallery-item:hover img {
  filter: saturate(1.05) brightness(1.02);
}

/* ─── Contenido 3 columnas ─── */
.mineral-content {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 240px 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  animation: fadeUp 0.55s 0.16s ease both;
}

/* Propiedades físicas */
.props-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1.8rem 1.5rem;
  position: sticky;
  top: 88px;
}
.section-label {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.3rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.props-list { list-style: none; }
.props-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}
.props-list li:last-child { border-bottom: none; }
.prop-key {
  font-size: 0.62rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.prop-val { font-size: 0.84rem; color: var(--cream); font-weight: 400; }

/* Secciones de texto */
.mineral-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2rem 1.8rem;
}
.mineral-section p {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.9;
  margin-bottom: 0.95rem;
}
.mineral-section p:last-child { margin-bottom: 0; }
.mineral-section strong { color: var(--cream); font-weight: 500; }
.mineral-section a {
  color: var(--gold);
  border-bottom: 1px solid rgba(201,168,76,0.25);
  transition: color 0.2s, border-color 0.2s;
}
.mineral-section a:hover { color: var(--gold-2); border-color: var(--gold-2); }

.yacimientos-block {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}
.yac-label {
  font-size: 0.62rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.yacimientos-block p { font-size: 0.81rem; color: var(--text-dim); margin: 0; }

/* ─── Bloque comprar ─── */
.buy-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
  animation: fadeUp 0.55s 0.24s ease both;
}
.buy-block {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.buy-text {
  font-family: var(--font-d);
  font-size: 1.55rem;
  font-weight: 300;
  color: var(--text-dim);
}
.buy-text strong { color: var(--cream); font-weight: 400; }
.btn-precios {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--gold);
  color: var(--bg);
  font-family: var(--font-b);
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.9rem 2rem;
  border-radius: var(--r);
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.btn-precios:hover { background: var(--gold-2); transform: translateY(-2px); }
.btn-precios svg { width: 15px; height: 15px; }

/* ─── Footer ─── */
.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 4rem 2rem 2rem;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}
.footer-logo-img {
  height: 44px;
  filter: var(--logo-filter-footer);
  margin-bottom: 1rem;
  transition: filter 0.35s;
}
.footer-tagline {
  font-family: var(--font-d);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}
.footer-social { display: flex; gap: 0.5rem; }
.social-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  border-radius: var(--r);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  text-decoration: none;
}
.social-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,76,0.06);
}
.social-btn svg { width: 16px; height: 16px; }

.footer-col h4 {
  font-size: 0.66rem;
  letter-spacing: 0.21em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.2rem;
}
.footer-col a, .footer-col p {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  transition: color 0.2s;
  text-decoration: none;
}
.footer-col a:hover { color: var(--cream); }

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer-copy { font-size: 0.74rem; color: var(--text-dim); }
.footer-bottom-links { display: flex; gap: 1.5rem; }
.footer-bottom-links a {
  font-size: 0.72rem;
  color: var(--text-dim);
  transition: color 0.2s;
  text-decoration: none;
}
.footer-bottom-links a:hover { color: var(--gold); }

/* ─── Animaciones ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Página índice ─── */
.index-hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
  text-align: center;
  animation: fadeUp 0.55s ease both;
}
.index-hero h1 {
  font-family: var(--font-d);
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 300;
  color: var(--cream);
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}
.index-divider {
  width: 50px; height: 1px;
  background: var(--gold);
  margin: 1.2rem auto 1.4rem;
  opacity: 0.5;
}
.index-hero p {
  font-size: 0.88rem;
  color: var(--text-dim);
  max-width: 440px;
  margin: 0 auto;
}

/* Filtro alfabético */
.alpha-filter {
  max-width: 1280px;
  margin: 3rem auto 1.5rem;
  padding: 0 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  animation: fadeUp 0.55s 0.1s ease both;
}
.alpha-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border: 1px solid var(--border-2);
  background: none;
  cursor: pointer;
  border-radius: var(--r);
  font-family: var(--font-b);
  transition: all 0.18s;
  text-transform: uppercase;
}
.alpha-btn:hover, .alpha-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,76,0.06);
}
.alpha-btn.all { padding: 0 0.9rem; letter-spacing: 0.12em; font-size: 0.72rem; }

/* Grid minerales */
.minerals-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem 6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.4rem;
  animation: fadeUp 0.55s 0.18s ease both;
}
.mineral-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.28s, transform 0.28s, background 0.35s;
  position: relative;
  text-decoration: none;
}
.mineral-card:hover {
  border-color: rgba(201,168,76,0.4);
  transform: translateY(-4px);
}
.card-img-wrap {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg-3);
}
.card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.82);
  transition: transform 0.55s ease, filter 0.4s;
}
.mineral-card:hover .card-img-wrap img {
  transform: scale(1.06);
  filter: saturate(1.05);
}
.card-body {
  padding: 1rem 1.1rem 2.5rem;
  flex: 1;
}
.card-name {
  font-family: var(--font-d);
  font-size: 1.42rem;
  font-weight: 400;
  color: var(--cream);
  line-height: 1.1;
  margin-bottom: 0.2rem;
}
.card-formula {
  font-family: var(--font-d);
  font-style: italic;
  font-size: 0.83rem;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.card-group {
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.card-arrow {
  position: absolute;
  bottom: 0.85rem; right: 0.85rem;
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  border-radius: var(--r);
  transition: all 0.2s;
}
.mineral-card:hover .card-arrow {
  border-color: var(--gold);
  color: var(--gold);
}

/* ─── Iconos sociales sin recuadro ─── */
.social-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
  padding: 2px;
}
.social-icon-btn:hover {
  color: var(--gold);
  transform: translateY(-2px);
}
.social-icon-btn svg { display: block; }

/* ─── Blog link footer ─── */
.footer-blog-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.1rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}
.footer-blog-link:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.footer-blog-link svg { flex-shrink: 0; }

/* ─── Selector de idioma ─── */
.lang-selector {
  position: relative;
  flex-shrink: 0;
}
.lang-current {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-dim);
  font-family: var(--font-b);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.38rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}
.lang-current:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,76,0.06);
}
.lang-chevron {
  transition: transform 0.2s;
  opacity: 0.6;
}
.lang-dropdown.open + .lang-current .lang-chevron,
.lang-current[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}
.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 300;
  min-width: 130px;
  display: none;
  overflow: hidden;
  transition: background 0.35s, border-color 0.35s;
}
.lang-dropdown.open { display: block; }
.lang-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  font-family: var(--font-b);
  font-size: 0.82rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
  border-bottom: 1px solid var(--border-2);
}
.lang-opt:last-child { border-bottom: none; }
.lang-opt:hover { background: var(--bg-3); color: var(--cream); }
.lang-opt.active { color: var(--gold); }
.lang-opt span { flex: 1; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

/* ─── Tablet apaisada: 1024px ─── */
@media (max-width: 1024px) {
  /* Contenido mineral: props fija + 2 columnas de texto */
  .mineral-content {
    grid-template-columns: 200px 1fr;
    padding: 0 1.5rem;
  }
  .mineral-section:nth-child(3) { grid-column: 2; }

  /* Footer 2 columnas */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }

  .mineral-gallery { padding: 1.5rem 1.5rem 0; }
  .buy-section     { padding: 0 1.5rem; }
  .index-hero      { padding: 4rem 1.5rem 2.5rem; }
  .alpha-filter    { padding: 0 1.5rem; }
  .minerals-grid   { padding: 0 1.5rem 5rem; }
}

/* ─── Tablet portrait / móvil grande: 768px ─── */
@media (max-width: 768px) {

  /* ── Header ── */
  .header-inner {
    padding: 0 1rem;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 0;
  }

  /* Fila 1: logo + botones de acción */
  .site-logo      { flex: 1; min-width: 0; padding: 0.75rem 0; }
  .logo-text .l2  { display: none; }   /* "Diccionario de Minerales" oculto */
  .logo-text .l1  { font-size: 0.85rem; }

  .header-nav {
    margin-left: 0;
    gap: 0.5rem;
    padding: 0.75rem 0;
    flex-shrink: 0;
  }
  .header-nav .nav-link { display: none; }  /* "Minerales" oculto en móvil */
  .btn-tienda { font-size: 0.68rem !important; padding: 0.4rem 0.75rem !important; }

  /* Buscador en fila 2 (ancho completo) */
  .header-search {
    order: 10;           /* va después de logo y nav */
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 0 0.6rem;
  }
  .header-search input { font-size: 0.88rem; padding: 0.65rem 2.5rem 0.65rem 1rem; }

  /* ── Topbar ── */
  .topbar { font-size: 0.68rem; padding: 0.45rem 0.75rem; letter-spacing: 0.08em; }

  /* ── Hero mineral ── */
  .mineral-hero { padding: 2rem 1rem 1.5rem; }
  .hero-layout  {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
  }
  .mineral-name { font-size: clamp(2.8rem, 12vw, 5rem); }
  .hero-meta    { text-align: left; }
  .mineral-formula { font-size: 1.1rem; }

  /* ── Galería ── */
  .mineral-gallery         { padding: 1rem 1rem 0; gap: 0.6rem; }
  .mineral-gallery.cols-3  { grid-template-columns: 1fr 1fr; }
  .mineral-gallery.cols-2  { grid-template-columns: 1fr 1fr; }

  /* ── Contenido mineral: todo en 1 columna ── */
  .mineral-content {
    grid-template-columns: 1fr;
    padding: 0 1rem;
    gap: 1rem;
  }
  .mineral-section:nth-child(3) { grid-column: 1; }
  .props-card { position: static; top: auto; }

  /* Props: 2 columnas en móvil para aprovechar espacio */
  .props-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .props-list li { padding: 0.5rem 0.25rem; }
  .props-list li:nth-child(odd)  { border-right: 1px solid var(--border-2); padding-right: 0.75rem; }
  .props-list li:nth-child(even) { padding-left: 0.75rem; border-bottom: 1px solid var(--border-2); }
  .props-list li:nth-last-child(-n+2) { border-bottom: none; }

  /* Secciones de texto */
  .mineral-section { padding: 1.5rem 1.2rem; }
  .mineral-section p { font-size: 0.9rem; line-height: 1.8; }

  /* ── Bloque comprar ── */
  .buy-section { padding: 0 1rem; }
  .buy-block   {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 1.5rem 1.2rem;
    gap: 1.2rem;
  }
  .buy-text    { font-size: 1.25rem; }
  .btn-precios { justify-content: center; padding: 0.85rem 1.5rem; }

  /* ── Índice ── */
  .index-hero   { padding: 2.5rem 1rem 1.5rem; }
  .index-hero h1 { font-size: clamp(2.4rem, 10vw, 4rem); }
  .alpha-filter { padding: 0 1rem; margin: 1.5rem auto 1rem; gap: 0.3rem; }
  .alpha-btn    { min-width: 30px; height: 30px; font-size: 0.72rem; }
  .minerals-grid { padding: 0 1rem 4rem; gap: 1rem; }

  /* ── Footer ── */
  .site-footer  { padding: 3rem 1rem 1.5rem; margin-top: 3rem; }
  .footer-grid  { grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 2rem; }
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }
  .footer-bottom-links { flex-wrap: wrap; justify-content: center; gap: 1rem; }

  /* ── Selector idioma ── */
  .lang-current { font-size: 0.68rem; padding: 0.35rem 0.5rem; }
  #lang-code    { display: none; }  /* Solo bandera en móvil */

  /* ── Tema toggle ── */
  .theme-toggle { width: 32px; height: 32px; }
}

/* ─── Móvil pequeño: 480px ─── */
@media (max-width: 480px) {
  /* Galería: 1 columna */
  .mineral-gallery.cols-2,
  .mineral-gallery.cols-3 { grid-template-columns: 1fr; }

  /* Grid de minerales: 2 columnas ajustadas */
  .minerals-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .card-body     { padding: 0.75rem 0.85rem 2.2rem; }
  .card-name     { font-size: 1.2rem; }
  .card-formula  { font-size: 0.75rem; }
  .card-group    { font-size: 0.6rem; }

  /* Props: 1 columna en pantallas muy pequeñas */
  .props-list { grid-template-columns: 1fr; }
  .props-list li:nth-child(odd)  { border-right: none; padding-right: 0; }
  .props-list li:nth-child(even) { padding-left: 0; border-bottom: 1px solid var(--border-2); }

  /* Hero nombre más compacto */
  .mineral-name { font-size: clamp(2.4rem, 14vw, 3.5rem); }

  /* Header: oculta texto del botón tienda, solo icono */
  .btn-tienda { letter-spacing: 0; }

  /* Filtro alfa: botones más pequeños */
  .alpha-btn { min-width: 28px; height: 28px; font-size: 0.68rem; }
  .alpha-btn.all { padding: 0 0.6rem; }

  /* Topbar oculta texto largo, deja solo el link */
  .tb-txt { display: none; }
}

/* ─── Móvil muy pequeño: 360px ─── */
@media (max-width: 360px) {
  .minerals-grid { grid-template-columns: 1fr; }
  .logo-text .l1 { font-size: 0.78rem; }
  .site-logo img { height: 28px; }
}
