/* ============================================================
   Pinares Altoverde School — Buscador de Pictogramas
   Paleta derivada del logo: terracota de los pinos + carbón del
   texto. Tipografía serif para titulares (eco del logo) y sans
   accesible para el cuerpo, pensada para lectura clara.
   ============================================================ */

:root{
  --cream:        #FBF7EF;
  --cream-soft:   #F3ECDD;
  --charcoal:     #2C2A27;
  --charcoal-60:  #625E56;
  --terracotta:   #BE3A2F;
  --terracotta-dark: #8F2A22;
  --sage:         #6F8768;
  --gold:         #D9A441;
  --line:         #E4DDCB;
  --white:        #FFFFFF;

  --font-display: 'Bitter', Georgia, serif;
  --font-body:    'Work Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius: 18px;
}

*{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--charcoal);
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
}

/* Fondo sutil: silueta de pinos muy tenue, anclada abajo */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(0deg, rgba(190,58,47,0.05), transparent 40%);
  z-index: -1;
}

/* ---------- Encabezado ---------- */
.site-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 28px clamp(20px, 6vw, 64px) 10px;
}

.brand-logo{
  height: 52px;
  width: auto;
  display: block;
}

.site-eyebrow{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--charcoal-60);
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}

/* ---------- Hero / buscador ---------- */
main{
  flex: 1;
  padding: 20px clamp(20px, 6vw, 64px) 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.hero{
  text-align: center;
  padding: 28px 0 8px;
}

.hero-title{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.15;
  margin: 0 0 14px;
  color: var(--charcoal);
}

.hero-subtitle{
  font-size: 16px;
  color: var(--charcoal-60);
  max-width: 520px;
  margin: 0 auto 30px;
  line-height: 1.55;
}

.search-bar{
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}

#search-input{
  flex: 1;
  font-family: var(--font-body);
  font-size: 18px;
  padding: 16px 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--charcoal);
  outline-offset: 2px;
  resize: vertical;
  min-height: 58px;
  line-height: 1.4;
}

#search-input:focus-visible{
  border-color: var(--terracotta);
  outline: 3px solid var(--gold);
}

#search-button{
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  padding: 16px 26px;
  border: none;
  border-radius: var(--radius);
  background: var(--terracotta);
  color: var(--white);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#search-button:hover{ background: var(--terracotta-dark); }
#search-button:active{ transform: translateY(1px); }
#search-button:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Palabras frecuentes ---------- */
.quick-words{
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.quick-label{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--charcoal-60);
  margin-right: 4px;
}

.chip{
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--charcoal);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chip:hover{
  border-color: var(--sage);
  background: var(--sage);
  color: var(--white);
}

.chip:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Área de resultado ---------- */
.result-area{
  margin-top: 44px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hint-text{
  color: var(--charcoal-60);
  font-size: 15px;
  text-align: center;
}

.state-message{
  text-align: center;
  color: var(--charcoal-60);
  font-size: 15px;
  max-width: 380px;
}

.state-message strong{ color: var(--charcoal); }

/* Contenedor general del resultado: pinos + tira + barra de lectura */
.sentence-result{
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: card-rise 0.35s ease-out;
}

@keyframes card-rise{
  from{ opacity: 0; transform: translateY(10px); }
  to{ opacity: 1; transform: translateY(0); }
}

.pine-row{
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.pine{
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 20px solid var(--terracotta);
  animation: pine-grow 0.4s ease-out both;
}
.pine:nth-child(1){ animation-delay: 0s; }
.pine:nth-child(2){ animation-delay: 0.06s; border-bottom-color: var(--sage); height: 22px; }
.pine:nth-child(3){ animation-delay: 0.12s; }

@keyframes pine-grow{
  from{ transform: scaleY(0); opacity: 0; }
  to{ transform: scaleY(1); opacity: 1; }
}

/* Tira de pictogramas, una tarjeta por palabra */
.pictogram-strip{
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding: 8px 0 6px;
}

.picto-tile{
  width: 130px;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 10px 8px 12px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(44, 42, 39, 0.05);
}

.picto-tile.has-alt{ cursor: pointer; }
.picto-tile.has-alt:hover{ border-color: var(--sage); }

.picto-tile img{
  width: 100%;
  height: 96px;
  object-fit: contain;
  background: var(--cream-soft);
  border-radius: 10px;
  padding: 6px;
  display: block;
}

.picto-tile .picto-word{
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  margin-top: 8px;
  text-transform: lowercase;
  word-break: break-word;
}

.picto-tile .picto-alt-hint{
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--charcoal-60);
  margin-top: 2px;
}

.picto-tile.no-picto{
  border-style: dashed;
  background: var(--cream-soft);
}

.picto-tile.no-picto .no-picto-icon{
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--charcoal-60);
}

