/* RapidRepair — the diagnostic cutaway. A laundry room at night, the app's black room inside a phone; one family (Archivo), two widths. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/fonts/archivo-latin.woff2') format('woff2');
}

:root {
  --bg: #04060a;
  --ink: #eef1f5;
  --ink-2: rgba(238, 241, 245, 0.7);
  --ink-3: rgba(238, 241, 245, 0.42);
  --rule: rgba(238, 241, 245, 0.16);
  --blue: #5aaeff;
  --blue-deep: #2f6fe4;
  --fault: #ff6a2b;
  --pill-bg: #eef1f5;
  --pill-ink: #04060a;
  --scrim: rgba(4, 6, 10, 0.5);
  --display: 'Archivo', 'Archivo Fallback', Arial, Helvetica, sans-serif;
  color-scheme: dark;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: var(--blue-deep); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 2px; }
html { scrollbar-color: rgba(120, 140, 170, 0.45) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: rgba(120, 140, 170, 0.45); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- canvas and fallback */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
/* the stand-in hero: the canvas's own box, behind it, gone once the scene has drawn a frame */
#poster,
#poster img {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}
#poster { transition: opacity 420ms ease; }
html.scene-live #poster { opacity: 0; }
html.no-webgl #poster { display: none; }
html.no-webgl #scene { display: none; }
html.no-webgl .beat { height: auto; min-height: 100svh; }
html.no-webgl .beat + .beat { margin-top: 0; }
html.no-webgl .copy { opacity: 1 !important; transform: none !important; pointer-events: auto; }
html.no-webgl body {
  background:
    radial-gradient(60% 50% at 70% 35%, rgba(255, 194, 122, 0.16), transparent 70%),
    radial-gradient(40% 40% at 20% 80%, rgba(90, 174, 255, 0.12), transparent 70%),
    #04060a;
  background-attachment: fixed;
}

/* ---------- header */

.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 44px);
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-stretch: 112%;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-shadow: 0 1px 14px rgba(4, 6, 10, 0.55); /* the wordmark sits over the window by morning */
}
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.6); }
.top-cta {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  padding: 9px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.top-cta:hover { border-color: var(--ink-2); }

/* ---------- story beats */

#story { position: relative; z-index: 1; }

/*
 * Each chapter is pinned for --span vh of scroll. Chapters overlap by one
 * viewport so the next pin is already in place when the previous one releases:
 * no dead scroll between chapters, and the scene never freezes.
 */
.beat {
  position: relative;
  height: calc(var(--span, 120) * 1vh + 100vh);
  height: calc(var(--span, 120) * 1vh + 100svh);
}
.beat + .beat {
  margin-top: -100vh;
  margin-top: -100svh;
}
.pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: grid;
  align-items: center;
  padding: 0 clamp(18px, 6vw, 96px);
  pointer-events: none;
}
.copy {
  position: relative;
  max-width: 34rem;
  will-change: opacity, transform;
  pointer-events: none;
}
.copy.live { pointer-events: auto; }
.copy::before {
  /* soft legibility pool behind the copy; it is the room, not a card */
  content: '';
  position: absolute;
  inset: -30% -18% -30% -16%;
  background: radial-gradient(closest-side, var(--scrim), transparent);
  filter: blur(36px);
  z-index: -1;
  pointer-events: none;
}

h1, h2 {
  margin: 0 0 0.55em;
  font-weight: 760;
  font-stretch: 114%;
  letter-spacing: -0.028em;
  line-height: 0.98;
  text-wrap: balance;
  color: var(--ink);
}
h1 { font-size: clamp(2.7rem, 6.6vw, 5.8rem); }
h2 { font-size: clamp(2.15rem, 4.9vw, 4.3rem); }
.copy > p {
  margin: 0;
  max-width: 30rem;
  font-size: clamp(1.05rem, 1.35vw, 1.28rem);
  font-weight: 420;
  font-stretch: 100%;
  line-height: 1.45;
  color: var(--ink-2);
  text-wrap: pretty;
}
.copy .badge { margin-top: 2rem; }

/* chapters trade sides: the copy sits right when the camera has swung the machine to the left */
.copy.right { justify-self: end; }

