/* =================================================================
   TOKENS
   A close free substitute for the reference site's licensed serif
   (Heliotrope/Valkyrie/Triplicate, by Matthew Butterick). If you own
   a license, add @font-face rules for those and point --font-serif /
   --font-mono at them.
   ================================================================= */
:root {
  --bg: #fbe7ea;
  --surface: #f6dbe0;
  --ink: #17140f;
  --muted: #767068;
  --accent: #a3342f;
  --accent-hover: #7c211d;
  --line: #e3c3c9;

  --font-serif: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --content-width: 1222px;
  --sidebar-width: 210px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="light"]) {
    --bg: #fbe7ea;
    --surface: #f6dbe0;
    --ink: #211c15;
    --muted: #9c9186;
    --accent: #d97b6c;
    --accent-hover: #e59686;
    --line: #e3c3c9;
  }
}

:root[data-theme="light"] {
  --bg: #fbe7ea;
  --surface: #f6dbe0;
  --ink: #211c15;
  --muted: #9c9186;
  --accent: #d97b6c;
  --accent-hover: #e59686;
  --line: #e3c3c9;
}

/* =================================================================
   RESET / BASE
   ================================================================= */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.6 var(--font-serif);
  -webkit-font-smoothing: antialiased;
}

p { margin: 0 0 20px; }
p { hyphens: auto; text-align: justify; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover, a:focus-visible { color: var(--accent-hover); text-decoration: underline; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 0.75em 1em;
  z-index: 100;
}
.skip-link:focus { left: 1em; top: 1em; }

a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
}

/* =================================================================
   NAV — fixed italic sidebar on desktop, top bar under 900px
   ================================================================= */
.sidebar {
  position: fixed;
  left: 80px;
  top: 60px;
  width: var(--sidebar-width);
  font-style: italic;
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar li { margin-bottom: 10px; }
.sidebar a {
  color: var(--muted);
  text-decoration: none;
  font-size: 21px;
}
.sidebar a:hover,
.sidebar a:focus-visible,
.sidebar a.active {
  color: var(--accent);
}

.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  font-style: italic;
  z-index: 100;
  box-sizing: border-box;
}
.topbar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}
.topbar a { color: var(--muted); text-decoration: none; font-size: 18px; }
.topbar a:hover,
.topbar a:focus-visible,
.topbar a.active { color: var(--accent); }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { display: block; }
  .wrapper {
    padding-top: 84px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* =================================================================
   LAYOUT
   ================================================================= */
.wrapper {
  max-width: var(--content-width);
  margin: 0;
  margin-left: max(
    calc(var(--sidebar-width) + 80px),
    calc((100vw - var(--content-width)) / 2)
  );
  padding: 64px 24px 40px 0;
}

.section { scroll-margin-top: 2rem; }

/* =================================================================
   ABOUT HEADER — two columns: portrait left, name/bio right
   ================================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 360px 560px;
  justify-content: center;
  gap: 50px;
}

.portrait-col {
  margin-top: 12px;
}

.portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.header-block {
  margin-bottom: 24px;
  line-height: 1.5;
}

.name {
  font-size: 28px;
  display: block;
  margin-top: 6px;
  margin-bottom: 2px;
  line-height: 1.2;
}

.role {
  display: block;
  font-size: 21px;
  line-height: 1.3;
  margin-top: 4px;
  margin-bottom: 4px;
}

.icon-links {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  margin-top: 12px;
}
.icon-links a { color: var(--muted); display: inline-flex; }
.icon-links a:hover,
.icon-links a:focus-visible { color: var(--accent); }
.icon-links svg { width: 30px; height: 30px; }
.icon-links a[aria-label="Google Scholar"] svg { width: 38px; height: 38px; position: relative; top: -3px; }

@media (max-width: 640px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .portrait {
    width: 130px;
    aspect-ratio: 1 / 1;
  }
}

/* =================================================================
   SECTION HEADINGS — quiet rule divider
   ================================================================= */
h4 {
  font-size: 28px;
  font-weight: 700;
  font-style: normal;
  width: min(970px, 100%);
  margin: 70px 0 26px max(0px, calc((100% - 970px) / 2));
  padding: 10px 0 9px;
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  color: var(--muted);
}
.section:first-of-type h4 { margin-top: 0; }

/* =================================================================
   ENTRIES — experience / projects / education rows
   ================================================================= */

.entry {
  width: min(970px, 100%);
  margin: 0 0 26px max(0px, calc((100% - 970px) / 2));
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.entry-last {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.chip-entry {
  display: grid;
  grid-template-columns: 560px 360px;
  justify-content: center;
  align-items: start;
  gap: 12px 50px;
}
.chip-entry .entry-head {
  grid-column: 1 / -1;
}
.chip-entry p:last-of-type {
  margin-bottom: 0;
}

.chip-photo {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
}

@media (max-width: 640px) {
  .chip-entry {
    grid-template-columns: 1fr;
  }
}
.resources-entry {
  width: min(970px, 100%);
  margin-left: max(0px, calc((100% - 970px) / 2));
}
.entry-head {
  margin-bottom: 6px;
  font-size: 21px;
}
.entry-title { font-weight: 700; }
.accent { color: var(--accent); }

.entry-when {
  color: var(--muted);
  font-style: italic;
  font-size: 15px;
  margin-left: 8px;
}

.entry p:last-child { margin-bottom: 0; }

.entry-stack {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-style: italic;
  font-size: 15px;
}

.contact-text {
  width: min(970px, 100%);
  margin-left: max(0px, calc((100% - 970px) / 2));
}

/* =================================================================
   FOOTER
   ================================================================= */
.footer {
  width: min(970px, 100%);
  margin: 70px 0 0 max(0px, calc((100% - 970px) / 2));
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.footer p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  text-align: center;
}

/* =================================================================
   RESPONSIVE
   ================================================================= */
@media (max-width: 560px) {
  body { font-size: 17px; }
  .wrapper { padding-left: 20px; padding-right: 20px; }
  .name { font-size: 24px; }
  h4 { margin-top: 50px; }
}
