/* =========================================================
   COLORES DE MARCA Y TIPOGRAFÍAS
   Los colores de marca son fijos: no cambian entre temas.
   Los temas solo redefinen los tokens semánticos (más abajo).
   ========================================================= */

:root {

    /* Colores de marca */

    --paper: #F5F1E8;
    --charcoal: #343434;
    --amber-glow: #E88300;
    --golden-beam: #FFC451;
    --deep-gold: #B47A21;
    --soft-grey: #D6D6D6;
    --velvet-purple: #514575;
    --royal-violet: #7166A6;
    --soft-lavender: #A79DDA;

    /* Ámbar oscurecido (mismo tono) para usarlo como texto sobre
       Paper con contraste suficiente:
       --amber-text    ≥ 4.5:1  texto normal, hover y foco
       --amber-display ≥ 3:1    texto grande */
    --amber-text: #A35C00;
    --amber-display: #CE7500;


    /* Tipografías */

    --font-title: "Cormorant Garamond", serif;
    --font-text: "Inter", sans-serif;
    --font-note: "Caveat", cursive;
    --font-code: "JetBrains Mono", monospace;
}


/* =========================================================
   TOKENS SEMÁNTICOS POR TEMA
   El tema lo fija el script del <head> con data-theme en <html>
   (preferencia guardada > tema del sistema). Sin JS: tema claro.
   ========================================================= */

/* Tema claro (por defecto) */
:root {
    color-scheme: light;

    --bg: var(--paper);
    --text: var(--charcoal);
    --text-muted: #66616A;
    --surface: var(--paper);               /* tarjetas, marcos, modal */
    --frame: var(--charcoal);              /* borde de las fotografías */
    --line: var(--soft-grey);              /* separadores */
    --hairline: rgba(52, 52, 52, 0.1);     /* borde fino de imágenes */
    --placeholder: #EDE7DB;                /* fondo mientras carga una imagen */

    /* Paneles de lectura (texto sobre los cables) */
    --text-panel-bg: rgba(245, 241, 232, 0.62);
    --text-panel-blur: blur(1.5px);

    /* Tarjetas de vidrio */
    --card-bg: rgba(255, 255, 255, 0.48);
    --card-blur: blur(3px) saturate(1.1);
    --card-border: rgba(52, 52, 52, 0.08);
    --card-border-hover: rgba(52, 52, 52, 0.16);
    --card-shadow: 0 6px 22px rgba(52, 52, 52, 0.06);
    --card-shadow-hover: 0 12px 30px rgba(52, 52, 52, 0.1);

    --modal-overlay: rgba(245, 241, 232, 0.3);
    --modal-glass: rgba(245, 241, 232, 0.74);      /* cuadro de vidrio */
    --modal-border: rgba(52, 52, 52, 0.1);
    --modal-shadow: 0 18px 50px rgba(32, 33, 57, 0.16);

    --footer-bg: var(--charcoal);
    --footer-text: var(--paper);

    /* Acentos como texto (contraste comprobado sobre --bg) */
    --accent-light: var(--amber-text);
    --accent-light-display: var(--amber-display);
    --accent-logic: var(--royal-violet);
    --accent-create: var(--royal-violet);
    --focus-ring: var(--amber-text);

    /* Tubo de cristal de los cables (la luz no cambia de tema):
       pared exterior nítida e interior de vidrio claro */
    --tube-wall: rgba(52, 52, 52, 0.32);
    --tube-glass: rgba(255, 255, 255, 0.45);
    --tube-shade: rgba(52, 52, 52, 0.07);          /* sombra interior */
    --tube-specular: rgba(255, 255, 255, 0.95);    /* reflejo principal */
    --tube-specular-soft: rgba(255, 255, 255, 0.55);

    /* Chispitas: sobre Paper se leen por saturación */
    --sparkle-light: var(--amber-glow);
    --sparkle-light-hot: var(--golden-beam);
    --sparkle-logic: var(--royal-violet);
    --sparkle-logic-hot: var(--soft-lavender);
}

/* Tema oscuro: carbón cálido con un matiz violeta, sin negro puro */
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #1E1C21;
    --text: var(--paper);
    --text-muted: #C7C1CC;
    --surface: #2A2730;
    --frame: #514C56;
    --line: #4A4550;
    --hairline: rgba(245, 241, 232, 0.1);
    --placeholder: #2A2730;

    --text-panel-bg: rgba(30, 28, 33, 0.64);

    --card-bg: rgba(42, 39, 48, 0.56);
    --card-border: rgba(245, 241, 232, 0.08);
    --card-border-hover: rgba(245, 241, 232, 0.16);
    --card-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
    --card-shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.35);

    --modal-overlay: rgba(15, 14, 17, 0.5);
    --modal-glass: rgba(30, 28, 33, 0.74);
    --modal-border: rgba(245, 241, 232, 0.1);
    --modal-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);

    --footer-bg: #141317;
    --footer-text: var(--paper);

    --accent-light: var(--amber-glow);         /* 6.2:1 sobre --bg */
    --accent-light-display: var(--amber-glow);
    --accent-logic: var(--soft-lavender);      /* 6.8:1 sobre --bg */
    --accent-create: var(--soft-lavender);
    --focus-ring: var(--golden-beam);

    /* Sobre fondo oscuro la pared del tubo brilla como el cristal
       que refleja la luz y el interior apenas se aclara */
    --tube-wall: rgba(235, 230, 245, 0.35);
    --tube-glass: rgba(255, 255, 255, 0.05);
    --tube-shade: rgba(0, 0, 0, 0.35);
    --tube-specular: rgba(255, 255, 255, 0.85);
    --tube-specular-soft: rgba(255, 255, 255, 0.3);

    /* Sobre fondo oscuro las chispitas pueden ser más claras */
    --sparkle-light: var(--golden-beam);
    --sparkle-light-hot: #FFF6DE;
    --sparkle-logic: var(--soft-lavender);
    --sparkle-logic-hot: #F4F1FF;
}

/* Transición de color solo durante el cambio de tema (la clase la
   pone js/script.js unos ms). Así no se pisan las transiciones
   propias de cada elemento el resto del tiempo. */
html.theme-changing,
html.theme-changing *,
html.theme-changing *::before,
html.theme-changing *::after {
    transition:
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        stroke 0.3s ease,
        fill-opacity 0.3s ease,
        opacity 0.3s ease,
        transform 0.3s ease !important;
}


/* =========================================================
   FUENTES
   WOFF2 variables con el subconjunto latino (textos en español,
   puntuación y flechas). Los TTF originales siguen en
   assets/fonts como fuente de origen.
   ========================================================= */

