/* Layout: the same language as the coming-soon page. A slim header (small hourglass, the name, the
   two fields in tracked capitals), a centered hero with the logo and the three reading depths, a
   hairline topic strip (the archive index), then two white panels side by side — Alzheimer's left,
   Pain right — over the two watercolors, which sit in the top corners the way they do on the
   coming-soon page. A navy footer carries the logo and the author. Georgia for headings and
   sentences, the system sans for everything else. Light theme only. */
:root {
  color-scheme: light;
  --paper: #fcfbf8;
  --white: #ffffff;
  --ink: #2b3b48;
  --heading: #344957;
  --muted: #63727b;
  --label: #5d6d79;
  --coral: #c47461;             /* Pain, and the page's one warm accent */
  --g-confirms: #3f7a5f;        /* literature map: points the same way */
  --g-extends: #5c6ba6;         /* built on, or built past */
  --g-complicates: #c4552f;     /* cuts against it */
  --g-foundation: #8a929b;      /* background it rests on */
  --slate-blue: #5c6ba6;        /* Alzheimer's, from the hourglass' lower bulb */
  --navy: #1b2e43;
  --hairline: rgba(68, 85, 99, .19);
  --focus: #8b766d;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; min-width: 280px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
/* The watercolors: neuron wash in the top-left corner, pain wash in the top-right, fading toward
   the middle, with a soft paper light in between. They stay fixed while the page scrolls. */
body::before, body::after {
  content: "";
  position: fixed;
  top: 0; bottom: 0;
  width: 60%;
  z-index: 0;
  background-repeat: no-repeat;
  background-size: auto 100%;
  opacity: .85;
  pointer-events: none;
}
body::before {
  left: 0;
  background-image: url("img/alz-bg.jpg");
  background-position: left top;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 22%, transparent 61%);
  mask-image: linear-gradient(to right, #000 0%, #000 22%, transparent 61%);
}
body::after {
  right: 0;
  background-image: url("img/pain-bg.jpg");
  background-position: right top;
  -webkit-mask-image: linear-gradient(to left, #000 0%, #000 20%, transparent 61%);
  mask-image: linear-gradient(to left, #000 0%, #000 20%, transparent 61%);
}
.page { position: relative; z-index: 1; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 6px; border-radius: 4px; }
.wrap {
  max-width: 76rem;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.caps {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--label);
}

/* Header: small mark, name, the two fields */
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 27px 8px;
}
.header-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.header-brand img { width: 35px; height: 43px; object-fit: contain; mix-blend-mode: multiply; }
.header-name { font-size: 14px; line-height: 1.35; font-weight: 600; letter-spacing: .015em; }
.header-topics { margin: 0; text-align: right; }
.header-topics a { text-decoration: none; }
.header-topics a:hover { text-decoration: underline; text-underline-offset: 4px; }
.topic-divider { padding: 0 12px; opacity: .6; }

/* Hero: logo and the three reading depths */
.hero { text-align: center; padding-block: 18px 28px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid rgba(135, 117, 104, .24);
  border-radius: 50px;
  color: #806b5e;
  background: rgba(252, 251, 248, .67);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  line-height: 1.5;
  text-transform: uppercase;
}
.status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #cd8e76; }
/* Visible to search engines and screen readers, not on screen. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.hero-logo { width: min(360px, 100%); margin: 14px auto 0; mix-blend-mode: multiply; }
.hero-logo img { width: 100%; height: auto; }
.reading-depths {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(560px, 100%);
  margin: 8px auto 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--hairline);
  list-style: none;
}
.reading-depths li { padding: 0 14px; }
.reading-depths li + li { border-left: 1px solid var(--hairline); }
.reading-time {
  display: block;
  font-family: var(--font-serif);
  font-size: 23px;
  letter-spacing: -.025em;
  line-height: 1.2;
  white-space: nowrap;
}
.reading-purpose { display: block; margin-top: 6px; color: #5e6d77; font-size: 12px; letter-spacing: .015em; line-height: 1.5; }

/* Archive bar: "ARCHIVE" labels two stacked field rows. Each field's topics open on its own row,
   to the right of its name, so one field's list never runs on from the other field's name.
   The rows are explicitly placed in the grid, because a hidden panel leaves no box behind and
   auto-placement would pull the second field up beside the first. */
.ribbon {
  background: rgba(252, 251, 248, .8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.ribbon .wrap { display: flex; align-items: center; gap: 22px; padding-block: 9px; }
.ribbon-label {          /* a label for the rows beside it, not a section of its own */
  flex: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
}
.ribbon-neuron {       /* ties the label to the two rows; decorative, so it goes at narrow widths
                          where the rows no longer sit at a fixed distance apart */
  flex: none;
  width: 52px;
  height: 40px;
  margin-inline: -10px -14px;
  overflow: visible;
}

.ribbon-fields {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 18px;
  align-items: baseline;
}
.ribbon-fields > :nth-child(1) { grid-area: 1 / 1; }
.ribbon-fields > :nth-child(2) { grid-area: 1 / 2; }
.ribbon-fields > :nth-child(3) { grid-area: 2 / 1; }
.ribbon-fields > :nth-child(4) { grid-area: 2 / 2; }
.ribbon-field {
  justify-self: start;
  font: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  text-transform: inherit;
  background: none;
  border: 0;
  padding: 1px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ribbon-field.alz { color: var(--slate-blue); }
.ribbon-field.pain { color: var(--coral); }
.ribbon-field::after {
  content: "";
  width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
}
.ribbon-field[aria-expanded="true"]::after {
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 5px solid currentColor;
  border-bottom: 0;
}
.ribbon-field:hover { text-decoration: underline; text-underline-offset: 4px; }
.topics { display: flex; flex-wrap: wrap; gap: 3px 16px; min-width: 0; }
.topics a { color: var(--ink); text-decoration: none; white-space: nowrap; }
.topics a:hover { text-decoration: underline; text-underline-offset: 4px; }
.topics a.all { font-weight: 700; }
.ribbon-next {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  text-align: right;
  padding-left: 22px;
  border-left: 1px solid var(--hairline);
  color: var(--muted);
  font-weight: 600;
  line-height: 1.25;
}
.ribbon-next b { color: var(--ink); font-weight: 700; white-space: nowrap; }

/* Front page: two white panels */
.front { padding-block: 26px 40px; }
.desks { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.panel { background: var(--white); border: 1px solid var(--hairline); border-radius: 10px; }
.desk { min-width: 0; padding: 22px 28px 26px; }
.desk-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}
.desk-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin: 0;
  color: var(--slate-blue);
}
.desk.pain .desk-head h2 { color: var(--coral); }
.reading-time, .archive h1 { color: var(--heading); }
.desk-head .count { white-space: nowrap; }
.desk-head .count a { color: var(--muted); text-decoration: none; }
.desk-head .count a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.entries { min-width: 0; }
.entry { padding-block: 18px 14px; border-bottom: 1px solid var(--hairline); }
.desk .entry:last-child, .feed .entry:last-child { border-bottom: 0; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-bottom: 7px; }
.entry-meta time { font-variant-numeric: tabular-nums; }
.desks .entry-meta .field { display: none; }   /* the panel already says which field */
.feed .entry-meta .field { display: inline; }
.feed .entry[data-field="alz"] .field { color: var(--slate-blue); }
.feed .entry[data-field="pain"] .field { color: var(--coral); }
.feed .entry[data-field="both"] .field { color: var(--ink); }
.feed.panel { padding: 6px 20px 10px; }
.sentence {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.42;
  margin: 0 0 10px;
  text-wrap: pretty;
}

/* A story that belongs to both fields: its sentence sits in a rounded frame that runs from the
   Alzheimer's blue to the Pain coral, so it can be placed in either column. */
.entry.dual .sentence {
  padding: 13px 17px;
  border: 3px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(var(--white), var(--white)) padding-box,
    linear-gradient(120deg, var(--slate-blue), var(--coral)) border-box;
}

/* The two fold-outs under each sentence */
details.depth { border-top: 1px solid var(--hairline); }
details.depth summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 7px;
  padding: 9px 0;
  font-weight: 600;
  font-size: .98rem;
  line-height: 1.4;
  color: var(--ink);
}
details.depth summary::-webkit-details-marker { display: none; }
details.depth summary::before {
  content: "";
  flex: none;
  align-self: center;
  width: 0; height: 0;
  border-left: 6px solid var(--coral);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  margin-right: 2px;
}
details.depth[open] summary::before {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--coral);
  border-bottom: 0;
}
details.depth summary:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.time { color: var(--muted); font-weight: 400; }
.depth-body { padding: 2px 0 16px; }
.depth-body h4 { margin: 14px 0 3px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--label); }
.depth-body h4:first-child { margin-top: 6px; }
.depth-body p { margin: 0; font-size: 1.04rem; line-height: 1.65; max-width: 62ch; }
.depth-body p.todo { color: var(--muted); font-style: italic; }
.replication { font-size: .92rem; margin-bottom: 6px; max-width: 62ch; }
.replication b { font-weight: 600; color: var(--coral); }
.depth-body p a.ref { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--coral); }
/* The literature map: this paper in the middle, cited work either side. */
.litmap { margin: 10px 0 16px; max-width: 34rem; }
.litmap svg { display: block; width: 100%; height: auto; overflow: visible; }
.litmap svg a text { text-decoration: none; }
.litmap svg a:hover rect { fill-opacity: .26; }
.litmap svg a:focus-visible rect { outline: 2px solid var(--focus); outline-offset: 2px; }
.litmap figcaption { margin-top: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .key { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.refs { list-style: none; margin: 8px 0 0; padding: 0; font-size: .9rem; color: var(--muted); max-width: 62ch; }
.refs li { padding-left: 1rem; text-indent: -1rem; }
.refs a { color: var(--ink); }
.paper { margin-top: 14px; font-size: .9rem; color: var(--muted); max-width: 62ch; }
.paper a { color: var(--ink); }
.paper .cite { display: block; margin-bottom: 3px; }
.paper .oa { white-space: nowrap; }
.paper .oa::before { content: "·"; margin: 0 .4rem; }
.paper .disclosure { display: block; margin-top: 5px; }

/* Archive */
.archive { padding-block: 26px 40px; }
.archive .panel { padding: 22px 28px 26px; }
.archive h1 { font-family: var(--font-serif); font-weight: 400; font-size: 34px; letter-spacing: -.03em; margin: 0 0 4px; }
.archive .intro { margin: 0 0 18px; max-width: 62ch; color: var(--muted); }
.archive h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -.03em;
  margin: 34px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
  scroll-margin-top: 16px;
}
.archive h2.alz { color: var(--slate-blue); }
.archive h2.pain { color: var(--coral); }
.archive h3 { margin: 24px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--hairline); scroll-margin-top: 16px; }
.archive .entries { max-width: 60rem; }
.archive .none { padding: 8px 0; color: var(--muted); font-style: italic; font-size: .9rem; margin: 0; }

