/*
 * Naturfagslaboratoriets 3D-hero.
 *
 * Lærredet ligger bag heroens tekst. Selve scenen bygges af naturfag-hero3d.js;
 * uden WebGL (eller uden JavaScript) står heroens CSS-baner som før.
 */

.lab-intro-3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.lab-intro-3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* En rolig skygge bag teksten, så overskrift og brødtekst altid kan læses. */
.lab-intro.has-3d::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(18, 36, 67, .78) 0%, rgba(18, 36, 67, .42) 42%, rgba(18, 36, 67, 0) 68%);
}

/* De gamle CSS-baner erstattes af 3D-scenen, men står stadig for skærmlæsere. */
.lab-intro.has-3d .lab-intro-visual {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}

@media (max-width: 900px) {
  .lab-intro.has-3d::before {
    background: linear-gradient(180deg, rgba(18, 36, 67, .62), rgba(18, 36, 67, .3) 70%, rgba(18, 36, 67, .1));
  }
}

/* ── Den faste baggrund bag resten af siden (naturfag-baggrund3d.js) ── */
.naturfag-bg3d {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.naturfag-bg3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}
/* Panelerne bliver en anelse gennemsigtige, så baggrunden kan anes bag dem. */
.har-bg3d .lab-panel,
.har-bg3d .progress-strip,
.har-bg3d .journey-nav {
  background-color: rgba(255, 255, 255, .8);
}

/* ── De seks sansemodeller i 3D (naturfag-sanser3d.js) ── */
.sense3d {
  position: relative;
  width: 100%;
  aspect-ratio: 720 / 390;
  background: #0d2038;
  overflow: hidden;
}
.sense3d canvas { display: block; width: 100%; height: 100%; }
.sense3d__labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.sense3d__label {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 8px;
  font: 750 .66rem/1.15 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: pre;
  text-align: center;
  color: #e8f4ff;
  background: rgba(9, 26, 48, .78);
  border: 1px solid rgba(123, 228, 238, .38);
  will-change: transform;
}
.sense3d__label.is-skjult { visibility: hidden; }
.sense3d__meter {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: grid;
  gap: 5px;
  width: min(190px, 42%);
  text-align: right;
  font: 750 .68rem/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #bfe3f0;
  pointer-events: none;
}
.sense3d__meter i {
  display: block;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}
.sense3d__meter b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7be4ee, #b58bff);
  transform: scaleX(0);
  transform-origin: left center;
}
/* SVG'en bliver stående som tekstalternativ for skærmlæsere, men ses ikke. */
.har-sense3d #senseSvg {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}
@media (max-width: 520px) {
  .sense3d__label { font-size: .62rem; padding: 3px 6px; }
  .sense3d__meter { display: none; }
}

/* ── Synapsen i 3D (naturfag-synapse3d.js) ── */
.synapse3d { aspect-ratio: 720 / 440; }
.har-synapse3d #synapseSvg {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}

/* ── Lyd og bølger i 3D (naturfag-boelger3d.js) ── */
.boelge3d { aspect-ratio: 900 / 420; }
.har-boelge3d #waveCanvas {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}

/* ── Krop i praksis i 3D (naturfag-kroppen3d.js) ── */
.kropp3d { position: absolute; inset: 0; aspect-ratio: auto; background: transparent; }
.pp-lab-visual { position: relative; }
.har-kropp3d .pp-lab-visual .pp-lab-canvas { opacity: 0; }

/* Højere ramme på mobil: modellerne får mere plads til etiketter (kameraet tilpasses i koden). */
@media (max-width: 620px) {
  .sense3d:not(.kropp3d),
  .synapse3d,
  .boelge3d { aspect-ratio: 7 / 5; }
}

/* ── Balance-modellerne i 3D (naturfag-systemer3d.js) ── */
.systems-visual > .sys3d { position: absolute; inset: 0; aspect-ratio: auto; background: transparent; }
.sys3d-aktiv .systems-visual > #systemsCanvas { opacity: 0; }