@font-face {
    font-family: "Cormorant Garamond";
    src: url("../assets/fonts/woff2/cormorant-garamond-latin.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Inter";
    src: url("../assets/fonts/woff2/inter-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Inter";
    src: url("../assets/fonts/woff2/inter-italic-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Caveat";
    src: url("../assets/fonts/woff2/caveat-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../assets/fonts/woff2/jetbrains-mono-latin.woff2") format("woff2");
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}


/* =========================================================
   RESET
   ========================================================= */

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

header nav ul {
    list-style: none;
}


/* =========================================================
   BASE
   ========================================================= */

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-text);
    position: relative;
    overflow-x: hidden;
}

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

img {
    max-width: 100%;
    display: block;
}

main {
    position: relative;
    /* Sin z-index: si <main> tuviera z-index propio, crearía su propio
       contexto de apilado y todo lo de dentro (incluido el fondo de
       #contact) se pintaría por encima de los cables sin importar el
       z-index interno que tuviera cada cosa. Al quitarlo, el fondo
       (z-index:0), los cables (z-index:1) y el contenido (z-index:2)
       se comparan todos en el mismo contexto, como toca. */
}

/* Capas respecto a los cables (z-index: 1):
   - Las secciones con contenido sobre el fondo general forman su
     propio contexto por encima de los cables.
   - Contact y footer no: su fondo (::before, z-index 0) queda por
     debajo de los cables y solo su contenido sube (z-index 2). */
#home,
#about,
#light,
#logic,
#create {
    position: relative;
    z-index: 2;
}

h2 {
    font-family: var(--font-title);
    font-size: 60px;
    font-weight: 500;
    color: var(--text);
}

h3 {
    font-family: var(--font-title);
    font-size: 32px;
    font-weight: 500;
    color: var(--text);
}

h4 {
    font-family: var(--font-note);
    font-size: 24px;
    font-weight: 500;
    color: var(--text);
}

/* Foco visible y coherente en toda la web (solo con teclado) */
:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 4px;
}


/* =========================================================
   HEADER
   ========================================================= */

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;

    display: flex;
    align-items: center;

    padding: 0 40px;

    z-index: 1000;
}

header nav {
    position: fixed;
    right: 20px;
    top: 50%;

    transform: translateY(-50%);
    z-index: 1001;
}

header nav ul {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

header nav a {
    position: relative;

    display: block;

    width: 10px;
    height: 10px;

    border: 2px solid var(--text);
    border-radius: 50%;

    font-size: 0;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

header nav a:hover {
    background-color: var(--text);
    transform: scale(1.4);
}

/* Sección actual (aria-current lo pone js/script.js) */
header nav a[aria-current="true"] {
    background-color: var(--text);
}

header nav a::after {
    content: attr(data-label);

    position: absolute;

    right: 20px;
    top: 50%;

    transform: translateY(-50%) translateX(6px);

    font-family: var(--font-text);
    font-size: 14px;

    white-space: nowrap;

    color: var(--text);

    opacity: 0;

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;

    pointer-events: none;
}

/* El nombre de la sección aparece también al navegar con teclado */
header nav a:hover::after,
header nav a:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}


/* =========================================================
   LOGO
   ========================================================= */

/* El i² va dentro de un círculo de vidrio (como tarjetas y flechas).
   Es la "toma" de la que nacen los cables: su punto de inicio cae
   dentro del círculo y se intuye a través del cristal. El círculo se
   centra exactamente donde estaba el texto, así nada se desplaza. */
.logo {
    font-family: var(--font-title);
    font-size: 42px;
    font-weight: 600;

    color: var(--text);

    line-height: 1;

    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin-left: -20px;
    padding-bottom: 2px;
    border: 1px solid var(--card-border-hover);
    border-radius: 50%;
    background-color: var(--card-bg);
    -webkit-backdrop-filter: var(--card-blur);
    backdrop-filter: var(--card-blur);
    box-shadow: var(--card-shadow);

    transition:
        color 0.2s ease,
        border-color 0.2s ease;
    position: relative;
    z-index: 1001;
}

.logo:hover {
    border-color: var(--accent-light-display);
}

.logo sup {
    font-size: 0.55em;
    vertical-align: top;
}

.logo:hover {
    color: var(--accent-light-display);
}


/* =========================================================
   BOTÓN DE TEMA
   ========================================================= */

/* Gemelo del círculo del logo: mismo tamaño, vidrio, borde, sombra
   y altura, en el lado opuesto de la cabecera */
.theme-toggle {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 1100;

    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;

    padding: 0;
    border: 1px solid var(--card-border-hover);
    border-radius: 50%;
    background-color: var(--card-bg);
    -webkit-backdrop-filter: var(--card-blur);
    backdrop-filter: var(--card-blur);
    box-shadow: var(--card-shadow);
    color: var(--text);

    cursor: pointer;

    transition: border-color 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--accent-light-display);
}

.theme-toggle svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Bombilla: encendida (cristal dorado y rayos) en el tema claro,
   apagada (solo contorno) en el oscuro */
.theme-toggle .bulb-glass {
    fill: var(--golden-beam);
    fill-opacity: 0.55;
    transition: fill-opacity 0.3s ease;
}

.theme-toggle .bulb-rays {
    stroke: var(--accent-light-display);
    transform-origin: 12px 10px;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

html[data-theme="dark"] .theme-toggle .bulb-glass {
    fill-opacity: 0;
}

html[data-theme="dark"] .theme-toggle .bulb-rays {
    opacity: 0;
    transform: scale(0.6);
}


/* =========================================================
   HOME
   ========================================================= */

#home {
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: flex-start;

    padding: 0 200px;

    gap: 20px;
}

#home h1 {
    font-family: var(--font-title);
    font-size: 80px;
    line-height: 1.2;
}

/* ---------- Efecto lupa sobre el título ---------- */

/* Cada palabra es un bloque que no se parte; dentro, cada letra
   se escala por separado */
#home h1 .lupa-word {
    display: inline-block;
    white-space: nowrap;
}

#home h1 .lupa-letter {
    display: inline-block;
    transform-origin: center bottom;
    transition: transform 0.15s ease-out;
}

#home p {
    font-family: var(--font-note);
    font-size: 40px;
    line-height: 1.5;
    max-width: 600px;
}


/* =========================================================
   TEXTOS, FOTOS Y COMPONENTES COMPARTIDOS
   About, Light, Logic y Create comparten tipografía de texto,
   marcos de foto, carruseles y botones. Cada sección define
   su color de acento y las reglas equivalentes son una sola.
   ========================================================= */

#light {
    --accent: var(--accent-light);
    --accent-display: var(--accent-light-display);
}

#logic {
    --accent: var(--accent-logic);
    --accent-display: var(--accent-logic);
}

#create {
    --accent: var(--accent-create);
}


/* ---------- Texto ---------- */

.about-text,
.light-text,
.logic-text,
.create-text {
    font-family: var(--font-text);
    font-size: 18px;
    line-height: 1.6;
}

.about-text p + p,
.light-text p + p,
.logic-text p + p,
.create-text p + p {
    margin-top: 1em;
}

/* Paneles de lectura: papel esmerilado detrás de los bloques de
   texto que cruzan los cables. Más opacos que las tarjetas para que
   el texto se lea siempre bien; los cables se intuyen difuminados.
   Los títulos quedan sin panel a propósito: el recorrido de los
   cables está pensado para cruzarlos. */
