/* ==========================================================================
   Mela Letterhead — one-page site
   Palette taken from the tool's own scaffold: accent #4a3f8a, band #f5f5f7,
   rule #e6e3ec. Light mode is paper; dark mode is ink.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light;

  --accent: #4a3f8a;
  --accent-soft: #6a5fc0;
  --accent-ink: #ffffff;
  --accent-wash: #efedf8;
  --teal: #16706a;
  --amber: #b4761f;
  --danger: #b4302f;

  --paper: #fbfbfd;
  --paper-2: #f4f4f8;
  --band: #f5f5f7;
  --rule: #e6e3ec;
  --ink: #16151c;
  --ink-2: #3b3945;
  --muted: #6f6b7a;
  --card: #ffffff;
  --code-bg: #f7f6fb;
  --code-ink: #2c2a36;
  --shadow-1: 0 1px 2px rgba(22, 21, 28, .05), 0 4px 14px rgba(22, 21, 28, .05);
  --shadow-2: 0 2px 6px rgba(22, 21, 28, .06), 0 18px 48px rgba(22, 21, 28, .10);
  --shadow-3: 0 30px 90px rgba(28, 24, 60, .22);

  --wrap: 1180px;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --radius: 16px;
  --radius-sm: 10px;

  --serif: "Fraunces", "Libertinus Serif", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace;

  --step--1: clamp(.82rem, .79rem + .14vw, .9rem);
  --step-0: clamp(1rem, .96rem + .2vw, 1.075rem);
  --step-1: clamp(1.15rem, 1.08rem + .35vw, 1.35rem);
  --step-2: clamp(1.45rem, 1.3rem + .7vw, 1.9rem);
  --step-3: clamp(1.85rem, 1.55rem + 1.4vw, 2.85rem);
  --step-4: clamp(2.3rem, 1.7rem + 2.9vw, 4.4rem);
}

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

  --accent: #9c8ef5;
  --accent-soft: #b6abff;
  --accent-ink: #14121f;
  --accent-wash: #211e33;
  --teal: #4fc7bb;
  --amber: #e0a94f;
  --danger: #ff8b83;

  --paper: #101018;
  --paper-2: #15151f;
  --band: #191926;
  --rule: #2a2a3a;
  --ink: #f2f1f7;
  --ink-2: #cfccdd;
  --muted: #9a97ac;
  --card: #171724;
  --code-bg: #12121c;
  --code-ink: #dedbea;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .28);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .45), 0 24px 60px rgba(0, 0, 0, .45);
  --shadow-3: 0 30px 100px rgba(0, 0, 0, .65);
}

/* ------------------------------------------------------------------ base */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* clip, not hidden: hidden would make the body a scroll container and
     break the sticky nav. This is a guard for the decorative bleed, not a
     licence for layout to overflow. */
  overflow-x: clip;
}

img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.015em;
  margin: 0 0 .5em;
  color: var(--ink);
}
h1 { font-size: var(--step-4); font-weight: 500; letter-spacing: -.03em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: -.01em; }
h1 em, h2 em { font-style: italic; color: var(--accent); font-weight: 400; }

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-color: color-mix(in oklab, var(--accent) 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

code, pre, .mono { font-family: var(--mono); font-size: .88em; font-variant-ligatures: none; }
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .08em .36em;
  color: var(--code-ink);
  /* Long tokens — ![caption](plate.svg) — must be allowed to break, or they
     push the paragraph past the edge of a phone. */
  overflow-wrap: anywhere;
}

/* A grid or flex child is min-width:auto by default, which lets a wide <pre>
   push the whole page sideways on a phone. Every container that holds code
   gets a floor of nought so the <pre> scrolls inside itself instead. */
.hero__inner > *, .panel > *, .lang > *, .install > *, .how__grid > *,
.stack, .stack__md, .win, .card, .term, .copyline, .copyline code, pre {
  min-width: 0;
  max-width: 100%;
}

