/* nibspark's website: the editor's start view, in its night colors
   (crates/nibspark/themes/nibspark.toml's [dark.palette]), set in
   Inconsolata like the app. */

@font-face {
  font-family: "Inconsolata";
  src: url("fonts/Inconsolata.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #16152a;
  --surface: #1f1e36;
  --raised: #28274a;
  --code: #121123;
  --border: #302e4d;
  --foreground: #e6e4f6;
  --muted: #9a97b8;
  --accent: #9a96f2;
  --accent-strong: #5f5ad6;
  --accent-deep: #6f6ae4;
  --shocking-pink: #ff5fa8;
  --blue: #7aa2f0;

  /* The start view's sizes: the phrases', the wordmark's over them, and
     the logo's side over the wordmark's (WORDMARK_SCALE, LOGO_SCALE). */
  --phrase: clamp(1rem, 0.6rem + 1.6vw, 1.45rem);
  --wordmark: calc(var(--phrase) * 2.6);
  --logo: calc(var(--wordmark) * 2.4);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* No background of its own: the page's is <html>'s, and one here would
     cover the dots behind it. */
  color: var(--foreground);
  font: 300 1rem/1.5 "Inconsolata", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
}

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

/* The start view's field of dots, gone well before the edges, as faint as
   the app's ([fx.surface.start]'s pattern_opacity). */
.dots {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle, var(--muted) 1px, transparent 1.6px);
  background-size: 22px 22px;
  opacity: 0.2;
  mask-image: radial-gradient(ellipse 60% 55% at 50% 30%, #000 0%, transparent 100%);
}

main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(48px, 12vh, 120px) 16px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The brand: the nib, and beside it the wordmark over the phrases. */
.brand {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  width: var(--logo);
  height: var(--logo);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* As wide as the widest phrase, so the brand doesn't move as they're
     typed. */
  width: calc(var(--phrase) * 16.5);
}

.wordmark {
  margin: 0;
  font-size: var(--wordmark);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.nib {
  color: var(--foreground);
}

.spark {
  color: var(--accent);
}

/* The spark's ticks off the "k", in the wordmark's ems: the box stands
   as high as the "k" over the baseline, and the ticks start a little back
   over the letter (start.rs's TICKS, TICKS_LEFT and ASCENDER). */
.ticks {
  position: relative;
  display: inline-block;
  width: 0.215em;
  height: 0.72em;
}

.ticks svg {
  position: absolute;
  left: -0.1em;
  top: 0;
  width: 0.4em;
  height: 0.4em;
  fill: none;
  stroke: var(--shocking-pink);
  stroke-width: 6.5;
  stroke-linecap: round;
}

/* The phrases, the accent, shocking pink and blue flowing across them. */
.phrase {
  margin: 0;
  min-height: 1.5em;
  font-size: var(--phrase);
  white-space: nowrap;
}

.typed {
  background: linear-gradient(90deg, var(--accent), var(--shocking-pink), var(--blue), var(--accent));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: flow 7s linear infinite;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--accent);
  animation: blink 1.1s step-end infinite;
}

@keyframes flow {
  to {
    background-position: 300% 0;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.lede {
  margin: 40px 0 0;
  max-width: 34em;
  text-align: center;
  font-size: 1.15rem;
  color: var(--muted);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--foreground);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.button:hover {
  background: var(--raised);
  border-color: var(--accent);
}

.button.primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

/* Downloads. */
.downloads {
  width: 100%;
  margin-top: 96px;
  scroll-margin-top: 32px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 16px;
}

h2,
h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.release {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.platforms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.platform {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
}

/* The visitor's own platform, picked out. */
.platform.yours {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent),
    0 12px 40px -16px color-mix(in srgb, var(--accent-strong) 70%, transparent);
}

.platform h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--foreground);
}

.platform p {
  margin: 0;
}

.needs {
  color: var(--muted);
  margin-bottom: 8px !important;
}

.file,
.alt {
  font-size: 0.85rem;
  color: var(--muted);
}

/* A file the release has, or doesn't have yet. */
[data-state="ready"] > .when-soon,
[data-state="soon"] > .when-ready,
.alt[data-state="soon"] {
  display: none;
}

.platform[data-state="soon"] .when-soon {
  color: var(--muted);
}

/* The cheat sheet, in two columns. */
.sheet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px 48px;
  width: 100%;
  max-width: 560px;
  margin-top: 96px;
}

.column h3 {
  margin-bottom: 10px;
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  align-items: baseline;
}

dd {
  margin: 0;
  color: var(--muted);
}

code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--code);
  font-family: inherit;
  font-weight: 400;
  font-size: 0.95em;
}

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

/* Narrow screens: the nib over the wordmark and the phrases. */
@media (max-width: 640px) {
  .brand {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .brand-text {
    align-items: center;
    width: auto;
  }

  .phrase {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typed,
  .caret {
    animation: none;
  }

  .caret {
    display: none;
  }
}

/* ⌘, which Inconsolata hasn't, in the system's font, at the text's size. */
.mod {
  font-family: -apple-system, system-ui, sans-serif;
}