.about-text,
.light-text,
.logic-text,
.create-text,
.light-tools,
.logic-tools {
    padding: 24px 28px;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    background-color: var(--text-panel-bg);
    -webkit-backdrop-filter: var(--text-panel-blur);
    backdrop-filter: var(--text-panel-blur);
    box-shadow: var(--card-shadow);
}

.light-tools,
.logic-tools {
    width: fit-content;
    max-width: 100%;
}


/* ---------- Fotos con marco ---------- */

.about-img,
.light-img,
.logic-img {
    border: 2px solid var(--frame);
    flex-shrink: 0;
    background-color: var(--surface);
}

.about-img img,
.light-img img,
.logic-img img {
    width: 400px;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}


/* ---------- Flujo (Preparar → Actuar / Pensar → Resolver) ---------- */

/* Panel de lectura, como el resto de textos: centrado y ajustado a
   las palabras, para que los cables pasen por detrás sin chocar */
.light-process,
.logic-process {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 10px 40px;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 40px;

    font-family: var(--font-note);
    font-size: 40px;
    color: var(--accent-display);
    text-align: center;

    border: 1px solid var(--card-border);
    border-radius: 18px;
    background-color: var(--text-panel-bg);
    -webkit-backdrop-filter: var(--text-panel-blur);
    backdrop-filter: var(--text-panel-blur);
    box-shadow: var(--card-shadow);
}

.light-process span,
.logic-process span {
    position: relative;
}

.light-process span:not(:last-child)::after,
.logic-process span:not(:last-child)::after {
    content: "→";
    margin-left: 40px;
}


/* ---------- Segunda imagen ---------- */

.light-img-2,
.logic-img-2 {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
}

.light-img-2 img,
.logic-img-2 img {
    width: 1000px;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 280px;
    object-fit: cover;
    border: 2px solid var(--frame);
    background-color: var(--surface);
}


/* ---------- Trabajos / proyectos (carruseles) ---------- */

.light-works,
.logic-works,
.create-projects {
    margin-top: 60px;
}

.light-works h3,
.logic-works h3,
.create-projects h3 {
    margin-bottom: 40px;
}

.light-carousel,
.logic-carousel,
.create-carousel {
    display: flex;
    align-items: center;
    gap: 30px;
}

.light-grid,
.logic-grid,
.create-grid {
    display: flex;
    gap: 40px;
    overflow: hidden;
    flex: 1;
    /* Aire para la sombra y la elevación de las tarjetas, que el
       overflow del carrusel recortaría */
    padding: 8px 6px 18px;
    scroll-padding-inline: 6px;
}

/* Tarjetas de vidrio: translúcidas, con desenfoque de lo que hay
   detrás (los cables se intuyen a través), esquinas redondeadas y
   margen interior */
.light-card,
.logic-card,
.create-card {
    flex: 0 0 350px;
    padding: 14px 14px 18px;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    background-color: var(--card-bg);
    -webkit-backdrop-filter: var(--card-blur);
    backdrop-filter: var(--card-blur);
    box-shadow: var(--card-shadow);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.light-card:hover,
.logic-card:hover,
.create-card:hover,
.light-card:focus-within,
.logic-card:focus-within,
.create-card:focus-within {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--card-border-hover);
}

.light-card img,
.logic-card img,
.create-card img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    border: 1px solid var(--hairline);
    border-radius: 10px;
}

.light-card article,
.logic-card article,
.create-card article {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.light-card h4,
.logic-card h4,
.create-card h4 {
    padding-inline: 4px;
}

.light-ver-proyecto,
.logic-ver-proyecto,
.create-ver-proyecto {
    margin-inline: 4px;
}


/* ---------- Flechas ---------- */

/* Botones circulares de vidrio, a juego con las tarjetas. Al pasar
   el ratón toman el color de su sección (ámbar en Light, violeta en
   Logic/Create) con un halo suave, y la flecha apunta hacia su lado.
   En los extremos del carrusel se atenúan (aria-disabled, lo pone
   js/script.js). */
.light-arrow,
.logic-arrow,
.create-arrow {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--card-border-hover);
    border-radius: 50%;
    background-color: var(--card-bg);
    -webkit-backdrop-filter: var(--card-blur);
    backdrop-filter: var(--card-blur);
    box-shadow: var(--card-shadow);
    color: var(--text);
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.25s ease,
        opacity 0.25s ease,
        transform 0.15s ease;
}

.light-arrow svg,
.logic-arrow svg,
.create-arrow svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.25s ease;
}

.light-arrow:not([aria-disabled="true"]):hover,
.logic-arrow:not([aria-disabled="true"]):hover,
.create-arrow:not([aria-disabled="true"]):hover {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent),
        0 6px 18px color-mix(in srgb, var(--accent) 22%, transparent);
}

.light-arrow-right:not([aria-disabled="true"]):hover svg,
.logic-arrow-right:not([aria-disabled="true"]):hover svg,
.create-arrow-right:not([aria-disabled="true"]):hover svg {
    transform: translateX(2px);
}

.light-arrow-left:not([aria-disabled="true"]):hover svg,
.logic-arrow-left:not([aria-disabled="true"]):hover svg,
.create-arrow-left:not([aria-disabled="true"]):hover svg {
    transform: translateX(-2px);
}

.light-arrow:not([aria-disabled="true"]):active,
.logic-arrow:not([aria-disabled="true"]):active,
.create-arrow:not([aria-disabled="true"]):active {
    transform: scale(0.94);
}

/* Extremo del carrusel: no hay más tarjetas hacia ese lado */
.light-arrow[aria-disabled="true"],
.logic-arrow[aria-disabled="true"],
.create-arrow[aria-disabled="true"] {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
}


/* ---------- Botón proyecto ---------- */

.light-ver-proyecto,
.logic-ver-proyecto,
.create-ver-proyecto {
    align-self: flex-start;
    border: none;
    background: none;
    font-family: var(--font-text);
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.light-ver-proyecto:hover,
.logic-ver-proyecto:hover,
.create-ver-proyecto:hover {
    color: var(--accent);
}


/* ---------- Herramientas ---------- */

.light-tools,
.logic-tools {
    margin-top: 80px;
}

.light-tools h3,
.logic-tools h3 {
    margin-bottom: 50px;
}

.light-tools h4,
.logic-tools h4 {
    margin-top: 35px;
    margin-bottom: 10px;
}

.light-tools ul,
.logic-tools ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 25px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.light-tools li,
.logic-tools li {
    font-family: var(--font-text);
    font-size: 18px;
}


/* =========================================================
   ABOUT
   ========================================================= */

#about {
    min-height: 100vh;

    padding: 100px 200px;

    display: flex;
    flex-direction: column;

    justify-content: center;

    gap: 50px;
}

#about h2 {
    align-self: center;
    text-align: center;
}

