/* ─── Portal Matteria — descubrimiento de tiendas ─── */
:root {
  --primary: #0a2540;
  --primary-dark: #061a30;
  --primary-soft: #1a365d;
  --accent: #ff6b35;
  --accent-soft: #ffedd5;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 2px 8px rgba(15,23,42,.06);
  --shadow: 0 6px 18px rgba(15,23,42,.10);
  --shadow-lg: 0 16px 44px rgba(15,23,42,.16);
  --radius: 14px;
  --container: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

.splash { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.spin { width: 32px; height: 32px; border: 3px solid #eee; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ─── Header ─── */
.portal-header {
  position: sticky; top: 0; z-index: 80;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.portal-header-inner {
  max-width: var(--container); margin: 0 auto;
  padding: 18px 24px;
  display: flex; align-items: center; gap: 24px;
}
.portal-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.portal-brand img { height: 48px; }
.portal-brand .brand-text { font-weight: 800; font-size: 20px; color: var(--primary); letter-spacing: -.025em; }
.portal-nav { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.portal-nav a {
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.portal-nav a:hover { background: var(--bg-soft); color: var(--text); }
.portal-nav a.cta { background: var(--accent); color: #fff; }
.portal-nav a.cta:hover { background: #ea580c; color: #fff; }

@media (max-width: 640px) {
  .portal-header-inner { padding: 10px 14px; gap: 10px; }
  .portal-brand img { height: 36px; }
  .portal-nav { gap: 4px; }
  .portal-nav a { padding: 6px 9px; font-size: 12px; }
  /* En móvil ocultamos "Sobre Matteria" para no apretar */
  .portal-nav a:not(.cta):not([href="#tiendas"]) { display: none; }
}

/* ─── Banner APK Android ─── */
.apk-banner {
  background: linear-gradient(90deg,#fff7ed,#ffedd5);
  border-bottom: 1px solid #fed7aa;
  padding: 8px 14px;
  font-size: 13.5px;
  color: #7c2d12;
}
.apk-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.apk-inner svg { color: #ea580c; }
.apk-text { flex: 1; min-width: 0; }
.apk-text strong { font-weight: 800; }
.apk-btn {
  background: #f97316; color: #fff;
  padding: 6px 14px; border-radius: 8px;
  font-weight: 700; font-size: 12.5px;
  text-decoration: none; flex-shrink: 0;
  transition: background .15s;
}
.apk-btn:hover { background: #ea580c; color: #fff; }
.apk-close {
  background: none; border: none; cursor: pointer;
  color: #7c2d12; font-size: 22px; padding: 0 4px;
  line-height: 1; flex-shrink: 0;
}
@media (max-width: 540px) {
  .apk-banner { padding: 8px 12px; font-size: 12px; }
  .apk-inner { gap: 8px; }
  .apk-text { font-size: 12px; line-height: 1.35; }
  .apk-text strong { display: block; font-size: 12.5px; }
  .apk-btn { padding: 5px 12px; font-size: 11.5px; }
}

/* ─── Hero ─── */
.hero {
  position: relative;
  background:
    radial-gradient(circle at 70% 30%, rgba(255,107,53,0.18) 0%, transparent 45%),
    radial-gradient(circle at 30% 70%, rgba(15,118,110,0.18) 0%, transparent 50%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  color: #fff;
  padding: 80px 0 100px;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><path d="M0 30h60M30 0v60" stroke="%23ffffff" stroke-opacity="0.04" stroke-width="1"/></svg>');
  background-size: 30px 30px;
}
.hero-inner { position: relative; z-index: 1; max-width: 800px; }
.hero-eyebrow { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .15em; color: var(--accent); margin-bottom: 18px; }
.hero-title { font-size: 56px; font-weight: 900; line-height: 1.05; letter-spacing: -.03em; margin: 0 0 22px; }
.hero-title strong { color: var(--accent); }
.hero-sub { font-size: 18px; line-height: 1.6; opacity: .92; margin: 0 0 32px; max-width: 600px; }
.hero-stats {
  display: flex; gap: 36px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid rgba(255,255,255,.15);
  margin-top: 22px;
}
.hero-stat strong { display: block; font-size: 36px; font-weight: 900; color: var(--accent); letter-spacing: -.02em; }
.hero-stat span { font-size: 13px; opacity: .8; text-transform: uppercase; letter-spacing: .08em; }

@media (max-width: 720px) {
  .hero { padding: 44px 0 52px; }
  .hero-title { font-size: 32px; }
  .hero-sub { font-size: 14.5px; line-height: 1.55; }
  .hero-stats { gap: 22px; padding-top: 12px; margin-top: 20px; }
  .hero-stat strong { font-size: 26px; }
  .hero-stat span { font-size: 11.5px; }
}
@media (max-width: 480px) {
  .hero { padding: 32px 0 40px; }
  .hero-eyebrow { font-size: 11px; margin-bottom: 12px; }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 14px; }
  .hero-stats { gap: 16px; }
}

/* ─── Cómo funciona ─── */
.como-funciona { padding: 64px 0; background: var(--bg-soft); }
.como-funciona h2 { font-size: 30px; font-weight: 800; text-align: center; margin: 0 0 8px; color: var(--primary); letter-spacing: -.025em; }
.como-funciona .sub { text-align: center; color: var(--text-soft); margin: 0 0 48px; font-size: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
@media (max-width: 768px) { .steps { grid-template-columns: 1fr; gap: 20px; } }
.step { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: var(--accent-soft); color: var(--accent); border-radius: 12px; font-weight: 800; font-size: 18px; margin-bottom: 18px; }
.step h3 { font-size: 18px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.step p { font-size: 14px; color: var(--text-soft); margin: 0; line-height: 1.55; }

/* ─── Sección tiendas ─── */
.section-tiendas { padding: 72px 0 96px; }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head .eyebrow { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin-bottom: 10px; }
.section-head h2 { font-size: 32px; font-weight: 800; margin: 0 0 8px; color: var(--primary); letter-spacing: -.025em; }
.section-head p { color: var(--text-soft); margin: 0; font-size: 15.5px; }
@media (max-width: 640px) {
  .section-tiendas { padding: 44px 0 56px; }
  .section-head { margin-bottom: 26px; }
  .section-head h2 { font-size: 24px; }
  .section-head p { font-size: 13.5px; }
}

/* ─── Cómo funciona móvil ─── */
@media (max-width: 640px) {
  .como-funciona { padding: 44px 0; }
  .como-funciona h2 { font-size: 24px; }
  .como-funciona .sub { font-size: 14px; margin-bottom: 28px; }
  .step { padding: 22px 18px; }
}

/* ─── CTA / Footer móvil ─── */
@media (max-width: 640px) {
  .cta-asociate { padding: 44px 16px; }
  .cta-asociate h2 { font-size: 24px; }
  .cta-asociate p { font-size: 14px; }
  .cta-asociate a { padding: 12px 26px; font-size: 14px; }
  .portal-footer { padding: 36px 0 22px; }
  .portal-footer .footer-grid { padding-bottom: 24px; }
}

.tiendas-toolbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 28px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border-radius: 14px;
  border: 1px solid var(--border);
}
@media (max-width: 640px) {
  .tiendas-toolbar { padding: 12px; gap: 8px; border-radius: 12px; }
  .tiendas-search { min-width: 100%; height: 40px; }
  .tiendas-toolbar select { min-width: 100%; height: 40px; }
  .tiendas-counter { margin-left: 0; width: 100%; text-align: center; }
}
.tiendas-search {
  flex: 1; min-width: 220px;
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0 14px;
  height: 42px;
  transition: border-color .15s;
}
.tiendas-search:focus-within { border-color: var(--primary); }
.tiendas-search svg { color: var(--text-mute); flex-shrink: 0; }
.tiendas-search input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; font-size: 14px; font-family: inherit; color: var(--text); }
.tiendas-search input::placeholder { color: var(--text-mute); }
.tiendas-toolbar select { padding: 0 14px; height: 42px; border: 1.5px solid var(--border); border-radius: 999px; background: #fff; font-size: 14px; font-family: inherit; color: var(--text); cursor: pointer; min-width: 180px; }
.tiendas-counter { font-size: 13px; color: var(--text-mute); margin-left: auto; }

/* Mapa simplificado */
#tiendas-map { width: 100%; height: 460px; border-radius: 16px; border: 1px solid var(--border); margin-bottom: 28px; box-shadow: var(--shadow-sm); overflow: hidden; background: #f5f6f8; }
@media (max-width: 768px) { #tiendas-map { height: 340px; border-radius: 12px; margin-bottom: 22px; } }
@media (max-width: 480px) { #tiendas-map { height: 280px; } }
.leaflet-container { font-family: 'Inter', sans-serif; background: #f5f6f8 !important; }
.leaflet-popup-content { font-family: 'Inter', sans-serif; font-size: 13px; }
.leaflet-popup-content strong { display: block; font-size: 14px; color: var(--primary); margin-bottom: 4px; }
.leaflet-popup-content a { color: var(--accent); font-weight: 600; text-decoration: none; }
/* Pines personalizados — div con SVG inline */
.tienda-pin { background: transparent !important; border: none !important; }
.tienda-pin svg { display: block; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); transition: transform .15s; }
.tienda-pin:hover svg { transform: translateY(-3px) scale(1.08); }
.tienda-pin-online { z-index: 1000 !important; }

/* ─── Modal Asóciate ─── */
.asociate-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; padding-top: env(safe-area-inset-top, 20px); padding-bottom: env(safe-area-inset-bottom, 20px); }
.asociate-bg { position: absolute; inset: 0; background: rgba(10,37,64,.55); backdrop-filter: blur(4px); animation: bgIn .2s ease-out; }
@keyframes bgIn { from { opacity: 0; } to { opacity: 1; } }
.asociate-window { position: relative; background: #fff; border-radius: 18px; max-width: 560px; width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,.35); animation: windIn .25s cubic-bezier(.2,.7,.3,1.1); }
@keyframes windIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.asociate-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--bg-soft); border: none; font-size: 22px; color: var(--text-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; transition: background .15s; }
.asociate-close:hover { background: var(--border); color: var(--text); }
.asociate-head { padding: 28px 32px 8px; border-bottom: 1px solid var(--border); }
.asociate-head .asociate-eyebrow { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin-bottom: 6px; }
.asociate-head h3 { margin: 0 0 8px; font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }
.asociate-head p { margin: 0 0 22px; font-size: 13.5px; color: var(--text-soft); line-height: 1.55; }
.asociate-form { padding: 22px 32px 28px; }
.ar-row { margin-bottom: 14px; }
.ar-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .ar-row-2 { grid-template-columns: 1fr; } }
.ar-row label { display: block; font-size: 12px; font-weight: 700; color: var(--text-soft); }
.ar-row input, .ar-row textarea { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s; }
.ar-row input:focus, .ar-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,37,64,.08); }
.ar-row textarea { resize: vertical; min-height: 80px; }
.ar-msg { font-size: 13px; margin: 0 0 12px; padding: 0 2px; min-height: 18px; }
.ar-msg.ar-ok { color: #15803d; font-weight: 600; }
.ar-msg.ar-ko { color: #b91c1c; font-weight: 600; }
.ar-submit { width: 100%; padding: 13px 20px; background: var(--accent); color: #fff; border: none; border-radius: 12px; font-size: 14.5px; font-weight: 700; cursor: pointer; transition: background .15s, transform .1s; box-shadow: 0 8px 22px rgba(255,107,53,.3); }
.ar-submit:hover:not(:disabled) { background: #ea580c; }
.ar-submit:active { transform: translateY(1px); }
.ar-submit:disabled { opacity: .5; cursor: not-allowed; }
.ar-legal { font-size: 11.5px; color: var(--text-mute); margin: 14px 0 0; line-height: 1.5; text-align: center; }

/* Grid de tiendas */
.tiendas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 1000px) { .tiendas-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .tiendas-grid { grid-template-columns: 1fr; gap: 10px; } }

.tienda-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column;
}
.tienda-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(10,37,64,.2); }

/* ─── Vista compacta en móvil: card horizontal en lugar de vertical ─── */
@media (max-width: 640px) {
  .tienda-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 110px;
    border-radius: 14px;
  }
  .tienda-card:hover { transform: none; }
  .tienda-cover {
    width: 110px;
    height: 110px;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    font-size: 32px;
  }
  .tienda-cover img { padding: 0; }
  .tienda-cover .cover-logo { padding: 10px; }
  .tienda-cover .cover-logo img { max-width: 90%; max-height: 90%; }
  .tienda-online-badge {
    font-size: 8px; padding: 3px 6px;
    top: 5px; right: 5px;
    letter-spacing: .04em;
  }
  .tienda-body {
    padding: 10px 12px 10px 14px;
    min-width: 0;
    justify-content: space-between;
  }
  .tienda-name { font-size: 13.5px; margin-bottom: 2px; -webkit-line-clamp: 2; min-height: 0; }
  .tienda-loc { font-size: 11.5px; margin-bottom: 4px; }
  .tienda-loc svg { width: 11px; height: 11px; }
  /* Ocultamos los detalles secundarios: la card es un teaser ahora */
  .tienda-addr { display: none; }
  .tienda-contacts { display: none; }
  .tienda-actions { gap: 6px; }
  .tienda-actions a { font-size: 11.5px; padding: 6px 10px; border-radius: 8px; min-height: 30px; line-height: 1.2; }
}

.tienda-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,107,53,0.25) 0%, transparent 60%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  color: rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 900; letter-spacing: -.05em;
  text-transform: uppercase;
  overflow: hidden;
}
.tienda-cover img { width: 100%; height: 100%; object-fit: cover; }
/* Cuando solo hay logo (no foto/hero), centrarlo con padding sobre el fondo navy */
.tienda-cover .cover-logo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 22px; background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.10) 0%, transparent 60%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%); }
.tienda-cover .cover-logo img { width: auto; height: auto; max-width: 80%; max-height: 80%; object-fit: contain; filter: drop-shadow(0 4px 16px rgba(0,0,0,.25)); }
.tienda-online-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 5px 10px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(255,107,53,.4);
}

.tienda-body { padding: 18px 20px 20px; flex: 1; display: flex; flex-direction: column; }
.tienda-name { font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -.015em; margin: 0 0 6px; line-height: 1.3; }
.tienda-loc { font-size: 13px; color: var(--text-soft); margin: 0 0 6px; }
.tienda-loc svg { width: 14px; height: 14px; vertical-align: text-bottom; margin-right: 4px; color: var(--accent); }
.tienda-addr { font-size: 12.5px; color: var(--text-mute); margin: 0 0 14px; line-height: 1.45; }
.tienda-contacts { display: flex; gap: 14px; font-size: 12px; margin-bottom: 14px; }
.tienda-contacts a { color: var(--text-soft); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tienda-contacts a:hover { color: var(--primary); }

.tienda-actions { margin-top: auto; display: flex; gap: 8px; }
.tienda-actions a {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 700;
  text-align: center; text-decoration: none;
  transition: background .15s;
}
.tienda-actions .btn-online { background: var(--accent); color: #fff; }
.tienda-actions .btn-online:hover { background: #ea580c; }
.tienda-actions .btn-info { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.tienda-actions .btn-info:hover { background: var(--bg); border-color: var(--primary); }

.empty-tiendas { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--text-mute); }

/* ─── CTA Asóciate ─── */
.cta-asociate {
  background:
    radial-gradient(circle at 100% 50%, rgba(255,107,53,0.3) 0%, transparent 60%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 64px 0;
  text-align: center;
}
.cta-asociate h2 { font-size: 32px; font-weight: 900; margin: 0 0 14px; letter-spacing: -.025em; }
.cta-asociate p { font-size: 16px; opacity: .9; margin: 0 0 26px; max-width: 580px; margin-left: auto; margin-right: auto; }
.cta-asociate a {
  display: inline-block;
  background: var(--accent); color: #fff;
  padding: 14px 32px; border-radius: 999px;
  font-size: 15px; font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(255,107,53,.35);
  transition: transform .15s;
}
.cta-asociate a:hover { transform: translateY(-2px); }

/* ─── Footer ─── */
.portal-footer { background: var(--primary-dark); color: rgba(255,255,255,.75); padding: 48px 0 24px; }
.portal-footer .footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 36px; padding-bottom: 32px; }
@media (max-width: 768px) { .portal-footer .footer-grid { grid-template-columns: 1fr; gap: 28px; } }
.portal-footer h4 { color: #fff; font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 14px; }
.portal-footer p, .portal-footer a { font-size: 13.5px; line-height: 1.6; }
.portal-footer a { color: rgba(255,255,255,.75); text-decoration: none; transition: color .15s; }
.portal-footer a:hover { color: var(--accent); }
.portal-footer .footer-bottom { padding-top: 22px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; opacity: .65; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