pre {
  margin: 0;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 1.1rem 1.2rem;
  line-height: 1.6;
  tab-size: 2;
}
/* Wrapping, not scrolling. A <pre> that scrolls inside itself hides the end
   of a command behind an edge no thumb can find, and these blocks sit in
   cards that are narrow long before the viewport is: two columns at 900px is
   already too little for a clone URL. `pre-wrap` keeps the YAML indentation
   and `anywhere` lets a URL or a path break mid-token. Where a line fits —
   every one of them on a desktop — the rule does nothing. The overflow on
   `pre` above stays as the net for a token that cannot break at all. */
pre code { white-space: pre-wrap; overflow-wrap: anywhere; }

/* code tinting */
pre .k { color: var(--accent); }
pre .s { color: var(--teal); }
pre .c { color: var(--muted); font-style: italic; }
pre .b { color: var(--amber); }
pre .h { color: var(--ink); font-weight: 600; }
pre .err { color: var(--danger); font-weight: 600; }
pre .ok { color: var(--teal); font-weight: 600; }
pre .sec { color: var(--ink); font-weight: 600; }
pre .prompt { color: var(--accent); user-select: none; }

.wrap {
  width: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
}
.wrap--narrow { width: min(100% - 2rem, 820px); }

.sr, .skip {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip:focus {
  position: fixed; top: .75rem; left: .75rem;
  width: auto; height: auto; clip: auto; margin: 0;
  padding: .6rem 1rem; z-index: 200;
  background: var(--accent); color: var(--accent-ink); border-radius: 8px;
}

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

/* ---------------------------------------------------------------- shared */

.eyebrow, .kicker {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}
.kicker { color: var(--accent); }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--teal) 18%, transparent);
}

.btn {
  --btn-bg: transparent;
  --btn-ink: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .72rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 550;
  font-size: var(--step--1);
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(0); }
.btn--primary {
  --btn-bg: var(--accent);
  --btn-ink: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 6px 20px color-mix(in oklab, var(--accent) 30%, transparent);
}
.btn--primary:hover { box-shadow: 0 10px 30px color-mix(in oklab, var(--accent) 38%, transparent); }
.btn--ghost { background: var(--card); }
.btn--lg { padding: .9rem 1.6rem; font-size: var(--step-0); }
.i-gh { width: 1.05em; height: 1.05em; fill: currentColor; }

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease;
}
.iconbtn:hover { border-color: var(--accent); transform: translateY(-1px); }
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
:root[data-theme="light"] .i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }

.note {
  font-size: var(--step--1);
  color: var(--muted);
  line-height: 1.6;
}

/* reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.2, .7, .3, 1), transform .7s cubic-bezier(.2, .7, .3, 1);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

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

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklab, var(--paper) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.nav.is-stuck { border-bottom-color: var(--rule); }
.nav__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--ink);
  font-size: var(--step--1);
  letter-spacing: .01em;
  margin-right: auto;
}
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__mark rect { fill: var(--accent); }
.brand__mark path { stroke: var(--accent-ink); }
.brand__text strong { font-weight: 700; }

.nav__links {
  display: flex;
  gap: 1.4rem;
  font-size: var(--step--1);
}
.nav__links a {
  color: var(--muted);
  text-decoration: none;
  padding: .3rem 0;
  position: relative;
  transition: color .2s ease;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active::after { transform: scaleX(1); }

.nav__actions { display: flex; align-items: center; gap: .6rem; }
/* `justify-content` is the one .iconbtn does not already give us: its
   `place-items: center` sets align-items and justify-items, and a column
   flexbox ignores the latter, so without this the bars stack at the top. */
.nav__burger { display: none; flex-direction: column; justify-content: center; gap: 4px; }
.nav__burger span { width: 16px; height: 1.8px; background: currentColor; border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.8px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.8px) rotate(-45deg); }

