/*
 * Source Code Pro is the wordmark's face — site/logo.svg is its Light caps,
 * outlined. It is not the display face here: the titles are set in the
 * reader's own grotesque, and the monospace is kept for the /slash tags, the
 * counters and the standings figures, which is what a monospace is for.
 */
@font-face {
  font-family: "Source Code Pro";
  /* `format("truetype")` and not `format("truetype-variations")`: an
     unrecognised format string makes a browser skip the `src` entirely. */
  src: url("fonts/SourceCodePro-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #0c1339; /* Navora's first colour: the app's navy. */
  --near-black: #0a0a0a;

  /* THEME_PRESETS, second colour of each pair — the six accents. */
  --amber: #feac20; /* Navora  */
  --teal: #358f92; /* Ocean   */
  --gold: #ffd700; /* Oz      */
  --orange: #fd7000; /* Pipster */
  --grey: #c2c2c2; /* Nautica */
  --magenta: #ee00ff; /* Cyber   */

  --font-body:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --font-mono:
    "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, monospace;

  --edge: clamp(10px, 1vw, 16px);
  --pad: clamp(24px, 3.2vw, 56px);
  --radius: 18px;
  --hair: rgba(12, 19, 57, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── The two columns ────────────────────────────────────────────────────
 *
 * One grid for the whole document. The left column is sticky and as tall as
 * the window; the right one is a stack of panels taller than it.
 */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--edge);
  padding: var(--edge);
}
@media (min-width: 62rem) {
  .shell {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── The masthead ──────────────────────────────────────────────────────── */

.masthead {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vw, 48px);
  padding: clamp(20px, 2.4vw, 40px) clamp(12px, 2vw, 40px);
}
@media (min-width: 62rem) {
  .masthead {
    position: sticky;
    top: var(--edge);
    height: calc(100vh - var(--edge) * 2);
    justify-content: space-between;
  }
}
/*
 * The wordmark is the logo, inlined rather than linked as an image so that it
 * takes its colour from here. Its paths are filled with
 * `var(--pipster-ink, currentColor)`.
 */
.wordmark {
  display: inline-flex;
  color: var(--ink);
  line-height: 1;
}
.wordmark svg {
  display: block;
  height: clamp(3.25rem, 5.5vw, 4.5rem);
  width: auto;
}

.masthead-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.masthead-foot {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.4vw, 30px);
}

a {
  color: inherit;
}
/* The one link style on the page: underlined, offset a little off the
   baseline so a coloured panel does not turn it into a button. */
.link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
}
.link:hover {
  text-decoration-thickness: 2px;
}

/* ── Panels ─────────────────────────────────────────────────────────────
 *
 * A screen, not a card: one subject, the height of the window, and never
 * beside another one. `--panel` is the only thing that differs between them,
 * and `--panel-ink` is set where the colour needs a darker one than the navy.
 */
.panels {
  display: flex;
  flex-direction: column;
  gap: var(--edge);
  /*
   * A container, so the angled joint below can measure itself against the
   * width of this column rather than the viewport: `cqw` is 1% of it.
   */
  container-type: inline-size;
}
.panel {
  /*
   * ── THE JOINT'S ANGLE. This is the only place to set it. ──
   *
   * Careful: the unit is `cqw`, not degrees. `--slope` is the vertical
   * rise the angled edge makes across the full width of the column, and
   * `cqw` is 1% of that width — so the value is `tan(angle) x 100`, and
   * because it is a fraction of the width the angle holds at every
   * viewport instead of flattening as the column grows.
   *
   *     1 deg  1.746cqw        4 deg   6.993cqw
   *     2 deg  3.492cqw        5 deg   8.749cqw
   *     3 deg  5.241cqw        8 deg  14.054cqw
   *
   * 3cqw, below, is 1.72 degrees.
   *
   * It is declared on `.panel` rather than on `.panels` for two reasons:
   * a container's own declarations cannot use its own query units, and
   * both sides of a joint need to read it — the panel below carries the
   * clip, and the panel above reserves the same amount at its foot so the
   * wedge coming up does not cover its last line.
   */
  --slope: 3cqw;
  background: var(--panel, var(--paper));
  color: var(--panel-ink, var(--ink));
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
}
@media (min-width: 62rem) {
  .panel {
    min-height: calc(100vh - var(--edge) * 2);
  }
}
/* The first panel carries no colour, so it needs its own edge. */
.panel-plain {
  box-shadow: inset 0 0 0 1px var(--hair);
}

