/* Night hero (demo). Loaded after style.css. */
.nh {
  position: relative;
  height: 420vh; /* 220vh of camera move + 100vh holding inside the laptop */
  background: #050608;
}
.nh__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #050608;
}
.nh__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* Beat 1 — headline in the night sky */
.nh__intro {
  position: absolute;
  z-index: 2;
  top: 11vh;
  left: var(--gutter);
  right: var(--gutter);
  pointer-events: none;
  will-change: transform, opacity;
}
.nh__title {
  font-family: var(--serif);
  font-weight: 400;
  max-width: 16em;
  font-size: clamp(36px, 4.2vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: #f4f1ec;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.6);
}
.nh__title .muted { color: rgba(244, 241, 236, 0.55); }
.nh__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(244, 241, 236, 0.7);
}
.nh__kicker::before,
.nh__hint::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f2a65a;
  box-shadow: 0 0 12px 2px rgba(242, 166, 90, 0.6);
}
.motion .nh__hint::before { animation: nh-pulse 2s ease-in-out infinite; }
@keyframes nh-pulse { 50% { opacity: 0.35; } }
.nh__hint { display: inline-flex; align-items: center; gap: 10px; color: rgba(244, 241, 236, 0.75); }

.nh__ui {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px var(--gutter);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: rgba(244, 241, 236, 0.75);
  pointer-events: none;
}
.nh__ui [data-clock] { font-variant-numeric: tabular-nums; }
.nh__progress { display: flex; align-items: center; gap: 12px; }
.nh__progress i { position: relative; width: 120px; height: 2px; border-radius: 2px; background: rgba(244, 241, 236, 0.2); overflow: hidden; }
.nh__progress b { position: absolute; inset: 0; background: #f4f1ec; transform-origin: left center; transform: scaleX(var(--p, 0)); }

/* Beat 2 — the laptop screen that becomes the page */
.nh__screen {
  --scr: 236 241 255;
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  transform-origin: 0 0;
  background: rgb(var(--scr));
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  backface-visibility: hidden;
  will-change: transform, opacity;
}
.nh__screen-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.22) 1.2px, transparent 1.6px);
  background-size: 24px 24px;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 42%, #000 40%, transparent 85%);
  mask-image: radial-gradient(70% 60% at 50% 42%, #000 40%, transparent 85%);
}
.nh__screen-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 110px;
  text-align: center;
  opacity: 0;
}
.nh__role {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: #000;
}
.nh__role .muted { color: var(--muted); }
.nh__tag { margin-bottom: 22px; }
.nh__areas {
  max-width: 34em;
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.55;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.nh__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.btn--ghost { color: var(--ink); background: rgba(255, 255, 255, 0.6); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14); }
.btn--ghost:hover { filter: none; background: #fff; }
.nh__bar {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(800px, 100%);
  height: 72px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #ebe8e6;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #000;
}
.nh__bar .hero__info-stripes { inset: 0; }
.nh__bar p, .nh__bar span { position: relative; }
.nh__bar .hero__clock { font-variant-numeric: tabular-nums; }

/* Reduced motion: no camera move; the scene is a still frame and the
   screen content sits below it as a normal block. */
html:not(.motion) .nh { height: auto; }
html:not(.motion) .nh__sticky { position: relative; height: auto; overflow: visible; }
html:not(.motion) .nh__canvas { position: relative; height: 100vh; height: 100svh; }
html:not(.motion) .nh__screen,
html:not(.motion) .nh__screen-content { position: relative; opacity: 1; transform: none !important; pointer-events: auto; }
html:not(.motion) .nh__screen { width: 100% !important; height: 100vh !important; height: 100svh !important; }
html:not(.motion) .nh__ui { display: none; }

@media (max-width: 999.98px) {
  .nh__intro { top: 12vh; }
}
@media (max-width: 799.98px) {
  .nh__progress .nh__hint { font-size: 0; gap: 0; } /* keep just the pulsing dot on small screens */
  .nh__progress .nh__hint::before { margin-right: 10px; }
}
@media (max-width: 599.98px) {
  .nh { height: 390vh; }
  .nh__intro { text-align: center; }
  .nh__kicker { justify-content: center; font-size: 13px; }
  .nh__title { margin: 0 auto; max-width: 11em; }
  .nh__ui { padding: 20px; font-size: 13px; }
  .nh__progress i { width: 72px; }
  .nh__areas { font-size: 17px; }
  .nh__bar { font-size: 17px; }
}

/* ==========================================================================
   Preloader: terminal → counter → the screen switches on
   ========================================================================== */
.nl { display: none; }
.js.motion .nl {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #050608;
  color: #f4f1ec;
  transition: opacity 0.18s linear;
}
.nl::before { /* film grain */
  content: "";
  position: absolute;
  inset: -50%;
  opacity: 0.07;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: nl-grain 0.6s steps(3) infinite;
}
@keyframes nl-grain {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-3%, 2%); }
  66% { transform: translate(2%, -3%); }
}
.nl__ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px var(--gutter) 36px;
  transition: opacity 0.25s ease;
}
.nl__top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(244, 241, 236, 0.5);
}
.nl__term {
  min-height: 8.4em;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 2;
  color: rgba(244, 241, 236, 0.8);
}
.nl__prompt { color: #f2a65a; }
.nl__ok { color: rgba(242, 166, 90, 0.8); }
.nl__caret {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: #f4f1ec;
  animation: nl-blink 0.9s steps(1) infinite;
}
@keyframes nl-blink { 50% { opacity: 0; } }
.nl__bottom { display: flex; align-items: flex-end; gap: 32px; }
.nl__bar { position: relative; flex: 1; height: 1px; margin-bottom: 1.4em; background: rgba(244, 241, 236, 0.15); }
.nl__bar i { position: absolute; inset: 0; background: #f4f1ec; transform-origin: left center; transform: scaleX(0); }
.nl__count {
  font-family: var(--serif);
  font-size: clamp(72px, 13vw, 190px);
  line-height: 0.8;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.nl__flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  transform: scale(0, 0.002);
  box-shadow: 0 0 80px 20px rgba(220, 230, 255, 0.55);
}
.nl.is-on .nl__ui { opacity: 0; }
.nl.is-on .nl__flash { opacity: 1; animation: nl-power 0.45s cubic-bezier(0.7, 0, 0.2, 1) forwards; }
@keyframes nl-power {
  0% { transform: scale(0, 0.002); }
  40% { transform: scale(1, 0.002); }
  100% { transform: scale(1, 1); }
}
.nl.is-done { opacity: 0; pointer-events: none; }

/* Nav waits until the camera has pulled back */
.nav { transition: opacity 0.8s ease, transform 0.8s var(--ease-out); }
html.night-intro .nav { opacity: 0; transform: translateY(-12px); pointer-events: none; }

@media (max-width: 599.98px) {
  .nl__ui { padding: 22px 20px 28px; }
  .nl__term { font-size: 13px; }
  .nl__top span:last-child { display: none; }
}

/* ==========================================================================
   Sound toggle (rain + music), fixed bottom-left
   ========================================================================== */
.snd {
  position: fixed;
  z-index: 55;
  left: var(--gutter);
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(14, 15, 18, 0.9);
  color: #f4f1ec;
  font: 500 13px/1 var(--sans);
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out), background-color 0.25s ease;
}
.snd:hover { background: rgba(30, 31, 36, 0.85); }
.snd:focus-visible { outline: 2px solid #f2a65a; outline-offset: 3px; }
.snd__bars { display: flex; align-items: center; gap: 3px; height: 16px; }
.snd__bars i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
  transform: scaleY(0.25);
  transform-origin: center;
  transition: transform 0.4s ease, opacity 0.4s ease;
}
.snd.is-on .snd__bars i { opacity: 1; animation: snd-bar 1.1s ease-in-out infinite; }
.snd.is-on .snd__bars i:nth-child(2) { animation-duration: 0.8s; animation-delay: -0.3s; }
.snd.is-on .snd__bars i:nth-child(3) { animation-duration: 1.3s; animation-delay: -0.6s; }
.snd.is-on .snd__bars i:nth-child(4) { animation-duration: 0.95s; animation-delay: -0.2s; }
@keyframes snd-bar { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
.snd.is-on .snd__bars { color: #f2a65a; }
.snd.is-armed .snd__bars { color: #f2a65a; }
.snd.is-armed .snd__bars i { opacity: 0.9; animation: snd-wait 1.6s ease-in-out infinite; }
.snd.is-armed .snd__bars i:nth-child(2) { animation-delay: 0.15s; }
.snd.is-armed .snd__bars i:nth-child(3) { animation-delay: 0.3s; }
.snd.is-armed .snd__bars i:nth-child(4) { animation-delay: 0.45s; }
@keyframes snd-wait { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(0.55); } }
html.night-intro .snd { opacity: 0; transform: translateY(12px); pointer-events: none; }

/* the night scene's bottom bar makes room for the sound button */
.nh__ui p { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.nh__ui { justify-content: flex-end; }

@media (max-width: 599.98px) {
  .snd { left: 16px; bottom: 16px; padding: 0 13px; }
  .snd__label { display: none; }
  .snd.is-hint { padding-right: 16px; }
  .snd.is-hint .snd__label { display: inline; }
  .nh__ui p { left: auto; right: 20px; transform: none; }
  .nh__ui .nh__progress { display: none; }
  .nh__bar { padding-left: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .snd.is-on .snd__bars i { animation: none; transform: scaleY(0.7); }
}
