/* nowill-works — the machine room. One chamber per service, an invisible
   ping-pong loop in each. Bricolage Grotesque; graphite + teal. Always in motion. */

:root {
  --bg: #07080a;
  --ink: #eef3f2;
  --ink-dim: rgba(238, 243, 242, 0.63);
  --teal: #0fb5ba;
  --teal-bright: #3bdcd2;
  --teal-glow: rgba(15, 181, 186, 0.36);
  --hair: rgba(238, 243, 242, 0.17);
  --display: 'Bricolage Grotesque', -apple-system, sans-serif;
  --body: -apple-system, 'Helvetica Neue', sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(1.25rem, 4vw, 4.5rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--teal); color: #02282a; }
:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 3px; border-radius: 3px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 70;
  padding: 0.7em 1.2em; background: var(--teal); color: #02282a;
  font-family: var(--display); font-weight: 700; font-size: 0.9rem; text-decoration: none;
  border-radius: 0 0 10px 10px; transition: top 0.25s var(--ease);
}
.skip-link:focus { top: 0; }

/* ---------- Header ---------- */

.head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(0.9rem, 2vw, 1.3rem) var(--pad);
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none;
  font-family: var(--display); font-weight: 800; font-size: 1.02rem;
}
.head-cta {
  font-family: var(--display); font-weight: 700; font-size: 0.84rem;
  color: var(--ink); text-decoration: none;
  padding: 0.6em 1.4em; border: 1px solid var(--hair); border-radius: 999px;
  backdrop-filter: blur(10px); background: rgba(7, 8, 10, 0.25);
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
}
.head-cta:hover { border-color: var(--teal); color: var(--teal-bright); box-shadow: 0 0 24px var(--teal-glow); }

/* ---------- Service index rail ---------- */

.rail {
  position: fixed; left: clamp(0.8rem, 2vw, 1.6rem); top: 50%; z-index: 40;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.55rem;
}
.rail a {
  font-family: var(--display); font-weight: 700; font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(238, 243, 242, 0.4); text-decoration: none;
  padding: 0.1rem 0.3rem;
  border-left: 2px solid transparent;
  transition: color 0.3s, border-color 0.3s, text-shadow 0.3s;
}
.rail a:hover { color: var(--teal-bright); }
.rail a.is-here {
  color: var(--teal-bright);
  border-left-color: var(--teal);
  text-shadow: 0 0 14px var(--teal-glow);
}

/* ---------- Rooms ---------- */

.room { position: relative; height: 200vh; }
.room.is-hero { height: 190vh; }
.room.is-end { height: 200vh; }
.hold {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  overflow: hidden;
  display: grid; align-items: end;
}

/* Scene = video plate with idle breathe on top of the loop's own motion */
.scene {
  position: absolute; inset: -4%;
  z-index: 1; will-change: transform, filter;
  animation: breathe 17s ease-in-out infinite alternate;
}
.room:nth-child(even) .scene { animation-duration: 21s; animation-delay: -9s; }
@keyframes breathe {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.05) translateY(-1%); }
}
.scene video {
  width: 100%; height: 100%;
  object-fit: cover; object-position: var(--focus-x, 50%) center;
  opacity: 0; transition: opacity 0.9s ease;
}
.scene video.is-live { opacity: 1; }
.scene::before {
  content: ''; position: absolute; inset: 0;
  background-image: var(--poster);
  background-size: cover; background-position: var(--focus-x, 50%) center;
}

.shade {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7,8,10,0.5) 0%, rgba(7,8,10,0.04) 30%,
                    rgba(7,8,10,0.04) 55%, rgba(7,8,10,0.7) 100%);
}
.hold:has(.text-center) .shade {
  background:
    radial-gradient(ellipse 70% 55% at 50% 60%, rgba(7,8,10,0.5), rgba(7,8,10,0) 72%),
    linear-gradient(180deg, rgba(7,8,10,0.42), rgba(7,8,10,0.04) 30%, rgba(7,8,10,0.62) 100%);
}

/* ---------- Copy ---------- */

.text {
  position: relative; z-index: 3;
  padding: 0 var(--pad) clamp(3.4rem, 9vh, 6.5rem);
  max-width: 46rem;
}
.text-right { justify-self: end; text-align: right; }
.text-center { justify-self: center; text-align: center; max-width: 52rem; }
.is-hero .text-center { align-self: center; padding-bottom: 0; }

