/* Gamma 40 — drafting paper, one red line. */
:root {
  --paper: #EEF0F2;
  --ink: #18212C;
  --graphite: #56616D;
  --rule: #C3CAD2;
  --red: #D11433;
  --type: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --pad-x: clamp(1.25rem, 6vw, 6rem);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--paper); }
body {
  font-family: var(--type);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#scene { position: fixed; top: 0; left: 0; display: block; }

.skip {
  position: fixed; left: 1rem; top: 1rem; z-index: 20;
  padding: .5rem .8rem; background: var(--ink); color: var(--paper);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

.progress {
  position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 10;
  background: transparent;
}
.progress span {
  display: block; height: 100%; background: var(--red);
  transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- overlay panels ---------- */
.panel {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: max(7vh, env(safe-area-inset-top)) var(--pad-x) max(9vh, env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0; visibility: hidden;
  will-change: opacity, transform;
}
.panel a { pointer-events: auto; }

.panel h2 {
  margin: 0;
  font-weight: 300;
  font-stretch: 125%;
  font-size: clamp(2rem, 4.8vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  max-width: 13ch;
}
.panel p {
  margin: 1.1rem 0 0;
  max-width: 34ch;
  color: var(--graphite);
  font-size: clamp(1rem, 1.2vw, 1.15rem);
}
.companies {
  list-style: none;
  margin: 1.5rem 0 0; padding: .1rem 0 .1rem 1rem;
  border-left: 1px solid var(--red);
  font-size: .95rem; line-height: 1.7;
  font-stretch: 100%;
}

/* hero: tagline sits on a full-width red line */
.panel--hero { opacity: 1; visibility: visible; justify-content: center; align-items: center; text-align: center; }
.tagline {
  position: absolute; left: 0; right: 0; bottom: calc(50% + clamp(.9rem, 2.2vh, 1.6rem));
  margin: 0; padding: 0 var(--pad-x);
  font-weight: 200;
  font-stretch: 125%;
  font-size: clamp(2rem, 5.6vw, 5.4rem);
  line-height: .95;
  letter-spacing: -0.02em;
  clip-path: inset(0 0 100% 0);
  transform: translateY(.35em);
  transition: clip-path 1.1s cubic-bezier(.2,.7,.1,1), transform 1.1s cubic-bezier(.2,.7,.1,1);
}
.ready .tagline { clip-path: inset(0 0 -10% 0); transform: none; }
.hero-line {
  position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px;
  background: var(--red);
  transform: scaleX(0);
  animation: draw-line 1.5s cubic-bezier(.65,0,.35,1) .1s forwards;
}
@keyframes draw-line { to { transform: scaleX(1); } }

/* scroll cue: a red pulse travelling down a short rail */
.cue {
  position: fixed; left: 50%; bottom: max(4.5vh, env(safe-area-inset-bottom)); z-index: 7;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  padding: .5rem 1rem; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .95rem; font-stretch: 110%; color: var(--ink);
  opacity: 0; transition: opacity .6s ease;
}
.cue-track { position: relative; width: 2px; height: 64px; background: var(--rule); overflow: hidden; }
.cue-track span {
  position: absolute; left: 0; top: 0; width: 2px; height: 22px; background: var(--red);
  animation: cue-run 1.6s cubic-bezier(.6,0,.3,1) infinite;
}
@keyframes cue-run {
  0% { transform: translateY(-24px); }
  70%, 100% { transform: translateY(66px); }
}
.cue:hover .cue-text { color: var(--red); }

/* sound toggle */
.sound {
  position: fixed; right: var(--pad-x); top: max(1.25rem, env(safe-area-inset-top)); z-index: 12;
  display: flex; align-items: center; gap: .6rem;
  padding: .45rem .2rem; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .85rem; color: var(--graphite);
}
.sound:hover, .sound[aria-pressed="true"] { color: var(--ink); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { display: block; width: 2px; height: 3px; background: currentColor; transition: height .3s ease; }
.sound[aria-pressed="true"] .bars i { background: var(--red); animation: bar 1.1s ease-in-out infinite alternate; }
.sound[aria-pressed="true"] .bars i:nth-child(2) { animation-delay: -.4s; }
.sound[aria-pressed="true"] .bars i:nth-child(3) { animation-delay: -.8s; }
.sound[aria-pressed="true"] .bars i:nth-child(4) { animation-delay: -.2s; }
@keyframes bar { from { height: 3px; } to { height: 14px; } }

.panel--center { justify-content: flex-end; align-items: center; text-align: center; }
.panel--center h2 { max-width: none; }
.panel--center p { margin-left: auto; margin-right: auto; }

/* ---------- the logo hand-off ---------- */
.logo-stage {
  position: fixed; left: 50%; top: 50%; z-index: 4;
  transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0;
  will-change: transform, opacity;
}
.logo-stage img { display: block; width: 60vw; height: auto; }

/* ---------- 40 years ---------- */
/* the 40 years block is centred in the space below the logo */
.panel--end {
  justify-content: center; align-items: center; text-align: center;
  padding-top: max(22vh, env(safe-area-inset-top)); padding-bottom: max(10vh, env(safe-area-inset-bottom));
}
.badge { width: min(580px, 86vw); height: auto; overflow: visible; --d: 1; }
.badge .draw { stroke-dasharray: 1; stroke-dashoffset: var(--d); }
.badge .years {
  font-family: var(--type); font-weight: 300; font-stretch: 125%; font-size: 46px;
  fill: var(--red); opacity: calc(1 - var(--d) * 2);
}
.close-line {
  margin: 1.6rem 0 0 !important; max-width: none !important;
  color: var(--ink) !important;
  font-weight: 200; font-stretch: 125%;
  font-size: clamp(1.3rem, 2.6vw, 2.2rem) !important; line-height: 1.2;
}
.close-line span { display: block; }
.close-line .cl2 { margin-top: .2em; }
.static .close-line span { opacity: 1 !important; }
.visit {
  position: absolute; left: 50%; bottom: max(5vh, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--red); padding-bottom: .15rem;
}
.visit:hover { color: var(--red); }

/* ---------- sector rail ---------- */
.rail {
  position: fixed; right: var(--pad-x); top: 50%; z-index: 6;
  transform: translate(12px, -50%);
  opacity: 0; visibility: hidden;
  transition: opacity .5s ease, transform .5s ease, visibility .5s;
}
.rail.show { opacity: 1; visibility: visible; transform: translate(0, -50%); }
.rail ol { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--rule); }
.rail button {
  display: block; width: 100%; text-align: right;
  font: inherit; font-size: .8rem; font-stretch: 100%;
  color: var(--graphite); background: none; border: 0; cursor: pointer;
  padding: .32rem 1rem .32rem 0; position: relative;
}
.rail button::after {
  content: ""; position: absolute; right: -1px; top: 25%; bottom: 25%; width: 1px;
  background: var(--red); transform: scaleY(0); transition: transform .3s ease;
}
.rail button:hover { color: var(--ink); }
.rail button.on { color: var(--red); }
.rail button.on::after { transform: scaleY(1); width: 3px; right: -2px; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.spacer { position: relative; height: 1400vh; }
#end { position: absolute; bottom: 0; left: 0; width: 1px; height: 1px; }

@media (max-width: 760px) {
  .rail { display: none; }
  .panel { padding-bottom: max(6vh, env(safe-area-inset-bottom)); }
  .panel h2 { font-size: clamp(1.9rem, 9vw, 2.6rem); }
  .companies { font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tagline, .rail, .rail button::after, .cue { transition: none !important; }
  .hero-line { animation: none; transform: none; }
  .cue-track span, .sound .bars i { animation: none !important; }
  .cue-track span { transform: translateY(20px); }
}

/* ---------- fallback without WebGL ---------- */
.static #scene, .static .progress, .static .rail, .static .spacer, .static .cue, .static .sound, .static .hero-line { display: none; }
.static .panel, .static .logo-stage {
  position: relative; opacity: 1 !important; visibility: visible !important;
  min-height: 70vh; justify-content: center;
}
.static .logo-stage { left: auto; top: auto; transform: none; display: flex; justify-content: center; padding: 10vh var(--pad-x); }
.static .tagline { position: relative; inset: auto; clip-path: none; transform: none; opacity: 1; }
.static .badge { --d: 0; }

.static .visit { position: static; transform: none; margin-top: 1.4rem; }