/* the exploded chapter: the machine takes the frame, the copy becomes a caption in the corner */
.copy.caption { max-width: 22rem; align-self: end; margin-bottom: clamp(24px, 7vh, 72px); }
.copy.caption h2 { font-size: clamp(1.6rem, 2.7vw, 2.5rem); margin-bottom: 0.4em; }
.copy.caption > p { font-size: clamp(0.95rem, 1.1vw, 1.08rem); max-width: 22rem; }
.copy.caption .hint { margin-top: 0.9rem; font-size: 0.82rem; font-weight: 500; font-stretch: 88%; color: var(--ink-3); opacity: 0; transform: translateY(6px); transition: opacity 0.6s ease, transform 0.6s ease; }
.copy.caption .hint.on { opacity: 1; transform: none; }
/* while the machine can be turned, a horizontal drag is ours and a vertical one is still the scroll */
html.orbit .beat { touch-action: pan-y pinch-zoom; }

/* status lines: the app's own progress states, arriving one at a time */
.status {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.status li {
  position: relative;
  padding-left: 1.4rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-stretch: 80%;
  letter-spacing: 0.005em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
}
.status li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.42em;
  width: 0.62em; height: 0.62em;
  border: 1.5px solid var(--blue);
  background: transparent;
  transition: background-color 0.3s ease 0.35s;
}
.status li.on { opacity: 1; clip-path: inset(0 -2% 0 0); }
.status li.on::before { background: var(--blue); }
.status li.note { color: var(--ink-3); font-stretch: 90%; font-size: 0.82rem; padding-left: 1.4rem; }
.status li.note::before { display: none; }

/* big hitters: three on the whole page */
.hit {
  font-size: clamp(4.2rem, 11.5vw, 9.6rem);
  font-weight: 820;
  font-stretch: 118%;
  letter-spacing: -0.045em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.hit-label {
  margin: 0.6rem 0 0;
  max-width: 24rem;
  font-size: clamp(0.98rem, 1.15vw, 1.1rem);
  font-weight: 450;
  line-height: 1.4;
  color: var(--ink-2);
}
.hits { display: grid; gap: 2.4rem; margin-top: 2rem; }

.gate { margin-top: 1.8rem; }
.meter {
  position: relative;
  height: 6px;
  width: min(100%, 26rem);
  margin-top: 1rem;
  background: var(--rule);
  border-radius: 3px;
  overflow: visible;
}
.meter .fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 3px;
  box-shadow: 0 0 18px -2px var(--blue);
}
.meter .mark {
  position: absolute;
  left: 95%; top: -7px;
  width: 2px; height: 20px;
  background: var(--fault);
}
.meter .mark::after {
  content: 'gate';
  position: absolute;
  left: 8px; top: -3px;
  font-size: 0.72rem;
  font-weight: 600;
  font-stretch: 85%;
  color: var(--ink-2);
  font-style: normal;
}

/* scroll hint */
.scroll-hint {
  position: absolute;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  font-stretch: 85%;
  color: var(--ink-3);
  transition: opacity 0.5s ease;
}
.scroll-hint span { width: 1px; height: 46px; background: linear-gradient(var(--ink-3), transparent); overflow: hidden; position: relative; }
.scroll-hint span::after { content: ''; position: absolute; left: 0; top: -46px; width: 1px; height: 46px; background: var(--ink); animation: drop 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes drop { to { top: 46px; } }
html.scrolled .scroll-hint { opacity: 0; }
.top { transition: opacity 0.35s ease; }
html.atend .top { opacity: 0; pointer-events: none; }
html.og .scroll-hint, html.og .top-cta { display: none; }

/* the store action */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 12px 16px;
  border-radius: 12px;
  background: var(--pill-bg);
  color: var(--pill-ink);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.55);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
  will-change: transform;
}
.badge:hover { transform: translateY(-2px); box-shadow: 0 20px 34px -14px rgba(0, 0, 0, 0.6); }
.badge svg { width: 26px; height: 28px; flex: none; }
.badge b { display: block; font-size: 1.05rem; font-weight: 700; font-stretch: 105%; letter-spacing: -0.01em; line-height: 1.1; }
.badge small { display: block; font-size: 0.72rem; font-weight: 500; opacity: 0.75; line-height: 1.1; margin-bottom: 2px; }

/* ---------- the part name: one label, on the part the visitor clicked */

