/* A plain academic page: one serif face, one narrow column, modest sizes, no ornament.
   theme.js sets <html data-theme="light|dark"> from the visitor's choice or system setting. */
:root{
  color-scheme:light;
  --bg:#ffffff;--ink:#1c2024;--ink-2:#30353b;--muted:#68707a;--faint:#a0a6ad;--line:#e4e6e9;
  --accent:#0f6e6a;
  --serif:Charter,"Bitstream Charter","Iowan Old Style","Sitka Text",Cambria,Georgia,serif;
  --max:720px;--gutter:24px;
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#121a22;--ink:#ece8df;--ink-2:#c9d0d6;--muted:#8d98a3;--faint:#5c6875;--line:#26323d;
  --accent:#d9b97f;
}
/* Without JavaScript, follow the system setting. */
@media(prefers-color-scheme:dark){:root:not([data-theme]){
  color-scheme:dark;
  --bg:#121a22;--ink:#ece8df;--ink-2:#c9d0d6;--muted:#8d98a3;--faint:#5c6875;--line:#26323d;
  --accent:#d9b97f;
}}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{margin:0;min-height:100vh;display:flex;flex-direction:column;background:var(--bg);color:var(--ink-2);font:16px/1.6 var(--serif);-webkit-font-smoothing:antialiased}
a{color:var(--ink);text-decoration:underline;text-decoration-color:var(--faint);text-decoration-thickness:1px;text-underline-offset:.18em}
a:hover{color:var(--accent);text-decoration-color:currentColor}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
p{margin:0 0 .9em}
h1,h2,h3{margin:0;color:var(--ink);font-family:var(--serif);letter-spacing:0}
h1{font-size:1.5rem;line-height:1.3;font-weight:400}
h2{font-size:1.125rem;line-height:1.4;font-weight:600;margin:0 0 .5em}
h3{font-size:1rem;line-height:1.45;font-weight:600}
strong{color:var(--ink);font-weight:600}
::selection{background:rgba(15,110,106,.18)}
.skip-link{position:absolute;left:-9999px;top:8px;background:var(--ink);color:var(--bg);padding:.4rem .8rem}
.skip-link:focus{left:8px}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Header and footer */
.header-inner,main,.site-footer{width:100%;max-width:var(--max);margin:0 auto;padding-left:var(--gutter);padding-right:var(--gutter)}
.header-inner{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 24px;padding-top:28px;padding-bottom:6px}
/* A small line-drawn brain beside the name, in the same ink as the name. */
.brand{display:inline-flex;align-items:center;gap:8px;font-weight:600;color:var(--ink);text-decoration:none}
.brand-icon{width:18px;height:18px;flex:none}
.site-nav{display:flex;flex-wrap:wrap;gap:4px 20px;font-size:.9375rem}
.site-nav a{color:var(--muted);text-decoration:none}
.site-nav a:hover{color:var(--ink)}
/* Theme toggle: a moon in light mode, a sun in dark mode. Hidden until theme.js runs. */
.theme-toggle{display:inline-flex;align-items:center;align-self:center;padding:6px;margin:-6px;border:0;background:none;color:var(--muted);cursor:pointer}
.theme-toggle:hover{color:var(--ink)}
.theme-toggle[hidden]{display:none}
.theme-toggle svg{width:16px;height:16px}
.icon-sun,:root[data-theme="dark"] .icon-moon{display:none}
:root[data-theme="dark"] .icon-sun{display:block}
.site-nav a[aria-current=page]{color:var(--ink);text-decoration:underline;text-underline-offset:.35em;text-decoration-color:var(--ink)}
main{flex:1}
.site-footer{display:flex;flex-wrap:wrap;justify-content:space-between;gap:6px 20px;margin-top:40px;padding-top:16px;padding-bottom:32px;border-top:1px solid var(--line);font-size:.875rem;color:var(--muted)}
.site-footer a{color:var(--muted)}

/* Page heading */
.page-hero{padding:36px 0 4px}
.page-hero.has-portrait{display:grid;grid-template-columns:minmax(0,1fr) 96px;gap:32px;align-items:start}
.eyebrow{display:block;margin:0 0 6px;font-size:.875rem;color:var(--muted)}
.lead{margin:12px 0 0;color:var(--ink-2)}
.hero-actions{display:flex;flex-wrap:wrap;gap:4px 18px;margin-top:10px;font-size:.9375rem}
.hero-matrix{width:96px;margin-top:6px}
.hero-matrix img{display:block;width:100%;height:auto}
:root[data-theme="dark"] .hero-matrix img{filter:invert(1) hue-rotate(180deg)}

/* Sections: spacing instead of rules; the numbered labels are redundant with the headings. */
.content-section{padding:30px 0 0}
.section-label{display:none}
.section-body>:last-child,.wide-copy>:last-child{margin-bottom:0}
.small{font-size:.875rem;color:var(--muted)}
.text-link{white-space:nowrap}

/* Project lists */
.project-list{margin:6px 0 0}
.project-row{display:block;padding:6px 0;color:inherit;text-decoration:none}
.project-row .number,.project-row .arrow{display:none}
.project-row h3{display:inline;text-decoration:underline;text-decoration-color:var(--faint);text-decoration-thickness:1px;text-underline-offset:.18em}
.project-row:hover h3{color:var(--accent);text-decoration-color:currentColor}
.project-row p{margin:2px 0 0;color:var(--muted)}

/* Short numbered steps */
.method-grid{margin:8px 0 12px}
.method-step{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px;margin:0 0 10px}
.step-index{order:0;width:1.75em;flex:none;font-size:.875rem;color:var(--faint)}
.method-step h3{order:1}
.method-quantity{order:2;font-size:.875rem;color:var(--muted)}
.method-quantity::before{content:"· "}
.method-step p{order:3;flex-basis:calc(100% - 1.75em - 8px);margin:2px 0 0 calc(1.75em + 8px)}

/* Sleep page lists */
.sleep-impact{margin:6px 0 4px}
.impact-row{margin:0 0 10px}
.impact-index{display:none}
.impact-row p{margin:2px 0 0}

/* Figure and disclosure */
.research-figure{margin:16px 0}
.research-image-pan{overflow-x:auto}
.research-figure img{display:block;width:100%;height:auto}
.research-figure figcaption{margin-top:8px;font-size:.875rem;color:var(--muted)}
.technical{margin:12px 0 0}
.technical summary{cursor:pointer;font-weight:600;color:var(--ink)}
.technical-content{padding:4px 0 0}
.technical-content h3{margin:12px 0 2px}

/* Publications */
.pub-entry{display:grid;grid-template-columns:3.25em minmax(0,1fr);gap:12px;margin:0 0 14px}
.pub-entry .year{color:var(--muted)}
.pub-entry h3{font-weight:400}
.pub-entry p{margin:2px 0;color:var(--muted);font-size:.9375rem}
.pub-entry .text-link{font-size:.9375rem}

@media(max-width:600px){
  :root{--gutter:18px}
  .header-inner{padding-top:20px}
  .page-hero{padding-top:24px}
  .page-hero.has-portrait{display:block}
  .hero-matrix{display:none}
  .pub-entry{grid-template-columns:1fr;gap:0}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
