/* Synoros — single stylesheet. No build step, no framework.
   Fonts: Fraunces (self-hosted, headings + wordmark) over system serif prose.
   Palette: warm off-white / near-black / clay accent.
   Dark mode via prefers-color-scheme only, no toggle. */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-var.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #faf9f5;
  --fg: #1a1915;
  --muted: #5d594f;
  --rule: #e3dfd3;
  --accent: #9c4f24;
  --sun: #c27849;
  --h1: #eceadf; --h2: #e0dccd; --h3: #cfc9b6; --h4: #b0a892; --h5: #7a7264;
  --ht3: #b5ae99; --ht4: #8d8571; --ht5: #5c5648;

  --serif: Charter, "Bitstream Charter", Cambria, Georgia, serif;
  --display: "Fraunces", Charter, Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
    --bg: #1a1915;
    --fg: #f2f0e9;
    --muted: #a39d8e;
    --rule: #3a362e;
    --accent: #d98f5f;
    --sun: #d98f5f;
    --h1: #26241f; --h2: #2e2b25; --h3: #3a362e; --h4: #4d483d; --h5: #6b6455;
    --ht3: #332f28; --ht4: #423d33; --ht5: #57503f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1915;
    --fg: #f2f0e9;
    --muted: #a39d8e;
    --rule: #3a362e;
    --accent: #d98f5f;
    --sun: #d98f5f;
    --h1: #26241f; --h2: #2e2b25; --h3: #3a362e; --h4: #4d483d; --h5: #6b6455;
    --ht3: #332f28; --ht4: #423d33; --ht5: #57503f;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  text-align: left;
}

/* Layout: everything sits in a measured column. */
header.site-header,
footer.site-footer,
main {
  max-width: 68ch;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

main {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 4.5vw, 2.5rem);
  font-weight: 550;
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin: 0 0 1.25rem;
}

/* Small label above a page h1. */
p.eyebrow {
  font-family: var(--ui);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.5rem;
}

p {
  margin: 0 0 1.15rem;
  text-wrap: pretty;
}

/* Links: underline color is the one motion allowed. */
a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  transition: text-decoration-color 0.15s ease;
}

a:hover,
a:focus-visible {
  text-decoration-color: var(--accent);
}

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

::selection {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg));
}

a.plain {
  text-decoration: none;
}

/* Subtitle line under a page h1 (e.g. a paper's subtitle). */
p.subtitle {
  font-size: 1.15rem;
  color: var(--muted);
}

/* Lists */
ul, ol {
  margin: 0 0 1.15rem;
  padding-left: 1.3rem;
}

li {
  margin-bottom: 0.4rem;
}

ul.plain-list {
  list-style: none;
  padding-left: 0;
}

ul.plain-list li {
  margin-bottom: 1.25rem;
}

/* UI chrome (nav, meta lines, form labels) uses the system-ui stack. */
header.site-header,
footer.site-footer,
nav,
.ui {
  font-family: var(--ui);
}

/* Header */
header.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}

header.site-header .wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 550;
  text-decoration: none;
  color: var(--fg);
}

.mark {
  display: block;
  flex: none;
}

/* The one animation on the site: the measurement. On load the mark is a
   flat, straight-edged triangle; its edges bow inward to the geodesic form.
   Space looks flat until you measure it. Browsers without CSS d: support
   (Safari) show the final form; reduced motion skips it entirely. */
@media (prefers-reduced-motion: no-preference) {
  @supports (d: path("M 0 0 L 1 1")) {
    @keyframes measure {
      from { d: path("M 16.00 3.40 C 12.19 10.00 8.38 16.60 4.57 23.20 C 12.19 23.20 19.81 23.20 27.43 23.20 C 23.62 16.60 19.81 10.00 16.00 3.40 Z"); }
      to   { d: path("M 16.00 3.40 C 15.54 11.93 11.73 18.53 4.57 23.20 C 12.19 19.33 19.81 19.33 27.43 23.20 C 20.27 18.53 16.46 11.93 16.00 3.40 Z"); }
    }
    .mark path {
      animation: measure 1.1s cubic-bezier(0.55, 0, 0.15, 1) 0.2s both;
    }
  }
}

header.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

button.theme-toggle {
  width: auto;
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.15rem;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
}

button.theme-toggle:hover {
  color: var(--fg);
  background: none;
}

header.site-header nav a {
  text-decoration: none;
  color: var(--muted);
}

header.site-header nav a:hover,
header.site-header nav a:focus {
  color: var(--fg);
}

/* Footer */
footer.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

footer.site-footer a {
  color: var(--muted);
}

footer.site-footer a:hover,
footer.site-footer a:focus {
  color: var(--fg);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-family: var(--ui);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

th {
  font-weight: 500;
  color: var(--muted);
}

/* Benchmark-style tables: label column left, all value columns right-aligned. */
table.bench td:not(:first-child),
table.bench th:not(:first-child) {
  text-align: right;
}

table.bench td:not(:first-child) {
  white-space: nowrap;
}

/* Code */
code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: color-mix(in srgb, var(--fg) 6%, var(--bg));
  padding: 0.1em 0.35em;
}

pre {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Forms */
label {
  display: block;
  font-family: var(--ui);
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: var(--muted);
}

input, textarea, button {
  font-family: var(--ui);
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.5rem 0.65rem;
  width: 100%;
  margin-bottom: 1.1rem;
}

input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  width: auto;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
}

button:hover {
  background: color-mix(in srgb, var(--accent) 85%, black);
}

/* Honeypot field: hidden from sighted users, present for bots to fill. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Homepage horizon band: the frontier landscape, inlined so it follows the
   theme toggle. Ridge tones are mixes of the scheme tokens; the mist overlay
   fades the scene down through the footer. */
.horizon {
  margin-top: 1.5rem;
  position: relative;
}

.horizon-art {
  display: block;
  width: 100%;
  height: clamp(220px, 31.5vw, 470px);
}

.horizon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 45%;
  background: linear-gradient(to bottom, transparent, var(--bg) 92%);
  pointer-events: none;
}

.horizon-art .r1 { fill: var(--h1); }
.horizon-art .r2 { fill: var(--h2); }
.horizon-art .r3 { fill: var(--h3); }
.horizon-art .r4 { fill: var(--h4); }
.horizon-art .r5 { fill: var(--h5); }
.horizon-art .t3 { fill: var(--ht3); }
.horizon-art .t4 { fill: var(--ht4); }
.horizon-art .t5 { fill: var(--ht5); }
.horizon-art .sun { fill: var(--sun); opacity: 0.82; }
.horizon-art .fr { fill: none; stroke: var(--accent); stroke-width: 2; stroke-opacity: 0.92; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes drift {
    to { transform: translateX(-1500px); }
  }
  .horizon-art .d1 { animation: drift 260s linear infinite; }
  .horizon-art .d2 { animation: drift 210s linear infinite; }
  .horizon-art .d3 { animation: drift 165s linear infinite; }
  .horizon-art .d4 { animation: drift 125s linear infinite; }
  .horizon-art .d5 { animation: drift 95s linear infinite; }
}

.horizon + footer.site-footer {
  margin-top: -3.5rem;
  border-top: none;
  position: relative;
}

@media (max-width: 700px) {
  .horizon + footer.site-footer {
    margin-top: -2rem;
  }
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}