#callouts { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#callouts svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#callouts line { stroke: var(--blue); stroke-width: 1; opacity: 0.8; }
#callouts circle { fill: var(--blue); }
.callout {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 6px 11px;
  font-size: 0.9rem;
  font-weight: 600;
  font-stretch: 92%;
  color: var(--ink);
  white-space: nowrap;
  background: rgba(4, 6, 10, 0.72);
  border: 1px solid rgba(90, 174, 255, 0.55);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: callout-in 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes callout-in { from { opacity: 0; transform: translate(-50%, -40%); } }

/* ---------- the end: a full-screen black blur over the room, every detail in one place */

.end {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: center;
  color: #eef1f5;
  background: rgba(3, 4, 7, 0.86);
  backdrop-filter: blur(32px) saturate(0.8);
  -webkit-backdrop-filter: blur(32px) saturate(0.8);
  border-top: 1px solid rgba(238, 241, 245, 0.08);
  padding: clamp(40px, 7vw, 96px) clamp(18px, 6vw, 96px) clamp(28px, 4vw, 44px);
}
.end-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 2.5rem clamp(2rem, 6vw, 6rem);
  align-items: start;
  max-width: 76rem;
  width: 100%;
  margin: 0 auto;
}
.end-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 1.2rem;
  font-weight: 700;
  font-stretch: 112%;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.end-brand img { width: 40px; height: 40px; border-radius: 10px; }
.end-lede {
  margin: 0 0 1.6rem;
  max-width: 26rem;
  font-size: clamp(1.25rem, 1.9vw, 1.7rem);
  font-weight: 600;
  font-stretch: 108%;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: pretty;
}
.end .badge { background: #eef1f5; color: #04060a; }
.end-details {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.3rem 2rem;
}
.end-details > div { min-width: 0; }
.end-details dt {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-stretch: 88%;
  color: rgba(238, 241, 245, 0.5);
}
.end-details dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 450;
  line-height: 1.45;
  color: rgba(238, 241, 245, 0.86);
  text-wrap: pretty;
}
.end-details dd a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(238, 241, 245, 0.35); }
.end-details dd a:hover { text-decoration-color: #eef1f5; }
.end-details dd a + a { margin-left: 1.2rem; }
.end .entity { grid-column: 1 / -1; margin: 1.5rem 0 0; font-size: 0.8rem; color: rgba(238, 241, 245, 0.45); }

/* ---------- responsive */

@media (max-width: 760px) {
  .top { padding: 14px 16px; }
  .brand span { display: none; }
  .top-cta { font-size: 0.86rem; padding: 8px 12px; }
  .pin { align-items: end; padding: 0 18px 12vh; }
  .copy { max-width: 100%; }
  .copy.right { justify-self: stretch; }
  .copy::before { inset: -14% -10% -18% -10%; }
  h1 { font-size: clamp(2.5rem, 12vw, 3.6rem); }
  h2 { font-size: clamp(2rem, 9.5vw, 3rem); }
  .copy > p { font-size: 1.02rem; }
  .status { margin-top: 1.1rem; gap: 0.4rem; }
  .status li { font-size: 0.88rem; }
  .hit { font-size: clamp(3.6rem, 19vw, 5.2rem); }
  .hits { gap: 1.4rem; margin-top: 1.2rem; }
  .hit-label { font-size: 0.92rem; margin-top: 0.35rem; }
  .gate { margin-top: 1.1rem; }
  .callout { font-size: 0.8rem; padding: 5px 9px; }
  .copy.caption { margin-bottom: 0; }
  .scroll-hint { display: none; }
  .end-inner { grid-template-columns: 1fr; gap: 2rem; }
  .end-details { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .pin { align-items: center; }
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.8rem; }
  .hit { font-size: 3.4rem; }
}

/* ---------- reduced motion: everything visible, nothing scroll-driven */

@media (prefers-reduced-motion: reduce) {
  .beat { height: auto; min-height: 100svh; }
  .beat + .beat { margin-top: 0; }
  .copy { opacity: 1 !important; transform: none !important; pointer-events: auto; }
  .status li { opacity: 1; clip-path: none; transition: none; }
  .status li::before { background: var(--blue); }
  .scroll-hint { display: none; }
  .badge, .top-cta { transition: none; }
  .scroll-hint span::after { animation: none; }
}
