/* AVIR — site stylesheet
 * Dark-dominant, editorial. No gradients, no glow, no glassmorphism.
 * The statement blue (#1019EC) is reserved for ONE section only.
 */

/* ---------------------------------------------------------------- fonts */

/* Instrument Serif — display headings ONLY */
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Satoshi — everything in UI */
@font-face { font-family: 'Satoshi'; src: url('../fonts/satoshi-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('../fonts/satoshi-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('../fonts/satoshi-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('../fonts/satoshi-900.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }

/* --------------------------------------------------------------- tokens */

:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg-black: #0a0a0a;
  --bg-surface: #141414;
  --bg-card: #1a1a1a;

  /* Statement color — product showcase ONLY */
  --blue: #1019EC;
  --blue-line: #4650f4;

  /* Text on dark: white at opacity steps */
  --fg-headline: rgba(255, 255, 255, 1);
  --fg-body: rgba(255, 255, 255, 0.55);
  --fg-subtext: rgba(255, 255, 255, 0.45);
  --fg-label: rgba(255, 255, 255, 0.35);
  --fg-hint: rgba(255, 255, 255, 0.28);

  /* Lines / hairlines */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Families */
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-ui: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Nav — shared by every page. Change once, both top bars follow. */
  --nav-logo-size: 22px;
  --nav-link-size: 16px;
  --nav-pad-y: 26px;

  /* Layout */
  --content-max: 1280px;
  --gutter: 32px;
  --radius: 0px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 200ms;
}

/* ---------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-black);
  color: var(--fg-body);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
a:hover { color: #ffffff; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--fg-headline);
  margin: 0;
}

::selection { background: var(--blue); color: #ffffff; }
input::placeholder { color: rgba(255, 255, 255, 0.3); }

:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.6);
  outline-offset: 3px;
}

/* Screen-reader-only, for skip links */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed; top: 12px; left: 12px;
  width: auto; height: auto;
  clip: auto; margin: 0;
  z-index: 100;
  background: #ffffff; color: #0a0a0a;
  padding: 10px 16px;
  font-size: 13px;
}

/* ------------------------------------------------------------------ nav */
/* One definition, both pages. This is what keeps the two top bars
 * identical — sizes come from the tokens above, never from inline styles. */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  background: rgba(10, 10, 10, 0.92);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  backdrop-filter: saturate(140%) blur(6px);
  transition: background-color 0.45s var(--ease);
}

/* The bar takes the colour of the section passing under it, so it reads as
 * part of that section rather than a slab floating over it. Driven by
 * home.js from each section's data-bg. */
.nav[data-bg='blue'] {
  background: var(--blue);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.nav__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--nav-pad-y) var(--gutter);
}

.nav__logo {
  font-family: var(--font-display);
  font-size: var(--nav-logo-size);
  line-height: 1;
  color: #ffffff;
}
.nav__logo:hover { color: #ffffff; opacity: 0.7; }

.nav__links {
  display: flex;
  gap: 36px;
}

.nav__link {
  font-family: var(--font-ui);
  font-size: var(--nav-link-size);
  line-height: 1;
  padding: 8px 0;
  cursor: pointer;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.5);
  transition: color var(--dur) var(--ease);
}
.nav__link:hover { color: #ffffff; }

/* Current page */
.nav__link[aria-current='page'] { color: rgba(255, 255, 255, 0.9); }

/* Scroll progress rail under the bar (Thesis) */
.nav__progress {
  position: absolute;
  left: 0; bottom: -1px;
  height: 1.5px;
  width: 0;
  background: rgba(255, 255, 255, 0.45);
  transition: width 0.2s linear;
}

/* --------------------------------------------------------------- shared */

.contact-block {
  text-align: center;
}
.contact-block__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  color: #ffffff;
  margin: 0;
}
.contact-block__addr {
  margin: 14px 0 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.5);
}

.site-footer {
  border-top: 1px solid var(--line);
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 26px var(--gutter);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
}

/* ---------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.72);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}
.modal[hidden] { display: none; }

.modal__panel {
  background: var(--bg-black);
  border: 1px solid var(--line-strong);
  padding: clamp(28px, 7vw, 56px);
  width: 100%;
  max-width: 400px;
  position: relative;
  /* The form is taller than a short phone viewport once every field is in;
   * let the panel scroll rather than letting the submit button fall off. */
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal__close {
  position: absolute;
  top: 12px; right: 16px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font-ui);
  padding: 6px;
}
.modal__close:hover { color: #ffffff; }

.modal__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  color: #ffffff;
  margin: 0;
}

.modal__fields {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 32px;
}

.modal__input {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: 15px;
  padding: 10px 0;
  width: 100%;
  border-radius: 0;
}
.modal__input:focus {
  outline: none;
  border-bottom-color: rgba(255, 255, 255, 0.6);
}

.modal__textarea {
  resize: vertical;
  min-height: 40px;
  max-height: 180px;
  line-height: 1.5;
}

.modal__submit[disabled] {
  opacity: 0.45;
  cursor: default;
}

/* Post-submit confirmation, shown in place of the form. */
.modal__done[hidden] { display: none; }
.modal__done p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
  margin: 18px 0 0;
}

.modal__error {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  margin: 18px 0 0;
}
.modal__error[hidden] { display: none; }

.modal__submit {
  margin-top: 40px;
  background: #ffffff;
  border: none;
  color: #0a0a0a;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 22px;
  cursor: pointer;
  transition: opacity var(--dur) var(--ease);
}
.modal__submit:hover { opacity: 0.82; }

/* ------------------------------------------------------------ home page */

html { scroll-behavior: smooth; }