/* Footer: navy, with the logo and the author */
.site-footer { background: var(--navy); color: #dbe1e6; margin-top: 16px; }
.site-footer .wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px 40px;
  padding-block: 28px 32px;
}
.footer-logo { width: 225px; height: auto; }
.bio { max-width: 62ch; }
.bio h3 { margin: 0 0 6px; font-family: var(--font-serif); font-weight: 400; font-size: 19px; color: #f0ece7; }
.bio p { margin: 0; font-size: 14px; line-height: 1.7; }
.contact { margin: 10px 0 0 !important; font-size: 14px; }
.contact a { color: #f0ece7; text-underline-offset: 3px; overflow-wrap: anywhere; }
.footer-meta { text-align: right; align-self: center; }
.footer-meta p { margin: 0 0 10px; color: #b4c0cb; font-size: 11px; letter-spacing: .025em; }
.footer-meta a { color: #dbe1e6; font-size: 11px; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.footer-meta a + a { margin-left: 14px; }

/* Narrow screens */
@media (max-width: 47.9rem) {
  body::before, body::after { opacity: .62; width: 70%; }
  .site-header .wrap { padding-block: 18px 8px; gap: 12px; }
  .header-topics { max-width: 110px; line-height: 1.7; letter-spacing: .08em; }
  .header-topics span, .header-topics a { display: block; }
  .topic-divider { display: none; }
  .hero-logo { width: 240px; }
  .reading-depths li { padding: 0 6px; }
  .reading-time { font-size: clamp(15px, 4.3vw, 21px); }
  .reading-purpose { font-size: 11px; }
  .ribbon .wrap { flex-wrap: wrap; gap: 8px 16px; }
  .ribbon-label { font-size: 13px; }
  .ribbon-neuron { display: none; }
  .ribbon-fields { flex-basis: 100%; grid-template-columns: minmax(0, 1fr); }
  .ribbon-fields > :nth-child(1) { grid-area: 1 / 1; }
  .ribbon-fields > :nth-child(2) { grid-area: 2 / 1; }
  .ribbon-fields > :nth-child(3) { grid-area: 3 / 1; }
  .ribbon-fields > :nth-child(4) { grid-area: 4 / 1; }
  .ribbon-next { padding-left: 0; border-left: 0; flex-direction: row; align-items: baseline; gap: 8px; text-align: left; margin-left: auto; }
  .desks { grid-template-columns: 1fr; }
  .desk { padding: 16px 16px 20px; }
  .sentence { font-size: 1.1rem; }
  .site-footer .wrap { grid-template-columns: 1fr; gap: 18px; }
  .footer-logo { width: 180px; }
  .footer-meta { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
