/* DF Studio site. One stylesheet, no framework, system fonts only. */

:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --ink: #1c1c1a;
  --muted: #5d5c57;
  --rule: #dcd9d1;
  --accent: #0b5d8c;
  --accent-ink: #ffffff;
  --code-bg: #efede7;
  --c-comment: #6d6a62;
  --c-directive: #8a4b08;
  --c-func: #0b5d8c;
  --c-unit: #2f6d3a;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Source Serif Pro", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 42rem;
  --wide: 68.75rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151515;
    --surface: #1c1c1c;
    --ink: #e7e5df;
    --muted: #a19e95;
    --rule: #34332f;
    --accent: #7cbde3;
    --accent-ink: #0d1a22;
    --code-bg: #1f1f1e;
    --c-comment: #8d8a82;
    --c-directive: #e0a45c;
    --c-func: #7cbde3;
    --c-unit: #8fcb98;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151515;
  --surface: #1c1c1c;
  --ink: #e7e5df;
  --muted: #a19e95;
  --rule: #34332f;
  --accent: #7cbde3;
  --accent-ink: #0d1a22;
  --code-bg: #1f1f1e;
  --c-comment: #8d8a82;
  --c-directive: #e0a45c;
  --c-func: #7cbde3;
  --c-unit: #8fcb98;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

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

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

.skip {
  position: absolute; left: -999px; top: 0.5rem;
  background: var(--surface); color: var(--ink); padding: 0.5rem 0.75rem; z-index: 10;
  font-family: var(--sans); font-size: 0.9rem;
}
.skip:focus { left: 0.5rem; }

.wrap { max-width: calc(var(--measure) + 2rem); margin-inline: auto; padding-inline: 1rem; }

/* Header */
header.site {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}
header.site .bar {
  max-width: calc(var(--wide) + 2rem);
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 3.5rem;
}
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: 0.01em;
  white-space: nowrap;
}
header nav { margin-left: auto; overflow-x: auto; scrollbar-width: none; }
header nav ul { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
header nav li, header nav li + li { margin: 0; }
header nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; white-space: nowrap; }
header nav a:hover { color: var(--ink); }
.theme {
  flex: none; display: grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0;
  background: none; border: 1px solid var(--rule); border-radius: 4px;
  color: var(--muted); cursor: pointer;
}
.theme:hover { color: var(--ink); border-color: var(--muted); }
@media (max-width: 40rem) {
  header.site .bar { gap: 0.75rem; }
  header nav ul { gap: 0.9rem; }
  header nav li:nth-child(2), header nav li:nth-child(5) { display: none; }
  .brand span { display: none; }
}

/* Intro */
.intro { padding-top: 4.5rem; padding-bottom: 2.5rem; }
h1 {
  font-size: clamp(2.4rem, 6vw, 3.4rem); line-height: 1.05;
  font-weight: 600; letter-spacing: -0.015em; margin: 0 0 0.6rem;
}
.lede { font-size: 1.35rem; font-style: italic; color: var(--ink); margin: 0 0 1.5rem; }
.abstract { margin: 0 0 1.25rem; }
.meta {
  font-family: var(--sans); font-size: 0.85rem; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 0.35rem 0; margin: 0 0 1.75rem;
}
.meta > span:not(:last-child)::after { content: "·"; margin: 0 0.6rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; }
.button {
  font-family: var(--sans); font-size: 0.95rem; font-weight: 500;
  display: inline-block; padding: 0.55rem 1rem;
  border: 1px solid var(--rule); border-radius: 4px;
  color: var(--ink); text-decoration: none; background: var(--surface);
}
.button:hover { border-color: var(--muted); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(1.08); }

/* Sections */
section { padding-block: 1.5rem; }
section + section { border-top: 1px solid var(--rule); margin-top: 2rem; padding-top: 3rem; }
#features { border-top: 0; }
h2 {
  font-size: 1.65rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.005em;
  margin: 0 0 1.25rem;
}
h2 .num {
  font-family: var(--sans); font-weight: 500; font-size: 0.95rem; color: var(--muted);
  display: inline-block; min-width: 1.75rem; vertical-align: 0.2em;
}
h3 { font-size: 1.18rem; font-weight: 600; line-height: 1.3; margin: 2.25rem 0 0.4rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li + li { margin-top: 0.3rem; }
.feature > :last-child { margin-bottom: 0; }
.small { font-family: var(--sans); font-size: 0.9rem; color: var(--muted); }
.small a { color: var(--accent); }

code, kbd, pre { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--code-bg); padding: 0.08em 0.3em; border-radius: 3px; overflow-wrap: anywhere; }
kbd {
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px;
  padding: 0.05em 0.35em; background: var(--surface);
}

