/*
 * estudio.css
 * «El estudio» (proof of concept): the HTML layer over the 3D scene.
 * Its language comes from Raya's CV: a small colour tab before each title, code comments
 * in mono, headings written as code. No boxes: the text floats over the scene.
 */

/* The typefaces come from css/fuentes.css, served from here */

:root {
    --bg: #0a0a0d;
    --ink: #f1f1f4;
    --ink-2: #b4b4bf;
    --ink-3: #7c7c88;
    --line: rgba(255, 255, 255, 0.14);

    --c-orange: #ee7752;
    --c-pink: #e73c7e;
    --c-blue: #23a6d5;
    --c-green: #23d5ab;
    /* Light of the stop on screen; js/estudio/main.js keeps it in sync */
    --c-current: #c9c9ff;

    --font: "Mona Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg);
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body.sin-3d {
    background: radial-gradient(80% 60% at 50% 30%, #17171f, var(--bg));
}

a {
    color: inherit;
    text-decoration: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ===========================
   Scene
=========================== */
.escena {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    /* The tallest the viewport gets: on a phone the toolbar comes and goes with the scroll,
       and the scene keeps its frame under it instead of jumping with it */
    height: 100lvh;
    display: block;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.4s ease;
}

.escena.lista {
    opacity: 1;
}

.sin-3d .escena {
    display: none;
}

/* The loader: the R of the sign as a neon tube over the dark, drawing itself while the
   studio loads (the CSS draws it slowly on its own; main.js takes it the rest of the way at
   each step of the start and lights it up when the studio shows). Where the sign will be */
.carga {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 27vh;
    pointer-events: none;
    transition: opacity 1.1s ease;
}

.carga-r {
    width: min(17vmin, 9rem);
    overflow: visible;
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c-orange) 55%, transparent));
    transition: filter 0.35s ease;
}

.carga-r .tubo {
    fill: none;
    stroke: color-mix(in srgb, var(--c-orange) 80%, #ffffff);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    /* On its own: most of the way in six seconds, the outer tube first; if nothing ever
       comes (an old browser), gone after half a minute */
    animation: carga-trazo 6s cubic-bezier(0.2, 0.6, 0.3, 1) forwards, carga-fuera 1s 30s forwards;
}

.carga-r .tubo + .tubo {
    animation-delay: 3.5s, 30s;
    animation-duration: 3s, 1s;
}

@keyframes carga-trazo {
    to { stroke-dashoffset: 0.3; }
}

@keyframes carga-fuera {
    to { opacity: 0; }
}

/* main.js at the wheel: the tubes go where it says, smoothly */
.carga.manda .tubo {
    animation: none;
    transition: stroke-dashoffset 0.7s cubic-bezier(0.2, 0.6, 0.3, 1);
}

/* The studio is on: the tube lights up (a stutter first, as the sign does)... */
.carga.encendida .carga-r {
    filter: drop-shadow(0 0 4px var(--c-orange)) drop-shadow(0 0 14px color-mix(in srgb, var(--c-orange) 70%, transparent));
    animation: carga-chispa 0.45s steps(1) forwards;
}

.carga.encendida .tubo {
    stroke: #fff4ec;
}

@keyframes carga-chispa {
    0% { opacity: 0.35; }
    18% { opacity: 1; }
    30% { opacity: 0.5; }
    42% { opacity: 1; }
    100% { opacity: 1; }
}

/* ...and goes with the dark */
.carga.fuera {
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.1s ease, visibility 0s 1.1s;
}

.sin-3d .carga {
    display: none;
}

/* ===========================
   Top bar
=========================== */
.barra {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 6vw;
    pointer-events: none;
}

.barra>* {
    pointer-events: auto;
}

.barra-marca {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.2em;
}

.barra-nav {
    display: flex;
    gap: 1.6rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-2);
}

.barra-nav a {
    transition: color 0.25s ease;
}

.barra-nav a:hover {
    color: var(--ink);
}

.barra-nav a.activo {
    color: var(--c-current);
}

/* ===========================
   Stops: one screen of scroll each. While the scene runs (.con-escena) the texts are
   pinned and js/estudio/main.js fades them in step with the camera.
=========================== */
main {
    position: relative;
    z-index: 1;
}

