/*
 * nitz.fyi shared styles: tokens, type, masthead, buttons, footer.
 * The page is a comic book printed in process colors on newsprint:
 * ink key lines, flat fills, Ben-Day dots. The N! burst is the pin.
 */

:root {
  color-scheme: light;

  /* Process colors, sampled from the N! burst where they overlap. */
  --ink: #000;
  --paper: #faf3e3;
  --paper-deep: #f0e2c0;
  --white: #fff;
  --yellow: #ffd21a;
  --yellow-deep: #ffc400;
  --red: #d1221a;
  --oxblood: #7a0c06;
  --cyan: #12a5e3;
  --cyan-deep: #0a7fb4;
  --text-2: #3d3328;

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sfx: "Luckiest Guy", "Archivo", Impact, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Perfect-fourth scale around a 17px body. */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: clamp(1.45rem, 1.2rem + 1vw, 1.875rem);
  --step-3: clamp(2.25rem, 1.3rem + 3.8vw, 4.5rem);

  --line: 3px;
  --side: 16px;
  --gutter: 12px;
  --page: 1240px;
  --focus: var(--ink);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 720px) {
  :root {
    --side: 32px;
    --gutter: 18px;
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
pre {
  margin: 0;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--side);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--yellow);
  font-weight: 700;
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: min(var(--page), 100% - 2 * var(--side));
  margin-inline: auto;
}

/* Section headings: expanded black, the comic masthead voice. */
.title {
  font-size: var(--step-3);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--text-2);
  max-width: 58ch;
  text-wrap: pretty;
}

/* Comic narration box. Uppercase because comic captions are lettered that way. */
.caption {
  display: inline-block;
  padding: 0.35em 0.7em 0.3em;
  background: var(--yellow);
  border: 2px solid var(--ink);
  font-size: 0.8125rem;
  font-weight: 800;
  font-style: italic;
  font-stretch: 80%;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

kbd {
  display: inline-flex;
  align-items: center;
  min-height: 1.7em;
  padding: 0 0.45em;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  border-bottom-width: 4px;
  border-radius: 6px;
}

/* Buttons: pills, so they never read as panels. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 52px;
  padding: 0 1.5em;
  font-size: var(--step-0);
  font-weight: 800;
  font-stretch: 110%;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink);
  background: var(--white);
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 160ms var(--ease-pop),
    background-color 120ms ease,
    color 120ms ease;
  /* Each variant sets its own hover fill; disabled buttons never change. */
  --btn-hover-bg: var(--paper);
  --btn-hover-fg: currentColor;
}

.btn:not(:disabled):hover {
  color: var(--btn-hover-fg);
  background-color: var(--btn-hover-bg);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.btn--primary {
  --btn-hover-bg: var(--oxblood);
  color: var(--white);
  background: var(--red);
}

.btn--ghost {
  --btn-hover-bg: var(--white);
  background: transparent;
}

.btn--ink {
  --btn-hover-bg: var(--yellow);
  --btn-hover-fg: var(--ink);
  color: var(--yellow);
  background: var(--ink);
}

.btn--small {
  min-height: 40px;
  padding: 0 1.1em;
  font-size: 0.9375rem;
}

.btn__mark {
  width: 1.5em;
  height: auto;
  margin-left: -0.3em;
}

/* Masthead */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--masthead-bg, var(--paper));
  border-bottom: var(--line) solid transparent;
  transition:
    background-color 200ms ease,
    border-color 200ms ease;
}

.masthead[data-stuck] {
  --masthead-bg: var(--paper);
  border-bottom-color: var(--ink);
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  font-weight: 900;
  font-stretch: 125%;
  letter-spacing: -0.03em;
  line-height: 1;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: auto;
  margin: -4px 0 -4px -6px;
  transition: transform 220ms var(--ease-pop);
}

.brand:hover img {
  transform: rotate(-10deg) scale(1.12);
}

.masthead nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
  font-weight: 700;
  font-size: 0.9375rem;
}

.masthead nav a {
  text-decoration: none;
  padding: 6px 0;
  background: linear-gradient(var(--ink), var(--ink)) no-repeat left bottom / 0 3px;
  transition: background-size 180ms var(--ease-out);
}

.masthead nav a:hover {
  background-size: 100% 3px;
}

.masthead .btn {
  margin-left: 4px;
}

@media (max-width: 900px) {
  .masthead nav {
    display: none;
  }

  .masthead .btn {
    margin-left: auto;
  }
}

/* Footer: the back cover. */
.colophon {
  padding: 36px 0 44px;
  color: var(--paper);
  background: var(--ink);
  font-size: var(--step--1);
  --focus: var(--yellow);
}

.colophon__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
}

.colophon a {
  color: var(--paper);
  text-underline-offset: 3px;
}

.colophon a:hover {
  color: var(--yellow);
}

.colophon__links {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

/* Long-form pages (privacy, support). */
.doc {
  padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 8vw, 104px);
}

.doc__inner {
  width: min(720px, 100% - 2 * var(--side));
  margin-inline: auto;
}

.doc h1 {
  font-size: clamp(2.5rem, 1.6rem + 4vw, 4.5rem);
  font-weight: 900;
  font-stretch: 125%;
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.doc .updated {
  margin-top: 16px;
}

.doc h2 {
  margin: 48px 0 12px;
  font-size: var(--step-2);
  font-weight: 900;
  font-stretch: 112%;
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.doc h3 {
  margin: 32px 0 8px;
  font-size: var(--step-1);
  font-weight: 800;
  line-height: 1.2;
}

.doc p,
.doc li {
  color: var(--text-2);
  max-width: 68ch;
}

.doc p + p,
.doc ul + p,
.doc p + ul {
  margin-top: 14px;
}

.doc h1 + p,
.doc .updated + p {
  margin-top: 28px;
}

.doc ul {
  padding-left: 1.3em;
}

.doc li + li {
  margin-top: 8px;
}

.doc li::marker {
  color: var(--red);
}

.doc a {
  font-weight: 700;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.doc code {
  font-size: 0.88em;
  padding: 0.08em 0.35em;
  background: var(--paper-deep);
  border-radius: 4px;
}

.doc .lead {
  margin-top: 20px;
}

.doc .panel-note {
  margin-top: 32px;
  padding: 24px 26px;
  background: var(--yellow);
  border: var(--line) solid var(--ink);
}

.doc .panel-note__title {
  margin: 0;
  font-size: var(--step-1);
}

.doc .email {
  display: block;
  width: fit-content;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: clamp(1.05rem, 0.9rem + 1vw, 1.4rem);
  font-weight: 600;
  color: var(--ink);
  text-decoration-color: var(--red);
  overflow-wrap: anywhere;
}