.about-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
}

.about-text {
    flex: 1;
    max-width: 700px;
}


/* =========================================================
   LIGHT
   ========================================================= */

#light,
#logic {
    padding: 0 200px 100px;
    display: flex;
    flex-direction: column;
    gap: 60px;
}


/* ---------- Primera pantalla ---------- */

.light-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 60px;
}


/* ---------- Texto izquierda + foto derecha ---------- */

.light-intro {
    display: flex;
    align-items: center;
    gap: 80px;
}

.light-info {
    order: 1;
    flex: 1;
    max-width: 700px;
}

.light-info h2 {
    text-align: center;
    margin-bottom: 30px;
}

.light-img {
    order: 2;
}


/* =========================================================
   LOGIC
   ========================================================= */

/* ---------- Primera pantalla ---------- */

.logic-intro {
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 50px;
}


/* ---------- Foto izquierda + texto derecha ---------- */

.logic-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
}

.logic-info {
    flex: 1;
    max-width: 700px;
}

.logic-info h2 {
    text-align: center;
    margin-bottom: 30px;
}


/* =========================================================
   CREATE
   ========================================================= */

#create {
    min-height: 100vh;
    padding: 100px 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 60px;
}

#create h2 {
    align-self: center;
    text-align: center;
}

.create-text {
    max-width: 900px;
    margin: 0 auto;
}


/* =========================================================
   CONTACTO (Degradado por detrás de los cables)
   ========================================================= */

#contact {
    min-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 100px 40px 140px;
    position: relative;
    background: transparent;
}

/* Fondo degradado colocado detrás de los cables (z-index: 0).
   Funde el fondo de la página con el del footer en ambos temas;
   los porcentajes de mezcla reproducen la curva del degradado
   original (Paper → Charcoal). */
#contact::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(to bottom, var(--bg) 40%, var(--footer-bg) 100%);
    background: linear-gradient(
        to bottom,
        var(--bg) 0%,
        var(--bg) 40%,
        color-mix(in srgb, var(--footer-bg) 3%, var(--bg)) 50%,
        color-mix(in srgb, var(--footer-bg) 7%, var(--bg)) 58%,
        color-mix(in srgb, var(--footer-bg) 15%, var(--bg)) 66%,
        color-mix(in srgb, var(--footer-bg) 39%, var(--bg)) 74%,
        color-mix(in srgb, var(--footer-bg) 66%, var(--bg)) 82%,
        color-mix(in srgb, var(--footer-bg) 89%, var(--bg)) 90%,
        var(--footer-bg) 100%
    );
}

.contact-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 700px;
    position: relative;
    z-index: 2;
}

.contact-content h2 {
    margin-bottom: 15px;
}

.contact-content p {
    margin-bottom: 40px;
    font-family: var(--font-note);
    font-size: 1.5rem;
}


/* =========================================================
   ICONOS DE CONTACTO
   ========================================================= */

.contact-links {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
}

.contact-links a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: inherit;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.contact-links svg {
    width: 28px;
    height: 28px;
}

/* Iconos de relleno (LinkedIn, GitHub): siguen el color del texto.
   Los de trazo (email, Instagram) ya declaran fill="none". */
.contact-links svg:not([fill="none"]) {
    fill: currentColor;
}


/* =========================
   NOMBRE
   ========================= */

.contact-links span {
    margin-top: 8px;
    font-family: var(--font-code);
    font-size: 0.7rem;
    opacity: 0;
    transform: translateY(-5px);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}


/* =========================
   HOVER / FOCO
   ========================= */

.contact-links a:hover,
.contact-links a:focus-visible {
    transform: translateY(-3px);
}

.contact-links a:hover span,
.contact-links a:focus-visible span {
    opacity: 1;
    transform: translateY(0);
}


/* =========================================================
   MODAL DE PROYECTOS (<dialog>)
   - ::backdrop: capa que oscurece y desenfoca la página.
   - <dialog>: transparente, ocupa toda la pantalla; un clic fuera
     del cuadro cierra el modal.
   - .project-modal-content: cuadro de vidrio translúcido; deja
     intuir la web desenfocada detrás.
   El acento (ámbar o violeta) depende de la sección desde la que se
   abre: js/script.js pone data-accent en el <dialog>.
   ========================================================= */

.project-modal {
    --accent: var(--accent-light);
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    padding: 60px;
    background: transparent;
    color: var(--text);
    justify-content: center;
    align-items: center;
    display: none;
}

.project-modal[data-accent="logic"] {
    --accent: var(--accent-logic);
}

.project-modal[data-accent="create"] {
    --accent: var(--accent-create);
}

.project-modal[open] {
    display: flex;
}

.project-modal::backdrop {
    background: var(--modal-overlay);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}


/* ---------- CUADRO PRINCIPAL (vidrio) ---------- */

.project-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    padding: 50px;
    border: 1px solid var(--modal-border);
    border-radius: 24px;
    background: var(--modal-glass);
    -webkit-backdrop-filter: blur(22px) saturate(1.2);
    backdrop-filter: blur(22px) saturate(1.2);
    box-shadow: var(--modal-shadow);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

/* Entrada suave */
.project-modal[open] .project-modal-content {
    animation: modal-in 0.35s ease-out;
}

