/* ==========================================================================
   Personal academic site
   --------------------------------------------------------------------------
   Structure of this file:
     1. Tokens
     2. Reset and base type
     3. Page shell and identity rail
     4. Content: intro, sections, year-rail publication lists
     5. CV
     6. Responsive
     7. Print
   Only edit the tokens in section 1 to reskin the site.

   Typography note: this uses fonts already installed on the reader's
   machine — no webfont download, no third-party request, nothing to
   configure. Georgia is the plain, wide-set serif most academic
   department pages use.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  --paper:        #fafaf8;
  --ink:          #16202b;   /* blue-black, not grey */
  --ink-soft:     #3c4753;
  --muted:        #6b757f;
  --rule:         #e4e4de;
  --accent:       #1d5748;   /* deep green, the only colour on the page */
  --accent-strong:#123a2f;

  /* Georgia first; the rest are fallbacks for machines without it. */
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino,
           "Book Antiqua", "Times New Roman", serif;
  --sans:  "Segoe UI", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;

  --rail-col: 3.5rem;   /* year column beside publications */
  --cv-col:   5rem;     /* wider: CV entries carry date ranges */
  --rail-gap: 1.25rem;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #12171c;
    --ink:          #e7e5e0;
    --ink-soft:     #c3c3bd;
    --muted:        #8d959c;
    --rule:         #262d34;
    --accent:       #86bda9;
    --accent-strong:#a9d5c4;
  }
}

/* 2. Reset and base type --------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;          /* Georgia runs large; 16px reads like 17px */
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0 0 0.9em; }
h1, h2, h3 { font-weight: 400; margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  z-index: 10;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* 3. Page shell and identity rail ------------------------------------------ */

.page {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 40rem);
  column-gap: 4.5rem;
  max-width: 61rem;
  margin: 0 auto;
  padding: 5rem 2rem 8rem;
}

.rail {
  position: sticky;
  top: 5rem;
  align-self: start;
}

.identity {
  font-size: 1.4375rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.25rem;
}
.identity a { color: inherit; text-decoration: none; }
.identity a:hover { color: var(--accent); }

.identity-role {
  font-size: 0.875rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 1.6rem;
}

.portrait {
  width: 100%;
  aspect-ratio: 5 / 6;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.75rem;
}

.nav {
  font-size: 1rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.9rem;
  margin-bottom: 1.6rem;
}
.nav li { margin-bottom: 0.4rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--accent);
}

.contact {
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--muted);
}
.contact-top { border-top: 1px solid var(--rule); padding-top: 0.9rem; }
.contact a { color: var(--muted); text-decoration-color: var(--rule); }
.contact a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* 4. Content --------------------------------------------------------------- */

.main { min-width: 0; }

.page-title {
  font-size: 1.3125rem;
  margin-bottom: 2rem;
}

.intro { margin-bottom: 3.5rem; }

/* The opening statement is the loudest thing on the page: on an academic
   site the writing is the work, so it gets the largest type. */
.lead {
  font-size: 1.1875rem;
  line-height: 1.58;
  margin-bottom: 1.1em;
}
.intro p:not(.lead) { color: var(--ink-soft); }

.section { margin-bottom: 3.25rem; }

.section h2 {
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--ink-soft);
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.6rem;
}

.year { display: grid; grid-template-columns: var(--rail-col) minmax(0, 1fr); column-gap: var(--rail-gap); }
.year + .year { margin-top: 1.9rem; }

.year-label {
  font-size: 0.875rem;
  color: var(--muted);
  padding-top: 0.28rem;   /* aligns the year to the title's baseline */
}

.pub + .pub { margin-top: 1.4rem; }

.pub-title { margin: 0; line-height: 1.45; }

.pub-with { color: var(--muted); }

.pub-meta {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0.12rem 0 0;
}
.pub-meta em { font-style: italic; }

.pub-note {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0.35rem 0 0;
}

.secondary { color: var(--muted); white-space: nowrap; }
.secondary-link { color: var(--muted); text-decoration-color: var(--rule); }
.secondary-link:hover { color: var(--accent); text-decoration-color: currentColor; }

/* Lists with no year column stay on the same text edge as the ones that
   have it, so the whole page reads against one left margin. */
.plain-list { margin-left: calc(var(--rail-col) + var(--rail-gap)); }

.more {
  margin-top: 2rem;
  margin-left: calc(var(--rail-col) + var(--rail-gap));
  font-size: 0.9375rem;
}

/* 5. CV -------------------------------------------------------------------- */

.cv-header {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
}
.cv-updated { white-space: nowrap; }

.cv-entry { display: grid; grid-template-columns: var(--cv-col) minmax(0, 1fr); column-gap: var(--rail-gap); }
.cv-entry + .cv-entry { margin-top: 1.4rem; }

.print-only { display: none; }

/* 6. Responsive ------------------------------------------------------------ */

@media (max-width: 54rem) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    max-width: 42rem;
    padding: 3rem 1.5rem 5rem;
  }

  .rail {
    position: static;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule);
  }

  .portrait { width: 6.5rem; margin-bottom: 1.25rem; }

  .nav { border-top: 0; padding-top: 0; margin-bottom: 1rem; }
  .nav ul { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
  .nav li { margin-bottom: 0; }

  .contact { display: flex; flex-wrap: wrap; gap: 0 1rem; }

  .lead { font-size: 1.125rem; }

  /* Year above the entry rather than beside it */
  .year, .cv-entry { grid-template-columns: minmax(0, 1fr); }
  .year-label { padding-top: 0; margin-bottom: 0.4rem; }
  .cv-entry + .cv-entry { margin-top: 1.6rem; }
  .plain-list, .more { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 7. Print ----------------------------------------------------------------- */

@media print {
  @page { margin: 18mm 16mm; }

  body { background: #fff; color: #000; font-size: 10pt; line-height: 1.4; }

  .page { display: block; max-width: none; padding: 0; }
  .rail, .skip-link, .cv-header, .more { display: none; }

  .print-only { display: block; }
  .cv-print-head { margin-bottom: 1.4rem; }
  .cv-print-name { font-size: 16pt; font-weight: 700; margin: 0 0 0.2rem; }
  .cv-print-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.5rem;
    font-size: 9pt;
    color: #444;
    margin: 0;
  }

  /* A4 is narrower than the mobile breakpoint, so put the year column back
     and close the gaps the stacked layout leaves behind. */
  .year { grid-template-columns: var(--rail-col) minmax(0, 1fr); }
  .cv-entry { grid-template-columns: var(--cv-col) minmax(0, 1fr); }
  .year-label { padding-top: 0.15rem; margin-bottom: 0; font-size: 9pt; }
  .plain-list { margin-left: calc(var(--rail-col) + var(--rail-gap)); }
  .year + .year, .pub + .pub { margin-top: 0.5rem; }
  .cv-entry + .cv-entry { margin-top: 0.5rem; }
  .pub-meta, .pub-note { margin-top: 0; font-size: 9.5pt; }

  .page-title { display: none; }
  .section { margin-bottom: 1.4rem; }
  .section h2 { font-size: 11.5pt; color: #000; border-color: #bbb; margin-bottom: 0.7rem; }

  a { color: #000; text-decoration: none; }

  .section, .year, .cv-entry, .pub { break-inside: avoid; page-break-inside: avoid; }
}