.nav__mobile {
  display: grid;
  padding: .5rem 1rem 1.2rem;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.nav__mobile a {
  padding: .7rem .2rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  font-size: var(--step-0);
}
.nav__mobile a:last-child { border-bottom: 0; }

.nav__progress {
  position: absolute;
  left: 0; bottom: -1px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--teal));
}

@media (max-width: 940px) {
  .nav__links, .nav__gh { display: none; }
  .nav__burger { display: inline-flex; }
}
@media (min-width: 941px) {
  .nav__mobile { display: none !important; }
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  padding: clamp(3rem, 7vw, 6.5rem) 0 clamp(2.5rem, 5vw, 4.5rem);
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 120%;
  background:
    radial-gradient(48rem 28rem at 78% 8%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 62%),
    radial-gradient(38rem 26rem at 8% 36%, color-mix(in oklab, var(--teal) 12%, transparent), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: .28;
  mask-image: radial-gradient(70% 60% at 50% 20%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 20%, #000 0%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}
.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero__copy { max-width: 36rem; }
.hero h1 { margin-bottom: .6rem; }
.lede {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 34rem;
}
.lede--muted { font-size: var(--step-0); color: var(--muted); }
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.6rem 0 1.25rem; }

.copyline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem .55rem .55rem 1rem;
  border: 1px dashed var(--rule);
  border-radius: 12px;
  background: var(--card);
  max-width: 31rem;
}
.copyline code { font-size: .85rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copybtn {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--muted);
  font: 500 .72rem/1 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .45rem .7rem;
  border-radius: 8px;
  cursor: pointer;
  flex: none;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.copybtn:hover { color: var(--accent); border-color: var(--accent); }
.copybtn.is-done { color: var(--teal); border-color: var(--teal); }

.hero__facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  padding: 0;
  margin: 2rem 0 0;
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
}
.hero__facts li { display: grid; gap: .1rem; }
.hero__facts strong { font-family: var(--serif); font-size: var(--step-1); font-weight: 600; }
.hero__facts span { font-size: var(--step--1); color: var(--muted); }

/* hero art: the markdown window and the printed page */
.stack {
  position: relative;
  margin: 0;
  display: grid;
  justify-items: end;
}
.stack__pdf {
  width: min(100%, 460px);
  border-radius: 6px;
  box-shadow: var(--shadow-3);
  border: 1px solid var(--rule);
  transform: rotate(1.2deg);
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.stack:hover .stack__pdf { transform: rotate(0deg) translateY(-4px); }
.stack__md {
  position: absolute;
  left: -2%;
  bottom: 10%;
  z-index: 2;
  width: min(74%, 330px);
  transform: rotate(-2deg);
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.stack:hover .stack__md { transform: rotate(-1deg) translateY(-6px); }
.win {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--card);
  box-shadow: var(--shadow-2);
}
.win__bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .8rem;
  background: var(--band);
  border-bottom: 1px solid var(--rule);
}
.win__bar span { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); }
.win__bar span:first-child { background: color-mix(in oklab, var(--danger) 60%, var(--rule)); }
.win__bar em {
  margin-left: auto;
  font: 500 .7rem var(--mono);
  font-style: normal;
  color: var(--muted);
}
.win__code { font-size: .64rem; padding: .85rem 1rem 1.1rem; background: var(--card); }
.stack__arrow {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .7rem 0 0 .3rem;
}
.stack__arrow .cmd {
  font: 500 .68rem var(--mono);
  background: var(--accent);
  color: var(--accent-ink);
  padding: .3rem .55rem;
  border-radius: 6px;
  white-space: nowrap;
}
.stack__arrow svg { width: 40px; height: 12px; stroke: var(--accent); fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.stack figcaption {
  margin-top: 1.1rem;
  font-size: var(--step--1);
  color: var(--muted);
  text-align: right;
  max-width: 24rem;
}

@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__copy { max-width: none; }
  .stack { justify-items: center; margin-top: 1rem; }
  .stack__pdf { width: min(100%, 420px); }
  .stack__md { position: static; width: min(100%, 360px); transform: none; margin-bottom: 1.25rem; }
  .stack figcaption { text-align: center; }
}