.project-modal[open]::backdrop {
    animation: modal-backdrop-in 0.3s ease-out;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes modal-backdrop-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* ---------- BOTÓN CERRAR (círculo de vidrio, siempre visible) ---------- */

/* Pegajoso dentro del cuadro: se queda arriba a la derecha aunque
   se baje por un proyecto largo. Los márgenes negativos lo colocan a
   18 px de los bordes sin empujar el contenido. "top" se mide desde
   dentro del relleno del cuadro (50 px): -32 px = 18 px del borde. */
.project-modal-close {
    position: sticky;
    top: -32px;
    z-index: 2;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    margin: -32px -32px -12px auto;
    padding: 0 0 3px;
    border: 1px solid var(--card-border-hover);
    border-radius: 50%;
    background-color: var(--card-bg);
    -webkit-backdrop-filter: var(--card-blur);
    backdrop-filter: var(--card-blur);
    font: inherit;
    font-size: 26px;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease;
}

.project-modal-close:hover {
    color: var(--accent);
    border-color: var(--accent);
}


/* ---------- INFORMACIÓN PRINCIPAL ---------- */

.project-modal-main {
    display: flex;
    flex-direction: row;
    gap: 60px;
}


/* ---------- IZQUIERDA ---------- */

.project-modal-header {
    flex: 0.5;
}

/* Hueco para el botón de cerrar en títulos largos */
.project-modal-header h3 {
    padding-right: 50px;
}

/* Enlace bajo el título (p. ej. el Instagram del proyecto) */
.project-modal-header h3 a {
    display: block;
    margin-top: 6px;
    font-family: var(--font-text);
    font-size: 15px;
    font-weight: 500;
    color: var(--accent);
    width: fit-content;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.project-modal-header h3 a:hover {
    border-bottom-color: currentColor;
}

.project-modal-header img {
    width: 100%;
    margin-top: 25px;
    object-fit: cover;
    border-radius: 14px;
}


/* ---------- DERECHA ---------- */

.project-modal-body {
    flex: 0.5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    line-height: 1.6;
}

.project-modal-body h4,
.project-modal-gallery h4 {
    color: var(--accent);
}

/* Enlaces externos del proyecto ("Ver proyecto en GitHub ↗"):
   píldora con el color de la sección */
.project-modal-body > a {
    align-self: flex-start;
    margin-top: 8px;
    padding: 8px 18px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    color: var(--accent);
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.project-modal-body > a:hover {
    background-color: var(--accent);
    color: var(--bg);
}


/* ---------- GALERÍA ---------- */

.project-modal-gallery {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--line);
}

.project-modal-gallery-grid {
    display: flex;
    gap: 20px;
    margin-top: 25px;
    padding-bottom: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.project-modal-gallery-grid img {
    flex: 0 0 250px;
    width: 250px;
    height: 170px;
    object-fit: cover;
    border-radius: 12px;
    scroll-snap-align: start;
    transition: transform 0.25s ease;
}

.project-modal-gallery-grid img:hover {
    transform: scale(1.02);
}

.project-modal-header img,
.project-modal-gallery-grid img {
    border: 1px solid var(--hairline);
    cursor: pointer;
}


/* ---------- PROYECTO ANTERIOR / SIGUIENTE ---------- */

.project-modal-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--line);
}

.project-modal-nav button {
    flex: 0 1 48%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 18px;
    border: 1px solid var(--card-border-hover);
    border-radius: 16px;
    background-color: var(--card-bg);
    font: inherit;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        color 0.2s ease;
}

.project-modal-nav .project-nav-next {
    align-items: flex-end;
    text-align: right;
}

.project-modal-nav button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.project-nav-label {
    font-family: var(--font-code);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.project-nav-title {
    font-family: var(--font-title);
    font-size: 22px;
    line-height: 1.2;
}


/* =========================================================
   VISOR DE FOTOS
   Fondo oscuro en ambos temas (como una sala a oscuras): la foto
   se ve en grande, con flechas, contador y su texto. El acento
   sigue a la sección del proyecto.
   ========================================================= */

.lightbox {
    --accent: var(--amber-glow);
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    padding: 24px 90px;
    background: transparent;
    color: var(--paper);
    display: none;
    justify-content: center;
    align-items: center;
}

.lightbox[data-accent="logic"],
.lightbox[data-accent="create"] {
    --accent: var(--soft-lavender);
}

.lightbox[open] {
    display: flex;
}

.lightbox::backdrop {
    background: rgba(12, 11, 14, 0.9);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.lightbox-figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.lightbox-img {
    max-width: min(1200px, 100%);
    max-height: calc(100vh - 140px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: transparent;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox[open] .lightbox-img {
    animation: modal-in 0.3s ease-out;
}

.lightbox-caption {
    display: flex;
    align-items: baseline;
    gap: 16px;
    font-family: var(--font-note);
    font-size: 20px;
    color: rgba(245, 241, 232, 0.85);
    text-align: center;
}

.lightbox-count {
    font-family: var(--font-code);
    font-size: 12px;
    color: var(--accent);
}

/* Botones circulares de vidrio oscuro */
.lightbox-arrow,
.lightbox-close {
    position: absolute;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(245, 241, 232, 0.25);
    border-radius: 50%;
    background-color: rgba(42, 39, 48, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: var(--paper);
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease;
}

.lightbox-arrow:hover,
.lightbox-close:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.lightbox-arrow svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lightbox-prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-close {
    top: 18px;
    right: 18px;
    padding-bottom: 3px;
    font: inherit;
    font-size: 28px;
    line-height: 1;
}

/* Una sola foto: sin flechas */
.lightbox.is-single .lightbox-arrow {
    display: none;
}


/* =========================================================
   FOOTER (Fondo oscuro continuo)
   ========================================================= */

footer {
    position: relative;
    padding: 40px 20px 50px;
    text-align: center;
    background: transparent;   /* el color pasa al pseudo-elemento */
    color: var(--footer-text);
}

/* Fondo sólido del footer, colocado DETRÁS del cable
   (funciona porque footer vive dentro de <main>) */
footer::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;                /* por debajo del cable (z-index: 1) */
    background-color: var(--footer-bg);
    pointer-events: none;
}

footer p,
footer small {
    position: relative;
    z-index: 2;                /* por encima del cable, igual que el resto de textos */
}

footer p {
    font-family: var(--font-note);
    font-size: 22px;
}

footer small {
    display: block;
    margin-top: 10px;
    font-family: var(--font-code);
    font-size: 11px;
    opacity: 0.4;
}


/* =========================================================
   DIVIDER
   ========================================================= */

.divider {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 40px 0;
    position: relative;
    z-index: 2;
}

.divider img {
    width: 150px;
    max-width: 30%;
}


/* =========================================================
   PLACEHOLDERS
   Fondo visible mientras una imagen carga (o si falta).
   ========================================================= */

img {
    background-color: var(--placeholder);
}

.about-img img {
    background: linear-gradient(135deg, var(--line), var(--placeholder));
}

.light-img img,
.light-img-2 img {
    background: linear-gradient(135deg, rgba(232, 131, 0, 0.12), rgba(255, 196, 81, 0.25));
}

.logic-img img,
.logic-img-2 img {
    background: linear-gradient(135deg, rgba(81, 69, 117, 0.12), rgba(167, 157, 218, 0.25));
}

.light-card img {
    background: linear-gradient(135deg, var(--placeholder), rgba(232, 131, 0, 0.18));
}

.logic-card img {
    background: linear-gradient(135deg, var(--placeholder), rgba(113, 102, 166, 0.18));
}

.create-card img {
    background: linear-gradient(135deg, var(--placeholder), rgba(167, 157, 218, 0.18));
}


/* =========================================================
   RESPONSIVE: PORTÁTILES PEQUEÑOS (≤ 1280 px)
   Con 200 px de margen lateral y la foto de 400 px, el texto
   quedaba en una columna de ~160 px a 1024 px de ancho.
   ========================================================= */

@media (max-width: 1280px) {

    #home,
    #about,
    #light,
    #logic,
    #create {
        padding-left: 80px;
        padding-right: 80px;
    }

    .about-content,
    .light-intro,
    .logic-content {
        gap: 50px;
    }

    .about-img img,
    .light-img img,
    .logic-img img {
        width: 340px;
    }

    /* El flujo cabe en una línea dentro de su panel */
    .light-process,
    .logic-process {
        font-size: 34px;
        gap: 6px 28px;
    }

    .light-process span:not(:last-child)::after,
    .logic-process span:not(:last-child)::after {
        margin-left: 28px;
    }
}


/* =========================================================
   RESPONSIVE: TABLET Y PANTALLAS MEDIANAS (≤ 1000 px)
   Texto y foto se apilan: en fila, la foto fija dejaba columnas
   de texto de menos de 200 px en tablet.
   ========================================================= */

@media (max-width: 1000px) {

    #home,
    #about,
    #light,
    #logic,
    #create,
    #contact {
        padding-left: 80px;
        padding-right: 80px;
    }

    .about-content,
    .light-intro,
    .logic-content {
        flex-direction: column;
        gap: 40px;
    }

    .about-text,
    .light-info,
    .logic-info {
        max-width: 100%;
    }

    .about-img,
    .light-img,
    .logic-img {
        width: 100%;
        max-width: 350px;
    }

    .about-img img,
    .light-img img,
    .logic-img img {
        width: 100%;
    }

    /* El flujo deja de caber en una línea: se reparte en varias
       dentro de su panel */
    .light-process,
    .logic-process {
        gap: 10px 25px;
        padding: 12px 28px;
    }

    .light-process span:not(:last-child)::after,
    .logic-process span:not(:last-child)::after {
        margin-left: 25px;
    }
}


/* =========================================================
   MÓVIL (≤ 700 px)
   ========================================================= */

@media (max-width: 700px) {

    header {
        height: 70px;
        padding: 0 20px;
    }

    .logo {
        font-size: 36px;
        width: 52px;
        height: 52px;
        margin-left: -10px;
    }

    header nav {
        right: 12px;
    }

    header nav ul {
        gap: 12px;
    }

    header nav a {
        width: 9px;
        height: 9px;
    }

    .theme-toggle {
        top: 9px;
        right: 10px;
        width: 52px;
        height: 52px;
    }

    .theme-toggle svg {
        width: 23px;
        height: 23px;
    }

    main {
        padding-top: 50px;
    }

    h2 {
        font-size: 48px;
    }

    h3 {
        font-size: 28px;
    }

    h4 {
        font-size: 22px;
    }

    #home {
        min-height: 100svh;
        padding: 0 30px;
        justify-content: center;
    }

    #home h1 {
        font-size: clamp(48px, 13vw, 65px);
        line-height: 1.1;
    }

    #home p {
        font-size: 30px;
        line-height: 1.3;
        max-width: 100%;
    }

    #about {
        min-height: auto;
        padding: 100px 30px;
        gap: 40px;
    }

    .about-text,
    .light-text,
    .logic-text,
    .create-text {
        font-size: 16px;
    }

    .about-text,
    .light-text,
    .logic-text,
    .create-text,
    .light-tools,
    .logic-tools {
        padding: 18px;
        border-radius: 14px;
    }

    #light,
    #logic {
        padding: 0 30px 80px;
        gap: 50px;
    }

    .light-content {
        min-height: auto;
        padding-top: 80px;
        gap: 50px;
    }

    .logic-intro {
        min-height: auto;
        padding-top: 80px;
        gap: 40px;
    }

    .light-info h2,
    .logic-info h2 {
        margin-bottom: 25px;
    }

    .light-process,
    .logic-process {
        font-size: 30px;
    }

    .light-img-2,
    .logic-img-2 {
        margin-top: 30px;
    }

    .light-img-2 img,
    .logic-img-2 img {
        width: 100%;
        max-width: 100%;
    }

    .light-works,
    .logic-works {
        margin-top: 40px;
    }

    .light-works h3,
    .logic-works h3,
    .create-projects h3 {
        margin-bottom: 25px;
    }

    .light-carousel,
    .logic-carousel,
    .create-carousel {
        gap: 10px;
    }

    .light-grid,
    .logic-grid,
    .create-grid {
        gap: 20px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .light-grid::-webkit-scrollbar,
    .logic-grid::-webkit-scrollbar,
    .create-grid::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .light-card,
    .logic-card,
    .create-card {
        flex: 0 0 100%;
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }

    .light-arrow,
    .logic-arrow,
    .create-arrow {
        width: 38px;
        height: 38px;
    }

    .light-arrow svg,
    .logic-arrow svg,
    .create-arrow svg {
        width: 18px;
        height: 18px;
    }

    .light-tools,
    .logic-tools {
        margin-top: 60px;
    }

    .light-tools h3,
    .logic-tools h3 {
        margin-bottom: 35px;
    }

    .light-tools h4,
    .logic-tools h4 {
        margin-top: 30px;
    }

    .light-tools li,
    .logic-tools li {
        font-size: 16px;
    }

    #create {
        min-height: auto;
        padding: 100px 30px;
        gap: 45px;
    }

    .create-text {
        max-width: 100%;
    }

    .create-projects {
        margin-top: 30px;
    }

    #contact {
        min-height: 75vh;
        padding: 80px 30px;
        text-align: center;
    }

    .contact-content {
        width: 100%;
        max-width: 400px;
    }

    .contact-content h2 {
        font-size: 48px;
    }

    .contact-content p {
        font-size: 22px;
        margin-bottom: 35px;
    }

    .contact-links {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 25px;
    }

    .contact-links a {
        min-width: 60px;
    }

    .contact-links svg {
        width: 27px;
        height: 27px;
    }

    .contact-links span {
        font-size: 10px;
    }

    .project-modal {
        padding: 20px;
    }

    .project-modal-content {
        max-height: 90vh;
        padding: 35px 25px;
        border-radius: 18px;
    }

    .project-modal-close {
        top: -23px;          /* relleno de 35 px: queda a 12 px del borde */
        width: 40px;
        height: 40px;
        margin: -23px -13px -17px auto;
        font-size: 24px;
    }

    .project-modal-main {
        flex-direction: column;
        gap: 30px;
    }

    .project-modal-header,
    .project-modal-body {
        flex: none;
        width: 100%;
    }

    .project-modal-header img {
        margin-top: 15px;
    }

    .project-modal-gallery {
        margin-top: 40px;
        padding-top: 30px;
    }

    .project-modal-gallery-grid img {
        flex: 0 0 220px;
        width: 220px;
        height: 150px;
    }

    .project-modal-nav {
        margin-top: 35px;
        padding-top: 25px;
        gap: 10px;
    }

    .project-modal-nav button {
        padding: 12px 14px;
    }

    .project-nav-title {
        font-size: 18px;
    }

    /* Visor: flechas abajo, la foto ocupa todo el ancho */
    .lightbox {
        padding: 70px 12px 96px;
    }

    .lightbox-img {
        max-height: calc(100vh - 230px);
    }

    .lightbox-prev,
    .lightbox-next {
        top: auto;
        bottom: 24px;
        transform: none;
    }

    .lightbox-prev {
        left: calc(50% - 64px);
    }

    .lightbox-next {
        right: calc(50% - 64px);
    }

    .lightbox-close {
        top: 14px;
        right: 14px;
    }

    footer {
        padding: 30px 20px;
    }

    footer p {
        font-size: 19px;
    }

    footer small {
        font-size: 10px;
    }
}


