:root{
  --bg:#0b0f13;
  --card:#11161c;
  --text:#e6edf3;
  --muted:#a9b4bf;
  --accent:#7fd1b9;
  --accent-2:#c7a46c;
  --ring: 2px solid rgba(127,209,185,.25);
  --radius: 18px;

  /* Responsive globals */
  --container: 1200px;
  --gutter: clamp(14px, 4vw, 42px);
  --sectionY: clamp(34px, 6vw, 64px);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--text);
  font-family:Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size:16px;
}
a{color:var(--accent)}
img{max-width:100%;display:block}
input,textarea,button{font-size:16px}

/* Layout */
.container{
  width:min(var(--container), calc(100vw - (var(--gutter) * 2)));
  margin-inline:auto;
}
section{
  padding:var(--sectionY) 0;
  border-top:1px solid rgba(255,255,255,.06);
}
section h2{font-size:clamp(22px,3vw,34px);margin:0 0 18px}
.lead{
  color:var(--muted);
  font-size:clamp(16px, 1.2vw, 18px);
  line-height:1.6;
  margin-top:-6px;
}

/* Grid: 3 columnas SIEMPRE */
#totemGrid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Ajustes para móvil: menos gap y tarjetas más “cuadradas” */
@media (max-width: 560px){
  #totemGrid{ gap: 10px; }
  #totemGrid .totem{
    border-radius: 14px;
  }
  /* Si tienes títulos debajo, escóndelos en móvil para que no “rompan” el grid */
  #totemGrid .meta .title{ display:none; }
  #totemGrid .meta{ min-height: 0; }
}


.totem{ scroll-margin-top: 110px; }

.just-unlocked{
  outline: 2px solid rgba(102,217,224,0.75);
  box-shadow: 0 0 18px rgba(102,217,224,0.25);
  border-radius: 16px;
}

.modal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  justify-content:center;
  align-items:center;
  z-index: 99999;              /* <-- más alto */
}
.modal-content{
  position: relative;
  z-index: 100000;             /* <-- por si acaso */
}

.modal{
  padding: 24px;              /* margen interno para que no toque los bordes */
}
.modal-content{
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.totem .veil{
  padding: 0 6px;
  word-break: break-word;
}

/* Modal de tótem */
.totem-modal{
  width: min(920px, calc(100vw - 48px));
  padding: 18px;
}
.totem-modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.totem-modal__head h3{
  margin:0;
  font-size: 1.2rem;
}
.totem-close{
  background: transparent;
  border: 1px solid rgba(102,217,224,0.55);
  color: #e6edf3;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.totem-close:hover{
  background: rgba(102,217,224,0.12);
}

#totemModalImg{
  width: 100%;
  height: auto;
  display:block;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}

.totem-modal__body{
  color: rgba(255,255,255,0.88);
  line-height: 1.55;
  font-size: 1rem;
  max-height: min(42vh, 360px);
  overflow: auto;
  padding-right: 4px;
}


#map{
  position: relative;
  z-index: 1;
}

/* UI primitives */
.btn{
  background:var(--accent);
  color:#0b0f13;
  border:none;
  border-radius:12px;
  padding:12px 18px;
  font-weight:700;
  cursor:pointer;
}
.btn.secondary{
  background:transparent;
  color:var(--text);
  border:1px solid rgba(255,255,255,.18);
}
.card{
  background:var(--card);
  border:1px solid rgba(255,255,255,.06);
  border-radius:var(--radius);
  padding:18px;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
}

/* NAV */
header{
  position:sticky;top:0;z-index:50;
  background:rgba(11,15,19,.7);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(255,255,255,.06);
}
nav{display:flex;align-items:center;justify-content:space-between;padding:12px 0}
.brand{display:flex;gap:10px;align-items:center;font-weight:800;letter-spacing:.4px}
.brand .dot{width:10px;height:10px;border-radius:999px;background:var(--accent)}
.navlinks{display:flex;gap:18px;align-items:center}
.navlinks a{color:var(--text);text-decoration:none;font-weight:600;opacity:.85}
.navlinks a:hover{opacity:1}
#menuBtn{display:none}

@media (max-width: 820px){
  #menuBtn{
    display:inline-flex;
    background:none;
    border:1px solid rgba(255,255,255,.2);
    color:var(--text);
    padding:6px 10px;
    border-radius:10px;
  }
  .navlinks{display:none}
  .navlinks.open{
    display:flex;
    position:absolute;
    top:56px;left:0;right:0;
    background:#0f141a;
    padding:14px 18px;
    flex-direction:column;
    border-bottom:1px solid rgba(255,255,255,.06);
  }
}