.parada {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 6rem 6vw;
}

.parada[data-lado="derecha"] {
    justify-content: flex-end;
}

.parada[data-lado="centro"] {
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 12vh;
    text-align: center;
}

.panel {
    position: relative;
    width: min(30rem, 100%);
}

.con-escena .parada {
    height: 100vh;
    pointer-events: none;
}

.con-escena .panel {
    position: fixed;
    top: 50%;
    left: 6vw;
    translate: 0 -50%;
    width: min(28rem, 36vw);
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    will-change: opacity, transform;
}

.con-escena .parada[data-lado="derecha"] .panel {
    left: auto;
    right: 6vw;
}

.con-escena .parada[data-lado="centro"] .panel {
    top: auto;
    bottom: 12vh;
    left: 50%;
    translate: -50% 0;
    width: min(40rem, 88vw);
}

/* A soft shadow behind the words keeps them legible over the scene, with no box */
.panel::before {
    content: "";
    position: absolute;
    inset: -3rem -4rem;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(10, 10, 13, 0.85), rgba(10, 10, 13, 0.55) 60%, transparent);
    pointer-events: none;
}

/* The comment line over each title, with the CV's colour tab */
.panel .comentario {
    max-width: none;
}

.comentario {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.9rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.01em;
    color: var(--ink-3);
}

.parada[data-lado="centro"] .comentario {
    justify-content: center;
}

.bandera {
    width: 20px;
    height: 13px;
    flex-shrink: 0;
    background: var(--c-current);
    transition: background 0.6s ease;
}

.cursor {
    color: var(--c-current);
    animation: parpadeo 1.1s steps(1) infinite;
}

.panel h2 {
    margin-bottom: 1rem;
    font-size: clamp(2.4rem, 1.6rem + 2.8vw, 4rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.035em;
}

.sintaxis {
    color: var(--c-current);
    font-weight: 500;
    transition: color 0.6s ease;
}

.panel p {
    max-width: 34ch;
    font-size: 1.05rem;
    color: var(--ink-2);
}

.panel .lista {
    margin-top: 1.1rem;
    max-width: none;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-3);
}

.lista span {
    padding: 0 0.3em;
    color: var(--c-current);
}

.accion {
    display: inline-block;
    margin-top: 1.3rem;
    font-size: clamp(1.7rem, 1.2rem + 1.3vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--ink);
    transition: color 0.25s ease;
}

.accion:hover,
.accion:focus-visible {
    color: var(--c-current);
}

.datos {
    display: grid;
    gap: 0.35rem;
    margin-top: 1rem;
    font-family: var(--mono);
    font-size: 0.85rem;
}

.datos div {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 0.35rem 1rem;
}

.datos dt {
    color: var(--ink-3);
}

/* A label with more than one link: each one on its own row, under the first */
.datos dd {
    grid-column: 2;
}

.datos a {
    color: var(--ink);
    transition: color 0.2s ease;
}

.datos a:hover {
    color: var(--c-current);
}

/* The letter of «contacto»: the form in the language of the rest, mono labels and a line to
   write on, no boxes. What is written also comes out of the typewriter in the scene */
.carta {
    display: grid;
    gap: 0.4rem;
    margin-top: 1.1rem;
    font-family: var(--mono);
    font-size: 0.85rem;
}

.carta[hidden] {
    display: none;
}

.campo {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 1rem;
    align-items: baseline;
}

.campo > span {
    color: var(--ink-3);
}

