/* the allonelabs.com faces, self-hosted: AllOne Display (Orbitron Black + the Hungarian Ő ő Ű ű, renamed under the OFL)
   for display, Geist for everything else. Arabic has no glyphs in either, so it falls through to the system's Arabic face */
@font-face {
  font-family: "AllOne Display";
  src: url(fonts/allone-display.woff2) format("woff2");
  font-weight: 900;
  font-display: block;
}
@font-face {
  font-family: "Geist";
  src: url(fonts/geist.woff2) format("woff2");
  font-weight: 100 900;
  font-display: block;
}
:root {
  --blue: #2776ea;
  --ink: #000000;
  --paper: #eaebe5;
  --page-bg: #000000;
  --page-fg: #eaebe5;
  --m: 16px;
  --arabic: "SF Arabic", "Geeza Pro", "Noto Sans Arabic", "Segoe UI", Tahoma;
  --font: "Geist", "Noto Sans Georgian", system-ui, var(--arabic), sans-serif;
  --display: "AllOne Display", "Geist", "Noto Sans Georgian", system-ui, var(--arabic), Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: inherit;
}

html {
  scroll-behavior: auto;
}
body {
  background: var(--page-bg);
  color: var(--page-fg);
  font-family: var(--font);
  font-weight: 500;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
}

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--ink);
  display: grid;
  place-items: center;
  transition:
    opacity 0.9s ease 0.3s,
    visibility 0.9s 0.3s;
}
.loader.done {
  opacity: 0;
  visibility: hidden;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--m);
  font-size: 28px;
  line-height: 1;
  mix-blend-mode: difference;
  color: #fff;
}
.nav-logo img {
  height: 26px;
  display: block;
  filter: invert(1);
}
@media (max-width: 700px) {
  .nav {
    font-size: 18px;
  }
  .nav-logo img {
    height: 18px;
  }
}

a {
  color: inherit;
  text-decoration: none;
}
.link {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 2.5px;
  transition: background-size 0.3s ease-in-out;
}
.link:hover {
  background-size: 100% 2.5px;
}
.nav-logo.link:hover {
  background-size: 0 2.5px;
}

/* ---------- chapters ---------- */
main {
  position: relative;
  z-index: 10;
}
.chapter {
  min-height: 160vh;
  padding: var(--m);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 24px;
  pointer-events: none;
}
.chapter a {
  pointer-events: auto;
}
.chapter.right {
  align-items: flex-end;
  text-align: end;
}

.hero {
  min-height: 100vh;
  justify-content: flex-end;
  align-items: center;
}
.statement {
  font-family: var(--display);
  font-weight: 900;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: center;
  padding-bottom: 8px;
}

.big {
  font-family: var(--display);
  font-size: clamp(34px, 6.6vw, 104px);
  line-height: 0.95;
  letter-spacing: 0;
  font-weight: 900;
}
.body {
  font-size: 18px;
  line-height: 1.2;
  max-width: 34ch;
  letter-spacing: 0.01em;
}

/* text slides up out of a mask */
.reveal {
  overflow: hidden;
}
.reveal > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1.1s cubic-bezier(0.19, 1, 0.22, 1);
}
.reveal.in > span {
  transform: none;
}
.body.reveal > span {
  transition-delay: 0.12s;
}

/* ---------- contact: page turns blue under the shader cut ---------- */
.contact {
  min-height: 100vh;
  color: var(--ink);
  justify-content: space-between;
  padding-top: 30vh;
}
.foot {
  display: flex;
  flex-direction: column;
  gap: 48px;
  font-size: 28px;
  line-height: 1;
}
.foot-links,
.foot-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
@media (max-width: 700px) {
  .foot {
    font-size: 18px;
  }
}