.mark {
  font-family: var(--display); font-weight: 700;
  font-size: 0.72rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--teal-bright);
  margin-bottom: 1.15rem;
  text-shadow: 0 0 22px var(--teal-glow);
}
.big {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.7rem, 7.2vw, 6.4rem);
  line-height: 0.98; letter-spacing: -0.03em;
  text-wrap: balance;
  text-shadow: 0 3px 34px rgba(3, 4, 6, 0.85);
}
.lead {
  margin-top: 1.35rem;
  font-size: clamp(0.98rem, 1.3vw, 1.13rem);
  color: var(--ink-dim); line-height: 1.7; max-width: 44ch;
  text-shadow: 0 1px 18px rgba(3, 4, 6, 0.9);
}
.text-right .lead { margin-left: auto; }
.text-center .lead { margin-inline: auto; }

.row { display: flex; gap: 1rem; margin-top: 2.3rem; flex-wrap: wrap; }
.row-center, .text-center .row { justify-content: center; }
.btn-a, .btn-b {
  font-family: var(--display); font-weight: 700; font-size: 0.94rem;
  text-decoration: none; border-radius: 999px; padding: 0.9em 2em;
  white-space: nowrap;
  transition: transform 0.35s var(--ease), box-shadow 0.35s, background 0.35s, color 0.35s, border-color 0.35s;
}
.btn-a { background: var(--teal); color: #02282a; }
.btn-a:hover { background: var(--teal-bright); transform: translateY(-2px); box-shadow: 0 10px 36px var(--teal-glow); }
.btn-b { color: var(--ink); border: 1px solid var(--hair); }
.btn-b:hover { border-color: var(--teal); color: var(--teal-bright); transform: translateY(-2px); }

/* ---------- Scroll cue ---------- */

.cue {
  position: absolute; bottom: 2.2rem; left: 50%; z-index: 3;
  transform: translateX(-50%);
  width: 1px; height: 56px;
  background: rgba(238, 243, 242, 0.18); overflow: hidden;
}
.cue span {
  position: absolute; top: -40%; left: 0; width: 100%; height: 40%;
  background: var(--teal-bright);
  animation: cue 2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes cue { 0% { top: -40%; } 60%, 100% { top: 110%; } }

/* ---------- Footer ---------- */

.foot {
  position: relative; z-index: 3;
  padding: 2.8rem var(--pad);
  text-align: center;
  font-size: 0.78rem; color: var(--ink-dim);
}

/* ---------- Family glue ---------- */

.grade {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background:
    radial-gradient(ellipse 120% 90% at 50% 50%, rgba(0,0,0,0) 55%, rgba(2, 3, 4, 0.55) 100%),
    linear-gradient(165deg, rgba(15, 181, 186, 0.04), rgba(7, 8, 10, 0) 45%, rgba(9, 22, 25, 0.12) 100%);
}
.grain {
  position: fixed; inset: -100px; z-index: 21; pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.66s steps(8) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); } 12.5% { transform: translate(-28px, 16px); }
  25% { transform: translate(14px, -30px); } 37.5% { transform: translate(-34px, -8px); }
  50% { transform: translate(22px, 26px); } 62.5% { transform: translate(-12px, 34px); }
  75% { transform: translate(30px, -18px); } 87.5% { transform: translate(-20px, -26px); }
  100% { transform: translate(0, 0); }
}

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  .rail { display: none; }
  .text, .text-right { justify-self: start; text-align: left; }
  .text-center { justify-self: center; text-align: center; }
  .text-right .lead { margin-left: 0; }
  #s1 { --focus-x: 50%; }
  #s2 { --focus-x: 48%; }
  #s3 { --focus-x: 30%; }   /* the lamp head + beam origin */
  #s5 { --focus-x: 50%; }
  #s7 { --focus-x: 50%; }
  #s8 { --focus-x: 55%; }
  #s9 { --focus-x: 50%; }
  #s10 { --focus-x: 50%; }
}
@media (max-width: 380px) {
  .row { flex-direction: column; align-items: center; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .grain, .cue span, .scene { animation: none; }
  .room { height: auto; }
  .hold { position: relative; height: 100vh; }
  .scene { inset: 0; transform: none !important; filter: none !important; }
  .text { opacity: 1 !important; transform: none !important; }
}
