/* ==========================================================================
   isThisToxic — foundation: tokens, reset, typography, layout, nav, footer
   ========================================================================== */

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-variable.fdf9c509a809.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-variable.b058178d7f30.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Ground & surfaces */
  --ground: #eae1d6;
  --ground-raised: #f2eae0;
  --surface: #fffcf7;
  --surface-sunken: #fbf5ec;

  /* Ink */
  --ink: #1e1b18;
  --ink-soft: #6b5750;
  --ink-faint: #9c8981;

  /* Accents */
  --pink: #f9439b;
  /* Second chart series beside --pink (survival log productivity). Checked with the
     dataviz palette validator on --surface: colour-blind ΔE 13. Not a status colour. */
  --chart-blue: #3b5bdb;
  --pink-soft: #fcd9e8;
  --red: #c8322b;
  --yellow: #f5c542;
  --yellow-soft: #fae8b0;
  --mint: #a8dcc8;
  --mint-soft: #d6efe4;
  /* Good and bad, as status. Blue against vermillion (Okabe–Ito), never green against red,
     so the pair stays apart with colour-blindness. On dark cards, use the -on-dark pair. */
  --good: #0072b2;
  --good-soft: #d4e8f5;
  --good-on-dark: #56b4e9;
  --bad: #d55e00;
  --bad-soft: #fbe2d0;
  --bad-on-dark: #f2a27a;
  --peach: #f8d5c2;
  --beige: #e5dacb;

  /* Dark sections */
  --dark: #2e1e1b;
  --dark-raised: #3b2a25;
  --dark-ink: #f2eae0;
  --dark-ink-soft: #bda9a1;

  /* Type */
  --font-display: "Outfit", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

  --step-eyebrow: 0.75rem;
  --step-sm: 0.8125rem;
  --step-base: 0.9375rem;
  --step-lg: 1.125rem;
  --step-h3: clamp(1.1rem, 0.9rem + 0.8vw, 1.4rem);
  --step-h2: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --step-h1: clamp(2.25rem, 1.2rem + 4.6vw, 4.25rem);

  /* Shape */
  --bw: 2px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* Space */
  --gap: 1rem;
  --gap-lg: 2rem;
  --section-y: clamp(3rem, 6vw, 5.5rem);
  --shell: 1180px;
}

/* --------------------------------------------------------------- reset -- */

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

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

/* The hidden attribute always wins, even over a component's display (.btn is inline-flex). */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--step-base);
  line-height: 1.6;
  font-synthesis-weight: none;
}

img,
svg {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

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

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

/* ---------------------------------------------------------- typography -- */

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

h1 {
  font-size: var(--step-h1);
}
h2 {
  font-size: var(--step-h2);
}
h3 {
  font-size: var(--step-h3);
  line-height: 1.15;
}

p {
  margin: 0;
  text-wrap: pretty;
}

/* Pink marker behind the closing phrase of a heading. */
.mark {
  background: var(--pink);
  color: var(--ink);
  padding: 0.02em 0.16em 0.08em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* The marker's background is as tall as the line box, so a heading that follows
   an eyebrow needs room or the highlight bleeds up over it. */
.eyebrow + h1,
.eyebrow + h2 {
  margin-top: 0.75rem;
}

/* Mono uppercase label, pink, dot-separated. */
.eyebrow {
  font-size: var(--step-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--pink);
  font-weight: 600;
  margin: 0;
}

.lede {
  font-size: var(--step-base);
  color: var(--ink);
  max-width: min(46ch, 100%);
}

.muted {
  color: var(--ink-soft);
}

.fineprint {
  font-size: var(--step-sm);
  color: var(--ink-soft);
}

/* -------------------------------------------------------------- layout -- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.section {
  padding-block: var(--section-y);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
}

/* Jumping to an anchor must not park it underneath the pinned header. */
:target {
  scroll-margin-top: 6rem;
}

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

/* ----------------------------------------------------------------- nav -- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  /* Needs its own ground or the page scrolls through it. */
  background: var(--ground);
  padding-block: 1.25rem;
}

/* Only a phone held sideways is short enough that a pinned bar costs more room
   than it earns. A small laptop window is not, so keep the threshold below it. */
@media (max-height: 28rem) {
  .nav {
    position: static;
  }
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
}

.nav__brand svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin-inline-end: auto;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.75rem);
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__link {
  text-decoration: none;
  font-size: var(--step-sm);
  font-weight: 500;
  padding-block: 0.2rem;
}

.nav__link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Hidden until the script says it can do something, so the links stay reachable
   when JavaScript never arrives. */
.nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.3rem;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.nav__bars,
.nav__bars::before,
.nav__bars::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
}

.nav__bars {
  position: relative;
}

.nav__bars::before,
.nav__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav__bars::before {
  top: -6px;
}

.nav__bars::after {
  top: 6px;
}

@media (max-width: 44rem) {
  .nav--collapsible .nav__toggle {
    display: flex;
  }

  .nav--collapsible .nav__links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding-top: 0.9rem;
  }

  .nav--collapsible .nav__links[data-open="true"] {
    display: flex;
  }

  .nav--collapsible .nav__link {
    padding-block: 0.5rem;
  }
}

.nav__link[aria-current="page"] {
  color: var(--pink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

/* -------------------------------------------------------------- footer -- */

.footer {
  border-top: var(--bw) solid var(--ink);
  padding-block: 2.5rem;
  margin-top: var(--section-y);
}

.footer__inner {
  display: flex;
  gap: var(--gap-lg);
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
}

.footer__links {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--step-sm);
}

/* ------------------------------------------------- front door and play -- */

/* The two thin bars that replace the nav: a brand and a way back (front door),
   or one link and nothing else (play). */
.doorbar,
.playbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
  padding-block: 1.25rem;
}

.playbar {
  justify-content: flex-end;
  font-size: var(--step-sm);
}
