/* Lax's site: the app's own palette and fonts (docs/BRAND.md), all served
   from here. A river runs under the header; the pixel salmon swims along it. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/BricolageGrotesque-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/AtkinsonHyperlegibleNext-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --djupvatten: #0f2a33;
  --stromfara: #2e6f73;
  --ryggbla: #4f7f93;
  --silversida: #c7d6dc;
  --alvsten: #eef2f1;
  --laxrosa: #e07a84;

  --bg: var(--alvsten);
  --surface: #ffffff;
  --fg: var(--djupvatten);
  --muted: #3e6474;
  --line: var(--silversida);
  --accent: var(--stromfara);
  --accent-fg: #ffffff;
  --code-bg: #0f2a33;
  --code-fg: #e7f0ee;

  --display: "Bricolage Grotesque", -apple-system, sans-serif;
  --body: "Atkinson Hyperlegible Next", -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* Dark: the system's choice unless the visitor picked light, or picked dark
   with the button (site/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--djupvatten);
    --surface: #163843;
    --fg: var(--alvsten);
    --muted: #9db4bb;
    --line: #2c4c56;
    --accent: #7cc4c4;
    --accent-fg: var(--djupvatten);
    --code-bg: #0a1f26;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--djupvatten);
  --surface: #163843;
  --fg: var(--alvsten);
  --muted: #9db4bb;
  --line: #2c4c56;
  --accent: #7cc4c4;
  --accent-fg: var(--djupvatten);
  --code-bg: #0a1f26;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--laxrosa);
  outline-offset: 2px;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.88em;
}

kbd {
  padding: 0.05em 0.35em;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.top,
main,
footer {
  max-width: 54rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 1.25rem;
}

.mark {
  font: 800 1.5rem/1 var(--display);
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
}

.top nav {
  display: flex;
  gap: 1.25rem;
  font-weight: 600;
}

.top nav a {
  color: var(--muted);
  text-decoration: none;
}

.top nav a:hover {
  color: var(--fg);
}

.top nav {
  align-items: center;
}

/* The light/dark switch: a sun in dark mode, a moon in light mode. */
.theme {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme:hover {
  color: var(--fg);
  background: color-mix(in srgb, var(--line) 40%, transparent);
}

.theme svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme .sun {
  display: none;
}

:root[data-theme="dark"] .theme .sun {
  display: block;
}

:root[data-theme="dark"] .theme .moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme .moon {
    display: none;
  }
}

/* The hero: the river, the salmon swimming in, and the thesis. */
.hero {
  padding: 2.5rem 0 3.5rem;
}

.river {
  position: relative;
  height: 70px;
  margin-bottom: 1.75rem;
}

.river svg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  width: 100%;
  height: 10px;
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* The salmon swims along the river: across, turning at each bank, bobbing
   with the waves and flicking its tail. The span travels and turns; the
   picture bobs. */
.swimmer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 114px;
  height: 66px;
  animation: along 26s ease-in-out infinite;
}

.swimmer img {
  display: block;
  width: 114px;
  height: 66px;
  image-rendering: pixelated;
  transform-origin: 70% 55%;
  animation:
    bob 1.6s ease-in-out infinite alternate,
    flick 0.45s ease-in-out infinite alternate;
}

@keyframes along {
  0% {
    left: -120px;
    transform: scaleX(1);
  }
  46% {
    left: calc(100% - 114px);
    transform: scaleX(1);
  }
  50% {
    left: calc(100% - 114px);
    transform: scaleX(-1);
  }
  96% {
    left: 0;
    transform: scaleX(-1);
  }
  100% {
    left: 0;
    transform: scaleX(1);
  }
}

@keyframes bob {
  from {
    translate: 0 -3px;
  }
  to {
    translate: 0 3px;
  }
}

@keyframes flick {
  from {
    rotate: -2.5deg;
  }
  to {
    rotate: 2.5deg;
  }
}

.eyebrow,
.label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2,
h3 {
  font-family: var(--display);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h1 {
  margin: 0.6rem 0 1rem;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 800;
}

h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 750;
}

h3 {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.lede {
  max-width: 36rem;
  margin: 0;
  font-size: 1.2rem;
  color: var(--muted);
}

.section-lede {
  max-width: 40rem;
  color: var(--muted);
}

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

.button {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  text-decoration: none;
}

.button.quiet {
  background: none;
  color: var(--fg);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

section + section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--line);
}

/* The flow is a real sequence: each step feeds the next. */
.flow ol {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0 0;
  padding: 0;
}

.flow li {
  counter-increment: step;
}

.flow li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  margin-bottom: 0.6rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font: 600 0.85rem var(--mono);
  color: var(--accent);
}

.flow p,
.way p {
  margin: 0;
  color: var(--muted);
}

/* The writing assistant, shown in a reply. */
.write {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.demo {
  margin: 0;
  padding: 1.25rem;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px rgb(15 42 51 / 0.12);
}

.field {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.95rem;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

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

/* The salmon just under the cursor, the card opening beside it. */
.demo-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin: -0.35rem 0 0 calc(50% - 30px);
}

.demo-salmon {
  flex: none;
  width: 38px;
  height: 22px;
  image-rendering: pixelated;
}

.demo-card {
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgb(15 42 51 / 0.2), inset 0 0 0 1px rgb(255 255 255 / 0.4);
  font-size: 0.8rem;
  line-height: 1.45;
}

.demo-card p {
  margin: 0;
}

.demo-card .hint,
.small {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.never ul {
  display: grid;
  gap: 0.6rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.never li {
  padding-left: 1.6rem;
  position: relative;
  font-weight: 600;
}

.never li::before {
  content: "×";
  position: absolute;
  left: 0;
  color: var(--laxrosa);
  font: 700 1.1rem/1.4 var(--mono);
}

/* Two ways to get it: now, and later. */
.ways {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.way {
  padding: 1.4rem;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.way h3 {
  margin-top: 0.3rem;
}

.way.later {
  opacity: 0.7;
}

.code {
  position: relative;
  margin: 1rem 0;
}

.code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-fg);
  line-height: 1.7;
}

.copy {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  padding: 0.3rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font: 600 0.8rem var(--body);
  cursor: pointer;
}

footer {
  padding-top: 2rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .write,
  .ways {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .swimmer {
    animation: none;
    left: min(55vw, 30rem);
  }

  .swimmer img {
    animation: none;
  }

  .caret {
    animation: none;
  }
}
