/* Docs-style layout: top bar, sticky contents sidebar on the left, content on the right. */
:root {
  --paper: #dfe5ed;
  --ink: #1f2a3d;
  --muted: #5d6a80;
  --rule: #c3ccd9;
  --heading: #1b2d52;
  --link: #24479b;
  --active-bg: #cdd6e3;
  --sidebar-w: 220px;
  --topbar-h: 58px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.7 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.toplinks { display: flex; gap: 20px; font-size: 0.9rem; }
.toplinks a { color: var(--muted); text-decoration: none; }
.toplinks a:hover { color: var(--ink); }

/* Sidebar + content */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 760px);
  gap: 48px;
  padding: 0 24px;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 24px 0;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.sidebar a:hover { color: var(--ink); }
.sidebar a.active {
  background: var(--active-bg);
  color: var(--heading);
  font-weight: 600;
}

main { padding: 24px 0 64px; }

section { scroll-margin-top: calc(var(--topbar-h) + 16px); }
section + section { margin-top: 48px; }

/* Page header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 8px;
}
.crumb { margin: 0; font-size: 0.9rem; color: var(--muted); }
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--heading);
  margin: 4px 0 6px;
}
.role { margin: 0; color: var(--muted); }
.headshot {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

h2 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--heading);
  margin: 0 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

ul { list-style: none; margin: 0; padding: 0; }

.entries li + li { margin-top: 20px; }
.entries p { margin: 4px 0 0; }

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.row strong { font-weight: 600; }
.row span { color: var(--muted); white-space: nowrap; font-size: 0.9rem; }
.sub { color: var(--muted); font-size: 0.95rem; }

.pubs li { margin-bottom: 14px; font-size: 0.95rem; }
.pubs strong { font-weight: 600; }
.note { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
#pubs-meta { margin: -8px 0 16px; }

.tag {
  font-size: 0.75rem;
  background: var(--active-bg);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.plain li + li { margin-top: 8px; }
.plain li:has(.label) { display: flex; }
.label { flex: 0 0 112px; color: var(--muted); }

/* Photos: flex ratios match the image aspect ratios (3:4 and 4:3) so both are the same height */
.photos { display: flex; align-items: flex-start; gap: 20px; }
.photos figure { margin: 0; min-width: 0; }
.photos .portrait { flex: 3 1 0; }
.photos .landscape { flex: 5.33 1 0; }
.photos img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.photos figcaption { color: var(--muted); font-size: 0.85rem; padding: 6px 0; }

/* Contact form */
.contact {
  display: flex;
  flex-direction: column;
  max-width: 560px;
}
.contact label {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 14px 0 6px;
}
.contact label:first-of-type { margin-top: 0; }
.contact input,
.contact textarea {
  font: inherit;
  color: var(--ink);
  background: #f4f6f9;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 9px 12px;
}
.contact textarea { resize: vertical; min-height: 120px; }
.contact input:focus,
.contact textarea:focus {
  outline: 2px solid var(--link);
  outline-offset: 0;
  border-color: transparent;
}
.contact .hp { display: none; }
.hint { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.hint.over { color: #b3261e; font-weight: 600; }
.form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.contact button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--heading);
  border: 0;
  border-radius: 6px;
  padding: 9px 22px;
  cursor: pointer;
}
.contact button:hover { background: var(--link); }
.contact button:disabled { opacity: 0.6; cursor: default; }
.status { margin: 12px 0 0; font-size: 0.9rem; min-height: 1.4em; }
.status.ok { color: #1e6b3a; }
.status.error { color: #b3261e; }

footer {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}

/* Narrow screens: sidebar becomes a scrollable row under the top bar */
@media (max-width: 820px) {
  .layout { display: block; padding: 0 16px; }
  .sidebar {
    flex-direction: row;
    top: var(--topbar-h);
    z-index: 9;
    margin: 0 -16px;
    padding: 8px 16px;
    overflow-x: auto;
    max-height: none;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .sidebar a { white-space: nowrap; }
  .topbar { padding: 0 16px; }
  section { scroll-margin-top: calc(var(--topbar-h) + 64px); }
}

@media (max-width: 520px) {
  header { flex-direction: column-reverse; align-items: flex-start; }
  .headshot { width: 96px; height: 96px; }
  h1 { font-size: 2rem; }
  .row { flex-direction: column; gap: 0; }
  .photos { flex-direction: column; }
  .photos .portrait, .photos .landscape { flex: none; width: 100%; }
}