/* --------------------------------------------------------------- marquee */

.marquee {
  border-block: 1px solid var(--rule);
  background: var(--band);
  overflow: hidden;
  padding: .7rem 0;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  gap: 1.4rem;
  width: max-content;
  animation: slide 46s linear infinite;
  font-family: var(--serif);
  font-size: var(--step-0);
  color: var(--muted);
  white-space: nowrap;
}
.marquee__track i { color: var(--accent); font-style: normal; }
@keyframes slide { to { transform: translateX(-50%); } }

/* -------------------------------------------------------------- sections */

.section { padding: clamp(3.5rem, 8vw, 7rem) 0; }
.section--alt {
  background: var(--paper-2);
  border-block: 1px solid var(--rule);
}
.sechead { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.sechead__sub { font-size: var(--step-1); color: var(--muted); line-height: 1.55; margin: 0; }

/* ------------------------------------------------------------------- why */

.pains {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(255px, 100%), 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.pain {
  background: var(--card);
  padding: clamp(1.4rem, 2.4vw, 2rem);
  transition: background .25s ease;
}
.pain:hover { background: color-mix(in oklab, var(--accent-wash) 60%, var(--card)); }
.pain__no {
  font: 600 .75rem/1 var(--mono);
  color: var(--accent);
  letter-spacing: .1em;
}
.pain h3 { margin: .8rem 0 .5rem; font-size: var(--step-1); }
.pain p { margin: 0; color: var(--muted); font-size: var(--step--1); line-height: 1.7; }

.pullquote {
  margin: clamp(2rem, 4vw, 3.5rem) 0 0;
  padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.5rem, 4vw, 3.5rem);
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.pullquote p {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--step-2);
  font-weight: 300;
  font-style: italic;
  line-height: 1.35;
  color: var(--ink);
  max-width: 44rem;
}

/* ------------------------------------------------------------------- how */

.pipeline {
  list-style: none;
  padding: 0;
  margin: 0 0 clamp(2rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 1.1rem;
  counter-reset: step;
}
.step {
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-1);
}
.step::after {
  content: "→";
  position: absolute;
  right: -1.05rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1rem;
  z-index: 2;
}
.step:last-child::after { content: none; }
.step__n {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 .78rem/1 var(--sans);
  margin-bottom: .75rem;
}
.step h3 { font-size: var(--step-0); font-family: var(--sans); font-weight: 650; margin-bottom: .35rem; }
.step p { font-size: var(--step--1); color: var(--muted); margin: 0 0 .8rem; line-height: 1.6; }
.step code { font-size: .72rem; }

/* The connectors only mean anything while the four steps stand in one row. */
@media (max-width: 1000px) {
  .step::after { content: none; }
}

.how__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 1.25rem;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card--code pre { background: transparent; font-size: .8rem; }
.card__label {
  padding: .7rem 1.2rem;
  border-bottom: 1px solid var(--rule);
  background: var(--band);
  font: 500 .72rem/1.4 var(--mono);
  color: var(--muted);
  letter-spacing: .02em;
}
.card--note { padding: clamp(1.4rem, 2.4vw, 2rem); }
.card--note h3 { margin-top: 0; }
.card--note p { font-size: var(--step--1); color: var(--ink-2); }
.term {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.term pre { font-size: .8rem; }
.term--copy pre { padding-right: 4.5rem; }
.copybtn--float { position: absolute; top: .55rem; right: .55rem; z-index: 2; background: var(--card); }

/* ----------------------------------------------------------------- tabs */

.tabs {
  display: grid;
  gap: 1.25rem;
}
.tabs__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: .75rem;
}
.tab {
  display: grid;
  gap: .2rem;
  text-align: left;
  padding: 1.05rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
  transition: border-color .22s ease, transform .22s ease, box-shadow .22s ease, background .22s ease;
}
.tab:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.tab[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.tab__n {
  font: 600 .72rem/1 var(--mono);
  color: var(--accent);
  letter-spacing: .12em;
}
.tab__t { font-family: var(--serif); font-size: var(--step-1); font-weight: 600; letter-spacing: -.01em; }
.tab__d { font-size: var(--step--1); color: var(--muted); }

.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .85fr);
  gap: clamp(1.5rem, 3.5vw, 3rem);
  align-items: center;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: var(--shadow-1);
  animation: fade .45s cubic-bezier(.2, .7, .3, 1);
}
@keyframes fade { from { opacity: 0; transform: translateY(10px); } }
.panel__copy p { color: var(--ink-2); }
.panel__copy pre {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin: 1.2rem 0;
  font-size: .8rem;
}
.panel__shot img {
  border-radius: 6px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-2);
  cursor: zoom-in;
  /* An A4 page is tall; cap it so the panel does not become a column of
     white space beside three lines of text. */
  max-height: 520px;
  width: auto;
  margin-inline: auto;
}
.panel__shot { margin: 0; }

