/* Escapement — site styles
   One stylesheet, no build step, no external requests. */

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

:root {
  --paper:        #faf8f4;
  --paper-deep:   #f3efe7;
  --surface:      #ffffff;
  --ink:          #17150f;
  --ink-soft:     #3d3830;
  --muted:        #6b6558;
  --line:         #e6e0d4;
  --line-soft:    #efeae0;

  /* Brass dark enough to carry body text: #855c12 clears 4.5:1 on all three
     light surfaces (5.6 on paper, 5.2 on the tint, 5.9 for white-on-brass).
     A lighter brass looks better but fails WCAG AA at body size. */
  --brass:        #855c12;
  --brass-strong: #6b4a0e;
  --brass-tint:   #f7f0df;
  --brass-line:   #e3d3ac;

  --ruby:         #b3122b;

  --shadow-sm: 0 1px 2px rgb(23 21 15 / 0.05), 0 2px 8px rgb(23 21 15 / 0.04);
  --shadow-md: 0 2px 6px rgb(23 21 15 / 0.06), 0 12px 32px rgb(23 21 15 / 0.09);
  --shadow-lg: 0 4px 12px rgb(23 21 15 / 0.08), 0 28px 64px rgb(23 21 15 / 0.16);

  --radius:    10px;
  --radius-lg: 16px;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo,
          Consolas, monospace;

  --measure: 68ch;
  --page:    1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #131211;
    --paper-deep:   #0e0d0c;
    --surface:      #1b1917;
    --ink:          #f4f0e8;
    --ink-soft:     #ded8cc;
    --muted:        #9d9587;
    --line:         #2e2a25;
    --line-soft:    #24211d;

    --brass:        #d7a542;
    --brass-strong: #eebe5f;
    --brass-tint:   #241e13;
    --brass-line:   #3d331f;

    --ruby:         #ef4a5e;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 2px 6px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 4px 12px rgb(0 0 0 / 0.5), 0 28px 64px rgb(0 0 0 / 0.6);
  }
}

/* The viewer's explicit choice wins over the system preference. */
:root[data-theme="light"] {
  --paper: #faf8f4; --paper-deep: #f3efe7; --surface: #ffffff;
  --ink: #17150f; --ink-soft: #3d3830; --muted: #6b6558;
  --line: #e6e0d4; --line-soft: #efeae0;
  --brass: #855c12; --brass-strong: #6b4a0e; --brass-tint: #f7f0df;
  --brass-line: #e3d3ac; --ruby: #b3122b;
  --shadow-sm: 0 1px 2px rgb(23 21 15 / 0.05), 0 2px 8px rgb(23 21 15 / 0.04);
  --shadow-md: 0 2px 6px rgb(23 21 15 / 0.06), 0 12px 32px rgb(23 21 15 / 0.09);
  --shadow-lg: 0 4px 12px rgb(23 21 15 / 0.08), 0 28px 64px rgb(23 21 15 / 0.16);
}

:root[data-theme="dark"] {
  --paper: #131211; --paper-deep: #0e0d0c; --surface: #1b1917;
  --ink: #f4f0e8; --ink-soft: #ded8cc; --muted: #9d9587;
  --line: #2e2a25; --line-soft: #24211d;
  --brass: #d7a542; --brass-strong: #eebe5f; --brass-tint: #241e13;
  --brass-line: #3d331f; --ruby: #ef4a5e;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 2px 6px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 4px 12px rgb(0 0 0 / 0.5), 0 28px 64px rgb(0 0 0 / 0.6);
}

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.18;
  letter-spacing: -0.021em;
  font-weight: 640;
  color: var(--ink);
}

h1 { font-size: clamp(2.15rem, 1.4rem + 3.1vw, 3.5rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.1vw, 1.95rem); }
h3 { font-size: 1.16rem; letter-spacing: -0.012em; }
h4 { font-size: 1rem; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brass); text-decoration-color: color-mix(in srgb, var(--brass) 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--brass-strong); text-decoration-color: currentColor; }

strong { font-weight: 640; color: var(--ink); }

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

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

code {
  font-size: 0.87em;
  background: var(--brass-tint);
  border: 1px solid var(--brass-line);
  border-radius: 5px;
  padding: 0.08em 0.36em;
  color: var(--ink-soft);
  overflow-wrap: break-word;
}

pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 0 0 1.35em;
  box-shadow: var(--shadow-sm);
}
pre code { background: none; border: 0; padding: 0; font-size: 1em; color: var(--ink-soft); }

kbd {
  font-size: 0.82em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1em 0.4em;
  color: var(--ink-soft);
  white-space: nowrap;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

::selection { background: color-mix(in srgb, var(--brass) 26%, transparent); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; }

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

.wrap {
  width: min(100% - 2.5rem, var(--page));
  margin-inline: auto;
}

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.9rem; margin-bottom: 0.7rem; }
.prose h2, .prose h3 { scroll-margin-top: 5.5rem; }
.prose h3 { margin-top: 2rem; margin-bottom: 0.5rem; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.35em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--brass); }

.prose blockquote {
  margin: 0 0 1.15em;
  padding-left: 1.15rem;
  border-left: 3px solid var(--brass-line);
  color: var(--muted);
}

.lede {
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--muted);
}

.section { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.section--tint { background: var(--paper-deep); border-block: 1px solid var(--line-soft); }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 660;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 0.7rem;
}

/* --------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 640;
  font-size: 1.02rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.brand img { width: 26px; height: 26px; }

.nav { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: 7px;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--line-soft); }
.nav a[aria-current="page"] { color: var(--brass); font-weight: 600; }

.nav__cta {
  background: var(--brass) !important;
  color: #fff !important;
  font-weight: 600 !important;
  padding: 0.4rem 0.95rem !important;
}
.nav__cta:hover { background: var(--brass-strong) !important; }

/* Narrow screens: brand on its own line, navigation centred beneath it, rather
   than an awkward wrap around the brand. */
@media (max-width: 660px) {
  .site-header__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.6rem 0;
  }
  .brand { margin-right: 0; justify-content: center; }
  .nav { justify-content: center; }
  .nav a { padding: 0.35rem 0.55rem; font-size: 0.9rem; }
}