/* ── Kemi-værktøjerne i 3D (naturfag-kemi3d.js) ── */
.kemi3d { border-radius: 12px; margin: 10px 0; }
.kemi3d--atom { aspect-ratio: 1 / 1; max-height: 360px; }
.kemi3d--molekyle { aspect-ratio: 16 / 10; }
.kemi3d canvas { display: block; width: 100%; height: 100%; }
.kemi3d__hint {
  position: absolute; left: 10px; right: 10px; bottom: 9px; text-align: center;
  font: 750 .68rem/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #cfe3f5; text-shadow: 0 1px 6px #0d2038; pointer-events: none;
}
.kemi3d__hint.er-ok { color: #a8fff0; }
.kemi3d__tekst { font-size: .7rem; line-height: 1.45; color: #55657c; margin: 0 0 8px; }
.sense3d__label--sym { background: transparent; border: 0; padding: 0; font-size: .74rem; text-shadow: 0 1px 5px #0d2038, 0 0 3px #0d2038; }
.sense3d__label--advarsel { border-color: rgba(251, 146, 60, .75); color: #ffd7b0; }
.sense3d__label--sym.kemi3d__label--ion { color: #ffd98c; }
.kemi3d__label--ambra { border-color: rgba(224, 181, 99, .6); color: #ffd98c; }
@media (max-width: 620px) {
  .kemi3d--atom { aspect-ratio: 5 / 5; }
  .kemi3d--molekyle { aspect-ratio: 4 / 3; }
}

/* ── Emnebiblioteket i 3D (naturfag-emner3d.js) ── */
.topic-model-art.har-emne3d { position: relative; padding: 0; overflow: hidden; min-height: 250px; background: #0d2038; border-color: #1c3558; }
.topic-model-art.har-emne3d > svg { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.emne3d { position: absolute; inset: 0; aspect-ratio: auto; background: transparent; }
.emne3d canvas { display: block; width: 100%; height: 100%; }
.topic-model-grid:has(.har-emne3d) { grid-template-columns: 1fr; }
.topic-model-art.har-emne3d { min-height: 300px; }
@media (max-width: 620px) { .topic-model-art.har-emne3d { min-height: 260px; } }

/* Besked ved indgang: enheder */
.development-notice-device { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 10px 13px; border-radius: 12px; background: #eaf3fb; border: 1px solid #c9d8e6; font-size: .8rem; line-height: 1.5; color: #2c3e57; text-align: left; }
.development-notice-device > span:first-child { flex: none; font-size: 1.05rem; line-height: 1.3; }
.development-notice-logning { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 10px 13px; border-radius: 12px; background: #f1f6ee; border: 1px solid #cfe0c6; font-size: .8rem; line-height: 1.5; color: #35502b; text-align: left; }
.development-notice-logning > span:first-child { flex: none; font-size: 1.05rem; line-height: 1.3; }

/* ── Farv efter i det periodiske system (naturfag-periodisk-farve.js) ── */
.pf-raekke { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.pf-raekke__tit { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #55657c; }
.pf-raekke [role=group] { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-raekke button { border: 1px solid #c9d6e6; background: #fff; color: #1f3864; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.pf-raekke button[aria-pressed="true"] { background: #1f3864; border-color: #1f3864; color: #fff; }
.pf-legende { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 6px 0 2px; font-size: .74rem; color: #3b4b63; }
.pf-legende:empty { display: none; }
.pf-chip { display: inline-flex; align-items: center; gap: 5px; }
.pf-chip i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(15, 23, 42, .25); display: inline-block; }
.pf-forklar { margin: 4px 0 8px; font-size: .82rem; color: #3b4b63; max-width: 70ch; }
.pf-kilde { margin: -4px 0 8px; font-size: .72rem; color: #6b7a90; }
.periodic-table.pf-aktiv .element-cell { position: relative; transition: background-color .25s ease; }
.periodic-table.pf-aktiv .element-cell small, .periodic-table.pf-aktiv .element-cell .atomic-number { color: inherit; opacity: .85; }
.pf-maerke { position: absolute; top: 3px; right: 4px; font-size: .62rem; font-weight: 800; line-height: 1; padding: 2px 4px; border-radius: 6px; background: rgba(255, 255, 255, .85); color: #0d2038; }

/* ── Ung krop / Ældre krop i sansemodellerne (naturfag-sanser3d.js) ── */
.sense3d__alder { position: absolute; left: 10px; top: 10px; display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(9, 26, 48, .78); border: 1px solid rgba(123, 228, 238, .3); z-index: 3; }
.sense3d__alder button { border: 0; background: transparent; color: #bfe3f0; font: 750 .7rem/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.sense3d__alder button[aria-pressed="true"] { background: #2fd4b6; color: #062a26; }
.sense3d__alder button:focus-visible { outline: 2px solid #7be4ee; outline-offset: 2px; }
.sense3d__pleje { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .5); color: #fde7b0; font: 650 .78rem/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