@media (max-width: 860px) {
  .panel { grid-template-columns: 1fr; }
  .panel__shot { order: -1; max-width: 420px; margin-inline: auto; }
}

/* -------------------------------------------------------------- features */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 1.1rem;
}
.feat {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 2.4vw, 1.9rem);
  position: relative;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.feat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s cubic-bezier(.2, .7, .3, 1);
}
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: color-mix(in oklab, var(--accent) 35%, var(--rule)); }
.feat:hover::before { transform: scaleX(1); }
.feat__i {
  width: 26px; height: 26px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: .9rem;
}
.feat h3 { font-size: var(--step-1); margin-bottom: .45rem; }
.feat p { margin: 0; color: var(--muted); font-size: var(--step--1); line-height: 1.7; }

/* gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 1.25rem;
  margin-top: clamp(2rem, 4vw, 3rem);
}
.gallery__item { margin: 0; }
.gallery__item img {
  border-radius: 6px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-1);
  cursor: zoom-in;
  transition: transform .3s cubic-bezier(.2, .7, .3, 1), box-shadow .3s ease;
}
.gallery__item img:hover { transform: translateY(-5px) scale(1.01); box-shadow: var(--shadow-2); }
.gallery__item figcaption {
  margin-top: .7rem;
  font-size: var(--step--1);
  color: var(--muted);
  text-align: center;
}
.gallery__hint { text-align: center; color: var(--muted); font-size: var(--step--1); margin-top: 1.25rem; }

/* ------------------------------------------------------------- languages */

.lang {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
}
.lang h2 { margin-bottom: .6rem; }
.lang__copy > p:not(.kicker) { color: var(--muted); font-size: var(--step-1); line-height: 1.55; }
.ticks { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: 1rem; }
.ticks li {
  position: relative;
  padding-left: 1.9rem;
  font-size: var(--step--1);
  color: var(--muted);
  line-height: 1.7;
}
.ticks strong { color: var(--ink); font-weight: 600; }
.ticks li::before {
  content: "";
  position: absolute;
  left: 0; top: .5em;
  width: 11px; height: 6px;
  border-left: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(-45deg);
}
.lang__code { display: grid; gap: 1rem; }
.lang__code pre { font-size: .78rem; }
.langchips { display: flex; flex-wrap: wrap; gap: .45rem; }
.langchips span {
  font: 500 .72rem/1 var(--mono);
  padding: .45rem .65rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  background: var(--card);
}