/* ── The angled joint ───────────────────────────────────────────────────
 *
 * PREVIEW, first two panels only: square corners, no gap between them, and
 * the edge where one meets the next tilted 3 degrees instead of level.
 *
 * ── Where the 3 degrees comes from ──
 *
 * `--slope` is the vertical rise the edge makes across the full width of the
 * column, and it has to be a fraction of that width or the angle changes with
 * the window. `cqw` is 1% of the panels column, so the rise for an angle a is
 * `tan(a) x 100cqw`; tan(3deg) is 0.05241, hence 5.241cqw. At a 700px column
 * that is 37px, and it stays 3 degrees at every size.
 *
 * That is the only number to change for a different angle: 8.75cqw is 5
 * degrees, 14.054cqw is 8.
 *
 * ── Why the lower panel carries it ──
 *
 * The joint is drawn by clipping the *top* of the panel below, not the bottom
 * of the panel above, and then pulling that panel up by the same `--slope` so
 * it overlaps its neighbour. The wedge cut away above the diagonal is
 * therefore filled by the panel behind it rather than by the white page — 
 * which is what makes this work between two coloured panels and not just
 * against the paper.
 *
 * The clip eats into the padding box, so the top padding gains `--slope` to
 * keep the first line clear of the diagonal at its deepest point.
 */
.panel-joined {
  border-radius: 0;
}
/* The first and last panels are still the top and bottom of the page, so they
     keep those corners. Only the edges that join another panel are squared. */
