/* ═══════════ Portada de caratoa.com ═══════════ */
:root {
  --papel: #f5f0e8; --tinta: #1c1712; --suave: #6b5d4d; --linea: rgba(61, 43, 31, .14); --linea-fuerte: rgba(61, 43, 31, .3);
  --ocre: #8a4b22; --acento: #3d2b1f; --boton-texto: #f7f2ea; --velo: rgba(138, 75, 34, .06); --error: #a3341f; --ok: #3f6b3a;
  --sombra-piedra: drop-shadow(0 22px 26px rgba(48, 30, 14, .2)) drop-shadow(0 5px 7px rgba(48, 30, 14, .16));
  --titulo: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --texto: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --papel: #14110d; --tinta: #ece3d4; --suave: #a8998a; --linea: rgba(217, 191, 145, .14); --linea-fuerte: rgba(217, 191, 145, .32);
  --ocre: #d9bf91; --acento: #d9bf91; --boton-texto: #16120e; --velo: rgba(217, 191, 145, .06); --error: #e08a74; --ok: #9cc58f;
  --sombra-piedra: drop-shadow(0 22px 30px rgba(0, 0, 0, .55)) drop-shadow(0 4px 8px rgba(0, 0, 0, .45));
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--texto); color: var(--tinta); -webkit-font-smoothing: antialiased;
  background: var(--papel) var(--fondo-img) left center / cover no-repeat;
  transition: background-color .5s, color .5s;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
.definiciones { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 2px solid var(--ocre); outline-offset: 3px; }

/* ── Barra superior ── */
.barra { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center;
  padding: max(18px, env(safe-area-inset-top)) clamp(20px, 4vw, 44px) 0; pointer-events: none; }
.barra > * { pointer-events: auto; }
.idiomas { display: flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: .12em; color: var(--suave); }
.idiomas button { background: none; border: 0; padding: 6px 4px; cursor: pointer; color: var(--suave); letter-spacing: inherit; }
.idiomas button[aria-current="true"] { color: var(--tinta); }
.controles { display: flex; gap: 6px; }
.control { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 50%; cursor: pointer; color: var(--tinta); transition: background .25s; }
.control:hover { background: var(--velo); }
.control svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.control .luna, [data-theme="dark"] .control .sol { display: none; }
[data-theme="dark"] .control .luna { display: block; }
[data-sonido-boton] .on, [data-sonido-boton].encendido .off { display: none; }
[data-sonido-boton].encendido .on { display: block; }

/* ── Escena: una sola pantalla ── */
.escena { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); align-items: center;
  gap: clamp(24px, 5vw, 88px); padding: 76px clamp(28px, 6vw, 104px) 56px; }
