/* Twilight over the cloud deck: the palette of assets/sky.jpg. Dark only. */

/* Drafting* Mono by Owen Earl (indestructibletype.com), SIL OFL 1.1:
   see assets/fonts/DraftingMono-OFL.txt. */
@font-face {
  font-family: "Drafting Mono";
  src: url("assets/fonts/DraftingMono-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-display: swap;
}
@font-face {
  font-family: "Drafting Mono";
  src: url("assets/fonts/DraftingMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Drafting Mono";
  src: url("assets/fonts/DraftingMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --dusk: #a198cb;
  --cloud: #0c1736;
  --deep: #070e24;
  --burn: #eef3ff;
  --ink: #e4e7f4;
  --ink-2: rgba(228, 231, 244, 0.62);
  --ink-3: rgba(228, 231, 244, 0.38);
  --rule: rgba(161, 152, 203, 0.18);
  --font: "Drafting Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Page colour on the root too, so overscroll and rounded screen corners
   show dark rather than white. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--deep); }

body {
  margin: 0;
  background: linear-gradient(var(--cloud) 100svh, var(--deep)) var(--deep);
  color: var(--ink);
  font: 400 13px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Film grain over everything, faint. */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: url("assets/grain.png");
  background-size: 80px;
  opacity: 0.05;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--burn); }
.dim { color: var(--ink-3); }

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }

/* Hero: the photograph, full bleed, settling into the cloud deck below. */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100svh;
  background: var(--cloud) url("assets/sky.jpg") 70% center / cover no-repeat;
}
.jets {
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  /* Same size and position as the hero's photo, so the cutout lines up. */
  background: url("assets/jets.webp") 70% center / cover no-repeat;
}
.hero::after {
  content: "";
  z-index: 3;
  position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  /* Eased stops so the fade has no visible top or bottom edge. */
  background: linear-gradient(
    rgba(12, 23, 54, 0) 0%, rgba(12, 23, 54, 0.04) 15%, rgba(12, 23, 54, 0.14) 30%,
    rgba(12, 23, 54, 0.3) 45%, rgba(12, 23, 54, 0.5) 60%, rgba(12, 23, 54, 0.7) 74%,
    rgba(12, 23, 54, 0.87) 87%, var(--cloud) 100%);
  pointer-events: none;
}

/* No z-index here, so the title sits under the jets. */
.intro {
  position: relative;
  width: 100%; max-width: 1120px;
  margin: -12vh auto 0;
  padding: 0 var(--gutter);
  container-type: inline-size;
}
h1 {
  /* Fills the column in Drafting* Mono ExtraLight; the script in index.html
     refits it if a fallback font renders instead. */
  font-size: 24.6cqi;
  font-weight: 200;
  /* A pale sky blue, partly see-through, so it sits in the dusk. */
  color: rgba(150, 164, 226, 0.62);
  line-height: 0.8;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.download {
  color: var(--burn);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.download:hover { text-decoration-thickness: 2px; }

/* Sections */

main { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
section { padding-top: clamp(80px, 10vw, 140px); }
h2 { font-size: 13px; color: var(--ink-3); margin-bottom: 24px; }

/* Foreword: body text only, set like the page before a book begins. */

/* Pulled up over the photo's fade into the page. */
.foreword {
  position: relative; z-index: 4;
  padding-top: 0;
  margin-top: 4vh;
}
.foreword p {
  max-width: 60ch;
  margin: 0 0 1.4em;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-2);
}
.foreword p:last-child { margin-bottom: 0; }

/* Product shots. Without JavaScript they're a plain list; features.js
   turns them into a reel (below). */

.shot {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
  margin: 0 0 clamp(56px, 7vw, 96px);
}
.shot figcaption { padding-top: 8px; font-size: 13px; font-weight: 500; }
.shot img {
  display: block;
  width: 100%; height: auto;
  border-radius: 12px;
}

/* The reel: one screen tall per shot. The stage sticks while the section
   scrolls past. Scrolling far enough to the next shot switches to it: the
   caption scrambles over and the new shot rises into place on its own,
   leaving the old one dimmed just behind and above it. */
.reel { height: calc(var(--count) * 100svh); }
.reel-stage {
  position: sticky; top: 0;
  height: 100svh;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: center;
}
.reel-caption {
  margin: 0;
  font-size: 13px; font-weight: 500;
  white-space: pre-wrap;
  min-height: 4.65em;
}
.reel-frame {
  position: relative;
  width: min(100%, calc(76svh * 1.6));
  aspect-ratio: 1920 / 1200;
}
.reel-frame .shot {
  position: absolute; inset: 0;
  display: block;
  margin: 0;
  transform-origin: 50% 0;
  transform: translateY(45%);
  opacity: 0;
  transition:
    transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.45s ease;
}
.reel-frame .shot.is-current { transform: none; opacity: 1; }
.reel-frame .shot.is-previous { transform: translateY(-6%) scale(0.92); filter: brightness(0.45); opacity: 1; }
.reel-frame .shot.is-past { transform: translateY(-10%) scale(0.86); filter: brightness(0.3); opacity: 0; }
.reel-frame .shot img { width: 100%; height: 100%; border-radius: 0; }
.reel-frame figcaption {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%);
}
@media (prefers-reduced-motion: reduce) {
  .reel-frame .shot { transition: opacity 0.2s ease; }
}

.code {
  margin: auto 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(7, 14, 36, 0.6);
  border: 1px solid var(--rule);
  font-size: 12px; line-height: 1.7;
  color: var(--ink-2);
  overflow-x: auto;
}


/* Install */

.install {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px 64px;
  align-items: end;
}
.credits {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 32px;
  margin: 0; font-size: 13px;
}
.credits dt { color: var(--ink-3); font-size: 12px; }
.credits dd { margin: 2px 0 0; }
.install .code { margin: 0 0 20px; }
/* Let the code block scroll instead of widening the grid on phones. */
.install > * { min-width: 0; }

/* Footer */

footer {
  display: flex; justify-content: space-between; gap: 16px;
  max-width: 1120px;
  margin: clamp(80px, 10vw, 140px) auto 0;
  padding: 24px var(--gutter) 36px;
  font-size: 12px;
  color: var(--ink-3);
}
footer span:last-child { display: flex; gap: 20px; }

/* Narrow */

@media (max-width: 860px) {
  .hero { align-items: flex-start; padding-top: 22svh; min-height: 88svh; }
  .hero, .jets { background-position: 78% center; }
  .intro { margin-top: 0; }
  .shot { grid-template-columns: 1fr; gap: 16px; }
  .shot figcaption { padding-top: 0; }
  .reel-stage { grid-template-columns: 1fr; align-content: center; gap: 20px; }
  .reel-caption { min-height: 3.1em; }
  .install { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  footer { flex-direction: column; }
}