/* Snapping suits full-viewport sections on a desktop. On a phone the
 * manifesto is genuinely taller than the viewport, and mandatory snapping
 * fights that — it drags you past text you are still reading. Snap only
 * where the sections actually fit. */
@media (min-width: 900px) {
  .home { scroll-snap-type: y mandatory; }
}

.hero {
  position: relative;
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100vh;
  height: 100svh;
  scroll-snap-align: start;
  padding: 76px var(--gutter) 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero__title {
  font-size: clamp(48px, 6.6vw, 104px);
  line-height: 1.04;
  max-width: 13ch;
  text-wrap: balance;
}

.hero__canvas-wrap {
  position: absolute;
  right: var(--gutter);
  top: 5%;
  width: 44%;
  height: 76%;
  pointer-events: none;
}
.hero__canvas-wrap canvas { width: 100%; height: 100%; display: block; }

@media (max-width: 899px) {
  .hero__canvas-wrap {
    position: static;
    width: auto;
    height: 220px;
    margin: 56px 0 0;
  }
}

.manifesto {
  background: var(--blue);
  min-height: 100vh;
  min-height: 100svh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
}
.manifesto__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(40px, 7vh, 80px) var(--gutter);
  width: 100%;
}
.manifesto__body {
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.4vh, 22px);
}
.manifesto__body p {
  font-size: clamp(14px, 2vh, 17px);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  text-wrap: pretty;
}

.closing {
  height: 100vh;
  height: 100svh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}
.closing__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 var(--gutter);
}

/* Section rail (right edge) */
.rail {
  position: fixed;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  height: 180px;
  width: 9px;
}
.rail__track {
  position: absolute;
  left: 4px; top: 0; bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.45s var(--ease);
}

/* The blue section needs more contrast than the black ones to stay legible. */
.rail[data-bg='blue'] .rail__track { background: rgba(255, 255, 255, 0.32); }
.rail[data-bg='blue'] .rail__dot { background: rgba(255, 255, 255, 0.45); }
.rail[data-bg='blue'] .rail__dot.is-active { background: #ffffff; }
.rail__fill {
  position: absolute;
  left: 4px; top: 0;
  width: 1px;
  height: 0;
  background: #ffffff;
  transition: height 0.25s var(--ease);
}
.rail__dot {
  position: absolute;
  left: 0.5px;
  width: 8px; height: 8px;
  display: block;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.4s var(--ease);
}
.rail__dot[data-i='0'] { top: 0; }
.rail__dot[data-i='1'] { top: calc(50% - 4px); }
.rail__dot[data-i='2'] { bottom: 0; }
.rail__dot.is-active { background: #ffffff; }

/* Kept on phones too — it is the only scroll indicator on a snapping page.
 * Tucked closer to the edge and shortened so it clears the body copy, which
 * runs to the gutter at this width. */
@media (max-width: 899px) {
  .rail {
    right: 10px;
    height: 120px;
  }
}

/* ---------------------------------------------------------- thesis page */

.thesis-article {
  max-width: 640px;
  margin: 0 auto;
  padding: 160px var(--gutter) 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-label);
}

.thesis-article > header h1 {
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1.05;
  margin: 18px 0 0;
}
.thesis-article__meta {
  font-size: 13px;
  color: var(--fg-hint);
  margin: 22px 0 0;
}

.thesis-section { margin-top: 88px; }
.thesis-section--loose { margin-top: 128px; }
.thesis-section--tight { margin-top: 80px; }
.thesis-section--mid { margin-top: 96px; }

.thesis-section h2 {
  font-size: 30px;
  line-height: 1.15;
  margin: 10px 0 24px;
}
.thesis-section--loose h2 { margin-bottom: 36px; }

.thesis-section p {
  font-size: 17px;
  line-height: 1.75;
  color: var(--fg-body);
  margin: 0 0 22px;
  text-wrap: pretty;
}
.thesis-section--loose p {
  line-height: 1.85;
  margin-bottom: 34px;
}
.thesis-section p:last-child { margin-bottom: 0; }

.thesis-figure { margin: 64px 0; }
.thesis-figure--tight { margin: 56px 0; }
.thesis-figure svg { width: 100%; display: block; }

.thesis-contact {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 168px var(--gutter) 0;
}
.thesis-footer { margin-top: 120px; }

@media (max-width: 640px) {
  :root { --gutter: 20px; }
  .thesis-article { padding-top: 128px; }
}

/* ------------------------------------------------------------ 404 page */

.page-404 {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* The 404 lays out as a full-height column, so its bar sits in the flow
 * rather than floating over the content like the other pages. */
.nav--static {
  position: static;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.error-main {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}

.error-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.error-content {
  position: relative;
  text-align: center;
  max-width: 520px;
}

.error-content h1 {
  font-size: clamp(36px, 5.5vw, 56px);
  line-height: 1.08;
  margin: 18px 0 0;
  text-wrap: balance;
}

.error-content__lede {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.5);
  margin: 24px 0 0;
  text-wrap: pretty;
}

.error-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 32px;
  margin-top: 44px;
}

.error-actions a {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.error-actions a:first-child {
  font-weight: 500;
  color: #ffffff;
}
.error-actions__arrow {
  display: inline-block;
  transition: transform var(--dur) var(--ease);
}
.error-actions a:hover .error-actions__arrow { transform: translateX(4px); }

/* Staggered entrance. Each element sets its own delay via --d. */
@keyframes rise404 {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.rise {
  opacity: 0;
  animation: rise404 0.9s var(--ease) var(--d, 0s) forwards;
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* The staggered entrance starts at opacity 0, so it must be shown
   * outright rather than merely sped up. */
  .rise { animation: none !important; opacity: 1 !important; transform: none !important; }
}
