/* Layout: a fluid page that uses the screen. Wide screens get two columns
   (a side column for the photo / page intro, a main column for lists);
   tablets and phones fold into one column. Dated "ledger" rows (date on
   the left, entry on the right) carry news, papers, courses and events. */
:root {
  --paper:   #faf6ef;   /* page */
  --sheet:   #f2eadd;   /* highlighted boxes */
  --ink:     #2a2420;   /* text */
  --pencil:  #6d6157;   /* secondary text */
  --rule:    #e3d8c8;   /* hairlines */
  --clay:    #a94f2b;   /* accent: links, marks */
  --clay-2:  #8a3d1f;   /* accent hover */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter", Georgia, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --page:    88rem;                         /* widest the page gets */
  --gutter:  clamp(20px, 4vw, 64px);        /* side margin, grows with screen */
  --side:    clamp(15rem, 24vw, 21rem);     /* side column on wide screens */
  --gap:     clamp(2.5rem, 5vw, 6rem);      /* between the two columns */
  --read:    68ch;                          /* longest comfortable line */

  --step--1: 0.8rem;
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1:  1.3rem;
  --step-2:  clamp(1.35rem, 1.2rem + 0.6vw, 1.7rem);
  --step-3:  clamp(2rem, 1.6rem + 1.6vw, 2.9rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1916; --sheet: #28221d; --ink: #ece4d8; --pencil: #a99c8d;
    --rule: #3a322b; --clay: #e08c62; --clay-2: #f0a881; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1d1916; --sheet: #28221d; --ink: #ece4d8; --pencil: #a99c8d;
  --rule: #3a322b; --clay: #e08c62; --clay-2: #f0a881; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.65 var(--serif);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

a { color: var(--clay); text-decoration: underline; text-decoration-thickness: 1px;
    text-underline-offset: 0.18em; text-decoration-color: color-mix(in srgb, var(--clay) 40%, transparent); }
a:hover { color: var(--clay-2); text-decoration-color: currentColor; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-weight: 400; line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-0); }
p  { margin: 0; }
.prose { display: grid; gap: 1em; max-width: var(--read); }

.label {
  font: 500 var(--step--1)/1.3 var(--sans);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--pencil);
}

/* ---------- header ---------- */
.site-head .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 2rem; padding-block: 1.5rem 0.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink);
         text-decoration: none; font-size: 1.1rem; }
.brand:hover { color: var(--ink); }
.brand svg { width: 26px; height: 26px; color: var(--pencil); flex: none; }
.brand svg .opt { fill: var(--clay); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem clamp(1rem, 2vw, 1.75rem); }
.site-nav a { font: 500 0.92rem/1 var(--sans); color: var(--pencil); text-decoration: none;
              padding-block: 0.45rem; border-bottom: 1.5px solid transparent; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--clay); }

/* ---------- page layout ---------- */
main.wrap { padding-block: clamp(1.75rem, 4vw, 3.5rem) clamp(3rem, 6vw, 5rem); }
.layout { display: grid; gap: 3rem; }
.side, .main { display: grid; gap: 2.25rem; align-content: start; min-width: 0; }
.main { gap: 3.25rem; }
section { display: grid; gap: 1.25rem; min-width: 0; }
.page-title { display: grid; gap: 0.9rem; }
.page-title .prose { color: var(--pencil); }

@media (min-width: 960px) {
  .layout { grid-template-columns: var(--side) minmax(0, 1fr); column-gap: var(--gap); }
}

/* ---------- home ---------- */
/* Phones: photo, name, intro, contact, teaching, news — one column.
   Tablets: small photo beside the name. Wide: photo and contact on the side. */
.home { display: grid; gap: 2rem; }
.home .side, .home .main { display: contents; }
.home .portrait { grid-area: photo; }
.home .who      { grid-area: who; }
.home .about    { grid-area: about; }
.home .contact  { grid-area: contact; }
.home .now-box  { grid-area: now; }
.home .rest     { grid-area: rest; display: grid; gap: 3.25rem; min-width: 0; }
.home { grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "photo" "who" "about" "contact" "now" "rest"; }
@media (min-width: 600px) and (max-width: 959.98px) {
  .home { grid-template-columns: 10rem minmax(0, 1fr); column-gap: 2rem;
          grid-template-areas: "photo who" "about about" "contact contact" "now now" "rest rest"; }
  .home .who { align-self: end; }
}
@media (min-width: 960px) {
  .home { grid-template-columns: var(--side) minmax(0, 1fr); column-gap: var(--gap); align-items: start; }
  .home .side, .home .main { display: grid; align-content: start; min-width: 0; }
  .home .side { gap: 1.75rem; }
  .home .main { gap: 2rem; }
  .home .side > *, .home .main > * { grid-area: auto; }
}

.portrait { margin: 0; width: 100%; max-width: 12rem; aspect-ratio: 4 / 5;
            border-radius: 6px; overflow: hidden; background: var(--sheet);
            box-shadow: 0 0 0 1px var(--rule); }
