:root {
  color-scheme: light dark;
  --bg:        #FBFAF5;
  --surface:   #F4F1E8;
  --text:      #1B1A17;
  --muted:     #6E6A60;
  --rule:      #DFDACB;
  --accent:    #7A2E2A;
  --accent-soft: #A85B50;
  --underline: #BDBDBD;
}

/* Dark: applied when the reader's system asks for it, unless they chose light here. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg:      #121212;
  --surface: #1A1A1A;
  --text:    #E7E5E1;
  --muted:   #A3A09B;
  --rule:    #2B2B2B;
  --accent:  #E09B8E;
  --accent-soft: #C08376;
  --underline: #5C5C5C;
  }
}

/* Dark: applied when the reader chose it here, whatever the system says. */
:root[data-theme="dark"] {
  --bg:      #121212;
  --surface: #1A1A1A;
  --text:    #E7E5E1;
  --muted:   #A3A09B;
  --rule:    #2B2B2B;
  --accent:  #E09B8E;
  --accent-soft: #C08376;
  --underline: #5C5C5C;
}

/* ---- Base ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "EB Garamond", "Adobe Garamond Pro", Garamond, Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.55;
  font-feature-settings: "onum" 1, "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 47rem; margin: 0 auto; padding: 3.5rem 1.5rem 5rem; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--underline);
}
a:hover { text-decoration-color: var(--text); }
a.plain, .plain a { text-decoration: none; }
.plain a:hover { text-decoration: underline; text-decoration-color: var(--text); }

p { margin: 0 0 1.05em; }
em { font-style: italic; }

/* ---- Masthead ------------------------------------------------------- */
.masthead {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.6rem 1.5rem;
  padding-bottom: 1.1rem; margin-bottom: 2.6rem;
  border-bottom: 1px solid var(--rule);
}
.masthead .site-name {
  font-size: 1.05rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text); margin-right: auto;
}
.masthead nav { display: flex; gap: 1.4rem; }
.masthead nav a {
  font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.masthead nav a:hover { color: var(--text); }
.masthead nav a[aria-current="page"] { color: var(--text); text-decoration: underline; text-decoration-color: var(--text); text-underline-offset: 6px; }

/* ---- Home ----------------------------------------------------------- */
.intro { display: flex; gap: 2rem; align-items: flex-start; margin-bottom: 2rem; }
.portrait {
  width: 160px; flex: 0 0 160px; aspect-ratio: 3 / 4;
  object-fit: cover; border-radius: 2px;
  background: var(--surface); border: 1px solid var(--rule);
}
h1.name {
  font-size: 2.35rem; font-weight: 400; line-height: 1.1;
  margin: -0.25rem 0 0.4rem;
}
.strap { color: var(--muted); font-size: 1rem; font-style: italic; margin: 0; }

.elsewhere {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem;
  margin-top: 2.2rem; padding-top: 1.1rem; border-top: 1px solid var(--rule);
  font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.elsewhere a { color: var(--muted); }
.elsewhere a:hover { color: var(--text); }

/* ---- Sections & lists ----------------------------------------------- */
h2.section-head {
  font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  margin: 3rem 0 1.4rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
h2.section-head:first-child { margin-top: 0; }

.paper { margin-bottom: 1.9rem; }
.paper .title { font-size: 1.18rem; line-height: 1.3; display: block; margin-bottom: 0.15rem; }
.paper .title a { color: var(--text); }
.paper .meta { color: var(--muted); font-size: 0.95rem; font-style: italic; }
.paper .meta a { color: var(--muted); text-decoration: none; }
.paper .meta a:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--underline); }
.paper .links { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.3rem; }
.paper .links a { color: var(--muted); margin-right: 1rem; text-decoration: none; }
.paper .links a:hover { color: var(--text); text-decoration: underline; }

details.abstract { margin-top: 0.45rem; }
details.abstract > summary {
  cursor: pointer; list-style: none;
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); display: inline-block;
}
details.abstract > summary::-webkit-details-marker { display: none; }
details.abstract > summary::before { content: "+\00a0"; }
details.abstract[open] > summary::before { content: "\2013\00a0"; }
details.abstract > summary:hover { color: var(--text); }
details.abstract > p {
  margin: 0.7rem 0 0; padding: 0.9rem 1.1rem;
  background: var(--surface); border-left: 2px solid var(--rule);
  font-size: 0.95rem; line-height: 1.6; color: var(--text);
}

.entry { margin-bottom: 1.3rem; }
.entry .what { display: block; }
.entry .when { color: var(--muted); font-size: 0.92rem; font-style: italic; }

.report { display: flex; justify-content: space-between; gap: 1.5rem; padding: 0.42rem 0; }
.report .when { color: var(--muted); font-size: 0.86rem; white-space: nowrap; font-variant-numeric: oldstyle-nums; }

.note { color: var(--muted); font-size: 0.95rem; font-style: italic; margin-bottom: 1.6rem; }

/* ---- Mobile --------------------------------------------------------- */
@media (max-width: 34rem) {
  body { font-size: 18px; }
  .wrap { padding-top: 2.2rem; }
  .intro { flex-direction: column; gap: 1.2rem; }
  .portrait { width: 120px; flex-basis: auto; }
  h1.name { font-size: 2rem; }
  .report { flex-direction: column; gap: 0.1rem; }
}


/* ---- Theme toggle ---------------------------------------------------- */
/* Shows the theme currently in use; clicking switches to the other one. */
.theme-toggle {
  background: none; border: 0; cursor: pointer; line-height: 0;
  color: var(--muted);
  padding: 0.4rem; margin: -0.4rem -0.4rem -0.4rem 0;
  display: inline-flex; align-items: center;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; border-radius: 2px; }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; display: block; }

.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun  { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
:root[data-theme="dark"]  .theme-toggle .sun  { display: none; }
:root[data-theme="dark"]  .theme-toggle .moon { display: block; }
:root[data-theme="light"] .theme-toggle .sun  { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
