/* Dark theme on every device, whatever the visitor's system setting */
:root {
  color-scheme: dark;
  --bg: #16181c;
  --text: #e6e6e6;
  --muted: #a0a4ab;
  --accent: #8ab4f8;
  --rule: #2e3238;
  --serif: "Charter", "Iowan Old Style", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Page layout: sidebar left, content right, full window width; stacks on narrow screens */
.layout {
  padding: 0 16px;
}

@media (min-width: 760px) {
  .layout {
    display: grid;
    grid-template-columns: clamp(12rem, 22vw, 15rem) minmax(0, 1fr);
    grid-template-areas:
      "side main"
      "side foot";
    column-gap: clamp(2rem, 4vw, 5rem);
    padding: 0 clamp(2rem, 5vw, 5rem);
  }
  .sidebar {
    grid-area: side;
    position: sticky;
    top: 0;
    align-self: start;
    padding: 3rem 0;
  }
  main { grid-area: main; }
  .site-footer { grid-area: foot; }
}

/* Sidebar */
.sidebar {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 760px) {
  .sidebar { border-bottom: 0; }
}
.site-name {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}
.site-name a { color: var(--text); }
.site-name a:hover { text-decoration: none; }
.role { color: var(--muted); margin: 0.4rem 0 0.75rem; font-size: 0.95rem; }
.contact { margin: 0 0 0.75rem; font-size: 0.95rem; overflow-wrap: anywhere; }

.links, nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.95rem; margin-bottom: 0.75rem; }
.links:not(:has(li:not([hidden]))) { display: none; }

nav ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
nav a { color: var(--muted); }
nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

@media (min-width: 760px) {
  nav { border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 0.5rem; }
  nav ul { flex-direction: column; gap: 0.4rem; }
}

/* Main content */
main { padding: 2rem 0 3rem; }
@media (min-width: 760px) {
  main { padding-top: 3rem; }
}
main > :first-child { margin-top: 0; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.3; }
h1 { font-size: 2rem; margin: 0 0 0.25rem; }
h2 {
  font-size: 1.3rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.1rem; margin: 0; }

.jm-banner {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.9rem;
}
.lead { font-size: 1.1rem; }

/* Home intro: About text left, photo panel right */
.intro { display: flex; align-items: flex-start; gap: 2.5rem; }
.intro > div { flex: 1; min-width: 0; }
.portrait {
  flex-shrink: 0;
  width: 34%;
  max-width: 28rem;
  height: auto;
  margin-top: 0.4rem;
  border-radius: 6px;
}
@media (min-width: 760px) {
  .portrait { width: 30%; }
}

/* Paper and item entries */
.paper { margin: 0 0 1.75rem; }
.paper p { margin: 0.25rem 0; }
.authors, .venue { color: var(--muted); }
.paper-links a + a::before {
  content: "·";
  color: var(--muted);
  margin: 0 0.5rem;
}
details summary {
  cursor: pointer;
  color: var(--accent);
  margin-top: 0.25rem;
}
details p { margin-top: 0.5rem; }

.plain-list { padding-left: 1.2rem; }
.plain-list li { margin-bottom: 0.4rem; }
.term { color: var(--muted); }

/* Placeholder for a file not yet posted ("coming soon") */
.soon { color: var(--muted); font-style: italic; }

/* Course materials: collapsible section with numbered notebook lists */
.course > summary { list-style: none; color: inherit; margin: 0; }
.course > summary::-webkit-details-marker { display: none; }
.course > summary h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.course > summary h2::after {
  content: "Click to expand ▸";
  flex-shrink: 0;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.course[open] > summary h2::after { content: "Click to collapse ▾"; }
.course > summary:hover h2::after { background: var(--rule); }
.course > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.course h3 { margin: 2rem 0 0.5rem; }
.note { color: var(--muted); font-size: 0.95rem; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--rule);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.materials {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.materials li {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  column-gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.materials .num {
  color: var(--muted);
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
}
.materials .tag {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.85rem;
}
.materials .companion > a { padding-left: 1rem; }
.materials .companion .tag { padding-left: 1rem; }
@media (min-width: 760px) {
  .materials li { grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: baseline; }
  .materials .tag { grid-column: 3; text-align: right; }
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}