.campo input,
.campo textarea {
    width: 100%;
    padding: 0.25rem 0 0.35rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
    caret-color: var(--c-current);
    outline: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.campo textarea {
    display: block;
    min-height: 4.4rem;
    line-height: 1.5;
    resize: none;
}

.campo input:focus,
.campo textarea:focus {
    border-bottom-color: var(--c-current);
}

.campo [aria-invalid="true"] {
    border-bottom-color: var(--c-pink);
}

/* While it goes, what was written can be read but not changed */
.carta.enviando .campo input,
.carta.enviando .campo textarea {
    color: var(--ink-3);
}

/* Under the fields, past the labels */
.carta-pie {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 1.2rem;
    margin-top: 0.15rem;
    padding-left: 6.5rem;
}

/* Under the letter, from its left edge like the labels: what happens with what you write,
   and where to read it all (.panel p would make it as big as the texts) */
.panel .carta-nota {
    margin-top: 0.55rem;
    max-width: none;
    font-size: 0.72rem;
    color: var(--ink-3);
}

.carta-nota a {
    color: var(--ink-2);
    transition: color 0.2s ease;
}

.carta-nota a:hover,
.carta-nota a:focus-visible {
    color: var(--c-current);
}

.enviar {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font-family: var(--font);
    font-size: clamp(1.4rem, 1rem + 0.9vw, 1.8rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    cursor: pointer;
    transition: color 0.25s ease;
}

.enviar:hover,
.enviar:focus-visible {
    color: var(--c-current);
}

.enviar:focus-visible {
    outline: 2px solid var(--c-current);
    outline-offset: 3px;
}

.enviar:disabled {
    color: var(--ink-3);
    cursor: default;
}

.panel .estado {
    max-width: none;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-3);
}

.panel .estado.mal {
    color: var(--c-pink);
}

.panel .estado.bien {
    color: var(--c-current);
}

/* For bots only: out of sight and out of reach */
.tarro {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* A phone zooms into any field written smaller than 16px */
@media (pointer: coarse) {
    .campo input,
    .campo textarea {
        font-size: 16px;
    }
}

/* First stop */
.panel .entrada {
    max-width: none;
    font-size: clamp(1.35rem, 1.05rem + 1vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.panel .pista {
    max-width: none;
    margin-top: 1.1rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--ink-3);
}

/* ...and the rule of the game, as in a point-and-click adventure (only with the scene), with
   the verb of the hand that plays it. When the board has finished drawing, it comes on like
   the neon: a flicker, a glow, and it stays in the stop's colour */
.panel .toque {
    max-width: none;
    margin-top: 0.35rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--ink-3);
}

.dedo {
    display: none;
}

@media (pointer: coarse) {
    .raton {
        display: none;
    }

    .dedo {
        display: inline;
    }
}

.panel .toque.encendido {
    animation: encender 3.4s linear both;
}

@keyframes encender {
    0%, 4%, 9% {
        color: var(--ink-3);
        text-shadow: none;
    }

    2%, 6%, 12%, 55% {
        color: var(--c-current);
        text-shadow: 0 0 6px var(--c-current), 0 0 16px var(--c-current);
    }

    100% {
        color: var(--c-current);
        text-shadow: 0 0 6px transparent, 0 0 16px transparent;
    }
}

.sin-3d .toque {
    display: none;
}

/* The same rule, said again to whoever stays a while at a stop without touching anything
   (js/estudio/main.js): low in the middle, over the floor, coming on like the neon */
.aviso {
    position: fixed;
    left: 50%;
    bottom: 5.4rem;
    z-index: 2;
    translate: -50% 0;
    padding: 0.6rem 1.6rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--c-current);
    white-space: nowrap;
    background: radial-gradient(closest-side, rgba(10, 10, 13, 0.75), transparent);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

.aviso.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease;
    animation: encender 3.4s linear both;
}

.sin-3d .aviso {
    display: none;
}

/* Over a piece of «diseño», what it is, typed as a comment in dark ink on a stroke of white
   paint that the brush lays first (js/estudio/caption.js). What is still to be typed waits
   unseen, so the line stays put as it grows */
.rotulo {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 2;
    padding: 0.5rem 1.15rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: #1b1b20;
    white-space: nowrap;
    pointer-events: none;
    visibility: hidden;
}

.rotulo.visible {
    visibility: visible;
}

/* The paint, behind the words */
.rotulo canvas {
    position: absolute;
    z-index: -1;
}

/* The slashes of the comment and the cursor in the colour of the stop, toasted so they hold
   on the white */
.rotulo-barras,
.rotulo .cursor {
    color: var(--c-current);
    color: color-mix(in srgb, var(--c-current) 80%, #000);
}

.rotulo-resto {
    visibility: hidden;
}

/* The journey goes sideways, so the hint points sideways */
.pista::after {
    content: " →";
    display: inline-block;
    animation: deslizar 1.8s ease-in-out infinite;
}

.panel a:focus-visible,
.barra a:focus-visible,
.regla a:focus-visible {
    outline: 2px solid var(--c-current);
    outline-offset: 3px;
}

/* ===========================
   Ruler: where you are in the journey (a nod to rauno.me)
=========================== */
.regla {
    --p: 0;
    position: fixed;
    left: 50%;
    bottom: 1.3rem;
    translate: -50% 0;
    z-index: 3;
    width: min(34rem, 78vw);
    height: 34px;
}

.regla::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 9px;
    background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 10px);
}