@media (min-width: 960px) { .portrait { max-width: 100%; } }
.portrait { position: relative; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .alt-photo { position: absolute; inset: 0; opacity: 0; background: var(--sheet); transition: opacity 0.35s ease; }
.portrait.has-alt { cursor: pointer; }
.portrait.has-alt:hover .alt-photo, .portrait.flipped .alt-photo { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .portrait .alt-photo { transition: none; } }
.portrait .initials { width: 100%; height: 100%; display: grid; place-items: center;
                      font-size: clamp(2.2rem, 4vw, 3.4rem); color: var(--pencil); letter-spacing: 0.04em; }
.who { display: grid; gap: 0.5rem; }
.affil { color: var(--pencil); font-style: italic; }

.contact { margin: 0; display: grid; gap: 0.9rem; font-size: 0.95rem; line-height: 1.5;
           grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
@media (min-width: 960px) { .contact { grid-template-columns: 1fr; padding-top: 0; } }
.contact div { display: grid; gap: 0.15rem; min-width: 0; align-content: start; }
.contact dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- ledger rows (news, papers, courses, events) ---------- */
.ledger { list-style: none; margin: 0; padding: 0; display: grid; }
.ledger > li { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.25rem 1.5rem;
               padding-block: 1rem; border-top: 1px solid var(--rule); }
.ledger > li:last-child { border-bottom: 1px solid var(--rule); }
.ledger .when { font: 500 0.82rem/1.9 var(--sans); color: var(--pencil);
                letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.ledger .what { min-width: 0; display: grid; gap: 0.25rem; max-width: var(--read); }
.ledger.events > li { grid-template-columns: 9.5rem minmax(0, 1fr); }

details.more { margin-top: -0.25rem; }
details.more > summary { cursor: pointer; width: fit-content; color: var(--clay);
                         font: 500 0.9rem/1 var(--sans); padding-block: 0.6rem; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; }
details.more[open] > summary::before { content: "\2212  "; }
details.more > .ledger > li:first-child { border-top: 0; }

/* papers */
.paper-title { font-size: 1.1em; line-height: 1.35; text-wrap: pretty; }
.paper-title a { color: var(--ink); text-decoration-color: var(--rule); }
.paper-title a:hover { color: var(--clay); text-decoration-color: currentColor; }
.authors { color: var(--pencil); font-size: 0.95em; }
.authors .me { color: var(--ink); }
.venue { font-style: italic; font-size: 0.95em; }
.meta-line { color: var(--pencil); font-size: 0.95em; }
.links { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; margin-top: 0.15rem; }
.links a { font: 500 0.78rem/1.6 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
           text-decoration: none; }
.links a:hover { text-decoration: underline; }

.jump { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; font-size: 0.95rem; }
.jump .n { color: var(--pencil); font: 500 0.8rem var(--sans); margin-left: 0.4rem; }

/* courses */
.course-code { font: 500 0.85rem/1.9 var(--sans); letter-spacing: 0.03em; color: var(--pencil);
               font-variant-numeric: tabular-nums; white-space: nowrap; }
.terms { color: var(--pencil); font-size: 0.95em; }

.now { background: var(--sheet); border-radius: 8px; padding: 1.2rem 1.35rem;
       display: grid; gap: 0.85rem; }
.now ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.now li { display: grid; gap: 0.05rem; }
.now .prose { gap: 0.8em; font-size: 0.95em; }
.now .prose strong { font-weight: 600; }
.now .course-name { font-size: 1.08em; line-height: 1.35; }

.place { display: grid; gap: 0.6rem; }

/* people */
.people { list-style: none; margin: 0; padding: 0; display: grid;
          grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1.4rem 2rem; }
.people li { display: grid; gap: 0.1rem; min-width: 0; align-content: start; }
.people .person { font-size: 1.1em; }
.people .meta { color: var(--pencil); font-size: 0.95em; }
.people.faculty { grid-template-columns: 1fr; gap: 0.9rem; }
.empty { color: var(--pencil); font-style: italic; max-width: var(--read); }

/* email: the @ is drawn here so the page text never holds a full address */
.email { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
.email .addr { overflow-wrap: anywhere; }
.email .at::before { content: "\0040"; }
.email .copy { font: 500 0.72rem/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
               color: var(--clay); background: transparent; border: 1px solid var(--rule);
               border-radius: 999px; padding: 0.3rem 0.6rem; cursor: pointer; }
.email .copy:hover { border-color: var(--clay); }
.email .copy:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }

#advising { gap: 1.5rem; scroll-margin-top: 1.5rem; }
.note { color: var(--pencil); max-width: var(--read); border-top: 1px solid var(--rule); padding-top: 1.25rem; }

/* poem */
.poem { margin: 0; padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 3vw, 2.25rem);
        background: var(--sheet); border-radius: 8px; display: grid; gap: 1rem; max-width: 46rem; }
.poem-title { font-style: italic; font-size: var(--step-1); }
.poem blockquote { margin: 0; display: grid; gap: 1.1em; }
.poem blockquote p { display: grid; }
.poem .line { padding-left: 1.5em; text-indent: -1.5em; line-height: 1.55; }
.poem figcaption { color: var(--pencil); font: 400 0.9rem/1.4 var(--sans); }
.poem figcaption::before { content: "\2014\00a0"; }

/* footer */
.site-foot { border-top: 1px solid var(--rule); }
.site-foot .wrap { padding-block: 1.75rem 2.5rem; display: flex; flex-wrap: wrap;
                   justify-content: space-between; gap: 0.5rem 1.5rem;
                   color: var(--pencil); font: 400 0.85rem/1.6 var(--sans); }

.noscript { padding-block: 3rem; }

/* ---------- phones ---------- */
@media (max-width: 599.98px) {
  .site-nav { width: 100%; justify-content: space-between; gap: 0.25rem 0.75rem; }
  .site-nav a { font-size: 0.88rem; }
  .portrait { max-width: 8.5rem; }
  .ledger > li, .ledger.events > li { grid-template-columns: 1fr; }
  .ledger .when, .course-code { line-height: 1.5; }
}

@media (prefers-reduced-motion: no-preference) {
  main.wrap { animation: rise 0.35s ease-out both; }
  @keyframes rise { from { opacity: 0.6; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
