/* ──────────────────────────────────────────────────────────
   Inside Totally — inside.4dhb.net
   Built from the cover: a cel-shaded room in flat primaries
   with thick black outlines, and a porthole onto a darker,
   denser room behind it. The page starts in the room, goes
   through the porthole on scroll, and the content lives in
   the machine room on the other side.
   ────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;
  --blue:   #2a6fc9;
  --blue-2: #1f55a8;
  --yellow: #c9d93b;      /* the lime panels */
  --red:    #e8482e;
  --green:  #2fb552;
  --pink:   #d9479a;
  --silver: #c9ccd1;      /* the frame */
  --cream:  #eef0f2;
  --line:   #0e0d0b;      /* the outline ink */
  --room:   #0a0a0c;      /* the machine room */
  --display: 'Baloo 2', 'Arial Rounded MT Bold', 'Helvetica Neue', Arial, sans-serif;
  --text:    'Rubik', 'Helvetica Neue', Arial, sans-serif;
  --stroke:  3px;
  --gutter:  clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--room);
  color: var(--cream);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: var(--stroke) solid var(--yellow); outline-offset: 3px; }

/* Outlined display type: white fill, ink stroke, like the lettering a cel would get */
.outlined {
  font-family: var(--display); font-weight: 800; line-height: 1;
  color: var(--cream);
  -webkit-text-stroke: var(--stroke) var(--line); paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--line);
}
.label { font-family: var(--text); font-weight: 600; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }

/* A "panel": flat colour, thick outline, rounded like the cover's frames */
.panel {
  background: var(--c, var(--blue));
  border: var(--stroke) solid var(--line);
  border-radius: 22px;
  box-shadow: 6px 6px 0 var(--line);
}

/* ── Header: a pipe across the top ── */
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 62px; padding: 8px var(--gutter);
  background: var(--blue);
  border-bottom: var(--stroke) solid var(--line);
  box-shadow: 0 6px 0 var(--yellow), 0 calc(6px + var(--stroke)) 0 var(--line);
}
.top-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.menu-btn {
  display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%;
  background: var(--silver); border: var(--stroke) solid var(--line); box-shadow: 3px 3px 0 var(--line);
  transition: transform .12s, box-shadow .12s;
}
.menu-btn svg { width: 34px; height: auto; color: var(--line); }
.menu-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.top .title { font-size: clamp(18px, 2.4vw, 26px); white-space: nowrap; }
.top nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a {
  font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--line); background: var(--c); padding: 7px 14px; border-radius: 999px;
  border: var(--stroke) solid var(--line); box-shadow: 3px 3px 0 var(--line);
  transition: transform .1s, box-shadow .1s;
}
.top nav a:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }

/* ── Porthole: the cover, then through it ── */
.porthole { height: 230vh; position: relative; }
.porthole .stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--room); }
/* The scene is a 2048-unit square scaled to cover the viewport; the plates sit inside it
   at the positions measured from the cover, and each scales about the window's centre. */
.porthole .scene {
  position: absolute; left: 50%; top: 50%;
  width: max(100vw, 100vh); height: max(100vw, 100vh);
  transform: translate(-50%, -50%);
}
.porthole .plate { position: absolute; max-width: none; height: auto; will-change: transform; }
.porthole .room  { left: 0; top: 0; width: 100%; transform: scale(var(--wall, 1)); transform-origin: 49.19% 46.75%; z-index: 2; }
.porthole .frame { left: 8.557%; top: 13.626%; width: 82.923%; transform: scale(var(--wall, 1)); transform-origin: 49.03% 51.56%; z-index: 3; }
.porthole .bay   { left: -13.31%; top: -2.05%; width: 125%; transform: scale(var(--bay, .8)); transform-origin: 50% 50%; z-index: 1; }   /* oversized so the hole can keep revealing more of it */
.porthole .still { display: none; }   /* the flat cover, shown only without motion */
.porthole .dim { position: absolute; inset: 0; background: var(--room); opacity: var(--dim, 0); pointer-events: none; }
.porthole .cue {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  opacity: calc(1 - var(--p, 0) * 3);
  color: var(--line); background: var(--yellow); padding: 8px 16px; border-radius: 999px;
  border: var(--stroke) solid var(--line); box-shadow: 3px 3px 0 var(--line);
  font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
}
.porthole .sig {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 32px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  opacity: calc((var(--p, 0) - .55) * 4);
}
.porthole .sig h1 { font-size: clamp(44px, 9vw, 120px); }
.porthole .sig .mark { width: clamp(90px, 12vw, 170px); color: var(--cream); filter: drop-shadow(3px 3px 0 var(--line)); }

/* ── Inside: the machine room ── */
.inside { position: relative; background: var(--room); }
/* pipes running down the sides, continuing the cover's plumbing */
.pipes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.pipes svg { position: absolute; height: 100%; width: auto; }
.pipes .l { left: -20px; } .pipes .r { right: -20px; transform: scaleX(-1); }
.wrap { position: relative; z-index: 1; width: min(1100px, 100%); margin-inline: auto; padding: clamp(56px, 8vw, 110px) var(--gutter); }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: clamp(24px, 4vw, 44px); }
.sec-head h2 { font-size: clamp(34px, 5.4vw, 64px); }
.sec-head .label { color: var(--yellow); }