/* SEO/accessibility */
.sr-only{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

/* Grids */
.grid{display:grid;gap:16px}

/* Totems grid */
.grid.totems{grid-template-columns:repeat(3, 1fr)}
@media (max-width: 900px){.grid.totems{grid-template-columns:repeat(2, 1fr)}}
@media (max-width: 560px){.grid.totems{grid-template-columns:1fr}}

.totem{
  position:relative;
  overflow:hidden;
  border-radius:16px;
  background:#0f141a;
  border:1px solid rgba(255,255,255,.06);
}
.totem .meta{
  padding:12px 14px;
  border-top:1px solid rgba(255,255,255,.06);
  display:flex;justify-content:space-between;align-items:center;
}
.tag{
  font-size:12px;
  color:#10151b;
  background:var(--accent);
  padding:4px 8px;
  border-radius:999px;
  font-weight:800;
}
.totem .title{font-weight:700}
.placeholder{
  background:linear-gradient(180deg, #1a222b, #0f141a);
  aspect-ratio:16/12;
  display:flex;align-items:center;justify-content:center;
  color:#7b8a97;
}
.placeholder span{opacity:.7}

/* Totems: modo sin spoilers */
#totems .totem img{
  filter:blur(12px);
  transform:scale(1.03);
  transition:filter .25s ease, transform .25s ease, opacity .25s ease;
}
.totem .veil{
  position:absolute;inset:0;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(to bottom, rgba(0,0,0,.15), rgba(0,0,0,.70));
  color:rgba(255,255,255,.92);
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  opacity:1;
  pointer-events:none;
  transition:opacity .25s ease;
}
#totems .totem.unlocked img{filter:none !important;transform:none !important;}
.totem.unlocked .veil{opacity:0;}

/* Eneatipos */
.enea-grid{display:grid;grid-template-columns:repeat(3, 1fr);gap:12px}
@media (max-width: 820px){.enea-grid{grid-template-columns:1fr 1fr}}
.chip{
  background:#0f141a;
  border:1px solid rgba(255,255,255,.06);
  padding:12px;
  border-radius:12px;
}
.chip b{color:var(--accent)}

/* Map */
#map{
  height:420px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.06);
  overflow:hidden;
}
.map-legend{font-size:13px;color:var(--muted);margin-top:8px}
.map-actions{margin-top:18px;text-align:center}

/* Personajes */
.people{display:grid;grid-template-columns:repeat(3, 1fr);gap:16px}
@media (max-width: 900px){.people{grid-template-columns:1fr 1fr}}
@media (max-width: 560px){.people{grid-template-columns:1fr}}
.person{
  display:flex;
  gap:14px;
  align-items:flex-start;
  background:#0f141a;
  border:1px solid rgba(255,255,255,.06);
  padding:14px;
  border-radius:14px;
}
.avatar{width:64px;height:64px;border-radius:12px;background:#192028;flex:none}


/* Reader access + buttons */
#readerAccess{display:flex;gap:.75rem;justify-content:center;flex-wrap:wrap;margin-top:1.25rem}

.amazon-btn{
  display:inline-block;
  background:#FF9900;
  color:#111;
  font-weight:600;
  padding:12px 24px;
  border-radius:8px;
  text-decoration:none;
  transition:0.3s;
}
.amazon-btn:hover{background:#e68a00;transform:translateY(-2px)}

.secondary-btn{
  display:inline-block;
  background:transparent;
  color:#66d9e0;              /* un poco más luminoso */
  font-weight:600;
  padding:12px 24px;
  border-radius:10px;         /* iguala o supera al principal */
  text-decoration:none;
  border:2px solid #66d9e0;
  transition:all 0.3s ease;
}

.secondary-btn:hover{
  background:#66d9e0;
  color:#081018;
  transform:translateY(-2px);
}

.reset-btn{
  background:transparent;
  color:var(--accent);
  border:1px solid var(--accent);
  padding:8px 18px;
  border-radius:999px;
  cursor:pointer;
  font-size:.95rem;
  transition:.25s ease;
}
.reset-btn:hover{background:var(--accent);color:#111;transform:translateY(-1px)}

@media (max-width: 560px){
  .amazon-btn,.btn{display:inline-flex;justify-content:center;width:100%}
}

/* Footer */
footer{padding:40px 0;color:var(--muted)}
footer .row{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}
.credits a{color:var(--muted)}
@media (max-width: 560px){
  footer .row{flex-direction:column;align-items:flex-start;gap:10px}
}

/* FIX Leaflet: evita que el max-width global rompa los tiles */
.leaflet-container img{max-width:none !important;}
.leaflet-pane,
.leaflet-top,
.leaflet-bottom{
  z-index: 400;   /* valores típicos Leaflet; el modal va muchísimo más arriba */
}
#totems .totem:not(.unlocked) img{
  pointer-events:none;
}

/* Estilo base del overlay */
.totem .veil{
  font-size: 22px;
  letter-spacing: 0;
}

/* En móvil mostramos solo icono */
/* MÓVIL: en bloqueado, solo candado (sin palabra) */
@media (max-width: 560px){
  #totems .totem:not(.unlocked) .veil{
    font-size: 0 !important;      /* oculta el texto BLOQUEADO */
    letter-spacing: 0 !important;
  }

  #totems .totem:not(.unlocked) .veil::before{
    content: "🔒";
    font-size: 20px;
    color: rgba(255,255,255,.9);
  }
}

