  :root {
    --bg:     #ffffff;
    --text:   #111111;
    --muted:  #111111;
    --rule:   #e8e8e8;
    --accent: #7a231a;
    --accent-dark: #631a13;

    --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
    --sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --maxw: 1060px;
  }

  *, *::before, *::after { box-sizing: border-box; }

  html { scroll-behavior: smooth; }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16.5px;
    line-height: 1.62;
    font-weight: 440;
    text-rendering: optimizeLegibility;
  }

  a { color: inherit; }

  /* Focus rings: show only for keyboard navigation (not mouse clicks), and
     tint to the accent so it's never a stray blue box — e.g. on the dark-mode
     toggle. Keyboard users still get a clear, accessible indicator. */
  :focus:not(:focus-visible) { outline: none; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

  .page {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 44px 32px 0;
    display: flex;
    gap: 56px;
    align-items: flex-start;
  }

  /* ============================================================
     SIDEBAR — name above photo, contact, section nav
     ============================================================ */
  .sidebar { flex: 0 0 252px; position: sticky; top: 36px; text-align: center; }

  h1.name {
    font-family: var(--serif);
    font-weight: 600;              /* lighter than bold — larger size carries the presence */
    font-size: 1.9rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 16px;
  }

  .portrait img {
    width: 100%;
    height: auto;               /* override the img height attribute so aspect-ratio governs */
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
  }

  .contact { margin-top: 16px; }
  .contact-role { margin: 0; font-size: 1rem; color: var(--muted); line-height: 1.5; }
  .contact-line { margin: 6px 0 0; font-size: 1rem; color: var(--muted); }
  .contact-mail {
    font-size: 1rem;
    color: var(--muted);
    text-decoration: none;
    word-break: break-word;
    transition: color 0.2s ease;
  }
  .contact-mail:hover { color: var(--accent); }

  .socials { display: flex; gap: 10px; margin-top: 12px; justify-content: center; }
  .socials a {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1px solid var(--rule);
    color: var(--muted);
    transition: all 0.2s ease;
  }
  .socials a:hover { border-color: var(--accent); color: var(--accent); }
  .socials svg { width: 16px; height: 16px; }

  nav.side-nav { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 14px; text-align: left; }
  .side-nav a {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--muted);
    padding: 4px 0;
    transition: color 0.2s ease;
  }
  .side-nav a:hover { color: var(--accent); }
  .side-nav a .arr { font-size: 0.8em; }

  /* dark-mode toggle — sits right under the nav links */
  .theme-toggle {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid var(--rule);
    background: none;
    font-family: var(--sans);
    font-size: 0.8rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease;
  }
  .theme-toggle:hover { color: var(--accent); }
  .theme-toggle .tg-icon { margin-right: 7px; }

  /* ============================================================
     CONTENT
     ============================================================ */
  main.content { flex: 1; min-width: 0; max-width: 690px; }

  .about p {
    margin: 0 0 12px;
    max-width: 62ch;
  }
  .about .about-secondary { color: var(--muted); }
  .about a {
    color: var(--accent);
    text-decoration: none;
  }
  .about a:hover { color: var(--accent-dark); text-decoration: underline; }

  /* ---- section headings: serif black caps, hairline rule underneath ---- */
  .section-head {
    margin: 30px 0 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
  }
  .section-head h2 {
    font-family: var(--serif);
    font-weight: 700;           /* a touch heavier than the 600 paper titles → clear rank */
    font-size: 1.02rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;     /* barely-there tracking */
    color: var(--text);
    margin: 0;
    white-space: nowrap;
  }
  .section-head .rule { display: none; }   /* underline is the border-bottom now */
  /* a page whose content opens with a section heading (e.g. LSE AMP) aligns
     that heading with the top of the sidebar name */
  .content > .section-head:first-child { margin-top: 0; }

  /* ============================================================
     PAPER ENTRIES
     ============================================================ */
  .paper {
    position: relative;
    padding: 7px 14px;
    margin: 0 -14px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
  }
  /* hover shading only on real pointer devices — avoids sticky :hover on touch */
  @media (hover: hover) { .paper:hover { background-color: #f7f7f7; } }
  /* entries are separated by whitespace only — no rules between papers */

  .paper-title {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--accent);
    margin: 0 0 3px;
  }

  .paper-detail {
    font-size: 1rem;
    color: var(--muted);
    margin: 0;   /* open abstract supplies its own top gap; no stray space when closed */
  }

  /* action links (Link / Slides / Abstract) inline on the detail line,
     dot-separated; a soft rounded box appears on hover for affordance */
  .paper-detail a,
  .paper-detail .abstract-toggle {
    display: inline-block;       /* uniform box: same height for Link / Slides / Abstract */
    vertical-align: baseline;
    color: var(--accent);
    font: inherit;
    line-height: 1.4;
    background: none;
    border: 0;
    /* 6px side padding for the hover box, cancelled by -6px margin so the box
       adds NO horizontal footprint — dots sit the same distance from every
       glyph, padded link or plain text alike */
    padding: 1px 6px;
    margin: 0 -6px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
  }
  @media (hover: hover) {
    .paper-detail a:hover,
    .paper-detail .abstract-toggle:hover { background-color: rgba(122, 35, 26, 0.08); }
  }
  .paper-detail .abstract-toggle.open { background-color: rgba(122, 35, 26, 0.10); }

  /* the "+" affordance on the Abstract toggle (rotates to × when open) */
  .paper-detail .abstract-toggle .icon {
    display: inline-block;
    margin-left: 3px;
    line-height: 1;             /* keep the icon from inflating the button's box height */
    font-weight: 400;
    transition: transform 0.25s ease;
  }
  .paper-detail .abstract-toggle.open .icon { transform: rotate(45deg); }

  /* forthcoming entries: gray, non-active */
  .paper-detail .abstract-toggle.pending { color: #9a9a9a; }
  .paper-detail .abstract-toggle.pending.open { background-color: rgba(0, 0, 0, 0.05); }
  @media (hover: hover) {
    .paper-detail .abstract-toggle.pending:hover { background-color: rgba(0, 0, 0, 0.05); }
  }
  .paper-detail .pending-note {
    color: #9a9a9a;
    font-style: italic;
  }

  .paper-detail .sep { color: var(--muted); margin: 0 0.15em; }

  /* ---- abstract fold-out: expands in place below the buttons ---- */
  .abstract {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin-top 0.3s ease;
  }
  .abstract.open { max-height: 1200px; opacity: 1; margin-top: 10px; }
  .abstract-inner {
    background: #f7f7f7;
    border: 1px solid var(--rule);
    border-left: 2px solid var(--accent);
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
  }

  /* ---- prose sections (LSE AMP) ---- */
  .section-note { max-width: 66ch; margin: 6px 0 0; }
  .section-note a { color: var(--accent); text-decoration: none; }
  .section-note a:hover { color: var(--accent-dark); text-decoration: underline; }

  /* ============================================================
     FOOTER
     ============================================================ */
  footer {
    margin-top: 60px;
    border-top: 1px solid var(--rule);
    background: #f7f6f4;
  }
  .foot-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 30px 32px;
    display: flex;
    align-items: flex-start;
    gap: 56px;
    flex-wrap: wrap;
  }
  .foot-id { flex: 0 0 252px; }
  .foot-address { flex: 1; min-width: 240px; }
  .foot-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
  .foot-mail { display: block; font-size: 1rem; color: var(--muted); text-decoration: none; margin-top: 4px; }
  .foot-mail:hover { color: var(--accent); }
  .foot-address { font-style: normal; font-size: 1rem; color: var(--muted); line-height: 1.6; }

  /* ============================================================
     RESPONSIVE
     ============================================================ */
  @media (max-width: 820px) {
    .page { flex-direction: column; gap: 28px; padding-top: 32px; }
    .sidebar { position: static; width: 100%; }
    h1.name { margin-bottom: 12px; }
    .portrait img { max-width: 200px; margin: 0 auto; }
    nav.side-nav { padding-top: 12px; }
    .side-nav a { display: inline-block; padding: 3px 8px; }
    .theme-toggle { padding: 12px 8px 0; }   /* match the 8px inset of the nav chips */
    main.content { max-width: none; }
    .paper { padding: 7px 0; margin: 0; }
    .paper:hover { background: none; }
  }
  @media (max-width: 520px) {
    .page { padding-left: 22px; padding-right: 22px; }
    body { font-size: 16px; }
    h1.name { font-size: 1.5rem; }
    .section-head h2 { font-size: 1rem; }
    .paper-title { font-size: 1.04rem; }
    .section-head { margin: 24px 0 4px; }
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .abstract { transition: none; }
  }

  /* ============================================================
     AMP PAGE — resource groups (links list under labelled groups)
     ============================================================ */
  .amp-lead p { margin: 0 0 12px; max-width: 66ch; }
  .amp-lead a { color: var(--accent); text-decoration: none; }
  .amp-lead a:hover { color: var(--accent-dark); text-decoration: underline; }

  .res-group { margin: 0 0 18px; }
  .res-group:last-child { margin-bottom: 0; }
  .res-label {
    font-weight: 600;
    margin: 0 0 5px;
  }

  /* diamond-bulleted lists for references and resources */
  .ref-list, .res-list { list-style: none; margin: 0; padding: 0; max-width: 66ch; }
  .ref-list li, .res-list li {
    position: relative;
    padding-left: 20px;
    margin: 0 0 6px;
  }
  .ref-list li:last-child, .res-list li:last-child { margin-bottom: 0; }
  .ref-list li::before, .res-list li::before {
    content: "\25C6";              /* ◆ small diamond, echoes IBM's geometric marks */
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.6em;
    line-height: 2.7;              /* ≈ body line-height ÷ 0.6, centers the glyph on the first line */
    color: var(--accent);
  }
  .ref-list a, .res-list a { color: var(--accent); text-decoration: none; }
  .ref-list a:hover, .res-list a:hover { color: var(--accent-dark); text-decoration: underline; }

  /* ============================================================
     DARK MODE  (toggled via [data-theme="dark"] on <html>)
     Stark white fonts on a dark surface; maroon accent lifted to a
     lighter clay so it stays visible on dark.
     ============================================================ */
  :root[data-theme="dark"] {
    --bg:          #101113;   /* dark surface        */
    --text:        #ffffff;   /* stark white         */
    --muted:       #ffffff;   /* white, not gray     */
    --rule:        #34353a;   /* hairline on dark    */
    --accent:      #e59079;   /* light clay (maroon lifted for contrast) */
    --accent-dark: #f0ab97;
  }
  :root[data-theme="dark"] .abstract-inner { background: #212327; border-color: #34353a; border-left-color: var(--accent); }
  :root[data-theme="dark"] footer { background: #131417; }
  @media (hover: hover) {
    :root[data-theme="dark"] .paper:hover { background-color: #212327; }
    :root[data-theme="dark"] .paper-detail a:hover,
    :root[data-theme="dark"] .paper-detail .abstract-toggle:hover { background-color: rgba(229, 144, 121, 0.16); }
  }
  :root[data-theme="dark"] .paper-detail .abstract-toggle.open { background-color: rgba(229, 144, 121, 0.20); }
  :root[data-theme="dark"] .abstract-toggle.pending,
  :root[data-theme="dark"] .paper-detail .pending-note { color: #b3b3b3; }