/* Figures */
figure { margin: 2rem 0; }
figure.wide, .pair.wide {
  width: min(var(--wide), calc(100vw - 2rem));
  margin-left: 50%; transform: translateX(-50%);
}
figure.hero { margin-top: 0; }
figure img {
  width: 100%;
  border: 1px solid var(--rule);
  background: #1b1b1b;
}
figure img.paper { background: #fff; }
figure.narrow { max-width: 36rem; margin-inline: auto; }
figure a { display: block; }
figcaption {
  font-family: var(--sans); font-size: 0.86rem; line-height: 1.5; color: var(--muted);
  margin-top: 0.6rem; max-width: var(--measure);
}
figure.wide figcaption { margin-inline: auto; padding-inline: 0; }
.fig { color: var(--ink); font-weight: 600; margin-right: 0.25rem; }
.pair { display: grid; gap: 1.5rem; margin-block: 2rem; }
.pair figure { margin: 0; }
@media (min-width: 47.5rem) { .pair { grid-template-columns: 1fr 1fr; } }

/* Code */
pre.code {
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: 4px;
  padding: 1rem 1.1rem; margin: 0 0 1.25rem;
  overflow-x: auto; line-height: 1.55; font-size: 0.85rem; tab-size: 4;
}
pre.code code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.c { color: var(--c-comment); font-style: italic; }
.d { color: var(--c-directive); }
.f { color: var(--c-func); }
.u { color: var(--c-unit); }

/* Method */
ol.steps { padding-left: 1.4rem; }
ol.steps li + li { margin-top: 0.6rem; }

/* Downloads */
.table-scroll { overflow-x: auto; margin: 1.25rem 0 1rem; }
table.downloads {
  width: 100%; border-collapse: collapse;
  font-family: var(--sans); font-size: 0.93rem; line-height: 1.5;
}
.downloads th, .downloads td {
  text-align: left; vertical-align: top;
  padding: 0.75rem 0.9rem 0.75rem 0; border-bottom: 1px solid var(--rule);
}
.downloads thead th {
  font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); border-bottom-color: var(--ink);
}
.downloads tbody th { font-weight: 600; white-space: nowrap; }
.downloads .sub { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.downloads td:last-child { color: var(--muted); }
.downloads .size { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 40rem) {
  .downloads thead { display: none; }
  .downloads tr { display: block; border-bottom: 1px solid var(--rule); padding: 0.75rem 0; }
  .downloads th, .downloads td { display: block; border: 0; padding: 0.1rem 0; }
  .downloads tbody th { white-space: normal; }
}

/* Documentation list */
dl.docs { display: grid; gap: 0; margin-top: 0.5rem; }
dl.docs dt { font-weight: 600; margin-top: 1rem; }
dl.docs dt:first-child { margin-top: 0; }
dl.docs dd { margin: 0.15rem 0 0; color: var(--muted); }
@media (min-width: 47.5rem) {
  dl.docs { grid-template-columns: 13rem 1fr; column-gap: 1.5rem; }
  dl.docs dt, dl.docs dd { margin: 0; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
  dl.docs dt:first-child, dl.docs dt:first-child + dd { border-top: 1px solid var(--rule); }
}

ul.links { list-style: none; padding: 0; columns: 2 16rem; column-gap: 2rem; }
ul.links li { break-inside: avoid; margin: 0 0 0.35rem; }

/* Footer */
footer.site {
  border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.5rem 0 2.5rem;
  font-family: var(--sans); font-size: 0.85rem; color: var(--muted);
}
footer.site p { margin: 0; }
footer.site a { color: var(--muted); }

/* 404 */
.notfound { padding-block: 6rem 4rem; }

@media print {
  header.site, .actions, .theme { display: none; }
  body { background: #fff; color: #000; }
  figure.wide, .pair.wide { width: 100%; margin-left: 0; transform: none; }
}
