/* Berth's landing page. The app's type (Inter, JetBrains Mono), its tokens
   (Berth Light and Berth Dark, following the system) and coss-ui's buttons.
   The harbour at the top is the only picture that isn't a screenshot. */

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --card: #ffffff;
  --muted-bg: #f4f4f6;
  --border: #e6e6ea;
  --input: #dcdce1;
  --fg: #26272b;
  --fg-2: #45474e;
  --muted: #62646d;
  --primary: #26272b;
  --primary-fg: #ffffff;
  --amber: #c27a12;
  --ring: #8b8d96;
  --sea: #eef1f6;
  --blue: #3b82f6;
  --green: #16a34a;
  --shadow: 0 1px 2px rgb(20 22 30 / 0.04), 0 24px 60px -28px rgb(20 22 30 / 0.28);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --band: clamp(340px, 58vh, 600px);
  color-scheme: light;
}
/* Night: the system's dark mode, unless the page was put to day; or the
   page put to night by "Close the laptop". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) {
    --bg: #18191c;
    --card: #1f2024;
    --muted-bg: #222327;
    --border: #2c2d33;
    --input: #34353c;
    --fg: #e3e4e8;
    --fg-2: #c0c2c9;
    --muted: #9a9ca5;
    --primary: #e3e4e8;
    --primary-fg: #18191c;
    --amber: #e8a33d;
    --ring: #6b6d76;
    --sea: #131824;
    --green: #4ade80;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 30px 80px -30px rgb(0 0 0 / 0.75);
    color-scheme: dark;
  }
}
:root[data-theme="night"] {
  --bg: #18191c;
  --card: #1f2024;
  --muted-bg: #222327;
  --border: #2c2d33;
  --input: #34353c;
  --fg: #e3e4e8;
  --fg-2: #c0c2c9;
  --muted: #9a9ca5;
  --primary: #e3e4e8;
  --primary-fg: #18191c;
  --amber: #e8a33d;
  --ring: #6b6d76;
  --sea: #131824;
  --green: #4ade80;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 30px 80px -30px rgb(0 0 0 / 0.75);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg,
canvas {
  display: block;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}
h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
p {
  margin: 0;
}
code {
  font-family: var(--mono);
}
.wrap {
  width: min(1040px, 100% - 32px);
  margin-inline: auto;
}
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 10;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-fg);
}
.skip:focus {
  top: 12px;
}

/* coss-ui buttons: default (primary) and outline, size default. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--input);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font: 500 14px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover {
  background: var(--muted-bg);
}
.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: inset 0 1px rgb(255 255 255 / 0.16), 0 1px 2px rgb(0 0 0 / 0.12);
}
.btn.primary:hover {
  opacity: 0.9;
}
.btn svg {
  width: 16px;
  height: 16px;
  margin-inline: -2px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* Header: the mark and two links, lying over the harbour. */
