/* /homelab: the 3D journey (2026-10-24, REDESIGN_PLAN.md). Builds on /styles.css (tokens, header, buttons) and
   forces the night edition, a shade deeper, so the packet's orange light carries the page. */
:root[data-theme="dark"] {
  --paper: #0b0d10;
  --sheet: #13161a;
  --rule-soft: #2c3238;
}
.hl { background: var(--paper); }
.hl-header { background: color-mix(in srgb, var(--paper) 88%, transparent); }

.hl-canvas { position: fixed; inset: 0; z-index: 5; width: 100%; height: 100%; display: block; pointer-events: none; opacity: 0; transition: opacity 1s var(--ease-out); }
.hl-canvas.is-ready { opacity: 1; }
/* in the flow under the header, not fixed: pinned to the screen it covered stop 7's heading (2026-10-25) */
.hl-nogl { position: relative; z-index: 6; margin: 1rem max(var(--gutter), calc((100vw - var(--wrap)) / 2)) 0; max-width: 40ch; padding: .7rem .9rem; background: var(--sheet); border: 1px solid var(--rule-soft); color: var(--ink-2); font-size: .9rem; }

/* one screen per stop; the text keeps to one side, the station (in the canvas) takes the other */
.hl-sec { position: relative; z-index: 6; min-height: 100svh; display: flex; align-items: center; padding: calc(var(--header-h) + 2rem) var(--gutter) 3rem; }
.hl-sec[data-side="right"] { justify-content: flex-end; }
.hl-text { width: min(30rem, 42vw); margin-inline: max(0px, calc((100vw - var(--wrap)) / 2)); }
.hl-sec[data-side="left"] .hl-text { margin-right: auto; }

.hl-h1 { font-size: clamp(3.4rem, 9vw, 8rem); font-weight: 860; font-stretch: 62%; line-height: .84; text-transform: uppercase; letter-spacing: -0.015em; }
.hl-h1 .dot { color: var(--signal); }
.hl-lede { margin-top: 1.5rem; max-width: 32ch; font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.45; color: var(--ink-2); }
.hl-step { display: flex; align-items: baseline; gap: .75rem; font: 700 .9rem/1 var(--font); font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.hl-n { font: 800 2.6rem/1 var(--font); font-stretch: 62%; color: var(--signal); letter-spacing: 0; }
.hl-h2 { margin-top: .9rem; font-size: clamp(2.3rem, 4.6vw, 4.2rem); font-weight: 850; font-stretch: 64%; line-height: .9; text-transform: uppercase; }
.hl-copy { margin-top: 1.1rem; max-width: 46ch; color: var(--ink-2); font-size: 1.05rem; line-height: 1.6; }
.hl-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.75rem; }

/* the section text eases in as its stop arrives (opacity only; the packet carries the motion) */
.hl-text { opacity: .25; transition: opacity .6s var(--ease-out); }
.hl-sec.is-here .hl-text, .no-gl .hl-text { opacity: 1; }

@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  /* phones: the station sits in the upper third of the screen (homelab.js), the text starts right under it, and
     each stop is shorter than a screen so there's no dead gap between the drawing and its words */
  .hl-sec { min-height: 0; align-items: flex-start; padding: 50svh var(--gutter) 14svh; }
  .hl-sec[data-side="right"] { justify-content: flex-start; }
  .hl-text { width: 100%; margin: 0; }
  .hl-hero { padding-top: 50svh; }
  .nav li:nth-child(2), .nav li:nth-child(3) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hl-text { transition: none; }
}

