@font-face {
  font-family: "Iskoola Pota";
  src: local("Iskoola Pota"), local("IskoolaPota"),
       url("fonts/iskoola-pota-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0a09;
  --ink: #ece7df;
  --soft: #aaa49b;
  --muted: #8b867f;
  --light: 255 240 218;
  --pad: clamp(1.5rem, 7vw, 7.5rem);
  --mark: clamp(3.4rem, 2.6rem + 1.9vw, 4.6rem);

  /* Intro progress. The script drives it; the default is the settled page. */
  --p: 1;
}

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

html { background: var(--bg); }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iskoola Pota", "Times New Roman", Times, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Film grain: breaks up gradient banding and keeps the black from feeling flat. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  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%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* The spiral's light on the page: one soft disc, centred on its transform origin, that the
   script moves and scales along with the spiral. The default rests it on the logo. */
.wash {
  position: fixed;
  left: -500px;
  top: -500px;
  width: 1000px;
  height: 1000px;
  pointer-events: none;
  background: radial-gradient(closest-side,
    rgb(var(--light) / 0.12),
    rgb(var(--light) / 0.042) 35%,
    transparent);
  transform: translate(calc(var(--pad) + 1rem), 3.9rem) scale(3.4);
  will-change: transform;
}

.stage {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* While the intro plays, the page holds still; scrolling only hurries the spiral along. */
.intro body { overflow: hidden; }
.intro { overscroll-behavior: none; }
.intro .reveal {
  pointer-events: none;
  will-change: opacity;
}

header {
  position: relative;
  padding: clamp(1.75rem, 4vw, 3rem) var(--pad) 0;
}

/* The logo's resting box. Offsets line the spiral's left and top edges up with the text. */
.mark-slot {
  width: var(--mark);
  height: var(--mark);
  margin-left: calc(var(--mark) * -0.2207);
  margin-top: calc(var(--mark) * -0.2667);
}

.spiral {
  position: relative;
  width: 100%;
  height: 100%;
}

.spiral svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* The glow is a CSS shadow, not an SVG blur filter, so it stays cheap while the spiral moves.
   The script sets larger values during the intro; these are the resting logo's. */
.light-layer {
  filter: drop-shadow(0 0 3.2px rgb(var(--light))) drop-shadow(0 0 0.96px rgb(var(--light) / 0.6));
}

.intro .spiral {
  position: fixed;
  z-index: 1;
}

.grid { opacity: clamp(0, 1 - var(--p) * 2.2, 1); }

.grid-in { animation: fade 1.8s ease-out 0.6s both; }

.trail {
  stroke-dasharray: 1;
  animation: trace 2s cubic-bezier(0.45, 0.05, 0.25, 1) 0.3s both;
}

.source { animation: fade 0.6s ease-out 0.1s both; }

main {
  align-self: center;
  position: relative;
  padding: 4rem var(--pad);
}

h1 {
  max-width: 11em;
  margin: 0;
  font-weight: 400;
  font-size: clamp(2.1rem, 1.2rem + 3.6vw, 4.25rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.mission {
  max-width: 34em;
  margin: clamp(1.25rem, 2.4vw, 2rem) 0 0;
  color: var(--soft);
  font-size: clamp(1.05rem, 0.95rem + 0.45vw, 1.35rem);
  line-height: 1.4;
  text-wrap: pretty;
}

footer {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  padding: 0 var(--pad) clamp(1.75rem, 4vw, 3rem);
}

footer p {
  max-width: 46em;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
  line-height: 1.5;
  text-wrap: pretty;
}

/* Contact: a small envelope in the corner opposite the logo; it catches the light on hover.
   The padding gives it a comfortable tap target without changing where it sits. */
.contact {
  flex: none;
  display: block;
  padding: 0.6rem;
  margin: -0.6rem;
  color: var(--muted);
  transition: color 0.3s, filter 0.3s;
}

.contact svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.contact:hover,
.contact:focus-visible {
  color: var(--ink);
  filter: drop-shadow(0 0 6px rgb(var(--light) / 0.55));
}

.contact:focus-visible {
  outline: 1px solid rgb(var(--light) / 0.6);
  outline-offset: 2px;
}

/* Text stays dark until the light reaches it. */
.reveal { opacity: clamp(0, (var(--p) - 0.55) * 2.6, 1); }
.reveal.late { opacity: clamp(0, (var(--p) - 0.68) * 3.2, 1); }

@keyframes trace {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