.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.site-header .brand,
.pill {
  height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand svg {
  width: 17px;
  height: 21px;
}
.site-header nav {
  display: flex;
  gap: 6px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.pill:hover {
  background: var(--bg);
}
.pill svg {
  width: 15px;
  height: 15px;
}

/* Hero: the harbour band, then the pitch at its foot, where it dissolves. */
.hero {
  position: relative;
  /* The whole page: the harbour and what's under it fill the window. */
  min-height: 100svh;
  padding-bottom: 48px;
}
.harbour {
  position: relative;
  height: var(--band);
  overflow: hidden;
}
.harbour picture,
.harbour img {
  width: 100%;
  height: 100%;
}
.harbour img {
  object-fit: cover;
  object-position: 50% 42%;
  -webkit-mask-image: linear-gradient(black 50%, transparent);
  mask-image: linear-gradient(black 50%, transparent);
  transition: opacity 0.4s;
}
.harbour canvas {
  position: absolute;
  inset: 0;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 0.4s;
}
.harbour.drawn canvas {
  opacity: 1;
}
.harbour.drawn img {
  opacity: 0;
}
/* The loop, at night: over the drawn harbour in the same box (so nothing
   moves), dissolving through the same dots (a mask from assets/hero-loop.js).
   It brings its own beam, so the CSS one rests. */
.loop {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s;
  -webkit-mask: var(--mask, linear-gradient(black 50%, transparent)) 0 0 / 100% 100% no-repeat;
  mask: var(--mask, linear-gradient(black 50%, transparent)) 0 0 / 100% 100% no-repeat;
}
/* The video itself is a pixel, under the canvas its frames are drawn on. */
.loop video {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
}
.loop canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.harbour.live .loop {
  opacity: 1;
}
.harbour.live > canvas {
  transition-delay: 0.8s;
}
.harbour.live > canvas,
.harbour.live .beam {
  opacity: 0 !important;
}
.harbour .loop canvas {
  opacity: 1;
  image-rendering: auto;
  transition: none;
}
.hero-copy {
  position: relative;
  width: min(720px, 100% - 32px);
  margin: calc(var(--band) * -0.3) auto 0;
  text-align: center;
}
/* "Watch the film": a quiet pill above the headline, like the header's. */
.film-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  margin-bottom: 18px;
  padding: 0 12px 0 4px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.film-link:hover {
  border-color: var(--input);
  background: var(--bg);
}
.film-play {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
}
.film-play svg {
  width: 12px;
  height: 12px;
  margin-left: 1px;
}
.film-time {
  padding-left: 8px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hero h1 {
  font-size: clamp(32px, 5.2vw, 54px);
  line-height: 1.06;
  text-shadow: 0 0 10px var(--bg), 0 0 24px var(--bg);
}
.lede {
  max-width: 560px;
  margin: 16px auto 24px;
  color: var(--fg-2);
  font-size: 17px;
  text-shadow: 0 0 8px var(--bg);
  text-wrap: balance;
}
.install {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 0;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--muted-bg);
  text-align: left;
}
.install-label {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}
.install code {
  overflow-x: auto;
  font-size: 13px;
  white-space: nowrap;
  scrollbar-width: none;
}
.copy {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--input);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  font: 500 12.5px var(--sans);
  cursor: pointer;
}
.copy:hover {
  background: var(--bg);
}
.note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.note a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--fg-2);
  font-weight: 500;
  text-decoration: none;
}
.note a:hover {
  color: var(--fg);
}
.note svg {
  width: 13px;
  height: 13px;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font: 500 13px/1 var(--mono);
}
/* A segmented switch over several views. */
.seg {
  display: flex;
  width: fit-content;
  margin: 0 auto 18px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--muted-bg);
}
.seg button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 500 13.5px var(--sans);
  cursor: pointer;
}
.seg button:hover {
  color: var(--fg);
}
.seg button[aria-pressed="true"] {
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--border);
}
.stack {
  display: grid;
}
.stack > [aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0s 0.3s;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 640px) {
  :root {
    --band: clamp(300px, 52vh, 420px);
  }
  .hero-copy {
    margin-top: calc(var(--band) * -0.22);
  }
  .harbour img {
    object-position: 8% 42%;
  }
  .lede {
    font-size: 16px;
  }
  .install-label {
    display: none;
  }
  .pill span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .harbour canvas,
  .harbour img {
    transition: none;
  }
}

/* The lighthouse's beam: a wedge of halftone dots from the lamp, sweeping
   slowly. Only transform moves; it rests when the page is hidden and for
   reduced motion. Brighter at night. */