.regla ol {
    position: absolute;
    inset: 0;
    list-style: none;
}

.regla li {
    position: absolute;
    bottom: 0;
    translate: -50% 0;
}

.regla li:nth-child(1) { left: 0%; }
.regla li:nth-child(2) { left: 20%; }
.regla li:nth-child(3) { left: 40%; }
.regla li:nth-child(4) { left: 60%; }
.regla li:nth-child(5) { left: 80%; }
.regla li:nth-child(6) { left: 100%; }

.regla a {
    position: relative;
    display: block;
    width: 22px;
    height: 34px;
}

.regla a::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 2px;
    height: 16px;
    translate: -50% 0;
    border-radius: 2px;
    background: var(--ink-3);
    transition: background 0.2s ease, height 0.2s ease;
}

.regla a:hover::before {
    height: 22px;
    background: var(--ink);
}

.regla a span {
    position: absolute;
    left: 50%;
    bottom: 28px;
    translate: -50% 0;
    font-family: var(--mono);
    font-size: 0.68rem;
    white-space: nowrap;
    color: var(--ink-2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.regla a:hover span,
.regla a.activo span {
    opacity: 1;
}

.regla-cursor {
    position: absolute;
    left: calc(var(--p) * 100%);
    bottom: 0;
    width: 3px;
    height: 24px;
    translate: -50% 0;
    border-radius: 3px;
    background: var(--c-current);
    box-shadow: 0 0 12px var(--c-current);
    pointer-events: none;
}

/* ===========================
   Kavitor in «código»: while its sign is on, its text takes the panel, a little lower so the
   building floats above it, and comes in line by line
=========================== */
.panel-kavitor {
    display: none;
}

.panel.con-kavitor .panel-cara {
    display: none;
}

.panel.con-kavitor .panel-kavitor {
    display: block;
}

.con-escena .panel {
    transition: translate 0.6s ease;
}

.con-escena .panel.con-kavitor {
    translate: 0 calc(-50% + 9vh);
}

.panel-kavitor > * {
    animation: aparecer 0.6s ease both;
}

.panel-kavitor > :nth-child(2) { animation-delay: 0.08s; }
.panel-kavitor > :nth-child(3) { animation-delay: 0.16s; }
.panel-kavitor > :nth-child(4) { animation-delay: 0.24s; }
.panel-kavitor > :nth-child(5) { animation-delay: 0.32s; }
.panel-kavitor > :nth-child(6) { animation-delay: 0.4s; }

.panel-kavitor p {
    max-width: 42ch;
}

.panel .rasgos {
    margin: 0.9rem 0;
    list-style: none;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--ink-2);
}

.rasgos li::before {
    content: "· ";
    color: var(--c-current);
}

.panel .enlaces {
    max-width: none;
    margin-top: 1.4rem;
    font-family: var(--mono);
    font-size: 0.9rem;
}

.enlaces a {
    color: var(--ink);
}

.enlaces a:hover,
.enlaces a:focus-visible {
    color: var(--c-current);
}

/* Without the scene, Kavitor's text simply follows the rest */
.sin-3d .panel-kavitor {
    display: block;
    margin-top: 2.5rem;
}

/* ===========================
   The privacy in «contacto»: from the note under the letter or the noticeboard by the door,
   its text takes the panel, with a scroll of its own (js/estudio/privacy-panel.js). Without
   the scene its link goes to its page
=========================== */
.panel-privacidad {
    display: none;
}

.panel.con-privacidad .panel-cara {
    display: none;
}

.panel.con-privacidad .panel-privacidad {
    display: block;
}

.panel-privacidad > * {
    animation: aparecer 0.6s ease both;
}

.panel-privacidad > :nth-child(2) { animation-delay: 0.08s; }
.panel-privacidad > :nth-child(3) { animation-delay: 0.16s; }
.panel-privacidad > :nth-child(4) { animation-delay: 0.24s; }

/* The title takes the focus when it opens, only so a screen reader starts there */
.panel-privacidad h2:focus {
    outline: none;
}

.privacidad-texto {
    max-height: calc(100vh - 21rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--ink-3) transparent;
}

.privacidad-texto:focus-visible {
    outline: 1px solid var(--ink-3);
    outline-offset: 6px;
}

.panel .privacidad-texto p,
.privacidad-texto li {
    max-width: none;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--ink-2);
}