/* =========================================================
   CABLES SVG DE FONDO (LIGHT / LOGIC)
   Geometría, iluminación, chispas y cue final: js/cables.js
   ========================================================= */

.cables-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 1; /* Por encima de los fondos de Contact/footer y por debajo del contenido */
    overflow: hidden;
}

/* Tubo de cristal, de fuera adentro (anchos apilados: cada capa
   deja ver un borde de la anterior):
   - pared (.cable-path, 10 px): 1 px nítido a cada lado
   - vidrio (.cable-glass, 8 px): interior claro del tubo
   - luz (.cable-tint, 6 px): el color llena el interior sin tocar
     la pared, dejando 1 px de cristal limpio
   - núcleo y filamento en el centro */
.cable-path {
    fill: none;
    stroke: var(--tube-wall);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cable-glass {
    fill: none;
    stroke: var(--tube-glass);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Volumen del cilindro (capas creadas por js/cables.js con el mismo
   trazado, desplazadas como si la luz llegara de arriba a la
   izquierda):
   - sombra interior hacia el lado contrario a la luz
   - reflejo especular nítido sobre el vidrio, por encima de la luz
   - reflejo secundario tenue en el borde opuesto */
.cable-shade,
.cable-specular {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cable-shade {
    stroke: var(--tube-shade);
    stroke-width: 2;
    transform: translate(1.2px, 1.2px);
}

/* La pared del cristal se tiñe con la luz de dentro según la
   intensidad de su cable (en navegadores sin color-mix con calc se
   queda con el color neutro) */
@supports (stroke: color-mix(in srgb, red calc(50%), blue)) {
    .cable-light {
        stroke: color-mix(in srgb, var(--amber-glow) calc(var(--light-level) * 45%), var(--tube-wall));
    }

    .cable-logic {
        stroke: color-mix(in srgb, var(--royal-violet) calc(var(--logic-level) * 45%), var(--tube-wall));
    }
}

.cable-specular-main {
    stroke: var(--tube-specular);
    stroke-width: 1.3;
    transform: translate(-1.9px, -1.9px);
}

.cable-specular-soft {
    stroke: var(--tube-specular-soft);
    stroke-width: 0.8;
    transform: translate(2.4px, 2.4px);
}

.cable-core {
    fill: none;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cable-core-light {
    stroke: url(#cable-gradient-light);
}

.cable-core-logic {
    stroke: url(#cable-gradient-logic);
}

/* ---------------------------------------------------------
   ILUMINACIÓN POR SECCIONES (la controla js/cables.js)
   Variables escritas sobre #cables-svg:
     --light-level / --logic-level : 0 (apagado) a 1 (máximo)
     --light-glow  / --logic-glow  : resplandor (nivel al cuadrado)
     --blackout                    : 0 normal, 1 apagón total
   Los valores por defecto son el estado "tenue" (sin JS).
   Nunca se aplica opacidad al grupo: solo a las capas de brillo,
   así el tubo de cristal (.cable-path / .cable-glass) sigue visible.
   --------------------------------------------------------- */

.cables-svg {
    --light-level: 0.32;
    --light-glow: 0.1;
    --logic-level: 0.32;
    --logic-glow: 0.1;
    --blackout: 0;
}

/* El color del núcleo conserva su 0.9 original como máximo */
.cable-core-light {
    opacity: calc(0.9 * var(--light-level));
}

.cable-core-logic {
    opacity: calc(0.9 * var(--logic-level));
}

/* Halo: js/cables.js genera varias capas finas (ancho, color y
   opacidad en línea) cuya suma sigue una caída gaussiana: el
   resplandor se desvanece sin escalones. Sin filter: el SVG mide
   todo el documento y un blur sería muy costoso. */
.cables-svg {
    --halo-scale: 1;
}

.cable-halo {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Luz dentro del tubo: al encenderse, el color llena el interior
   del cristal sin llegar a la pared */
.cable-tint {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cable-tint-light {
    stroke: var(--golden-beam);
    opacity: calc(0.55 * var(--light-level));
}

.cable-tint-logic {
    stroke: var(--soft-lavender);
    opacity: calc(0.55 * var(--logic-level));
}

/* Filamento: punto caliente del LED, tintado y suave. Solo aparece
   con intensidad alta (sigue al glow, nivel²) */
.cable-hot {
    fill: none;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cable-hot-light {
    stroke: #FFEBB8;
    opacity: calc(0.55 * var(--light-glow));
}

.cable-hot-logic {
    stroke: #E9E4FF;
    opacity: calc(0.55 * var(--logic-glow));
}

/* Vidrio interior: al encenderse deja paso al color de la luz.
   Durante el blackout se atenúa hasta un 35 %: sin luz de color, el
   tubo apagado se lee gris sobre el fondo oscuro del footer */
.cable-glass-light {
    opacity: calc((1 - 0.6 * var(--light-level)) * (1 - 0.65 * var(--blackout)));
}

.cable-glass-logic {
    opacity: calc((1 - 0.6 * var(--logic-level)) * (1 - 0.65 * var(--blackout)));
}

/* ---------------------------------------------------------
   EXTREMOS DE LOS CABLES
   - Toma de inicio: donde nacen los dos cables, bajo el logo i²
     (se intuye a través de su círculo de vidrio).
   - Foco final: los cables terminan en él; al llegar la señal se
     enciende e ilumina las palabras del footer. El footer es
     oscuro en ambos temas: colores claros fijos.
   --------------------------------------------------------- */

.cable-socket,
.cable-foco {
    pointer-events: none;
}

.socket-ring {
    fill: var(--tube-glass);
    stroke: var(--tube-wall);
    stroke-width: 1.4;
}

.socket-pin {
    fill: var(--tube-wall);
}

/* Foco PAR: cuerpo oscuro (los cables desaparecen dentro), aletas,
   aro frontal, eje y lente. Apagado, la lente apenas se ve. */
.foco-can {
    fill: #1F1D22;
    stroke: rgba(245, 241, 232, 0.5);
    stroke-width: 1.1;
}

.foco-fins {
    fill: none;
    stroke: rgba(245, 241, 232, 0.4);
    stroke-width: 1.2;
    stroke-linecap: round;
}

.foco-shine {
    fill: none;
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1;
    stroke-linecap: round;
}

.foco-pivot,
.foco-rim {
    fill: #2A2730;
    stroke: rgba(245, 241, 232, 0.6);
    stroke-width: 1.1;
}

.foco-lens {
    opacity: 0.3;
    transition: opacity 0.5s ease;
}

.foco-lens-glow {
    opacity: 0;
    transition: opacity 0.6s ease;
}

/* Haz de luz: atraviesa las palabras y se pierde en el aire.
   El desenfoque difumina sus bordes (solo afecta a esta zona; en
   navegadores sin filter en SVG se ve con bordes nítidos) */
.foco-light {
    opacity: 0;
    transition: opacity 0.9s ease;
}

/* Mucho desenfoque en los tres conos: sus bordes interiores se
   funden entre sí y no se ve ningún corte */
.foco-beam-wide {
    filter: blur(20px);
    opacity: 0.7;
}

.foco-beam-mid {
    filter: blur(12px);
    opacity: 0.65;
}

.foco-beam-core {
    filter: blur(7px);
    opacity: 0.65;
}

.cable-foco.is-on .foco-lens,
.cable-foco.is-on .foco-light {
    opacity: 1;
}

.cable-foco.is-on .foco-lens-glow {
    opacity: 0.8;
}

/* Encendido: golpe de luz breve en la lente */
.cable-foco.is-igniting .foco-lens-glow {
    animation: foco-ignite 0.9s ease-out;
}

@keyframes foco-ignite {
    0% {
        opacity: 0;
    }

    25% {
        opacity: 1;
    }

    100% {
        opacity: 0.8;
    }
}

/* Las palabras del footer, bañadas por la luz del foco */
footer p {
    transition:
        color 0.8s ease,
        text-shadow 0.8s ease;
}

footer.foco-on p {
    color: #FFF4D6;
    text-shadow:
        0 0 14px rgba(255, 196, 81, 0.55),
        0 0 3px rgba(255, 196, 81, 0.45);
}

/* ---------------------------------------------------------
   CHISPAS
   Las chispas las mueve js/cables.js sobre el trazado real.
   --------------------------------------------------------- */

.cable-pulse {
    pointer-events: none;
}

/* Chispa que acompaña al scroll, como un cometa sobre el cable:
   - estela: tramos del propio trazado del cable (los recorta
     js/cables.js con stroke-dasharray); su longitud depende de la
     velocidad del scroll; la cola es larga, fina y tenue y las
     capas se suman cerca de la cabeza;
   - cabeza: la chispa del HTML (degradado radial, sin bordes),
     ampliada para que haga de resplandor redondo. */
/* Solo la estela (hijos directos); la estrella de la cabeza va rellena */
.cable-pulse > path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pulse-tail {
    stroke-width: 2.5;
    opacity: 0.35;
}

.pulse-body {
    stroke-width: 4;
    opacity: 0.45;
}

.pulse-glow {
    stroke-width: 12;
    opacity: 0.14;
}

.pulse-core {
    stroke-width: 3;
    opacity: 0.85;
}

.pulse-head {
    stroke-width: 2.6;
}

/* La chispa siempre está: en reposo el resplandor "respira" despacio */
.cable-pulse .spark-body {
    transform: scale(2);
    animation: spark-breathe 2.6s ease-in-out infinite;
}

@keyframes spark-breathe {
    0%,
    100% {
        transform: scale(2);
        opacity: 0.85;
    }

    50% {
        transform: scale(2.5);
        opacity: 1;
    }
}

/* Estrella de la cabeza: destello de 8 puntas que centellea */
.cable-pulse .spark-star {
    transform: scale(1.4);
    animation: star-twinkle 1.9s ease-in-out infinite;
}

@keyframes star-twinkle {
    0%,
    100% {
        transform: scale(1.4) rotate(0deg);
    }

    50% {
        transform: scale(1.65) rotate(14deg);
    }
}

/* Chispitas que se desprenden de la chispa (las mueve js/cables.js) */
.cable-sparkles {
    pointer-events: none;
}

.cable-sparkle-light {
    fill: var(--sparkle-light);
}

.cable-sparkle-light.is-hot {
    fill: var(--sparkle-light-hot);
}

.cable-sparkle-logic {
    fill: var(--sparkle-logic);
}

.cable-sparkle-logic.is-hot {
    fill: var(--sparkle-logic-hot);
}

.cable-pulse-light .pulse-tail,
.cable-pulse-light .pulse-glow { stroke: var(--amber-glow); }
.cable-pulse-light .pulse-body { stroke: var(--golden-beam); }
.cable-pulse-light .pulse-core { stroke: #FFE7A3; }
.cable-pulse-light .pulse-head { stroke: #FFFBEF; }

.cable-pulse-logic .pulse-tail,
.cable-pulse-logic .pulse-glow { stroke: var(--royal-violet); }
.cable-pulse-logic .pulse-body { stroke: var(--soft-lavender); }
.cable-pulse-logic .pulse-core { stroke: #DCD6FA; }
.cable-pulse-logic .pulse-head { stroke: #F8F6FF; }

@media (max-width: 1000px) {

    .cable-path {
        stroke-width: 9;
    }

    .cable-glass {
        stroke-width: 7;
    }

    .cable-core {
        stroke-width: 2.2;
    }

    .cable-hot {
        stroke-width: 0.9;
    }

    .cable-tint {
        stroke-width: 5;
    }

    .cable-shade {
        stroke-width: 1.8;
        transform: translate(1px, 1px);
    }

    .cable-specular-main {
        stroke-width: 1.1;
        transform: translate(-1.6px, -1.6px);
    }

    .cable-specular-soft {
        transform: translate(2px, 2px);
    }

    .cables-svg {
        --halo-scale: 0.85;
    }
}


/* =========================================================
   MOVIMIENTO REDUCIDO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    html,
    .light-grid,
    .logic-grid,
    .create-grid {
        scroll-behavior: auto;
    }

    /* Foco: se enciende sin golpe de luz ni transición */
    .cable-foco.is-igniting .foco-lens-glow {
        animation: none;
    }

    .foco-lens,
    .foco-lens-glow,
    .foco-light,
    footer p {
        transition: none;
    }

    /* La chispa sigue al scroll, pero sin respiración, centelleo
       ni chispitas */
    .cable-pulse .spark-body,
    .cable-pulse .spark-star {
        animation: none;
    }

    .cable-sparkles {
        display: none;
    }

    /* Bombilla del tema: cambio instantáneo */
    .theme-toggle .bulb-glass,
    .theme-toggle .bulb-rays {
        transition: none;
    }

    /* Modales y visor: aparecen sin animación */
    .project-modal[open] .project-modal-content,
    .project-modal[open]::backdrop,
    .lightbox[open] .lightbox-img {
        animation: none;
    }

    .project-modal-gallery-grid img:hover {
        transform: none;
    }

    /* Flechas: solo cambian de color, sin desplazamientos */
    .light-arrow svg,
    .logic-arrow svg,
    .create-arrow svg,
    .light-arrow:active,
    .logic-arrow:active,
    .create-arrow:active {
        transform: none !important;
    }

    /* Tarjetas: sin elevación, solo cambian borde y sombra */
    .light-card:hover,
    .logic-card:hover,
    .create-card:hover,
    .light-card:focus-within,
    .logic-card:focus-within,
    .create-card:focus-within {
        transform: none;
    }
}


/* =========================================================
   FOTOS PENDIENTES
   Logo i² provisional (js/script.js) sobre el fondo de la tarjeta
   mientras la foto real no existe.
   ========================================================= */

img.is-placeholder {
    object-fit: contain;
    cursor: default;
}

.project-modal-gallery-grid img.is-placeholder:hover {
    transform: none;
}