.beam {
  position: absolute;
  z-index: 1;
  width: min(70vw, 900px);
  height: 220px;
  margin-top: -110px;
  transform-origin: 0 50%;
  background: linear-gradient(to right, rgb(255 236 190 / 0.9), rgb(255 236 190 / 0.35) 40%, transparent 85%);
  clip-path: polygon(0 48%, 100% 0, 100% 100%, 0 52%);
  -webkit-mask: radial-gradient(circle at 1px 1px, #000 0.8px, transparent 1px) 0 0 / 3px 3px;
  mask: radial-gradient(circle at 1px 1px, #000 0.8px, transparent 1px) 0 0 / 3px 3px;
  opacity: 0;
  pointer-events: none;
  animation: sweep 11s ease-in-out infinite alternate;
  transition: opacity 0.8s;
}
.harbour.drawn .beam {
  opacity: 0.32;
}
:root[data-theme="night"] .harbour.drawn .beam {
  opacity: 0.85;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) .harbour.drawn .beam {
    opacity: 0.85;
  }
}
@keyframes sweep {
  from {
    transform: rotate(-14deg);
  }
  to {
    transform: rotate(10deg);
  }
}
:root.hidden .beam {
  animation-play-state: paused;
}

/* "Close the laptop": puts the page to night, and says what keeps going. */
.lid {
  cursor: pointer;
  font: 500 14px var(--sans);
  color: var(--fg);
}
/* Until the script shows it, the switch keeps its place, so the header
   never moves. */
.lid[hidden] {
  display: inline-flex;
  visibility: hidden;
}
.lid svg {
  width: 15px;
  height: 15px;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .beam {
    animation: none;
    transform: rotate(-4deg);
  }
}

/* The film's lightbox: a modal <dialog> over a dark backdrop, in either
   theme. The frame keeps 16:9 and fits the window. */
.film {
  width: min(1280px, 100vw - 32px, (100svh - 112px) * 16 / 9);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
  color: #e3e4e8;
}
.film::backdrop {
  background: rgb(10 11 14 / 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.film[open] {
  animation: film-in 0.22s ease-out;
}
@keyframes film-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}
:root:has(.film[open]) {
  overflow: hidden;
}
.film-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.film-bar p {
  font-size: 14px;
  font-weight: 500;
}
.film-bar span {
  margin-left: 6px;
  color: #9a9ca5;
  font-variant-numeric: tabular-nums;
}
.film-bar form {
  display: contents;
}
.film-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 10px;
  background: rgb(255 255 255 / 0.06);
  color: inherit;
  cursor: pointer;
}
.film-close:hover {
  background: rgb(255 255 255 / 0.12);
}
.film-close svg {
  width: 16px;
  height: 16px;
}
.film :focus-visible {
  outline-color: #9a9ca5;
}
.film-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08), 0 30px 80px -20px rgb(0 0 0 / 0.7);
}
.film-frame video {
  width: 100%;
  height: 100%;
}
.film-frame video:focus-visible {
  outline-offset: -2px;
}
.film-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(rgb(0 0 0 / 0.62), rgb(0 0 0 / 0.62)), url("assets/film/poster.webp") center / cover;
  color: #e3e4e8;
  font-size: 14px;
}
.film-error[hidden] {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .film[open] {
    animation: none;
  }
  .loop,
  .harbour.live > canvas {
    transition: none;
  }
}

/* Below the harbour: the film's story in six chapters. Each opens with one
   of the app's line scenes (assets/scenes.css), its one amber light, then the
   film's caption and a few words, and a short loop of the real app. */