@media (max-width: 900px) { .lang { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- standards */

/* The filing section borrows the languages grid rather than defining another
   two-column layout — same proportions, same breakpoint. All it needs of its
   own is the air between it and the cards above it. */
.standards__split { margin-top: clamp(2rem, 4vw, 3rem); }
.standards__split .card--code + .note { margin-top: 1rem; }

/* A table inside a code card sits flush against the label, and the card's
   padding is the only thing missing. It goes on a wrapper rather than on the
   table: `.cmds` collapses its borders, and padding on a table that does is
   ignored outright. */
.cardtable { padding: .4rem 1.2rem 1rem; }
.cardtable .cmds th { width: 46%; font-family: var(--mono); font-size: .74rem; line-height: 1.5; }
.cardtable .cmds th .c { display: inline-block; margin-top: .2rem; font-size: .68rem; }

/* --------------------------------------------------------------- install */

.install {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .92fr);
  gap: clamp(1.5rem, 3.5vw, 3rem);
  align-items: start;
}
.install__h {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-family: var(--sans);
  font-size: var(--step-0);
  font-weight: 650;
  letter-spacing: 0;
  margin: 2rem 0 .85rem;
}
.install__col > .install__h:first-child { margin-top: 0; }
.install__h span {
  display: inline-grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .75rem;
}
.os { display: flex; gap: .4rem; margin-bottom: .7rem; flex-wrap: wrap; }
.os__btn {
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: .4rem .85rem;
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
}
.os__btn:hover { color: var(--ink); }
.os__btn.is-on { background: var(--accent); border-color: transparent; color: var(--accent-ink); }

.install__side { display: grid; gap: 1.25rem; }
.checkcard {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-2);
}
.checkcard__bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem .9rem;
  background: var(--band);
  border-bottom: 1px solid var(--rule);
}
.checkcard__bar span { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); }
.checkcard__bar em {
  margin-left: auto;
  font: 500 .72rem var(--mono);
  font-style: normal;
  color: var(--muted);
}
.checkcard__out { font-size: .74rem; line-height: 1.75; }

.cmds { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.cmds th, .cmds td { text-align: left; vertical-align: top; padding: .75rem .6rem; border-top: 1px solid var(--rule); }
.cmds th { width: 38%; font-weight: 500; }
.cmds td { color: var(--muted); }
.cmds tr:first-child th, .cmds tr:first-child td { border-top: 0; }

@media (max-width: 900px) { .install { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------- faq */

.faq { display: grid; gap: .6rem; }
.qa {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0 1.2rem;
  transition: border-color .2s ease;
}
.qa[open] { border-color: color-mix(in oklab, var(--accent) 40%, var(--rule)); }
.qa summary {
  cursor: pointer;
  padding: 1.05rem 2rem 1.05rem 0;
  font-weight: 550;
  list-style: none;
  position: relative;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: "";
  position: absolute;
  right: .25rem; top: 50%;
  width: 9px; height: 9px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .25s ease;
}
.qa[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.qa p { margin: 0 0 1.05rem; color: var(--muted); font-size: var(--step--1); line-height: 1.75; max-width: 62ch; }

/* The same disclosure outside the FAQ grid: one is folded into the install
   column, where the clone is the answer to a question most readers are not
   asking any more. It needs the margin the grid's `gap` was giving it, and a
   `pre` that sits inside the padding rather than against the border. */
.qa--inline { margin-top: .8rem; }
.qa--inline summary { font-size: var(--step--1); font-weight: 500; color: var(--muted); }
.qa--inline pre { margin: 0 0 .6rem; font-size: .8rem; }

/* ------------------------------------------------------------------- cta */

.cta {
  padding: clamp(3.5rem, 8vw, 7rem) 0;
  background:
    radial-gradient(40rem 22rem at 50% 0%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
    var(--paper-2);
  border-top: 1px solid var(--rule);
  text-align: center;
}
.cta__inner { max-width: 46rem; margin-inline: auto; }
.cta h2 { font-size: var(--step-3); }
.cta p { color: var(--muted); font-size: var(--step-1); max-width: 38rem; margin-inline: auto; }
.cta__row { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: 1.75rem; }

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

.foot {
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding: clamp(2.5rem, 5vw, 4rem) 0 1.5rem;
}
.foot__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 2rem;
  align-items: start;
}
.foot__brand { display: flex; gap: .8rem; align-items: center; }
.foot__brand .brand__mark { width: 38px; height: 38px; }
.foot__name { margin: 0; font-family: var(--serif); font-size: var(--step-1); }
.foot__by { margin: 0; font-size: var(--step--1); color: var(--muted); }
.foot__links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 1.5rem;
}
.foot__links h3 {
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .7rem;
}
.foot__links a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--step--1);
  padding: .22rem 0;
  transition: color .2s ease;
}
.foot__links a:hover { color: var(--accent); }
.foot__bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: space-between;
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.foot__bar p { margin: 0; font-size: .78rem; color: var(--muted); }

@media (max-width: 760px) { .foot__inner { grid-template-columns: 1fr; } }

/* -------------------------------------------------------------- lightbox */

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(92vw, 900px);
  max-height: 92vh;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(10, 9, 16, .82); backdrop-filter: blur(6px); }