.panel .privacidad-texto .privacidad-entrada {
    font-size: 0.98rem;
    color: var(--ink);
}

.privacidad-texto p + p {
    margin-top: 0.6rem;
}

.privacidad-texto h3 {
    margin: 1.4rem 0 0.4rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--c-current);
}

.privacidad-texto h3::before {
    content: "// ";
    color: var(--ink-3);
}

.privacidad-texto ul {
    margin: 0.3rem 0 0.6rem;
    list-style: none;
}

.privacidad-texto li::before {
    content: "· ";
    color: var(--c-current);
}

.privacidad-texto a {
    color: var(--ink);
    transition: color 0.2s ease;
}

.privacidad-texto a:hover,
.privacidad-texto a:focus-visible {
    color: var(--c-current);
}

.panel .privacidad-texto .fecha {
    margin-top: 1.6rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-3);
}

.volver {
    margin-top: 1.1rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.volver:hover,
.volver:focus-visible {
    color: var(--c-current);
}

.volver:focus-visible {
    outline: 2px solid var(--c-current);
    outline-offset: 3px;
}

/* A text that takes the panel comes in line by line */
@keyframes aparecer {
    from {
        opacity: 0;
        translate: 0 0.5rem;
    }
}

/* ===========================
   A video seen big over the page (from the TV of «imagen»)
=========================== */
html.con-visor {
    overflow: hidden;
}

/* Looking through the telescope of «sobre mí»: a circle of sky, dark all round, with its
   reticle. The texts step aside meanwhile */
.telescopio {
    position: fixed;
    inset: 0;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, transparent 0 31vmin, rgba(0, 0, 0, 0.75) 31.5vmin, #000 33vmin);
}

.telescopio::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 62vmin;
    height: 62vmin;
    translate: -50% -50%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    background:
        linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)) center / 1px 100% no-repeat,
        linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)) center / 100% 1px no-repeat;
}

.telescopio::after {
    content: "clic para volver";
    position: absolute;
    left: 50%;
    top: calc(50% + 35vmin);
    translate: -50% 0;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-3);
}

html.mirando .panel {
    visibility: hidden !important;
}

/* While the pong of «sobre mí» is on, or a brush is in hand at the easel of «diseño» on a
   touch screen, the page holds still and a finger moves the paddle or paints */
html.jugando,
html.pintando {
    overflow: hidden;
    touch-action: none;
}

html.pintando {
    user-select: none;
}

.visor {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.9rem;
    padding: 4rem 1.25rem;
    background: rgba(5, 5, 8, 0.9);
}

/* The video between its two arrows */
.visor-escena {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    gap: 1.25rem;
    max-width: 100%;
}

.visor-marco {
    width: min(1100px, calc(100vw - 10rem), calc((100vh - 10rem) * 16 / 9));
    aspect-ratio: 16 / 9;
}

.visor-flecha {
    width: 2.6rem;
    height: 2.6rem;
    border: 0;
    background: none;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.visor-flecha:hover,
.visor-flecha:focus-visible {
    color: var(--c-current);
}

.visor-flecha:focus-visible {
    outline: 2px solid var(--c-current);
    outline-offset: 4px;
}

.visor-marco iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.visor-titulo {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-2);
}