/* Solo los desbloqueados parecen clicables */
#totems .totem.unlocked{
  cursor: pointer;
}

/* Los bloqueados no */
#totems .totem:not(.unlocked){
  cursor: default;
}

#totems .totem.unlocked:hover{
  transform: translateY(-4px);
  transition: transform .2s ease;
}

/* Tótems desbloqueados: claramente interactivos */
#totems .totem.unlocked{
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

#totems .totem.unlocked:hover{
  transform: translateY(-4px);
  border-color: rgba(127,209,185,.6);
  box-shadow: 0 10px 30px rgba(0,0,0,.35),
              0 0 18px rgba(127,209,185,.25);
}

/* Bloqueados: no parecen clicables */
#totems .totem:not(.unlocked){
  cursor: default;
}

.autor-box{
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.autor-foto{
  width: 170px;
  height: 170px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.08);
}

@media (max-width: 720px){
  .autor-box{ flex-direction: column; align-items: center; text-align: center; }
}

.cta-row{
  display: flex;
  gap: 14px;           /* separación entre botones */
  flex-wrap: wrap;     /* si no caben, bajan */
  align-items: center;
  margin-top: 14px;    /* aire respecto a la lista */
}

/* opcional: igualar alturas/anchos mínimos */
.cta-row a{
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 720px){
  .autor-box{
    flex-direction: column;
    align-items: center;   /* foto centrada */
  }
  .autor-box > div{
    text-align: left;      /* texto alineado normal */
    width: 100%;           /* para que el left tenga sentido */
  }
}
#modalError .modal-input{
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.35);
  color: rgba(255,255,255,.92);
  outline: none;
}

#modalError .modal-actions{
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

footer{
  font-size: 0.9rem;
}

footer .credits{
  font-size: 0.85rem;
}

footer .row > div:last-child{
  font-size: 0.75rem;
  opacity: 0.65;
}
.frase-final{
  text-align: center;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  margin: 90px 0 40px;
  letter-spacing: 0.02em;
}

@media (max-width: 560px){
  .person{
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .person .avatar{
    margin-bottom: 8px;
  }
}
/* HERO + LIBRO: layout alineado */
.hero{
  padding: clamp(44px, 7vw, 90px) 0 clamp(28px, 5vw, 60px);
}

.hero-clean .hero-left{
  padding-inline: 0;
}

.hero-title-img{
  width: min(560px, 100%);
  margin-bottom: clamp(14px, 3vw, 24px);
  opacity: .95;
}

.hero-inner,
.book{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: clamp(18px, 4vw, 44px);
  align-items: start;
}

.hero-left,
.book-left{
  min-width: 0;
}

.libro-card,
.book-right{
  width: 420px;
  max-width: 100%;
  justify-self: end;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px;
  min-height: 320px;
}

.libro-card{
  align-items: center;
}

.mockup,
.trailer-wrap{
  width: 320px;
  max-width: 100%;
  margin: 0;
}

.mockup{
  height: auto;
}

.trailer-wrap{
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.trailer-wrap iframe{
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

@media (max-width: 900px){
  .hero-inner,
  .book{
    grid-template-columns: 1fr;
  }

  .libro-card,
  .book-right{
    width: 100%;
    justify-self: stretch;
    min-height: auto;
  }

  .mockup,
  .trailer-wrap{
    margin: 0 auto;
  }

  .hero-title-img{
    width: 300px;
  }
}

@media (max-width: 560px){
  .trailer-wrap{
    max-width: 320px;
  }
}