@media (prefers-color-scheme: dark) { .nav__cta { color: #16130c !important; } }
:root[data-theme="dark"] .nav__cta { color: #16130c !important; }
:root[data-theme="light"] .nav__cta { color: #fff !important; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover { color: var(--ink); background: var(--surface); border-color: var(--brass-line); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Show the icon for the mode a click would switch *to*. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  .theme-toggle .icon-sun { display: block; }
  .theme-toggle .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

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

.hero { padding: clamp(3rem, 6vw, 5.5rem) 0 0; text-align: center; position: relative; overflow: hidden; }

.hero::before {
  content: "";
  position: absolute;
  inset: -30% 50% auto;
  width: 140%;
  height: 620px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 40%,
              color-mix(in srgb, var(--brass) 13%, transparent), transparent 62%);
  pointer-events: none;
  z-index: -1;
}

.hero__mark {
  width: clamp(84px, 12vw, 112px);
  height: auto;
  margin: 0 auto 1.9rem;
  filter: drop-shadow(0 10px 22px rgb(80 55 10 / 0.28));
  animation: tick 24s steps(12, end) infinite;
}

@keyframes tick { to { transform: rotate(360deg); } }

.hero h1 { margin-bottom: 0.85rem; text-wrap: balance; }

.hero__lede {
  font-size: clamp(1.08rem, 1rem + 0.5vw, 1.3rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 40ch;
  margin: 0 auto 2rem;
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.hero__meta {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0;
}
.hero__meta span { white-space: nowrap; }
.hero__meta span + span::before { content: "·"; margin: 0 0.55rem; color: var(--line); }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.82rem 1.5rem;
  border-radius: 9px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--brass);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--brass-strong); color: #fff; }

@media (prefers-color-scheme: dark) {
  .btn--primary { color: #16130c; }
  .btn--primary:hover { color: #16130c; }
}
:root[data-theme="dark"] .btn--primary,
:root[data-theme="dark"] .btn--primary:hover { color: #16130c; }
:root[data-theme="light"] .btn--primary,
:root[data-theme="light"] .btn--primary:hover { color: #fff; }

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn--ghost:hover { background: var(--surface); border-color: var(--brass-line); color: var(--ink); }

/* ----------------------------------------------------------- screenshot */

.shot {
  margin: clamp(2.5rem, 5vw, 4rem) auto 0;
  max-width: 900px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  line-height: 0;
}
.shot img { width: 100%; }

.shot--inline {
  max-width: 620px;
  margin: 1.75rem 0 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* ----------------------------------------------------------- schedules */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  max-width: 760px;
  margin: 0 auto;
}

/* No `white-space: nowrap` here: a nowrap flex item cannot shrink below its
   text width, and the longest chip overflows a ~320px viewport — where
   `overflow-x: hidden` on the body would clip it away silently. */
.chip {
  font-family: var(--mono);
  font-size: 0.88rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 0.45rem 1rem;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 430px) {
  .chip { font-size: 0.8rem; padding: 0.4rem 0.8rem; }
}
.chip::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brass);
  margin-right: 0.55rem;
  vertical-align: 0.08em;
}

/* --------------------------------------------------------------- cards */

.grid {
  display: grid;
  gap: 1.15rem;
  /* 240px keeps the four feature cards in one row at full width rather than
     wrapping to three plus an orphan. */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.6rem 1.7rem;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: 0.45rem; }
.card p { color: var(--muted); font-size: 0.96rem; margin: 0; }

.card__icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--brass-tint);
  border: 1px solid var(--brass-line);
  color: var(--brass);
  margin-bottom: 1rem;
}
.card__icon svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------- callouts */

.note {
  border: 1px solid var(--brass-line);
  background: var(--brass-tint);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 0 0 1.5em;
  font-size: 0.96rem;
}
.note > :last-child { margin-bottom: 0; }
.note__title {
  font-weight: 660;
  color: var(--ink);
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.94rem;
}
.note__title svg { width: 15px; height: 15px; color: var(--brass); flex: none; }

.note--plain { background: var(--surface); border-color: var(--line); }
.note--plain .note__title svg { color: var(--muted); }

/* ----------------------------------------------------------- docs shell */

.page-head {
  padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(1.75rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper-deep);
}
.page-head .lede { max-width: 56ch; margin-top: 0.85rem; }

.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding: clamp(2.5rem, 5vw, 4rem) 0 5rem;
}

.toc { position: sticky; top: 5rem; }
.toc__title {
  font-size: 0.74rem;
  font-weight: 660;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.85rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 0.34rem 0 0.34rem 0.95rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 0.91rem;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
}
.toc a:hover { color: var(--ink); border-left-color: var(--brass-line); }

@media (max-width: 860px) {
  /* minmax(0, …) rather than 1fr: a bare 1fr floors at min-content, which lets a
     wide table or code block push the column past the viewport. */
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 2rem; }
  .toc {
    position: static;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
  }
  .toc ol { border-left: 0; columns: 2; column-gap: 1.5rem; }
  .toc a { padding-left: 0; border-left: 0; }
}
@media (max-width: 520px) {
  .toc ol { columns: 1; }
}

/* ------------------------------------------------------------ download */

.dl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}
.dl-card img { width: 80px; height: 80px; margin: 0 auto 1.25rem; }
.dl-card h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 1.95rem);
  letter-spacing: -0.021em;
  margin-bottom: 0.4rem;
}
.dl-card .version { font-size: 0.9rem; color: var(--muted); margin-bottom: 1.6rem; }
.dl-card .btn { width: 100%; justify-content: center; }
.dl-card .fineprint { font-size: 0.85rem; color: var(--muted); margin: 1.1rem 0 0; }

/* --------------------------------------------------------------- table */

.table-scroll { overflow-x: auto; margin: 0 0 1.5em; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.94rem;
  min-width: 460px;
}
th, td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { font-weight: 620; color: var(--ink); background: var(--paper-deep); font-size: 0.86rem; }
td { color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }
table code { font-size: 0.84em; }

.table-scroll table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
  padding: 2.75rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brass); text-decoration: underline; }
.site-footer nav { display: flex; gap: 1.35rem; flex-wrap: wrap; }
.site-footer p { margin: 0; }

.colophon {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  max-width: 62ch;
  line-height: 1.6;
}

/* --------------------------------------------------------------- misc */

.cta-band { text-align: center; }
.cta-band h2 { margin-bottom: 0.6rem; }
.cta-band p { color: var(--muted); max-width: 46ch; margin-inline: auto; margin-bottom: 1.8rem; }

.center { text-align: center; }
.stack-head { max-width: 46ch; margin: 0 auto clamp(2rem, 4vw, 3rem); text-align: center; }
.stack-head p { color: var(--muted); margin: 0.6rem 0 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header, .toc, .hero__actions, .cta-band { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .layout { display: block; }
}