/* Tracks: each a panel in its own primary */
.tracks { list-style: none; display: grid; gap: 22px; }
.track {
  display: grid; grid-template-columns: 84px 1fr; gap: 20px; align-items: center;
  padding: 22px 26px; color: var(--line);
  transition: transform .12s, box-shadow .12s;
}
.track:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--line); }
.gauge {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--silver); border: var(--stroke) solid var(--line); box-shadow: inset 0 0 0 6px var(--c), inset 0 0 0 calc(6px + var(--stroke)) var(--line);
  font-family: var(--display); font-weight: 800; font-size: 20px;
}
.track h3 { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 4.6vw, 54px); line-height: 1; color: var(--line); text-wrap: initial; }
.track .dur { font-weight: 600; font-size: 13px; letter-spacing: .12em; margin-top: 6px; opacity: .8; }

/* Track rows are the player: the number is the control */
.track { display: block; position: relative; overflow: hidden; isolation: isolate; }
.track .play { display: grid; grid-template-columns: 84px 1fr; gap: 20px; align-items: center; width: 100%; text-align: left; padding: 0; color: inherit; }
.track .tt { min-width: 0; }
.track .hint { display: block; font-weight: 600; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; opacity: .7; margin-top: 6px; min-height: 1.2em; }
.track .hint::before { content: 'Preview'; }
.track .gauge { position: relative; transition: transform .12s, background .12s; }
.track .ico { display: none; }
.track:not(.is-unlinked) .play:hover .gauge { transform: scale(1.06); }
/* hover: the number becomes a play triangle */
.track:not(.is-unlinked) .play:hover .num, .track.is-playing .num { display: none; }
.track:not(.is-unlinked) .play:hover .ico { display: block; width: 0; height: 0; border-style: solid; border-width: 11px 0 11px 19px; border-color: transparent transparent transparent var(--line); margin-left: 5px; }
/* playing: a stop square, inverted gauge, colour sweeping the rectangle */
.track.is-playing .gauge { background: var(--line); }
.track.is-playing .ico { display: block; width: 18px; height: 18px; border: 0; margin: 0; background: var(--cream); }
.track.is-playing .hint::before { content: 'Playing · press to stop'; }
.track::before { content: ''; position: absolute; inset: 0; width: calc(var(--prog, 0) * 100%); background: var(--cream); opacity: .45; z-index: -1; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) { .track::before { transition: width .25s linear; } }
.track.is-unlinked .play { cursor: default; }
.track.is-unlinked .hint { visibility: hidden; }

/* Facts: a control strip */
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px;
}
.facts div { padding: 16px 18px; color: var(--line); }
.facts dt { font-weight: 600; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; opacity: .75; }
.facts dd { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.1; margin-top: 2px; }

/* Listen: big buttons */
.services { display: flex; flex-wrap: wrap; gap: 14px; }
.svc {
  display: flex; flex-direction: column; gap: 2px; min-width: 220px; padding: 18px 24px; color: var(--line);
  transition: transform .12s, box-shadow .12s;
}
.svc strong { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; }
.svc span { font-weight: 600; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; opacity: .75; }
.svc:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--line); }

/* Stay close: a control panel */
.signup { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 14px; align-items: center; padding: 20px 22px; color: var(--cream); max-width: 720px; }
.signup input { min-width: 0; font: inherit; font-weight: 600; font-size: 17px; padding: 12px 14px; border: var(--stroke) solid var(--line); background: var(--cream); color: var(--line); border-radius: 12px; }
.signup input:focus { outline: var(--stroke) solid var(--yellow); outline-offset: 2px; }
.signup button { font-family: var(--display); font-weight: 800; font-size: 15px; padding: 12px 20px; border: var(--stroke) solid var(--line); border-radius: 999px; background: var(--yellow); color: var(--line); box-shadow: 3px 3px 0 var(--line); transition: transform .1s, box-shadow .1s; white-space: nowrap; }
.signup button:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.signup-msg { grid-column: 1 / -1; font-weight: 600; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
@media (max-width: 520px) { .signup { grid-template-columns: 1fr; } }

/* Footer: the yellow floor */
footer {
  position: relative; z-index: 1;
  background: var(--yellow); color: var(--line); border-top: var(--stroke) solid var(--line);
  padding: 26px var(--gutter) 40px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 28px;
  font-weight: 600; font-size: 12px; letter-spacing: .06em;
}
footer a:hover { text-decoration: underline; }

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

@media (max-width: 720px) {
  .top nav a.ext { display: none; }
  .top nav a { padding: 6px 10px; font-size: 10px; }
  .top .title { font-size: 16px; }
  .track .play { grid-template-columns: 60px 1fr; gap: 14px; }
  .track { padding: 18px 18px; }
  .gauge { width: 54px; height: 54px; font-size: 16px; }
  .porthole { height: 180vh; }
  .pipes { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .porthole { height: auto; }
  .porthole .stage { position: relative; height: auto; }
  .porthole .scene { display: none; }
  .porthole .still { display: block; width: 100%; height: auto; }
  .porthole .dim, .porthole .cue { display: none; }
  .porthole .sig { position: relative; opacity: 1; padding: 24px var(--gutter); left: 0; right: 0; bottom: 0; }
}