/* the 404 page (2026-10-24): one screen, the 3D phone beside the words, the text always fully visible */
.hl-404 .hl-text { opacity: 1; }
.hl-404sec .hl-h1 { font-size: clamp(3.2rem, 8.4vw, 7.4rem); }
.hl-404sec .hl-lede { max-width: 40ch; }
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) { .hl-404sec { min-height: 100svh; padding-top: 52svh; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- stop 7, the teardown (phase 3, 2026-10-25) --------------------------------------------------------------------
   A longer stop so there's time to explore once the box comes apart. Desktop: homelab.js pins each layer button onto its
   3D layer (.is-placed). Phones, or no WebGL: the same buttons are a plain list under the text. */
@media (min-width: 761px) and (orientation: landscape), (min-width: 1101px) { .hl-inside { min-height: 190svh; } }
.td-layers { display: grid; gap: .35rem; margin-top: 1.4rem; max-width: 22rem; }
.td-layers button {
  display: flex; align-items: center; gap: .7rem; width: 100%; min-height: 3rem; padding: .5rem .2rem; background: none; border: 0;
  border-top: 1px solid var(--rule-soft); color: var(--ink); font: 760 1.05rem/1.2 var(--font); font-stretch: 85%; text-align: left; cursor: pointer;
}
.td-layers button:hover .td-name, .td-layers button:focus-visible .td-name { text-decoration: underline; text-decoration-color: var(--signal); text-underline-offset: .2em; }
.td-layers button.is-scroll-active .td-dot { background: var(--ink); outline-color: var(--ink); }
.td-layers.is-placed button.is-scroll-active .td-name { opacity: 1; }
.td-dot { width: .9rem; height: .9rem; flex: none; border-radius: 50%; background: var(--signal); border: 2px solid var(--paper); outline: 1.5px solid var(--signal); outline-offset: 2px; }

/* desktop: the list becomes hotspots on the layers, positioned every frame by homelab.js */
.td-layers.is-placed { position: fixed; inset: 0; z-index: 7; margin: 0; max-width: none; display: block; pointer-events: none; }
.td-layers.is-placed li { position: absolute; left: 0; top: 0; }
.td-layers.is-placed button {
  pointer-events: auto; width: auto; min-height: 0; padding: 0; border: 0; translate: -50% -50%;
  display: grid; place-items: center; width: 3rem; height: 3rem; opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s linear .3s;
}
.td-layers.is-placed.is-live button { opacity: 1; visibility: visible; transition: opacity .3s, visibility 0s; }
.td-layers.is-placed .td-name {
  position: absolute; left: calc(100% - .3rem); top: 50%; translate: 0 -50%; white-space: nowrap; pointer-events: none;
  padding: .35rem .6rem; background: var(--ink); color: var(--paper); font: 700 .86rem/1 var(--font); font-stretch: 88%;
  opacity: 0; transition: opacity .2s; text-decoration: none;
}
.td-layers.is-placed button:hover .td-name, .td-layers.is-placed button:focus-visible .td-name, .td-layers.is-placed button.is-hot .td-name { opacity: 1; text-decoration: none; }
.td-layers.is-placed button:focus-visible { outline: none; }
.td-layers.is-placed button:focus-visible .td-dot { outline-color: var(--ink); outline-width: 3px; }
.hl-inside.is-detail .td-layers.is-placed button { opacity: 0; visibility: hidden; }

/* the sheet: slides in on the left (desktop) or rises from the bottom (phones) */
.td-sheet {
  position: fixed; z-index: 9; top: var(--header-h); bottom: 0; left: 0; width: min(32rem, 42vw);
  padding: 2rem clamp(1.25rem, 3vw, 2.5rem); overflow-y: auto; background: var(--sheet);
  border-right: 1px solid var(--rule-soft); display: grid; align-content: center;
  /* visible at once when opening (so focus can land in it), hidden only after the fade when closing */
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease-out), visibility 0s linear .35s;
}
.hl-inside.is-detail .td-sheet { opacity: 1; visibility: visible; transition: opacity .35s var(--ease-out), visibility 0s; }
.td-detail { display: grid; gap: .9rem; }
.td-detail[hidden] { display: none; }                    /* display:grid would otherwise override the hidden attribute */
.hl-inside.is-detail .hl-text { opacity: 0; }            /* the sheet replaces the section's own words while open */
.td-fig { font: 700 .82rem/1 var(--font); font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase; color: var(--signal-ink); }
.td-title { font-size: clamp(2.4rem, 4.4vw, 3.8rem); font-weight: 860; font-stretch: 62%; line-height: .88; text-transform: uppercase; }
.td-title:focus { outline: none; }
.td-lede { color: var(--ink-2); font-size: 1.05rem; line-height: 1.5; max-width: 40ch; }
.td-parts { border-top: 1.5px solid var(--rule); }
.td-parts li { border-bottom: 1px solid var(--rule-soft); }
.td-parts button {
  display: flex; align-items: center; gap: .7rem; width: 100%; min-height: 2.9rem; padding: .45rem .1rem; background: none; border: 0;
  color: var(--ink); font: 760 1.05rem/1.2 var(--font); font-stretch: 85%; text-align: left; cursor: pointer;
}
.td-parts button::after { content: "+"; margin-left: auto; color: var(--ink-2); font-size: 1.3rem; font-weight: 500; }
.td-parts button[aria-expanded="true"]::after { content: "\2212"; }
.td-parts button:hover { text-decoration: underline; text-decoration-color: var(--signal); text-underline-offset: .2em; }
.td-n {
  display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; flex: none; border-radius: 50%;
  background: var(--signal); color: var(--on-signal); font: 800 .78rem/1 var(--font);
}
.td-parts button[aria-expanded="true"] .td-n { background: var(--ink); color: var(--paper); }
.td-parts p { display: none; padding: 0 .1rem .9rem 2.15rem; color: var(--ink-2); font-size: .98rem; line-height: 1.55; }
.td-parts button[aria-expanded="true"] + p { display: block; }
.td-back { justify-self: start; }

@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .td-sheet {
    top: auto; bottom: 0; width: 100%; max-height: 62svh; align-content: start; padding: 1.4rem var(--gutter) 1.6rem;
    border-right: 0; border-top: 1px solid var(--rule-soft); background: var(--sheet);
  }
}
@media (prefers-reduced-motion: reduce) {
  .td-sheet, .td-layers.is-placed button { transition: none; }
}
