/* Styles for the pages under writing/, research/ and community/. The home page keeps its own styles inline in index.html;
   the colours, type and header here are copied from there so the pages match. */
:root {
  --paper: #f5f6f3; --panel: #ffffff; --ink: #18201d; --ink-2: #4a5550; --rule: #d9ddd7;
  --gold: #9a6b12; --gold-soft: #f1e6cf; --ok: #2f6b45;
  --display: "Spectral", Georgia, "Times New Roman", serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111614; --panel: #18201d; --ink: #e8ece9; --ink-2: #a9b3ae;
    --rule: #2b3531; --gold: #d9a94a; --gold-soft: #2e2716; --ok: #7cc49a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111614; --panel: #18201d; --ink: #e8ece9; --ink-2: #a9b3ae;
  --rule: #2b3531; --gold: #d9a94a; --gold-soft: #2e2716; --ok: #7cc49a; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: 1040px; margin-inline: auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
header.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-size: 20px; text-decoration: none; }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; font-size: 15px; align-items: center; }
nav a { text-decoration: none; color: var(--ink-2); }
nav a:hover, nav a[aria-current] { color: var(--ink); }
.theme { font: inherit; font-size: 15px; background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 0 2px; line-height: 1; }
.theme:hover { color: var(--gold); }
footer { border-top: 1px solid var(--rule); padding-block: 28px 40px; color: var(--ink-2); font-size: 14px; margin-top: 72px; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.crumb { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; color: var(--ink-2); margin: 36px 0 20px; }
.crumb a { text-decoration: none; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); margin: 0 0 12px; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 5vw, 52px); line-height: 1.1; margin: 0 0 14px; letter-spacing: -0.01em; text-wrap: balance; }
.lede { color: var(--ink-2); font-size: 19px; max-width: 38em; margin: 0 0 22px; }
.btn { display: inline-block; font-size: 15px; text-decoration: none; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--rule); background: var(--panel); }
.btn:hover { border-color: var(--gold); }

/* publication page: picture beside the heading, then the list of articles */
.pub-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 44px; align-items: center; padding-bottom: 44px; border-bottom: 1px solid var(--rule); }
.pub-hero img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--rule); display: block; }
.articles { list-style: none; margin: 0; padding: 0; }
.articles li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 8px 28px; padding-block: 26px; border-bottom: 1px solid var(--rule); }
.articles time, .articles .when { font-family: var(--mono); font-size: 13px; color: var(--ink-2); padding-top: 7px; }
.articles h2 { font-family: var(--display); font-weight: 500; font-size: clamp(21px, 2.6vw, 26px); line-height: 1.25; margin: 0 0 6px; text-wrap: balance; }
.articles h2 a { text-decoration: none; }
.articles h2 a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.articles .src { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.articles .src a { text-decoration: none; color: var(--gold); }
.sub-h { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 56px 0 18px; font-weight: 500; }

/* tiles: a picture, the publication, how many articles */
.pubs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.pub { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.pub:hover { color: inherit; border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 10px 26px rgba(24, 32, 29, .10); }
.pub img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-bottom: 1px solid var(--rule); }
.pub-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pub .kind { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.pub h3 { font-family: var(--display); font-weight: 500; font-size: 21px; line-height: 1.25; margin: 0; }
.pub p { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.pub .more { margin-top: auto; padding-top: 10px; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.pub:hover .more { color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .pub { transition: none; } .pub:hover { transform: none; } }
@media (max-width: 860px) { .pubs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pub-hero { grid-template-columns: 1fr; gap: 24px; } }
@media (max-width: 560px) { .pubs { grid-template-columns: 1fr; } .articles li { grid-template-columns: 1fr; gap: 2px; } .articles time, .articles .when { padding-top: 0; } nav ul { gap: 14px; font-size: 14px; } }

/* pages made of groups (research/, community/): jump links, then one list per group */
.jump { display: flex; flex-wrap: wrap; gap: 8px; }
.jump a { font-family: var(--mono); font-size: 12.5px; text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink-2); }
.jump a:hover { border-color: var(--gold); color: var(--ink); }
.jump b { font-weight: 500; color: var(--gold); margin-left: 4px; }
.group { padding-top: 40px; scroll-margin-top: 70px; }
.group > h2 { font-family: var(--display); font-weight: 400; font-size: clamp(24px, 3vw, 30px); line-height: 1.2; margin: 0 0 4px; }
.rows li { grid-template-columns: 10.5em minmax(0, 1fr); padding-block: 20px; }
.rows .when { color: var(--gold); }
.rows h3 { font-family: var(--display); font-weight: 500; font-size: clamp(19px, 2.2vw, 22px); line-height: 1.3; margin: 0 0 4px; text-wrap: balance; }
.rows h3 a { text-decoration: none; }
.rows h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
@media (max-width: 560px) { .rows li { grid-template-columns: 1fr; } }

/* project cards (research/open-source.html) */
.group-intro { color: var(--ink-2); margin: 0 0 18px; max-width: 40em; }
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.project { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.project h3 { font-family: var(--display); font-weight: 500; font-size: 23px; line-height: 1.2; margin: 0; }
.project h3 a { text-decoration: none; }
.project h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.project p { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.project .install { align-self: flex-start; font-family: var(--mono); font-size: 13px; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 5px 10px; color: var(--ink); }
.project .links { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--mono); font-size: 12.5px; }
.project .links a { text-decoration: none; color: var(--gold); overflow-wrap: anywhere; }
.project .stats { font-family: var(--mono); font-size: 12px; color: var(--ink-2); min-height: 1.4em; }
.stat { font-family: var(--mono); font-size: 13.5px; color: var(--ok); margin: 16px 0 0; }
@media (max-width: 700px) { .projects { grid-template-columns: 1fr; } }