.identidad { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.piedra { margin: 0; line-height: 0; }
.piedra img { width: min(38vw, 50vh); height: auto; filter: var(--sombra-piedra); transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.piedra .noche, [data-theme="dark"] .piedra .dia { display: none; }
[data-theme="dark"] .piedra .noche { display: block; }
.identidad h1 { font-family: var(--titulo); font-weight: 500; font-size: clamp(54px, 7vw, 108px); line-height: .95; letter-spacing: -.01em; margin: clamp(12px, 2.4vh, 26px) 0 clamp(8px, 1.4vh, 14px); }
.frase { margin: 0; font-size: 12.5px; font-weight: 500; letter-spacing: .34em; text-transform: uppercase; color: var(--suave); }

/* ── Columna de accesos ── */
.acciones { position: relative; height: min(780px, calc(100vh - 150px)); height: min(780px, calc(100dvh - 150px)); display: flex; align-items: center; }
.menu { width: 100%; max-width: 410px; display: flex; flex-direction: column; transition: opacity .35s, transform .45s cubic-bezier(.2, .7, .2, 1), visibility 0s .45s; }
.acciones.abierta .menu { opacity: 0; transform: translateX(-14px); visibility: hidden; }
.accion { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 18px; padding: 22px 12px; text-align: left; cursor: pointer;
  background: none; border: 0; border-top: 1px solid var(--linea); transition: background .3s; }
.accion:last-child { border-bottom: 1px solid var(--linea); }
.accion:hover, .accion:focus-visible { background: var(--velo); }
.accion .textos { display: flex; flex-direction: column; gap: 4px; }
.accion .nombre { font-family: var(--titulo); font-size: 27px; font-weight: 500; line-height: 1.1; }
.accion .detalle { font-size: 13.5px; color: var(--suave); }

/* ── Íconos rupestres ── */
svg.pintura { width: 66px; height: 66px; overflow: visible; }
.pig { stop-color: var(--ocre); }
.pintura use { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.f1 { stroke: url(#pigA); stroke-width: 2.6; stroke-dasharray: 15 2.5 7 2 22 3.5 5 1.8; }
.f2 { stroke: url(#pigB); stroke-width: 1.4; stroke-dasharray: 5 2 18 3 9 2; opacity: .75; }
.f3 { stroke: var(--ocre); stroke-width: .8; stroke-dasharray: 2.5 3.5 10 4 2 2.5; opacity: .6; }
.accion:hover .f1, .accion:focus-visible .f1 { animation: repintar 1s ease; }
.accion:hover .f2, .accion:focus-visible .f2 { animation: repintar 1.2s ease; }
@keyframes repintar { 0% { stroke-dashoffset: 60; opacity: .35; } 100% { stroke-dashoffset: 0; } }

/* ── Paneles (formularios) ── */
.panel { position: absolute; inset: 0; width: 100%; max-width: 410px; display: flex; flex-direction: column; justify-content: safe center; margin: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 4px 2px; }
.panel[hidden] { display: none; }
.panel > * { opacity: 0; transform: translateY(12px); transition: opacity .45s ease, transform .55s cubic-bezier(.2, .7, .2, 1); }
.panel.visible > * { opacity: 1; transform: none; }
.panel.visible > *:nth-child(2) { transition-delay: .08s; } .panel.visible > *:nth-child(3) { transition-delay: .16s; }
.panel.visible > *:nth-child(4) { transition-delay: .24s; } .panel.visible > *:nth-child(5) { transition-delay: .32s; }
.panel.visible > *:nth-child(6) { transition-delay: .4s; } .panel.visible > *:nth-child(7) { transition-delay: .48s; }
.panel-cabecera { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; margin-bottom: 22px; }
.panel-cabecera .volver { grid-column: 1 / -1; justify-self: start; margin-bottom: 14px; padding: 6px 0; background: none; border: 0; cursor: pointer; font-size: 13px; letter-spacing: .06em; color: var(--suave); transition: color .2s; }
.panel-cabecera .volver:hover { color: var(--tinta); }
.panel-cabecera svg.pintura { width: 50px; height: 50px; }
.panel-cabecera h2 { margin: 0; font-family: var(--titulo); font-weight: 500; font-size: 32px; line-height: 1.05; }
.campo { position: relative; display: block; margin: 0 0 20px; border: 0; padding: 0; min-width: 0; }
.campo > span, .campo legend { display: block; font-size: 11.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--suave); padding: 0; margin-bottom: 4px; }
.campo input, .campo textarea { width: 100%; border: 0; background: transparent; color: var(--tinta); font: 17px/1.45 var(--texto); padding: 6px 0 11px; outline: none; resize: none; border-radius: 0; }
.campo input::placeholder, .campo textarea::placeholder { color: var(--suave); opacity: .55; }
.trazo { position: absolute; left: 0; bottom: 0; width: 100%; height: 8px; overflow: visible; }
.trazo path { fill: none; stroke: var(--ocre); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 330; stroke-dashoffset: 330; opacity: .45; transition: stroke-dashoffset 1.1s cubic-bezier(.3, .6, .2, 1) .35s, opacity .3s, stroke-width .3s; }
.panel.visible .trazo path { stroke-dashoffset: 0; }
.campo:focus-within .trazo path { opacity: 1; stroke-width: 2.4; }
.campo.con-error .trazo path { stroke: var(--error); opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 7px 15px; border: 1px solid var(--linea-fuerte); border-radius: 999px; font-size: 14px; cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .12s; user-select: none; }
.chip:hover span { border-color: var(--ocre); }
.chip input:checked + span { background: var(--acento); border-color: var(--acento); color: var(--boton-texto); }
.chip input:focus-visible + span { outline: 2px solid var(--ocre); outline-offset: 2px; }
.chip input:active + span { transform: scale(.96); }
.pie-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 6px; }
.enviar { background: var(--acento); color: var(--boton-texto); border: 0; border-radius: 2px; padding: 13px 30px; font-size: 15px; font-weight: 500; letter-spacing: .04em; cursor: pointer; transition: opacity .2s, transform .12s; }
.enviar:hover { opacity: .88; }
.enviar:active { transform: scale(.97); }
.enviar:disabled { opacity: .5; cursor: progress; }
.estado { margin: 0; font-size: 14px; line-height: 1.45; flex: 1 1 200px; }
.estado.error { color: var(--error); }
.estado.ok { color: var(--ok); }
.estado button { margin-top: 10px; background: none; border: 1px solid currentColor; padding: 8px 14px; cursor: pointer; font-size: 13px; }
.nota { margin: 18px 0 0; font-size: 13px; color: var(--suave); }
.nota a { color: var(--tinta); }
.exito { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.exito p { margin: 0; font-family: var(--titulo); font-size: 30px; line-height: 1.15; }
.exito small { font-size: 14px; color: var(--suave); }
.exito button { margin-top: 8px; background: none; border: 1px solid var(--linea-fuerte); padding: 10px 20px; cursor: pointer; font-size: 14px; }
.velo-movil[hidden] { display: none; }

/* ── Pie: redes, derechos y enlaces ── */
.pie { position: fixed; left: clamp(20px, 4vw, 44px); right: clamp(20px, 4vw, 44px); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px 22px; font-size: 12px; color: var(--suave); letter-spacing: .03em; }
.pie a { text-decoration: none; color: var(--suave); transition: color .2s; }
.pie a:hover { color: var(--tinta); }
.pie p { margin: 0; }
.redes { display: flex; gap: 4px; }
.redes a { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; transition: background .2s, color .2s; }
.redes a:hover { background: var(--velo); }
.redes svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.enlaces-pie { margin-left: auto; display: flex; gap: 8px; }
.ayuda { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--suave); }
.ayuda a { color: var(--tinta); text-underline-offset: 3px; }

/* ── La piedra responde al mouse y al dedo ── */
.piedra img { cursor: default; }
.piedra:hover img, .piedra.tocada img { transform: scale(1.04) rotate(-.6deg); }

/* Pantallas bajas: todo un poco más compacto para que quepa sin desplazarse */
@media (min-width: 821px) and (max-height: 700px) {
  .piedra img { width: min(32vw, 44vh); }
  .accion { padding: 14px 10px; }
  .campo { margin-bottom: 14px; }
}

/* ── Celular y tableta vertical ── */
@media (max-width: 820px) {
  body { background-position: 20% center; }
  .escena { height: auto; min-height: 100vh; min-height: 100dvh; grid-template-columns: 1fr; gap: 26px; padding: 72px 20px 64px; align-content: center; }
  .piedra img { width: min(62vw, 290px); }
  .identidad h1 { font-size: clamp(46px, 13vw, 70px); }
  .frase { font-size: 11px; letter-spacing: .26em; }
  .acciones { height: auto; justify-content: center; }
  .menu { flex-direction: row; max-width: 460px; }
  .acciones.abierta .menu { opacity: 1; transform: none; visibility: visible; }
  .accion { flex: 1; grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 8px; padding: 12px 4px; border: 0; border-radius: 12px; }
  .accion:last-child { border: 0; }
  .accion .textos { align-items: center; }
  .accion { align-self: start; }
  .accion .nombre { font-size: 17px; min-height: 2.3em; display: flex; align-items: flex-start; justify-content: center; }
  .accion .detalle { display: none; }
  svg.pintura { width: 54px; height: 54px; }
  .velo-movil { position: fixed; inset: 0; z-index: 40; background: rgba(20, 14, 8, .38); animation: aparecer .3s ease; }
  .panel { position: fixed; inset: auto 0 0 0; max-width: none; z-index: 50; justify-content: flex-start; max-height: 90dvh; overflow-y: auto;
    background: var(--papel); border-radius: 18px 18px 0 0; padding: 18px 22px calc(26px + env(safe-area-inset-bottom));
    box-shadow: 0 -12px 40px rgba(20, 14, 8, .18); transform: translateY(100%); transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
  .panel.visible { transform: none; }
  .panel-cabecera h2 { font-size: 27px; }
  .pie { position: static; flex-direction: column; justify-content: center; padding: 6px 20px max(18px, env(safe-area-inset-bottom)); text-align: center; }
  .enlaces-pie { margin-left: 0; }
  .escena { padding-bottom: 28px; }
}
@keyframes aparecer { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .trazo path { stroke-dashoffset: 0; }
}

/* Después de enviar: solo queda el mensaje de «recibido» */
.panel.enviado > :not(.exito):not(.panel-cabecera) { display: none; }
.panel.enviado .panel-cabecera .volver { visibility: hidden; }

/* Formularios que se compactan solos para caber sin barra de desplazamiento */
.panel.compacto .panel-cabecera { margin-bottom: 14px; }
.panel.compacto .panel-cabecera .volver { margin-bottom: 8px; }
.panel.compacto .panel-cabecera h2 { font-size: 28px; }
.panel.compacto .campo { margin-bottom: 13px; }
.panel.compacto .campo input, .panel.compacto .campo textarea { padding: 4px 0 8px; font-size: 16px; }
.panel.compacto .chips { gap: 6px; }
.panel.compacto .chip span { padding: 5px 12px; font-size: 13px; }
.panel.compacto .ayuda { margin-top: 6px; font-size: 12.5px; }
.panel.muy-compacto .panel-cabecera svg.pintura { display: none; }
.panel.muy-compacto .panel-cabecera h2 { font-size: 25px; }
.panel.muy-compacto .campo { margin-bottom: 10px; }
.panel.muy-compacto .campo > span, .panel.muy-compacto .campo legend { font-size: 10.5px; margin-bottom: 2px; }
.panel.muy-compacto .chip span { padding: 4px 10px; font-size: 12.5px; }
.panel.muy-compacto .enviar { padding: 11px 26px; }
/* Si de verdad no cabe (pantallas muy bajas): la barra dibujada de toda la web (recursos/barras.css) */

.enlace-barra { font-size: 13px; letter-spacing: .06em; color: var(--suave); text-decoration: none; padding: 8px 12px; border-radius: 999px; transition: color .2s, background .2s; align-self: center; }
.enlace-barra:hover { color: var(--tinta); background: var(--velo); }

/* Sonido activado pero aún bloqueado por el navegador (hasta el primer clic): parpadea despacio */
[data-sonido-boton].en-espera { animation: sonido-espera 2.4s ease-in-out infinite; }
@keyframes sonido-espera { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { [data-sonido-boton].en-espera { animation: none; opacity: .6; } }

/* «puedes elegir varias» junto al título de las opciones */
.opciones legend .varias { font-size: 12px; font-style: italic; color: var(--suave, #8a7a66); margin-left: 6px; letter-spacing: 0; text-transform: none; font-weight: 400; }

/* «¿Qué es Caratoa?»: enlace discreto bajo la frase; el texto se abre en la columna de accesos */
.que-es { margin-top: clamp(14px, 2.4vh, 22px); padding: 6px 2px; background: none; border: 0; cursor: pointer; font-family: var(--titulo); font-style: italic; font-size: 20px; color: var(--suave); transition: color .2s; }
.que-es:hover, .que-es[aria-expanded="true"] { color: var(--tinta); }
.que-es span[aria-hidden] { display: inline-block; font-style: normal; font-size: 15px; transition: transform .2s; }
.que-es:hover span[aria-hidden] { transform: translateX(4px); }
.panel-que .que-texto p { margin: 0 0 14px; font-size: 16.5px; line-height: 1.65; color: var(--tinta); }
.panel-que .que-texto .que-cierre { font-family: var(--titulo); font-style: italic; font-size: 22px; line-height: 1.35; color: var(--suave); margin-bottom: 22px; }