/* Acciones por pictograma: ampliar y descargar */
.picto-actions{
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.picto-action{
  width: 34px;
  height: 30px;
  font-size: 14px;
  line-height: 1;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--cream);
  color: var(--charcoal);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.picto-action:hover{ border-color: var(--terracotta); background: var(--white); color: var(--terracotta); }
.picto-action:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }

/* Ventana de zoom */
body.modal-open{ overflow: hidden; }

.zoom-modal{
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.zoom-modal[hidden]{ display: none; }

.zoom-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(44, 42, 39, 0.6);
}

.zoom-dialog{
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: 0 20px 50px rgba(44, 42, 39, 0.3);
  animation: card-rise 0.25s ease-out;
}

.zoom-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.zoom-title{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  text-transform: lowercase;
  word-break: break-word;
}

.zoom-close{
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--charcoal);
  font-size: 16px;
  cursor: pointer;
}

.zoom-close:hover{ border-color: var(--terracotta); color: var(--terracotta); }
.zoom-close:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }

.zoom-stage{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 65vh;
  overflow: hidden;
  background: var(--cream-soft);
  border-radius: 12px;
  touch-action: none;
  cursor: zoom-in;
  user-select: none;
}

.zoom-stage.zoomed{ cursor: grab; }
.zoom-stage.zoomed:active{ cursor: grabbing; }

.zoom-stage img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  display: block;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  pointer-events: none;
}

.zoom-controls{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.zoom-btn{
  min-width: 40px;
  height: 38px;
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--charcoal);
  cursor: pointer;
}

.zoom-btn:hover{ border-color: var(--terracotta); color: var(--terracotta); }
.zoom-btn:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }
.zoom-btn-text{ font-size: 13px; }

.zoom-btn-primary{
  font-size: 14px;
  border: none;
  background: var(--terracotta);
  color: var(--white);
}

.zoom-btn-primary:hover{ background: var(--terracotta-dark); color: var(--white); }

.zoom-level{
  font-family: var(--font-mono);
  font-size: 13px;
  min-width: 48px;
  text-align: center;
  color: var(--charcoal-60);
}

.zoom-help{
  font-size: 11.5px;
  color: var(--charcoal-60);
  text-align: center;
  margin: 10px 0 0;
}

/* Barra de lectura en voz alta */
.voice-bar{
  margin-top: 30px;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
}

.speak-btn{
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  background: var(--terracotta);
  color: var(--white);
  cursor: pointer;
}

.speak-btn:hover{ background: var(--terracotta-dark); }
.speak-btn:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }
.speak-btn.speaking{ background: var(--sage); }
.speak-btn:disabled{ opacity: 0.5; cursor: not-allowed; }

.voice-select, .rate-select{
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--cream);
  color: var(--charcoal);
  max-width: 190px;
}

.voice-select:focus-visible, .rate-select:focus-visible{
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.print-btn{
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--charcoal);
  cursor: pointer;
}

.print-btn:hover{ border-color: var(--terracotta); color: var(--terracotta); }
.print-btn:focus-visible{ outline: 3px solid var(--gold); outline-offset: 2px; }

.voice-note{
  width: 100%;
  text-align: center;
  font-size: 11.5px;
  color: var(--charcoal-60);
  margin-top: 8px;
}

/* ---------- Pie de página ---------- */
.site-footer{
  border-top: 1px solid var(--line);
  padding: 20px clamp(20px, 6vw, 64px) 26px;
  text-align: center;
  background: var(--cream-soft);
}

.arasaac-credit{
  font-size: 12.5px;
  color: var(--charcoal-60);
  margin: 0 0 6px;
  line-height: 1.5;
}

.arasaac-credit a{
  color: var(--terracotta-dark);
  text-decoration: underline;
}

.school-credit{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--charcoal-60);
  margin: 0;
}

.author-seal{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--charcoal-60);
  margin: 8px 0 0;
}

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

@media (max-width: 520px){
  .search-bar{ flex-direction: column; }
  #search-button{ width: 100%; }
}

/* ---------- Impresión: solo la tira de pictogramas ---------- */
@media print{
  .hero-subtitle, .quick-words, .search-bar, .voice-bar,
  .picto-actions, .zoom-modal{ display: none !important; }
  body::before{ display: none; }
  .picto-tile{ break-inside: avoid; }
}