.visor-cerrar {
    position: absolute;
    top: 1.1rem;
    right: 1.25rem;
    width: 2.6rem;
    height: 2.6rem;
    border: 0;
    background: none;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.visor-cerrar:hover,
.visor-cerrar:focus-visible {
    color: var(--c-current);
}

.visor-cerrar:focus-visible {
    outline: 2px solid var(--c-current);
    outline-offset: 4px;
}

/* ===========================
   Short wide screens (laptops): the letter of «contacto», the tallest panel, tighter so it
   fits between the bar and the ruler
=========================== */
@media (max-height: 720px) and (min-aspect-ratio: 9/10) and (min-width: 761px) {
    #contacto .panel h2 {
        margin-bottom: 0.55rem;
        font-size: clamp(2.2rem, 1.4rem + 2.2vw, 3.2rem);
    }

    #contacto .comentario {
        margin-bottom: 0.5rem;
    }

    .carta {
        gap: 0.25rem;
        margin-top: 0.7rem;
    }

    .campo textarea {
        height: 3.5rem;
        min-height: 0;
    }

    .datos {
        gap: 0.2rem;
        margin-top: 0.6rem;
    }

    .privacidad-texto {
        max-height: calc(100vh - 17rem);
    }
}

/* A text with a short version for a phone: there it goes under the scene and the long one
   would cover it (without the scene, the long one is always there) */
.corto {
    display: none;
}

/* ===========================
   Phones and portrait screens: the scene on top, the text below
=========================== */
@media (max-width: 760px),
(max-aspect-ratio: 9/10) {
    .con-escena .largo {
        display: none;
    }

    .con-escena .corto {
        display: block;
    }

    .barra-nav {
        display: none;
    }

    .con-escena .panel,
    .con-escena .parada[data-lado="derecha"] .panel,
    .con-escena .parada[data-lado="centro"] .panel,
    .con-escena .panel.con-kavitor {
        top: auto;
        bottom: 5.2rem;
        left: 1.25rem;
        right: 1.25rem;
        width: auto;
        translate: none;
    }

    .panel h2 {
        font-size: 2.5rem;
    }

    .panel p {
        font-size: 0.98rem;
    }

    /* Kavitor's text is long: a little smaller on a phone, so the scene still shows */
    .panel-kavitor p {
        font-size: 0.88rem;
    }

    .aviso {
        top: 4.2rem;
        bottom: auto;
        width: max-content;
        max-width: calc(100vw - 2rem);
        font-size: 0.74rem;
        white-space: normal;
        text-align: center;
    }

    /* ...and the privacy's, longer, scrolls in the lower half */
    .privacidad-texto {
        max-height: 40vh;
    }

    /* The letter, tighter on a phone: the hall shows above it */
    .campo,
    .datos div {
        grid-template-columns: 4.6rem 1fr;
        column-gap: 0.75rem;
    }

    .carta {
        gap: 0.2rem;
        margin-top: 0.8rem;
    }

    .campo textarea {
        min-height: 3.3rem;
    }

    .carta-pie {
        padding-left: 5.35rem;
    }

    .datos {
        gap: 0.2rem;
        margin-top: 0.7rem;
        font-size: 0.8rem;
    }

    .panel .rasgos {
        margin: 0.5rem 0;
        font-size: 0.7rem;
        line-height: 1.5;
    }

    /* A video seen big takes the whole width; its arrows go underneath */
    .visor-escena {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "marco marco"
            "anterior siguiente";
        gap: 0.6rem;
    }

    .visor-marco {
        grid-area: marco;
        width: min(calc(100vw - 2.5rem), calc((100vh - 12rem) * 16 / 9));
    }

    .visor-anterior {
        grid-area: anterior;
        justify-self: start;
    }

    .visor-siguiente {
        grid-area: siguiente;
        justify-self: end;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    /* The R is there whole from the start and just lights up */
    .carga-r .tubo,
    .carga.manda .tubo {
        animation: none;
        transition: none;
        stroke-dashoffset: 0 !important;
    }

    .carga.encendida .carga-r {
        animation: none;
    }

    .cursor,
    .pista::after,
    .panel-kavitor > *,
    .panel-privacidad > *,
    .panel .toque.encendido,
    .aviso.visible {
        animation: none;
    }

    .panel .toque.encendido {
        color: var(--c-current);
    }

    .con-escena .panel {
        transition: none;
    }
}

@keyframes parpadeo {
    50% {
        opacity: 0;
    }
}

@keyframes deslizar {
    50% {
        transform: translateX(5px);
    }
}