.hud {
  position: fixed;
  left: var(--m);
  bottom: var(--m);
  z-index: 20;
  font-size: 13px;
  letter-spacing: 0.01em;
  mix-blend-mode: difference;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
body.at-contact .hud {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .reveal > span {
    transition: none;
    transform: none;
  }
}

/* on the blue ground, difference-blend white would read orange — go plain ink */
.nav,
.nav-logo img {
  transition:
    color 0.4s,
    filter 0.4s;
}

/* loader: the mark is scanned in left to right as the world loads — cold white, one red beacon riding the scan.
   --p is the progress (0–100%), set by the loader tick in main.js. 500/300px keeps the 50 ruler ticks on whole pixels */
.loader {
  --p: 0%;
  --red: #ff2412;
}
.ld-core {
  width: 500px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  animation: ld-in 0.9s ease both;
  transition:
    opacity 0.7s ease,
    transform 1.1s cubic-bezier(0.19, 1, 0.22, 1);
}
@media (max-width: 700px) {
  .ld-core {
    width: 300px;
    gap: 18px;
  }
}
.ld-mark {
  position: relative;
  aspect-ratio: 1364 / 425;
}
.ld-ghost,
.ld-fill {
  position: absolute;
  inset: 0;
  -webkit-mask: url(allone-lockup.svg) center / contain no-repeat;
  mask: url(allone-lockup.svg) center / contain no-repeat;
}
.ld-ghost {
  background: rgba(234, 235, 229, 0.09);
}
.ld-fill {
  background: var(--paper);
  clip-path: inset(0 calc(100% - var(--p)) 0 0);
}
.ld-scan {
  position: absolute;
  top: -14%;
  bottom: -14%;
  left: var(--p);
  width: 1px;
  background: var(--paper);
}
.ld-scan::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -2px;
  width: 5px;
  height: 5px;
  background: var(--red);
  animation: ld-blink 1.2s steps(1) infinite;
}
.ld-ruler,
.ld-ruler i {
  --c: rgba(234, 235, 229, 0.2);
  background:
    linear-gradient(90deg, var(--c) 0 1px, transparent 1px) 0 0 / 10% 100%
      repeat-x,
    linear-gradient(90deg, var(--c) 0 1px, transparent 1px) 0 100% / 2% 45%
      repeat-x;
}
.ld-ruler {
  position: relative;
  width: calc(100% + 1px);
  height: 10px;
}
.ld-ruler i {
  --c: var(--paper);
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--p)) 0 0);
}
.ld-foot {
  position: absolute;
  left: var(--m);
  right: var(--m);
  bottom: var(--m);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}
/* done: scan and ruler go first, the mark settles down towards the water, then the black lifts off the world */
.loader.done .ld-core {
  opacity: 0;
  transform: translateY(14px);
}
.loader.done .ld-scan,
.loader.done .ld-ruler {
  opacity: 0;
  transition: opacity 0.25s ease;
}
@keyframes ld-in {
  from {
    opacity: 0;
  }
}
@keyframes ld-blink {
  50% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ld-scan::before {
    animation: none;
  }
}

/* intro: chrome and copy wait until the wordmark has risen */
.nav,
.hud,
.statement {
  transition: opacity 1.2s ease;
}
body.intro .nav,
body.intro .hud {
  opacity: 0;
}
body.intro .reveal > span {
  transform: translateY(105%);
}

/* nav: the sound switch sits beside contact, set like a link */
.nav-right {
  display: flex;
  gap: 1em;
  align-items: center;
}
.sound {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
}

/* chapter copy sits low in the frame when the scroll rests on a station, clear of the screen */
.chapter:not(.hero):not(.contact) {
  justify-content: flex-start;
  padding-top: 56vh;
}

/* ---------- 07: the finale — a glass card floating over the lit valley, below the mark ---------- */
.contact {
  min-height: 100vh;
  padding: 0 var(--m) 7vh;
  justify-content: flex-end;
  align-items: center;
  color: var(--page-fg);
}
.contact-card {
  width: min(560px, 100%);
  padding: 34px 36px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: rgba(6, 10, 20, 0.34);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 2px solid #ff2412;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 1.1s ease,
    transform 1.3s cubic-bezier(0.19, 1, 0.22, 1);
}
body.at-contact .contact-card {
  opacity: 1;
  transform: none;
}
.contact-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.95;
}
.contact-mail {
  font-size: clamp(18px, 2vw, 24px);
  align-self: flex-start;
}
/* the whole card is the link to alfred: hovering anywhere draws the underline */
.contact-card:hover .contact-mail {
  background-size: 100% 2.5px;
}
.contact-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 15px;
}
.contact-place {
  font-size: 13px;
  letter-spacing: 0.01em;
  opacity: 0.55;
}

/* telemetry, bottom right: set like the chapter counter */
.hud.tel {
  left: auto;
  right: var(--m);
  display: flex;
  gap: 1.4em;
}
@media (max-width: 700px) {
  .hud.tel .tel-geo,
  .hud.tel #telAlt {
    display: none;
  }
}

/* ---------- language switch: EN / AR / HU, the current one full strength */
.langs {
  display: flex;
  gap: 0.5em;
}
.langs button {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}
.langs button:hover,
.langs button[aria-pressed="true"] {
  opacity: 1;
}

/* ---------- Arabic: the page runs right to left; Arabic script wants air between lines and no tracking
   (spacing breaks the joins), and the hero line stays centred */
:root[lang="ar"] body,
:root[lang="ar"] body * {
  letter-spacing: 0 !important;
}
:root[lang="ar"] .big,
:root[lang="ar"] .contact-title {
  line-height: 1.25;
}
:root[lang="ar"] .statement {
  line-height: 1.4;
}
:root[lang="ar"] .body {
  line-height: 1.6;
  font-size: 19px;
}
/* Hungarian caps carry accents (Á É Ő Ű): the tight English leading lets line two's accents hit line one */
:root[lang="hu"] .big,
:root[lang="hu"] .contact-title {
  line-height: 1.14;
}
:root[lang="ar"] .nav-logo img,
:root[lang="ar"] .hud,
:root[lang="ar"] .ld-core {
  direction: ltr;
}
