/* ===========================================================================
   Pillow Client — reset, typography, layout primitives
   =========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration: none; }
a:hover { color: var(--violet-soft); }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

ul, ol { list-style: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--violet-soft);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection { background: rgba(139, 124, 246, 0.32); color: var(--text); }

/* --- typography ---------------------------------------------------------- */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.1; letter-spacing: var(--tracking-tight); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.25; }

p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

.mono { font-family: var(--mono); font-feature-settings: 'ss01' 1; letter-spacing: -0.01em; }
.dim  { color: var(--text-3); }

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

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--violet); color: var(--violet-ink); font-weight: 500;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 12px; color: var(--violet-ink); }

/* --- layout -------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--narrow { max-width: var(--wrap-narrow); }

/* A narrow reading column that keeps the page's left edge instead of centring
   itself — otherwise it reads as misaligned against a left-aligned page head. */
.narrow { max-width: 900px; }

.section { padding-block: var(--section-y); position: relative; }
.section--tint {
  background:
    linear-gradient(180deg, transparent, var(--bg-1) 12%, var(--bg-1) 88%, transparent);
  border-block: 1px solid var(--line);
}
.section--flush { padding-block: 0; }

.section__head { max-width: 720px; margin-bottom: clamp(34px, 5vw, 58px); }
.section__kicker {
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--violet-soft);
  margin-bottom: 14px;
}
.section__title { font-size: var(--fs-h2); }
.section__title--sm { font-size: var(--fs-h3); margin-bottom: 22px; }
.section__lede {
  margin-top: 16px;
  font-size: var(--fs-lead);
  color: var(--text-2);
  line-height: 1.65;
}
.section__more { margin-top: clamp(26px, 4vw, 40px); }

.band {
  padding-block: clamp(34px, 5vw, 56px);
  border-block: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
}
.band--tight { padding-block: clamp(22px, 3vw, 34px); }

/* --- eyebrow ------------------------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-2);
  padding: 7px 14px 7px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  backdrop-filter: blur(8px);
}
.eyebrow--error { color: var(--bad); border-color: rgba(255, 140, 140, 0.3); }

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 3px var(--glow-soft);
  animation: pulse 3.2s var(--ease) infinite;
}
.dot--up   { background: var(--ok);   box-shadow: 0 0 0 3px var(--ok-dim); }
.dot--soon { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); animation: none; }
.dot--none { background: var(--text-3); box-shadow: none; animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* --- grain + reveal ------------------------------------------------------ */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.032;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
html.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; }
}

/* --- shared bits --------------------------------------------------------- */
.ticks { display: grid; gap: 10px; }
.ticks li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.55;
}
.ticks svg { margin-top: 3px; color: var(--violet-soft); }
.ticks--fix svg { color: var(--warn); }
.ticks strong, .ticks b { color: var(--text); font-weight: 500; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--violet-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: gap var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.link-arrow:hover { gap: 13px; border-color: var(--line-3); color: var(--violet-soft); }

/* --- buttons ------------------------------------------------------------- */
.btn {
  --btn-y: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: var(--btn-y) 20px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn svg { transition: transform var(--dur) var(--ease); }

.btn--primary {
  background: linear-gradient(180deg, var(--violet) 0%, var(--violet-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow-glow), 0 1px 0 rgba(255, 255, 255, 0.22) inset;
}
.btn--primary:hover {
  color: #fff;
  box-shadow: 0 26px 80px -26px var(--glow), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
  filter: brightness(1.06);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-3);
  color: var(--text);
}

.btn--lg { --btn-y: 13px; padding-inline: 24px; font-size: var(--fs-body); }
.btn--sm { --btn-y: 8px;  padding-inline: 14px; font-size: var(--fs-xs); }
.btn--xs { --btn-y: 6px;  padding-inline: 12px; font-size: var(--fs-micro); }

/* --- tags, chips --------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.tag--read  { color: var(--ok);   background: var(--ok-dim);   border-color: rgba(95, 227, 176, 0.22); }
.tag--local { color: var(--violet-soft); background: var(--glow-soft); border-color: rgba(139, 124, 246, 0.26); }
.tag--send  { color: var(--warn); background: var(--warn-dim); border-color: rgba(255, 196, 107, 0.22); }
.tag--warn  { color: var(--warn); background: var(--warn-dim); border-color: rgba(255, 196, 107, 0.22); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-family: var(--mono);
  font-size: var(--fs-micro);
  color: var(--text-2);
}
.chip--soon { color: var(--text-3); border-style: dashed; }
.chip--soon span { color: var(--warn); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.62rem; }

/* Tags used inside running prose must not grow the line box: inline-flex on a
   baseline sits its whole padded height above the text baseline. */
.page-head__lede .tag,
.section__lede .tag,
.card__body .tag,
.qa__a .tag,
.callout .tag {
  padding: 1px 6px;
  line-height: 1.25;
  vertical-align: 0.04em;
  font-size: 0.7rem;
}

/* --- callout ------------------------------------------------------------- */
.callout {
  margin-top: clamp(26px, 4vw, 40px);
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--violet);
  background: linear-gradient(180deg, var(--surface), transparent);
}
.callout--warn { border-left-color: var(--warn); }
.callout__title { font-size: var(--fs-body); font-weight: 500; margin-bottom: 8px; }
.callout p { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.65; max-width: 76ch; }