.lightbox img { border-radius: 8px; box-shadow: var(--shadow-3); max-height: 92vh; width: auto; }
.lightbox__close {
  position: absolute;
  top: -14px; right: -14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 200%);
  background: var(--ink);
  color: var(--paper);
  padding: .65rem 1.1rem;
  border-radius: 999px;
  font-size: var(--step--1);
  z-index: 300;
  transition: transform .35s cubic-bezier(.2, .7, .3, 1);
  pointer-events: none;
}
.toast.is-on { transform: translate(-50%, 0); }

/* ================================================================= phones =
   A phone is not a narrow desktop. The code samples wrap everywhere (see
   `pre code` above); what is left for this breakpoint is the furniture that
   only works with room to spare.
   ========================================================================== */

@media (max-width: 760px) {
  /* The wrapped continuation of a command reads better a little tighter. */
  pre { padding: 1rem 1.05rem; line-height: 1.55; }
  .card--code pre, .term pre, .lang__code pre { font-size: .76rem; }

  /* The floating Copy button sat on the first line of every block. Give it a
     row of its own rather than a reserved column, which a wrapped line would
     have run under anyway. */
  .term--copy pre { padding-right: 1.05rem; padding-top: 2.9rem; }
  .copybtn--float { top: .5rem; right: .5rem; }

  /* The rotation costs about fifteen pixels a side, which is the whole
     gutter at this width. */
  .stack__pdf, .stack__md { transform: none; }
  .stack:hover .stack__pdf, .stack:hover .stack__md { transform: translateY(-3px); }

  /* One command per row reads; two half-commands do not. */
  .copyline { flex-wrap: wrap; row-gap: .6rem; padding: .7rem .7rem .7rem 1rem; }
  .copyline code { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .copyline .copybtn { margin-left: auto; }

  /* An A4 page shrunk into a third of a phone is a grey rectangle. One per
     row at least makes the headings legible, and the lightbox does the rest. */
  .gallery { grid-template-columns: 1fr; }
  .tabs__list { grid-template-columns: 1fr; }
}

/* The narrowest phones still in use — 320 CSS pixels. */
@media (max-width: 380px) {
  .wrap, .wrap--narrow { width: min(100% - 1.5rem, var(--wrap)); }
  .card--code pre, .term pre, .lang__code pre { font-size: .72rem; }
  .checkcard__out { font-size: .68rem; }
  .hero__facts { gap: 1.1rem; }
}

/* ------------------------------------------------------------- print-ish */

@media print {
  .nav, .cta, .marquee, .toast, .lightbox { display: none !important; }
  body { background: #fff; color: #000; }
}