.chapter {
  padding-top: clamp(72px, 10vw, 128px);
}
.chapter .wrap {
  width: min(1120px, 100% - 32px);
}
/* The hero already fills the window; the first chapter follows closer. */
#start {
  padding-top: clamp(40px, 6vw, 72px);
}
.chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 14px 64px;
  align-items: end;
  margin-bottom: clamp(28px, 4vw, 40px);
}
.chapter-mark {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  /* Room for what rises above the scene's box: a mast, a beam, a sun. */
  padding-top: 14px;
  margin-bottom: 6px;
}
.chapter-mark.centered {
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
/* A line scene's slot, its size kept until the drawing arrives. */
.scene {
  --muted-foreground: var(--muted);
  --warning: var(--amber);
  flex: none;
  display: block;
  width: 144px;
  aspect-ratio: 160 / 52;
}
.scene.dawn {
  width: 208px;
}
.scene svg {
  width: 100%;
  height: auto;
}
.chapter h2 {
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 1.05;
}
.chapter-head > p {
  max-width: 470px;
  color: var(--fg-2);
  font-size: 16.5px;
  text-wrap: pretty;
}

/* A loop: its poster sizes the frame; the video fades in over it once it
   plays. The footage is the app in Berth Dark, so the frame is dark too. */
.clip {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #1d1e22;
  box-shadow: var(--shadow);
}
.clip img {
  width: 100%;
  height: auto;
}
/* A poster not asked for yet keeps its frame, and shows no alt text. */
.clip img[data-src] {
  visibility: hidden;
}
.clip video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s;
}
.clip.playing video {
  opacity: 1;
}
.views .seg {
  margin-bottom: 16px;
}
.stack > .clip {
  grid-area: 1 / 1;
  transition: opacity 0.3s;
}

/* It keeps going: the night comes in through the harbour's dots, whatever
   the theme, and goes out the same way. */
.chapter.after-dark {
  padding-top: clamp(56px, 7vw, 96px);
}
.night-in,
.night-out {
  height: 64px;
  background: #18191c;
  -webkit-mask: url("assets/seam.svg") 0 0 / 16px 64px repeat-x;
  mask: url("assets/seam.svg") 0 0 / 16px 64px repeat-x;
}
.night-out {
  transform: scaleY(-1);
}
.night-body {
  --bg: #18191c;
  --card: #1f2024;
  --muted-bg: #222327;
  --border: #2c2d33;
  --input: #34353c;
  --fg: #e3e4e8;
  --fg-2: #c0c2c9;
  --muted: #9a9ca5;
  --amber: #e8a33d;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 30px 80px -30px rgb(0 0 0 / 0.75);
  padding: clamp(40px, 6vw, 72px) 0 clamp(48px, 7vw, 88px);
  background: var(--bg);
  color: var(--fg);
  color-scheme: dark;
}
.night-body .clip {
  border-color: #2c2d33;
}
.boxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin-top: 18px;
  color: var(--fg-2);
  font: 500 12.5px/1 var(--mono);
}
.boxes span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}
.boxes i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgb(74 222 128 / 0.6);
  animation: pulse 2.6s ease-in-out infinite;
}
.boxes span + span i {
  animation-delay: -1.3s;
}
:root.hidden .boxes i {
  animation-play-state: paused;
}

/* Install: the end, at dawn. */
.install-ch {
  padding-bottom: clamp(88px, 11vw, 136px);
  text-align: center;
}
.lede-2 {
  max-width: 460px;
  margin: 14px auto 26px;
  color: var(--fg-2);
  font-size: 17px;
  text-wrap: balance;
}
.ends {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin-top: 26px;
  font-size: 14.5px;
}
.ends a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--fg-2);
  font-weight: 500;
  text-decoration: none;
}
.ends a:hover {
  color: var(--fg);
}
.ends svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 760px) {
  .chapter-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .scene {
    width: 120px;
  }
  .scene.dawn {
    width: 168px;
  }
  /* On a phone, the frame closes in on the app's main pane. */
  .clip img,
  .clip video {
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: cover;
    object-position: 64% 40%;
  }
  .clip video {
    height: 100%;
  }
  .views .seg button {
    padding: 0 10px;
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .boxes i {
    animation: none;
  }
  .clip video,
  .stack > .clip {
    transition: none;
  }
}
@media (max-width: 760px) {
  .night-body .clip img,
  .night-body .clip video {
    object-position: 12% 50%;
  }
}
/* A phone's header keeps "Close the laptop" on one line. */
.lid span {
  white-space: nowrap;
}
@media (max-width: 420px) {
  .site-header {
    padding: 12px;
  }
  .site-header nav {
    gap: 4px;
  }
  .site-header .brand,
  .pill {
    padding: 0 10px;
  }
  .pill,
  .lid {
    font-size: 13.5px;
  }
}
