/* Plain HTML + CSS. Change the palette and font stacks here. */
:root {
  --paper: #f8f8f4;
  --ink: #25282d;
  --muted: #59616d;
  --line: #d8dce3;
  --accent: #2454a6;
  --surface-hover: #edf1f8;
  --font: "Narkisim", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --ui-font: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --code-font: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --max-width: 960px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui-font);
  font-size: 17px;
  line-height: 1.65;
}
body:has(dialog[open]) { overflow: hidden; }
::selection { background: #d7e4ff; color: #142e58; }
a { color: var(--accent); text-underline-offset: 0.22em; }
a:hover, button:hover { color: #163a79; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 {
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.2;
}
h1 { margin-bottom: 20px; font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.025em; }
h2 { font-size: 1.7rem; }
h3 { margin-bottom: 12px; font-size: 1.8rem; }
h4 { margin-bottom: 12px; font-size: 1.55rem; }
p { margin-bottom: 1em; }
img { max-width: 100%; height: auto; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A small, always-visible navigation. No menu script. */
.research-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 4px;
  padding: 6px max(12px, calc((100% - var(--max-width)) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.research-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  font-size: 0.85rem;
  text-decoration: none;
}
.research-nav .name {
  width: 100%;
  padding: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.4rem;
}
.research-nav a:hover { background: var(--surface-hover); }
.site-shell {
  width: min(100% - 40px, var(--max-width));
  margin: 0 auto;
  padding: 32px 0 56px;
}
.intro-column { padding-bottom: 32px; }
.intro-column h1 { max-width: 26ch; }
.intro { max-width: 65ch; }
.intro-column .intro { margin-bottom: 0; }
.intro-column, .research-column, .about-column { min-width: 0; }

/* Finding first, status separate. The HTML remains in reading order. */
.work-group { margin-bottom: 48px; }
.group-header { padding-top: 20px; border-top: 1px solid var(--line); }
.group-header p { max-width: 65ch; margin-bottom: 0; color: var(--muted); font-size: 0.95rem; }
.work-group--reports .group-header { border-top: 3px solid var(--accent); }
.work-group--reports h3 { font-size: clamp(2rem, 4vw, 2.6rem); }
.research-item { padding: 26px 0; border-bottom: 1px solid var(--line); }
.item-main {
  display: grid;
  grid-template-areas: "title" "outcome" "summary" "meta";
  gap: 12px;
}
.item-main h4 { grid-area: title; margin: 0; }
.item-summary { grid-area: summary; max-width: 68ch; margin: 0; }
.item-meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--ui-font);
  font-size: 0.82rem;
  line-height: 1.6;
}
.item-main > .item-meta { grid-area: meta; }
.item-outcome { grid-area: outcome; margin: 0; }
.item-actions { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.research-item > .text-button, .research-item .item-actions { margin-top: 8px; }
.text-button, .text-link, .close-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  color: var(--accent);
  font-family: var(--ui-font);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.22em;
}
.text-button, .close-button { border: 0; background: transparent; cursor: pointer; }
.status {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 3px;
  font-family: var(--ui-font);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.6;
}
.status--accepted { color: #225738; background: #deeddf; }
.status--resolved { color: #204d8b; background: #e0eafa; }
.status--informative { color: #795211; background: #f6e9c9; }
.status--duplicate, .status--wontfix { color: #883b3c; background: #f3dfe0; }

/* Background comes after the work, on every screen size. */
.about-column { padding-top: 28px; border-top: 2px solid var(--line); }
.about-column section + section { margin-top: 32px; }
.about-column p { max-width: 65ch; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { margin-bottom: 14px; }
.timeline strong, .timeline span { display: block; }
.timeline strong { font-size: 0.85rem; }
.timeline span { color: var(--muted); font-size: 0.95rem; }
.about-column footer {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.about-column footer a { display: inline-flex; align-items: center; min-height: 44px; font-size: 0.9rem; }

/* Native dialogs keep Escape and focus handling. */
dialog {
  width: 100%;
  max-width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  margin: auto 0 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 10px 10px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 48px #25282d30;
}
dialog::backdrop { background: #19243866; }
.dialog-content { padding: 0 24px max(28px, env(safe-area-inset-bottom)); }
.close-button { position: sticky; top: 0; display: flex; margin-left: auto; padding: 12px 8px; background: var(--paper); }
.dialog-content h2 { margin-top: 16px; font-size: 1.8rem; }
.story-points { display: grid; gap: 20px; margin: 24px 0; }
.story-points div { padding-top: 16px; border-top: 1px solid var(--line); }
.story-points dt { margin-bottom: 6px; color: var(--ink); font-size: 0.85rem; font-weight: 700; }
.story-points dd { margin: 0; }
.disclosure-note { margin: 24px 0 0; color: var(--muted); font-size: 0.95rem; }

/* Public write-ups share the same neutral reading palette. */
.writeup-shell { width: min(100% - 40px, 800px); margin: 0 auto; padding: 24px 0 64px; }
.jump-link, .back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--accent);
  font-family: var(--ui-font);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.back-link { position: sticky; top: 10px; z-index: 10; margin-bottom: 32px; }
.jump-link:hover, .back-link:hover { border-color: var(--accent); }
.writeup-header { padding-bottom: 28px; border-bottom: 3px solid var(--accent); }
.writeup-header h1 { max-width: 25ch; margin-top: 16px; font-size: clamp(2rem, 4.5vw, 3.1rem); overflow-wrap: anywhere; }
.writeup-header .intro { font-size: 1.1rem; }
.writeup-body section { padding: 32px 0; border-bottom: 1px solid var(--line); }
.writeup-body h2 { font-size: 1.75rem; }
.writeup-body h3 { margin: 28px 0 14px; }
.writeup-body p, .writeup-body li, .story-points dd { overflow-wrap: anywhere; }
.writeup-body p, .writeup-body ul, .writeup-body ol { max-width: 68ch; }
.writeup-body p:last-child, .writeup-body ul:last-child { margin-bottom: 0; }
.writeup-body ul, .writeup-body ol { padding-left: 24px; }
.writeup-body li + li { margin-top: 10px; }
.writeup-body li::marker { color: var(--accent); }
code { font-family: var(--code-font); font-size: 0.82em; }
:not(pre) > code { padding: 2px 4px; border-radius: 3px; color: #234579; background: #e9eef6; overflow-wrap: anywhere; }
pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  background: #edf1f8;
  color: #243550;
  line-height: 1.65;
  tab-size: 2;
}
pre code { font-size: 0.82rem; }
.lessons { border-left: 3px solid var(--accent); padding: 24px !important; margin-top: 24px; background: var(--surface-hover); }

@media (min-width: 600px) {
  .research-nav { flex-wrap: nowrap; justify-content: flex-end; }
  .research-nav .name { width: auto; margin-right: auto; }
  .site-shell { width: min(100% - 64px, var(--max-width)); padding-top: 48px; }
  .intro-column { padding-bottom: 48px; }
  .item-main { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title title" "summary summary" "meta outcome"; align-items: center; }
  .item-outcome { text-align: right; }
  .research-item { padding: 30px 0; }
  .work-group--reports h4 { font-size: 1.8rem; }
  dialog { width: 720px; max-width: calc(100% - 64px); max-height: 85dvh; margin: auto; border-radius: 6px; }
  .dialog-content { padding: 8px 36px 32px; }
  .story-points div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 18px; }
  .writeup-shell { padding-top: 40px; }
}
@media (min-width: 800px) {
  .about-column { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 64px; }
  .about-column section:first-child { grid-row: 1 / span 2; }
  .about-column section + section { margin-top: 0; }
  .about-column footer { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 599px) {
  html { scroll-padding-top: 116px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  body { background: white; color: black; font-size: 11pt; }
  .back-link, .jump-link, .research-nav { display: none; }
  .writeup-shell { width: 100%; padding: 0; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  h2, h3 { break-after: avoid; }
  figure { break-inside: avoid; }
}
