/*
 * Kymatra
 *
 * One visual world, deliberately. This is a wallpaper that glows on a dark
 * desktop, so the site commits to the app's own palette rather than following
 * the reader's theme: near black ground, the wave grey, and the amber the app
 * icon is drawn in. Every colour is painted explicitly so the page holds
 * whatever ground it lands on.
 *
 * One stylesheet for every page, so the look changes in one place.
 */

/*
 * Typefaces
 *
 * Served from this domain rather than from Google, so the site makes no third
 * party requests at all. That is worth the two files: an app sold on never
 * connecting to anything should not have a marketing page that quietly tells
 * Google who is reading it.
 *
 * One variable file per family covers every weight used here. Google serves the
 * same file whatever weight is asked for, so five requests were five copies of
 * two fonts.
 *
 * Chivo and Chivo Mono are licensed under the SIL Open Font License 1.1. The
 * licence travels with them, in assets/fonts/OFL.txt.
 */

@font-face {
  font-family: "Chivo";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/chivo.woff2") format("woff2");
}

@font-face {
  font-family: "Chivo Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/chivo-mono.woff2") format("woff2");
}

:root {
  --ground: #0E1013;
  --surface: #16191E;
  --raised: #1C2027;
  --line: #262C35;
  --amber: #F0A63C;
  --amber-dim: #C4822A;
  --grey: #9BA6B2;
  --bright: #E8ECF1;
  --ink: #10130F;

  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 3rem);

  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.16rem + 0.45vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.4rem + 1vw, 2.25rem);
  --step-3: clamp(2.2rem, 1.7rem + 2.5vw, 3.5rem);
  --step-4: clamp(2.8rem, 1.8rem + 5vw, 5.5rem);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--grey);
  font-family: Chivo, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  color: var(--bright);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; }

a { color: var(--amber); }
a:hover { color: var(--bright); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--amber);
  color: var(--ink);
  padding: 0.75rem 1rem;
  font-weight: 600;
  z-index: 10;
}
.skip:focus { left: 0; }

/* Read but not seen. Clipped rather than display:none, which would take it out
   of the accessibility tree along with everything else. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap-narrow { max-width: 46rem; }

.eyebrow {
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber-dim);
  margin: 0;
}

/* Header */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--bright);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}
.wordmark img { display: block; width: 26px; height: 26px; }

/* Buttons */

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.actions-spaced { margin-top: 1.5rem; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

/*
 * Hover lives here rather than in the script: it should be instant, cost no
 * listener, and survive a blocked script. The press does not, and lives in
 * motion.js, which also means transform belongs entirely to the script and
 * nothing here fights it for that property.
 *
 * The glow is the trace's glow. A generic lift would have suited any button on
 * any site; this one is the product.
 */

.button-primary { background: var(--amber); color: var(--ink); }
.button-primary:hover {
  background: #FFBC57;
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgba(240, 166, 60, 0.35),
    0 8px 24px -8px rgba(240, 166, 60, 0.55);
}

.button-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--bright);
}
.button-quiet:hover {
  border-color: var(--grey);
  color: var(--bright);
  background: rgba(232, 236, 241, 0.04);
}

/* Hero */

.hero { padding-block: clamp(2rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 3rem); }

.hero h1 {
  font-size: var(--step-4);
  margin-block: 0.6rem 1.1rem;
}

/*
 * The retyping headline
 *
 * text-wrap is returned to normal here alone. Balancing re-decides where the
 * lines break, and re-deciding that on every character makes finished words
 * jump between lines while later ones are still being typed.
 *
 * Height is reserved by the script rather than here, since which phrase is
 * tallest depends on how wide the window is. Without it everything below the
 * headline lifts and drops each time a phrase changes line count.
 */
.headline { text-wrap: normal; }

.headline-caret {
  display: none;
  width: 0.055em;
  height: 0.72em;
  margin-left: 0.07em;
  vertical-align: -0.02em;
  background: var(--amber);
  animation: caret-blink 1.06s steps(1, end) infinite;
}

/* Solid while characters are moving, blinking while the phrase sits there to
   be read. A caret that blinks through its own typing reads as a fault. */
.headline.is-typing .headline-caret {
  animation: none;
  opacity: 1;
}

