/* Differential Endeavors — site styles
   Tokens first, then base type, then layout, then components. Edit tokens; leave the rest alone unless you mean it. */

:root {
  --paper: #FAF7F2;
  --parchment: #F1ECE3;
  --rule: #E3DCD0;
  --stone: #6F6A66;
  --ink: #231F20;
  --maroon: #6B1A2A;
  --maroon-deep: #4B121D;
  --maroon-wash: #ECE1DE;

  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 680px;   /* body text column */
  --wide: 840px;      /* figures, code, tables */
  --page: 1040px;     /* header and footer */
  --gutter: 24px;
}

/* Optional dark mode. Delete this block to ship light only. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1A1214;
    --parchment: #261B1E;
    --rule: #3A2C30;
    --stone: #A39D97;
    --ink: #EDE6DF;
    --maroon: #D4657B;
    --maroon-deep: #E58BA0;
    --maroon-wash: #2E1C21;
  }
}
:root[data-theme="dark"] {
  --paper: #1A1214; --parchment: #261B1E; --rule: #3A2C30; --stone: #A39D97;
  --ink: #EDE6DF; --maroon: #D4657B; --maroon-deep: #E58BA0; --maroon-wash: #2E1C21;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;          /* 18px */
  line-height: 1.65;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--maroon); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--maroon-deep); text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--maroon); outline-offset: 3px; }
img, svg { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

h1, h2, h3, h4 { font-weight: 500; line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.005em; }
h1 { font-size: 2.25rem; }                         /* 36 */
h2 { font-size: 1.625rem; line-height: 1.25; }     /* 26 */
h3 { font-size: 1.25rem; line-height: 1.35; font-weight: 600; }
.display { font-size: 2.75rem; line-height: 1.15; letter-spacing: -0.01em; font-weight: 500; } /* 44 */
p { margin: 0 0 1.35em; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }
em { font-style: italic; }
small, .small { font-size: 0.9375rem; line-height: 1.5; color: var(--stone); }

.label {
  font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--maroon); font-weight: 500;
}
.meta { font-family: var(--mono); font-size: 0.8125rem; color: var(--stone); }
.definition { font-family: var(--mono); font-size: 0.8125rem; color: var(--stone); letter-spacing: 0.02em; }
.definition i { font-family: var(--serif); }

