/* ================================================================
   PRO QUÍMICA · IDENTIDAD VISUAL V22
   Capa final de identidad: tipografía, textura e iconografía de
   color por ensayo a la llama. Se apoya en los tokens de
   variables.css / theme-coherence-v21.css y en la estructura ya
   existente (grillas, breakpoints, accesibilidad) sin tocarlas.
   No reescribe layout ni reglas responsive: solo tipografía,
   color y las figuras CSS puramente decorativas.
   ================================================================ */

/* ---------- Tipografía local (SIL OFL, sin dependencia remota) ---------- */
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-latin-600-italic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-latin-900-normal.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

h1, h2, h3,
.hero h1, .closing h2, .section-heading h2,
.lab3d-portal-info h3, .nexus-portal-info h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Un único acento tipográfico deliberado: la palabra final del titular
   de portada, en cursiva seminegra de Fraunces — no se repite en el
   resto del sitio. */
.hero-title-main { font-style: italic; }

/* ---------- Textura de fondo: cuaderno cuadriculado, no puntos ---------- */
body::before {
  background-image:
    linear-gradient(rgba(22, 33, 42, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 33, 42, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: .5;
}
html[data-theme="dark"] body::before {
  background-image:
    linear-gradient(rgba(111, 180, 201, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 180, 201, .07) 1px, transparent 1px);
  opacity: .5;
}

/* ---------- Encabezado y navegación: más silencioso ---------- */
.site-header::before { background: var(--color-brand); }
.brand-mark { background: var(--color-surface); border-color: var(--color-line); box-shadow: none; }
.main-nav a[aria-selected="true"] {
  color: #fff;
  border-color: var(--color-brand);
  background: var(--color-brand);
  box-shadow: none;
}
.main-nav a:hover { background: var(--color-brand-soft); border-color: var(--color-line-strong); color: var(--color-brand-strong); }

/* ---------- Eyebrows / kickers: cita editorial, no chip ALL-CAPS ---------- */
.eyebrow, .section-kicker, .periodic-kicker, .lab-subheading {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-ink-soft);
}
.eyebrow::before, .section-kicker::before { display: none; }

/* ---------- Botones: radio contenido, sin flecha, acento de llama ---------- */
.button { border-radius: var(--radius-sm); font-weight: 600; }
.hero-actions .button-primary {
  color: #fff;
  border-color: #15705f;
  background: #15705f;
  box-shadow: none;
}
.hero-actions .button-primary:hover { background: #0f5a4d; }
.hero-actions .button-secondary {
  color: var(--ui-install-text, #e4edef);
  border-color: rgba(233, 239, 233, .35);
  background: rgba(233, 239, 233, .08);
}

/* ---------- Portada: panel nocturno propio, sin cuadrícula ni anillo genéricos ---------- */
.hero-grid {
  background: linear-gradient(125deg, #0e1517 0%, #163138 55%, #1d4e4a 100%);
  border-color: rgba(111, 180, 201, .22);
}
.hero-grid::before, .hero-grid::after { content: none; }
/* #29cdb2: variante más clara de flame-copper, calibrada a 4.5:1 contra el
   punto más luminoso del degradado del hero (el token de tarjetas usa su
   propio fondo y no necesita este ajuste). */
.hero .eyebrow, .hero .section-kicker { color: #29cdb2; }
.hero h1 span.hero-title-main { color: #fff; }
.hero h1 span:not(.hero-title-main) { color: #29cdb2; text-shadow: none; }

.decor-orbit { display: none; }
.hero-flame-figure { position: absolute; inset: 0; z-index: -1; display: flex; align-items: flex-end; justify-content: center; opacity: .9; pointer-events: none; }
.hero-flame-figure img { width: 100%; height: auto; max-width: 23rem; display: block; }

.hero-panel { background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); backdrop-filter: blur(10px); }
.element-display { border-top-color: var(--flame-copper-text); }
.element-symbol { color: #123244; }

/* ---------- Ramas de química: una llama, un color, sin numeración falsa ---------- */
.discipline-card::before { content: none; }
.discipline-card::after { background: var(--flame-copper); opacity: 1; }
.discipline-card { background: var(--ui-panel, var(--color-surface)); }
.discipline-grid > a:nth-of-type(1)::after { background: var(--flame-copper); }
.discipline-grid > a:nth-of-type(2)::after { background: var(--flame-strontium); }
.discipline-grid > a:nth-of-type(3)::after { background: var(--flame-sodium); }
.discipline-grid > a:nth-of-type(4)::after { background: var(--flame-potassium); }
.discipline-grid > a:nth-of-type(5)::after { background: var(--flame-barium); }
.discipline-grid > a:nth-of-type(6)::after { background: var(--flame-lithium); }
.card-index { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-mono); }
.card-index::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.discipline-grid > a:nth-of-type(1) .card-index { color: var(--flame-copper-text); }
.discipline-grid > a:nth-of-type(2) .card-index { color: var(--flame-strontium-text); }
.discipline-grid > a:nth-of-type(3) .card-index { color: var(--flame-sodium-text); }
.discipline-grid > a:nth-of-type(4) .card-index { color: var(--flame-potassium-text); }
.discipline-grid > a:nth-of-type(5) .card-index { color: var(--flame-barium-text); }
.discipline-grid > a:nth-of-type(6) .card-index { color: var(--flame-lithium-text); }
.card-arrow { color: var(--flame-copper-text); }

/* ---------- Variar el tratamiento de tarjetas: no la misma sombra en todas ---------- */
.phet-card { box-shadow: none; }
.phet-card:hover { box-shadow: var(--shadow-soft); }
.lab-card { background: var(--ui-panel, var(--color-surface)); box-shadow: none; border-left: 3px solid var(--flame-copper-text); }
.lab-card:hover { box-shadow: none; transform: none; border-left-color: var(--flame-sodium-text); }
.library-card::after { content: none; }
.library-card { box-shadow: none; border-left: 3px solid var(--flame-lithium-text); }

/* ---------- LAB3D y NEXUS: retinte de "vidrio nocturno", sin neón genérico ---------- */
.lab3d-portal-card, .nexus-portal-card { background: #0e1718; }
.lab3d-portal-visual { background: radial-gradient(ellipse at 51% 42%, #1d4e4a 0%, #15373a 34%, #0e1718 76%, #0a1113 100%); }
.lab3d-visual-orbit { border-color: rgba(31, 154, 134, .5); }
.lab3d-visual-orbit-b { border-color: rgba(111, 180, 201, .3); }
.lab3d-visual-orbit-c { border-color: rgba(200, 138, 46, .35); }
.lab3d-chip { border-color: rgba(31, 154, 134, .35); color: #7fd9c6; background: rgba(31, 154, 134, .12); }
.lab3d-chip-dot { background: var(--flame-copper); }
.lab3d-portal-metrics strong { color: #7fd9c6; }
.lab3d-open-tab, .nexus-launch-button { border-color: #15705f; background: #15705f; color: #fff; box-shadow: none; }
.lab3d-open-tab:hover, .nexus-launch-button:hover { background: #0f5a4d; }
.lab3d-portal-info, .nexus-portal-info, .lab3d-visual-readout { background: #0e1718; }
.lab3d-feature-list span::before { background: var(--flame-copper); box-shadow: none; }

/* ---------- Cierre ---------- */
.closing { background: linear-gradient(120deg, #0e1517 0%, #1d4e4a 100%); }
.closing::after { content: none; }

@media (prefers-reduced-motion: reduce) {
  .hero-flame-figure { opacity: .75; }
}

/* ---------- Diagramas conceptuales inline (Academia) ---------- */
.concept-diagram { margin: 1.1rem 0 1.4rem; padding: 0; }
.concept-diagram svg { width: 100%; height: auto; display: block; }
.cd-box { fill: var(--ui-panel, var(--color-surface)); stroke: var(--color-line); stroke-width: 1.5; }
.cd-box-root { stroke: var(--color-ink); stroke-width: 2; }
.cd-box-a { stroke: var(--flame-copper-text); stroke-width: 2; }
.cd-box-b { stroke: var(--flame-sodium-text); stroke-width: 2; }
.cd-label { font-family: var(--font-sans); font-weight: 600; font-size: 16px; fill: var(--color-ink); text-anchor: middle; }
.cd-sub { font-family: var(--font-mono); font-size: 10.5px; fill: var(--color-muted); text-anchor: middle; }
.cd-edge { stroke: var(--color-line-strong); stroke-width: 1.5; fill: none; }
.cd-arrow { stroke: var(--color-muted); stroke-width: 1.6; fill: none; }
.cd-arrowhead { fill: var(--color-muted); }
.cd-method { font-family: var(--font-mono); font-size: 10px; fill: var(--flame-copper-text); text-anchor: middle; font-weight: 600; }
.cd-icon { stroke: var(--flame-copper-text); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cd-grain { fill: var(--color-muted); }
.cd-salt-chip { fill: var(--flame-sodium-text); opacity: .85; }
.cd-solution { fill: var(--color-brand-soft); opacity: .8; }

/* ---------- Diagrama masa/peso (Lección 1) ---------- */
.cd-divider { stroke: var(--color-line); stroke-width: 1; stroke-dasharray: 4 4; }
.cd-refline { stroke: var(--color-line); stroke-width: 1; stroke-dasharray: 2 3; }
.cd-caption { font-family: var(--font-mono); font-size: 11px; fill: var(--color-muted); text-anchor: middle; font-style: italic; }
.cd-weight-earth { stroke: var(--flame-strontium-text); stroke-width: 3; fill: none; }
.cd-weight-moon  { stroke: var(--flame-copper-text); stroke-width: 3; fill: none; }
.cd-weight-earth-fill { fill: var(--flame-strontium-text); }
.cd-weight-moon-fill  { fill: var(--flame-copper-text); }
.cd-weight-earth-text { font-family: var(--font-mono); font-weight: 600; font-size: 13px; text-anchor: middle; fill: var(--flame-strontium-text); }
.cd-weight-moon-text  { font-family: var(--font-mono); font-weight: 600; font-size: 13px; text-anchor: middle; fill: var(--flame-copper-text); }

/* ---------- Diagrama cambio físico/químico (Lección 4) ---------- */
.cd-box-phys { stroke: var(--flame-copper-text); stroke-width: 2; }
.cd-box-chem { stroke: var(--flame-strontium-text); stroke-width: 2; }
.cd-formula { font-family: var(--font-mono); font-weight: 600; font-size: 12.5px; fill: var(--color-ink); text-anchor: middle; }
.cd-method-phys { font-family: var(--font-mono); font-size: 10px; text-anchor: middle; font-weight: 600; fill: var(--flame-copper-text); }
.cd-method-chem { font-family: var(--font-mono); font-size: 10px; text-anchor: middle; font-weight: 600; fill: var(--flame-strontium-text); }
.cd-badge-phys { font-family: var(--font-sans); font-weight: 600; font-size: 12px; fill: var(--flame-copper-text); }
.cd-badge-chem { font-family: var(--font-sans); font-weight: 600; font-size: 12px; fill: var(--flame-strontium-text); }
.cd-icon-phys { fill: none; stroke: var(--flame-copper-text); stroke-width: 1.6; }
.cd-water-fill { fill: var(--flame-copper-text); opacity: .35; }
.cd-metal-fill { fill: var(--color-muted); }
.cd-o2-ring { fill: none; stroke: var(--color-muted); stroke-width: 1.6; }
.cd-rust-fill { fill: var(--flame-sodium-text); opacity: .85; }
.cd-rust-speckle { fill: #7c4a12; }
html[data-theme="dark"] .cd-rust-speckle { fill: #5a3609; }

/* ---------- Diagrama catión/anión (Biblioteca de iones) ---------- */
.cd-nucleus { fill: var(--color-muted); }
.cd-orbit { fill: none; stroke: var(--color-line-strong); stroke-width: 1; stroke-dasharray: 2 2; }
.cd-e-neutral { fill: var(--color-muted); }
.cd-e-cation { fill: var(--flame-strontium-text); }
.cd-e-anion { fill: var(--flame-copper-text); }
.cd-charge-cation { font-family: var(--font-mono); font-weight: 700; font-size: 16px; fill: var(--flame-strontium-text); text-anchor: middle; }
.cd-charge-anion { font-family: var(--font-mono); font-weight: 700; font-size: 16px; fill: var(--flame-copper-text); text-anchor: middle; }
.cd-ion-sub-cation { font-family: var(--font-mono); font-size: 10px; text-anchor: middle; fill: var(--flame-strontium-text); }
.cd-ion-sub-anion { font-family: var(--font-mono); font-size: 10px; text-anchor: middle; fill: var(--flame-copper-text); }

/* ---------- Diagrama de capas electrónicas (ficha de elemento) ---------- */
.cd-shell-row { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-top: .4rem; }
.cd-shell-figure { margin: 0; flex: 0 0 auto; }
.cd-shell-diagram { width: 108px; height: 108px; display: block; }
.cd-shell-ring { fill: none; stroke: var(--color-line-strong); stroke-width: 1; stroke-dasharray: 2 2; }
.cd-shell-electron { fill: var(--flame-copper-text); }
.cd-shell-nucleus { fill: var(--color-ink); }
.cd-shell-symbol { font-family: var(--font-mono); font-weight: 700; font-size: 13px; fill: var(--color-page); text-anchor: middle; }