.panel-first {
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel-last {
  border-radius: 0 0 var(--radius) var(--radius);
}
.panel-joint {
  /*
   * `--edge` as well as `--slope`, because the column these sit in is a flex
   * stack with `gap: var(--edge)` and that gap is still between them. Pulling
   * up by the slope alone left the two overlapping by `slope - edge`, which
   * put the low end of the diagonal a whole `--edge` below the panel above and
   * showed as a white wedge at the right-hand end of the joint.
   */
  margin-top: calc((var(--slope) + var(--edge)) * -1);
  clip-path: polygon(0 0, 100% var(--slope), 100% 100%, 0 100%);
  padding-top: calc(var(--pad) + var(--slope));
}
/*
 * The same joint tilted the other way, and the reason the shapes read as
 * trapezoids rather than as a staircase.
 *
 * A panel's silhouette is made by two joints — the one above it and the one
 * below. Tilt both the same way and it comes out a parallelogram, every edge
 * running downhill and the whole column looking like it is sliding off the
 * page. Alternate them and each panel is a trapezoid: taller down one side
 * than the other, and the column stays level overall.
 *
 * So the direction flips at every joint, and this class is what does it.
 * It only overrides the clip; the negative margin and the extra top padding
 * are the same either way, which is why it is a modifier on `.panel-joint`
 * rather than a rule of its own.
 */
.panel-joint-rev {
  clip-path: polygon(0 var(--slope), 100% 0, 100% 100%, 0 100%);
}
/*
 * The panel above a joint gives up the slope's worth of room at its foot. The
 * wedge coming up from below is deepest at the left — that is where the lower
 * panel's clipped corner sits flush against the box top — and `--pad` alone
 * was less than `--slope`, so the amber climbed over the last line of the
 * panel above it.
 */
.panel-above-joint {
  padding-bottom: calc(var(--pad) + var(--slope));
}
/*
 * The panel above a joint loses its bottom hairline. It is white on a white
 * page so the line is what makes it a panel at all — but at the joint the
 * panel below defines the edge, and left in place the hairline showed as a
 * stray 1px crossing the wedge.
 */
.panel-plain.panel-joined {
  box-shadow:
    inset 0 1px 0 var(--hair),
    inset 1px 0 0 var(--hair),
    inset -1px 0 0 var(--hair);
}

/* A tag on the left, its number in the set on the right, a hairline under
     both. `currentColor` so it follows whatever ink the panel is using. */
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(10px, 1.2vw, 16px);
  border-bottom: 1px solid currentColor;
  margin-bottom: clamp(32px, 4.5vw, 72px);
}
.tag {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

/* ── Type ───────────────────────────────────────────────────────────────
 *
 * The titles are the reader's own grotesque at 700 — the reference this is
 * built to sets its own at 900 in the system face, and a monospace at this
 * size reads as a terminal rather than as a masthead.
 */
h1,
h2 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2rem, 4.4vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
h3 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(1.125rem, 1.7vw, 1.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/*
 * Prose set the way a book sets it: no space between paragraphs, a first-line
 * indent instead. It is the reference's own choice and it is what lets a
 * panel hold four paragraphs without looking like a form.
 */
.copy {
  font-size: clamp(1.0625rem, 1.6vw, 1.5rem);
  line-height: 1.45;
  max-width: 34ch;
}
.copy p {
  margin: 0;
  text-indent: 1.6em;
}
.copy p:first-child {
  text-indent: 0;
}
.copy > * + * {
  margin-top: 0 !important;
}
.copy .link {
  display: inline-block;
  margin-top: 1.2em;
  text-indent: 0;
}

/* Pushed to the foot of the panel, whatever height the panel ends up. */
.panel-foot {
  margin-top: auto;
  padding-top: clamp(32px, 4vw, 64px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 3vw, 56px);
}
.pair {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pair-value {
  font-weight: 700;
}

/* ── Rows inside a panel ────────────────────────────────────────────────
 *
 * Three ways a match gets in, and three things a saved one is worth. A
 * hairline between each, in the panel's own ink.
 */
.rows {
  display: flex;
  flex-direction: column;
}
.row {
  display: grid;
  gap: 8px clamp(20px, 2.4vw, 40px);
  padding: clamp(18px, 2.2vw, 28px) 0;
  border-top: 1px solid currentColor;
}
.row-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.step-number {
  display: inline-grid;
  place-items: center;
  flex: 0 0 1.65rem;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1;
}
.row:last-child {
  border-bottom: 1px solid currentColor;
}
@media (min-width: 45rem) {
  .row {
    grid-template-columns: 1fr 1.35fr;
    align-items: baseline;
  }
}
.row p {
  margin: 0;
  font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
  line-height: 1.5;
}

/* ── Screenshots ────────────────────────────────────────────────────────
 *
 * No frame. The Timer fills a phone edge to edge in its own two colours, and
 * on a panel of any of these six the shape reads on its own; the corner is
 * rounded because a screenshot with square corners is not a phone.
 */
.shot {
  width: 100%;
  max-width: 15rem;
  border-radius: 22px;
}
.panel-figure {
  margin: 0;
  display: flex;
  align-items: flex-end;
  gap: clamp(20px, 3vw, 44px);
  flex-wrap: wrap;
}
figcaption {
  margin-top: 14px;
}

/* A touch-first strip: each screenshot snaps into place, while mouse and
   trackpad users can scroll the same row horizontally. */
.screen-gallery {
  display: flex;
  gap: clamp(18px, 2.5vw, 32px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 1px;
  padding: 0 1px 18px;
  -webkit-overflow-scrolling: touch;
}
.screen-shot {
  flex: 0 0 min(70vw, 300px);
  margin: 0;
  padding: 12px 12px 14px;
  background: var(--paper);
  border-radius: 18px;
  scroll-snap-align: start;
}
.screen-shot img {
  width: 100%;
  aspect-ratio: 9 / 19.5;
  object-fit: cover;
  border-radius: 12px;
  background: var(--paper);
}
.screen-shot figcaption {
  margin-top: 10px;
  text-align: center;
}

/* ── Standings ────────────────────────────────────────────────────────── */

.standings {
  width: 100%;
  max-width: 26rem;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: clamp(1rem, 1.4vw, 1.25rem);
}
.standings th,
.standings td {
  text-align: left;
  padding: 0.75em 0;
  border-bottom: 1px solid currentColor;
}
.standings thead th {
  font-weight: 400;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}
.standings tbody td {
  font-weight: 500;
}
.standings .num {
  text-align: right;
  width: 3.5em;
}
.standings tbody tr:last-child td {
  border-bottom: 0;
}

/* ── FAQ ────────────────────────────────────────────────────────────────
 *
 * <details> rather than a script: it opens with no JavaScript, and the answer
 * is in the HTML whether it is open or shut, which is what a crawler reads.
 */
details {
  border-top: 1px solid currentColor;
}
details:last-of-type {
  border-bottom: 1px solid currentColor;
}
summary {
  cursor: pointer;
  list-style: none;
  padding: clamp(14px, 1.8vw, 22px) 2.25rem clamp(14px, 1.8vw, 22px) 0;
  position: relative;
  font-weight: 700;
  font-size: clamp(0.9375rem, 1.15vw, 1.125rem);
  letter-spacing: -0.01em;
}
summary::-webkit-details-marker {
  display: none;
}
/* A plus that becomes a minus: two rules rather than a glyph, so it cannot
     arrive in the wrong font or fail to load. */
summary::before,
summary::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 50%;
  background: currentColor;
  transition:
    transform 0.18s,
    opacity 0.18s;
}
summary::before {
  width: 13px;
  height: 2px;
  transform: translateY(-50%);
}
summary::after {
  width: 2px;
  height: 13px;
  right: 7.5px;
  transform: translateY(-50%);
}
details[open] summary::after {
  transform: translateY(-50%) rotate(90deg);
  opacity: 0;
}
details > p {
  margin: 0;
  padding-bottom: clamp(16px, 2vw, 24px);
  max-width: 46ch;
  font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
  line-height: 1.55;
}

/* ── The mark, at size ──────────────────────────────────────────────────
 *
 * The point holding a checker, rebuilt as an element so the checker can hold
 * the link. Every proportion is the logo's: the point there is 52 wide and 145
 * tall and the checker is a 39.51-diameter hole centred at y=124.245.
 *
 *   height  = base x 2.788   (145 / 52)
 *   checker = base x 0.760   (39.51 / 52)
 *   centre  = height x 0.857 (124.245 / 145)
 *
 * The checker is filled with the panel's own colour, so it reads as a hole
 * punched through the point — which is what it is in the logo, where the path
 * is one shape with `fill-rule: evenodd`.
 */
.point {
  --base: clamp(6.5rem, 11vw, 9.5rem);
  position: relative;
  width: var(--base);
  height: calc(var(--base) * 2.788);
  flex: none;
}
.point::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.checker {
  position: absolute;
  left: 50%;
  top: 85.7%;
  transform: translate(-50%, -50%);
  width: calc(var(--base) * 0.76);
  height: calc(var(--base) * 0.76);
  border-radius: 50%;
  background: var(--panel, var(--paper));
  display: grid;
  place-items: center;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: calc(var(--base) * 0.105);
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  text-decoration: none;
  color: currentColor;
  padding: 0 12%;
}
a.checker:hover {
  background: currentColor;
  color: var(--panel, var(--paper));
}

/* ── The contact form ───────────────────────────────────────────────────
 *
 * Drawn in `currentColor` on the panel's own ground, so it takes the last
 * panel's white ink without naming a colour of its own — the same way
 * `.panel-head` and the FAQ hairlines do it.
 *
 * A hairline to write on rather than a box around each field: a bordered
 * input on a coloured panel reads as a card, and a card is the one thing the
 * panels are not.
 */
.form {
  margin-top: clamp(24px, 3vw, 40px);
  max-width: 34ch;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.2vw, 28px);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* The label, set like a tag — it is the same kind of small mono marker. */
.field > span {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}
.field input,
.field textarea {
  font-family: inherit;
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  line-height: 1.45;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  padding: 8px 0;
  width: 100%;
  /* iOS gives both a rounded inset and its own font otherwise. */
  -webkit-appearance: none;
  appearance: none;
}
.field textarea {
  resize: vertical;
  min-height: 6.5em;
}
/* The rule thickens on focus, as `.link` does on hover. The padding gives
   back the pixel the border took, so nothing below it moves. */
.field input:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-bottom-width: 2px;
  padding-bottom: 7px;
}
.field ::placeholder {
  color: inherit;
  opacity: 0.5;
}

/* ── The button ─────────────────────────────────────────────────────────
 *
 * Two of them: the form's Send, and "Open the app" in the masthead, which is
 * the page's way in now that the closing checker is gone. One class, because
 * they are the same object — a commit, drawn as the panel's ink inverted.
 *
 * The inversion is named explicitly rather than taken from `currentColor`,
 * which on a rule that also sets `color` resolves to the colour being set and
 * would paint the button on itself. The two fallbacks are what let the same
 * class work in both places: on the navy last panel `--panel-ink` is white
 * and `--panel` is the navy, and in the masthead neither is set, so it falls
 * through to navy on the paper.
 */
.button {
  align-self: flex-start;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--panel-ink, var(--ink));
  color: var(--panel, var(--paper));
  border: 0;
  border-radius: 999px;
  padding: 12px 28px;
  /* An anchor carries the page's underline otherwise. */
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.18s,
    color 0.18s;
}
#contactSend {
  background: var(--amber);
}
.button:hover:not(:disabled) {
  background: transparent;
  color: inherit;
  box-shadow: inset 0 0 0 1px currentColor;
}
.button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* What the server said. Amber for a failure — the palette has no red, and
   amber is already the page's one attention colour. */
.form-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  line-height: 1.45;
}
.form-status:empty {
  display: none;
}
.form-status[data-state="error"] {
  color: var(--amber);
}

/* Nobody asked for the motion, and the transitions here are decoration. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
