/* Cloakroom site. One reading page: system type, two themes, no motion beyond a scroll-linked fade. */

:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --code-bg: #f3f4f6;
  --text: #1d1d1f;
  --text-2: #57575d;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #1a7f37;
  --on-accent: #ffffff;
  --ph-bg: rgba(26, 127, 55, 0.12);
  --ph-text: #116329;
  --real-bg: rgba(191, 135, 0, 0.16);
  --bar-bg: rgba(251, 251, 253, 0.72);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);

  --gutter: 1rem;
  --page: 68rem;
  --measure: 40rem;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10;
    --surface: #14171c;
    --code-bg: #14171c;
    --text: #f5f5f7;
    --text-2: #a1a1aa;
    --line: rgba(255, 255, 255, 0.09);
    --accent: #56d364;
    --on-accent: #0b0d10;
    --ph-bg: rgba(86, 211, 100, 0.16);
    --ph-text: #7ee787;
    --real-bg: rgba(242, 204, 96, 0.18);
    --bar-bg: rgba(11, 13, 16, 0.7);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

@media (min-width: 48rem) {
  :root { --gutter: 2rem; }
}

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

html {
  font: 100%/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  transition: background-color 300ms ease, color 300ms ease; /* ease light/dark switches */
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 0.06em; }
a:hover { text-decoration-thickness: 0.12em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 0.25rem; }

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

.skip {
  position: absolute; left: var(--gutter); top: -3rem; z-index: 20;
  padding: 0.5rem 0.75rem; background: var(--surface); border-radius: 0.5rem;
}
.skip:focus { top: 0.75rem; }

/* Top bar: translucent material, content scrolls underneath, fade at the scroll edge instead of a border. */

.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}
.bar::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 100%;
  height: 1rem;
  background: linear-gradient(var(--bar-bg), transparent);
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .bar::after { opacity: 0; animation: edge linear both; animation-timeline: scroll(); animation-range: 0 4rem; }
  @keyframes edge { to { opacity: 1; } }
}

.bar-inner {
  max-width: var(--page); margin: 0 auto;
  padding: 0 var(--gutter);
  height: 3.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--text); text-decoration: none;
  font-weight: 600; letter-spacing: -0.01em;
}
.brand svg { color: var(--accent); }
.bar nav { display: flex; gap: 1.25rem; }
.bar nav a {
  color: var(--text); text-decoration: none;
  font-size: 0.875rem; font-weight: 500; letter-spacing: 0.005em;
}
.bar nav a:hover { color: var(--accent); }

/* Layout */

main > section, .foot { max-width: var(--page); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.875rem; font-weight: 600; letter-spacing: 0.01em;
}

/* Hero */

.hero { padding-top: 4rem; padding-bottom: 3rem; }
.display {
  margin: 0;
  max-width: 22em;
  font-size: clamp(1.875rem, 1.2rem + 2.6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}
.lede {
  margin: 1.25rem 0 0;
  max-width: 34em;
  color: var(--text-2);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: 0.9375rem; text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.button:hover { border-color: var(--text-2); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { filter: brightness(1.06); }

/* Before / after */

.section-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.compare { padding-top: 2rem; padding-bottom: 3rem; }
.panes { display: grid; gap: 1rem; }
@media (min-width: 48rem) { .panes { grid-template-columns: 1fr 1fr; } }
.pane {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pane figcaption {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.01em;
}
.pane pre { margin: 0; padding: 1.25rem; background: none; border: 0; font-size: 0.8125rem; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
mark { color: inherit; border-radius: 0.25rem; padding: 0.05em 0.2em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
mark.real { background: var(--real-bg); }
mark.ph { background: var(--ph-bg); color: var(--ph-text); font-weight: 600; }
.note { margin: 1.25rem 0 0; max-width: var(--measure); color: var(--text-2); }

/* Feature cards */

.features { display: grid; gap: 1rem; padding-top: 1rem; padding-bottom: 3rem; }
@media (min-width: 48rem) { .features { grid-template-columns: 1fr 1fr; } .card.wide { grid-column: 1 / -1; } }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.1875rem; line-height: 1.25; letter-spacing: -0.012em; font-weight: 650; }
.card p { margin: 0; color: var(--text-2); }
.card.wide { display: grid; gap: 1.5rem; align-items: center; }
@media (min-width: 64rem) { .card.wide { grid-template-columns: 1fr 2fr; } }
.card.wide img { border-radius: 0.625rem; border: 1px solid var(--line); }

/* Install */

.install { padding-top: 2rem; padding-bottom: 4rem; }
.install p { max-width: var(--measure); }
.small { font-size: 0.875rem; }

pre {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre code { font-size: inherit; }
.cmd { max-width: var(--measure); }
.c { color: var(--text-2); }

/* Write-up */

.writeup {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 3rem var(--gutter) 4rem;
  border-top: 1px solid var(--line);
  font-size: 1.0625rem;
}
.article-title {
  margin: 0 0 2rem;
  font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.022em;
  font-weight: 700;
  text-wrap: balance;
}
.writeup h3 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.375rem; line-height: 1.25; letter-spacing: -0.015em; font-weight: 650;
}
.writeup p, .writeup ul { margin: 0 0 1rem; }
.writeup ul { padding-left: 1.25rem; }
.writeup li { margin-bottom: 0.375rem; }
.writeup pre { font-size: 0.875rem; }
.writeup :not(pre) > code {
  padding: 0.1em 0.3em; border-radius: 0.3rem; background: var(--code-bg);
}

/* Footer */

.foot {
  padding-top: 2rem; padding-bottom: 3rem;
  background: linear-gradient(var(--line), var(--line)) var(--gutter) 0 / calc(100% - 2 * var(--gutter)) 1px no-repeat;
  color: var(--text-2); font-size: 0.875rem;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.foot a { color: var(--text-2); }
.foot a:hover { color: var(--text); }
.foot p { margin: 1rem 0 0; }

/* Accessibility preferences */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar::after { animation: none; opacity: 1; }
  .button { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .bar::after { background: linear-gradient(var(--bg), transparent); }
}

@media (prefers-contrast: more) {
  :root { --line: currentColor; --text-2: var(--text); --shadow: none; }
  .bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 1px solid var(--text); }
  .bar::after { display: none; }
  mark.ph { text-decoration: underline; }
}

@media (forced-colors: active) {
  .bar::after { display: none; }
}