/* ---------- layout ---------- */
.wrap { max-width: var(--page); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.measure { max-width: var(--measure); }
.wide { max-width: var(--wide); }
main { padding-top: 5rem; padding-bottom: 6rem; }
.section { margin-top: 4.5rem; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--rule); padding-bottom: 0.6rem; margin-bottom: 0.25rem;
}
.section-head a { text-decoration: none; font-size: 0.9375rem; }
.section-head a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand .mark { height: 30px; width: auto; flex: none; }
.brand .wordmark { font-size: 1.1875rem; font-weight: 500; letter-spacing: 0.005em; white-space: nowrap; }
.brand .sub { font-family: var(--mono); font-size: 0.875rem; color: var(--stone); margin-left: 0.6rem; }
.mark .coil { stroke: var(--ink); stroke-width: 3; stroke-linecap: butt; stroke-linejoin: round; }
.mark .ring { stroke: var(--maroon); stroke-width: 3; stroke-linecap: butt; stroke-linejoin: round; }
.mark.on-maroon .coil, .mark.on-maroon .ring { stroke: #FAF7F2; }

.nav { display: flex; gap: 1.75rem; }
.nav a { color: var(--ink); text-decoration: none; font-size: 1rem; }
.nav a:hover { color: var(--maroon); }
.nav a[aria-current="page"] { color: var(--maroon); border-bottom: 1.5px solid var(--maroon); padding-bottom: 2px; }
.menu { display: none; }

@media (max-width: 719px) {
  .site-header .wrap { height: 60px; }
  .brand .mark { height: 26px; }
  .brand .wordmark { font-size: 1.0625rem; }
  .brand .sub { display: none; }
  .nav { display: none; }
  .menu { display: block; position: relative; }
  .menu summary { list-style: none; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center; margin-right: -10px; }
  .menu summary::-webkit-details-marker { display: none; }
  .menu[open] .nav {
    display: flex; flex-direction: column; gap: 0; position: absolute; right: 0; top: 48px; min-width: 200px;
    background: var(--paper); border: 1px solid var(--rule); padding: 0.5rem 0; z-index: 10;
  }
  .menu[open] .nav a { padding: 0.7rem 1.25rem; }
  .menu[open] .nav a[aria-current="page"] { border: 0; }
  main { padding-top: 2.5rem; padding-bottom: 3.5rem; }
  .display { font-size: 2rem; }
  h1 { font-size: 1.875rem; }
  body { font-size: 1.0625rem; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 2.5rem; }
.site-footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer .brand .mark { height: 20px; }
.site-footer .copy { font-family: var(--mono); font-size: 0.8125rem; color: var(--stone); }
.site-footer nav { display: flex; gap: 1.5rem; font-family: var(--mono); font-size: 0.8125rem; }
.site-footer nav a { color: var(--stone); text-decoration: none; }
.site-footer nav a:hover { color: var(--maroon); }

/* ---------- home ---------- */
.areas { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 0.9rem 1.5rem; }
.areas dt { font-weight: 600; margin: 0; }
.areas dd { margin: 0; }
@media (max-width: 719px) { .areas { grid-template-columns: 1fr; gap: 0.25rem; } .areas dd { margin-bottom: 0.8rem; } }

/* ---------- post list ---------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 1.4rem 0; border-bottom: 1px solid var(--rule); }
.entry .meta { display: block; margin-bottom: 0.3rem; }
.entry h2 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 0.3rem; }
.entry h2 a { color: var(--ink); text-decoration: none; }
.entry h2 a:hover { color: var(--maroon); text-decoration: underline; }
.entry p { font-size: 1.0625rem; line-height: 1.55; margin: 0; }
.pager { display: flex; gap: 1.25rem; font-family: var(--mono); font-size: 0.875rem; margin-top: 2rem; }
.pager a { text-decoration: none; }
.pager .current { color: var(--ink); }

/* ---------- tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--maroon); background: var(--maroon-wash); padding: 5px 9px; border-radius: 2px; text-decoration: none;
}
.tag:hover { background: var(--maroon); color: var(--paper); }

/* ---------- article ---------- */
.post-head { margin-bottom: 1.5rem; }
.post-head h1 { margin-top: 0.75rem; }
.post-head .standfirst { font-size: 1.25rem; line-height: 1.6; }
.post > p, .post > ul, .post > ol, .post > h2, .post > h3, .post > blockquote, .post > .eq { max-width: var(--measure); }
.post h2 { margin-top: 2.5rem; }
.post h3 { margin-top: 2rem; }
.post ul, .post ol { padding-left: 1.4rem; }
.post li { margin-bottom: 0.4rem; }
blockquote {
  margin: 1.5rem 0; padding: 0.2rem 0 0.2rem 1.4rem; border-left: 2px solid var(--maroon);
  font-size: 1.25rem; line-height: 1.5; font-style: italic;
}
blockquote p { margin: 0; }
figure { margin: 2rem 0; max-width: var(--wide); }
figure svg, figure img { display: block; }
figcaption { margin-top: 0.75rem; font-size: 0.9375rem; line-height: 1.5; color: var(--stone); max-width: var(--measure); }
figcaption .fig { font-family: var(--mono); font-size: 0.8125rem; color: var(--maroon); }
.figure-ink { stroke: var(--ink); }
.figure-maroon { stroke: var(--maroon); }
.figure-rule { stroke: var(--rule); }
.figure-label { font-family: var(--serif); font-style: italic; font-size: 15px; fill: var(--ink); }
.figure-label.muted { fill: var(--stone); }

code, kbd, samp { font-family: var(--mono); font-size: 0.9375rem; }
:not(pre) > code { background: var(--parchment); padding: 2px 6px; border-radius: 2px; }
pre {
  background: var(--parchment); padding: 1.1rem 1.35rem; margin: 1.5rem 0; max-width: var(--wide);
  overflow-x: auto; line-height: 1.6; font-size: 0.9375rem;
}
pre code { background: none; padding: 0; font-size: inherit; }
.tok-k { color: var(--maroon); }      /* keywords and literals */
.tok-c { color: var(--stone); }       /* comments */

.eq { display: flex; align-items: center; gap: 1.5rem; margin: 1.5rem 0; }
.eq .katex-display { flex: 1; margin: 0; }
.eq .eqno { font-family: var(--mono); font-size: 0.8125rem; color: var(--stone); }
.katex { font-size: 1.1em; }

.post-nav {
  display: flex; justify-content: space-between; gap: 1.5rem; margin-top: 3rem; padding: 1.5rem 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); max-width: var(--measure);
}
.post-nav a { display: flex; flex-direction: column; gap: 0.25rem; color: var(--ink); text-decoration: none; max-width: 45%; }
.post-nav a:hover { color: var(--maroon); }
.post-nav .next { text-align: right; align-items: flex-end; }
.post-nav .label { color: var(--stone); font-weight: 400; font-size: 0.75rem; }
.post-nav strong { font-weight: 500; font-size: 1.0625rem; line-height: 1.35; }

/* ---------- forms and buttons ---------- */
.btn {
  display: inline-block; font-family: var(--serif); font-size: 1rem; font-weight: 500; line-height: 1;
  padding: 0.8rem 1.25rem; border-radius: 2px; border: 1px solid var(--maroon); background: var(--maroon); color: var(--paper);
  text-decoration: none; cursor: pointer; min-height: 44px;
}
.btn:hover { background: var(--maroon-deep); border-color: var(--maroon-deep); color: var(--paper); }
.btn-outline { background: transparent; color: var(--maroon); }
.btn-outline:hover { background: var(--maroon-wash); color: var(--maroon-deep); }
.arrow { text-decoration: none; border-bottom: 1px solid var(--maroon); padding-bottom: 1px; }
label.field { display: block; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--stone); margin-bottom: 0.35rem; }
input[type="text"], input[type="email"], textarea {
  font-family: var(--serif); font-size: 1rem; padding: 0.65rem 0.75rem; border: 1px solid #C9C1B4; border-radius: 2px;
  background: var(--paper); color: var(--ink); min-height: 44px; width: 100%; max-width: 420px;
}
input:focus, textarea:focus { outline: 2px solid var(--maroon); outline-offset: 1px; border-color: var(--maroon); }

/* ---------- utilities ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