@keyframes caret-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* The caret appears only once the script that drives it is running, so a
   blocked script leaves a finished sentence rather than a finished sentence
   with a cursor waiting after it forever. Reduced motion never gets here
   either, the script having stopped before it reached the headline. */
.headline.is-live .headline-caret { display: inline-block; }

.hero-lede {
  font-size: var(--step-1);
  max-width: var(--measure);
  color: var(--grey);
  margin-bottom: 1.75rem;
}

.hero-note {
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--grey);
  opacity: 0.75;
  margin-top: 0.9rem;
}

/* Scope */

.scope {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.scope-canvas {
  display: block;
  width: 100%;
  height: clamp(220px, 34vw, 380px);
  background: #0B0D10;
}

.scope-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
  background: var(--raised);
}

.mode {
  flex: 1 1 auto;
  padding: 0.5rem 0.7rem;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--grey);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease;
}
.mode:hover { color: var(--bright); background: #232935; }
.mode[aria-pressed="true"] { background: var(--amber); color: var(--ink); }

.scope-caption {
  padding: 0 0.85rem 0.85rem;
  font-size: 0.9rem;
  color: var(--grey);
  background: var(--raised);
  margin: 0;
}

/* Sections */

section { padding-block: clamp(3rem, 8vw, 5.5rem); }

.section-head { max-width: var(--measure); margin-bottom: 2.5rem; }
.section-head h2 { font-size: var(--step-3); margin-block: 0.5rem 1rem; }
.section-head p { font-size: var(--step-1); }

.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* Specs */

.specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.spec { background: var(--surface); padding: 1.5rem 1.35rem; }

.spec dt {
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber-dim);
  margin-bottom: 0.7rem;
}

.spec dd {
  margin: 0;
  color: var(--bright);
  font-size: var(--step-2);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.spec .qualifier {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--grey);
  letter-spacing: 0;
}

.footnote {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--grey);
  opacity: 0.8;
  max-width: var(--measure);
}

/* Prose columns */

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
}

.column h3 { font-size: var(--step-1); margin-bottom: 0.6rem; }

/* Privacy call-out */

.privacy {
  border-left: 2px solid var(--amber);
  padding-left: clamp(1.25rem, 3vw, 2rem);
  max-width: var(--measure);
}
.privacy h2 { font-size: var(--step-3); margin-bottom: 1rem; }
.privacy p + p { margin-top: 1rem; }

/* Price */

.price-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  align-items: center;
}

.price-figure {
  font-size: var(--step-4);
  font-weight: 900;
  color: var(--bright);
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.price-terms { margin-top: 0.6rem; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.checklist li { padding-left: 1.4rem; position: relative; }
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.6rem;
  height: 1px;
  background: var(--amber);
}

/*
 * Document pages
 *
 * Terms, refunds, privacy, and the download page. These are read rather than
 * scanned, so they run at a single measure with generous leading, and they use
 * the same tokens as everything else.
 */

.page-head { padding-block: clamp(2rem, 6vw, 3.5rem) 1.5rem; }
.page-head h1 { font-size: var(--step-3); margin-block: 0.6rem 0.9rem; }
.page-head p { font-size: var(--step-1); max-width: var(--measure); }

.prose { padding-bottom: clamp(3rem, 8vw, 5rem); max-width: var(--measure); }
.prose h2 { font-size: var(--step-1); margin-block: 2.5rem 0.75rem; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }
.prose strong { color: var(--bright); font-weight: 600; }

.updated {
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  opacity: 0.7;
}

/* Requirements block on the download page */

.requirements {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.requirements dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem 1.5rem;
}

.requirements dt {
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-dim);
  padding-top: 0.25rem;
}

.requirements dd { margin: 0; color: var(--bright); }

/* Notice, for anything the reader needs before they click */

.notice {
  border: 1px solid var(--amber-dim);
  border-radius: 8px;
  background: rgba(240, 166, 60, 0.06);
  padding: 1.1rem 1.25rem;
  margin-bottom: 2rem;
}
.notice p + p { margin-top: 0.75rem; }

/* Steps, where order genuinely matters */

.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1.25rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--amber-dim);
  color: var(--amber);
  font-family: "Chivo Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
}

/* Footer */

footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem 3.5rem;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: baseline;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a { color: var(--grey); text-decoration: none; }
.footer-links a:hover { color: var(--bright); text-decoration: underline; }

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