/* ---------------------------------------------------------------
   Alberto Rodríguez Vázquez — site styles
   One stylesheet. No framework, no build step, no JavaScript.
   --------------------------------------------------------------- */

:root {
  --paper:  #fbfbf9;
  --ink:    #16181d;
  --muted:  #5d6472;
  --rule:   #e2e3de;
  --link:   #1a4fbf;
  --wash:   #eff3fc;

  /* Latin Modern is installed on most mathematicians' machines; the
     fallbacks keep the same colour and rhythm if it is not. */
  --serif: "Latin Modern Roman", "Charter", "Bitstream Charter", "Sitka Text",
           Cambria, Georgia, serif;
  --mono:  "Iosevka", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
           Consolas, "Liberation Mono", monospace;

  --measure: 68ch;
  --rail: 5.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161a;
    --ink:   #e7e8e3;
    --muted: #99a0ac;
    --rule:  #2a2e36;
    --link:  #8fb2ff;
    --wash:  #1b2029;
  }
}

*, *::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: 1.0625rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* --- links ---------------------------------------------------- */

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { text-decoration: none; }

.byline a,
.venue a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.byline a:hover,
.venue a:hover {
  color: var(--link);
  border-bottom-color: var(--link);
}

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

/* --- masthead ------------------------------------------------- */

.masthead {
  padding: 3.25rem 0 0;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.masthead .standfirst {
  margin: 0.7rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- navigation ----------------------------------------------- */

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 1.5rem;
  margin-top: 1.9rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav li { margin-right: 1.7rem; }
nav li:last-child { margin-right: 0; }

nav a {
  display: inline-block;
  padding: 0.75rem 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

nav a:hover { color: var(--ink); }

nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--link);
}

/* language switch */
.lang {
  margin: 0;
  padding: 0.75rem 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--rule);
  white-space: nowrap;
}

.lang a {
  padding: 0.2rem 0.34rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 3px;
}

.lang a:hover { color: var(--ink); }

.lang a[aria-current="true"] {
  color: var(--link);
  background: var(--wash);
}

.lang span { padding: 0 0.1rem; }

@media (max-width: 46rem) {
  nav { justify-content: flex-start; }
  .lang { padding-top: 0; }
}

/* --- section headings ----------------------------------------- */

h2 {
  margin: 3rem 0 0;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.82rem;
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

h2:first-of-type { margin-top: 2.6rem; }

/* --- the year rail -------------------------------------------- */
/* Years sit in a rail because these lists really are chronological;
   the marker carries information rather than decoration.          */

.entry {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule);
}

.entry:last-child { border-bottom: 0; }

.year {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 0.28rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.4;
}

.byline,
.venue {
  margin: 0.25rem 0 0;
  font-size: 0.97rem;
  color: var(--muted);
}

.note {
  color: var(--muted);
  font-weight: 400;
}

.venue em { font-style: italic; }
.venue b  { font-weight: 600; color: var(--ink); }

/* --- link chips ----------------------------------------------- */

.links {
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
}

.links a {
  margin: 0.2rem 0.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--link);
  background: var(--wash);
  border-radius: 3px;
  padding: 0.16rem 0.5rem;
}

.links a:hover {
  background: var(--link);
  color: var(--paper);
}

/* --- home page ------------------------------------------------ */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  column-gap: 3rem;
  row-gap: 2.2rem;
  align-items: start;
  margin-top: 2.4rem;
}

/* explicit placement so the two diagrams share a row and align at the top */
.hero .lede         { grid-column: 1; grid-row: 1; }
.hero .portrait-fig { grid-column: 2; grid-row: 1; }
.hero .diagram      { grid-column: 1; grid-row: 2; }
.hero .e8-fig       { grid-column: 2; grid-row: 2; }

.hero p { margin: 0 0 1rem; max-width: var(--measure); }
.hero p:last-child { margin-bottom: 0; }

.figure {
  margin: 0;
  max-width: 17rem;
}

/* the diagram fills the text column beside the E8 mark */
.diagram {
  max-width: none;
  margin: 0;
}
.diagram .caption {
  max-width: 52ch;
  margin: 0.7rem auto 0;
  text-align: center;
}

.figure img,
.figure svg {
  display: block;
  width: 100%;
  height: auto;
}

.portrait { border-radius: 2px; }

.caption {
  margin: 0.6rem 0 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--muted);
}

/* --- people list ---------------------------------------------- */

.people {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 2.5rem;
}

.people li {
  break-inside: avoid;
  margin: 0 0 0.6rem;
  font-size: 0.97rem;
  line-height: 1.35;
}

.people .aff {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

@media (max-width: 46rem) {
  .people { columns: 1; }
}

/* --- contact -------------------------------------------------- */

.contact {
  margin: 0.8rem 0 0;
  font-size: 0.97rem;
  line-height: 1.7;
}
.contact .label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- footer --------------------------------------------------- */

footer {
  margin-top: 3.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* --- narrow screens ------------------------------------------- */

@media (max-width: 46rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2rem;
  }
  /* stack in reading order on narrow screens */
  .hero .lede,
  .hero .portrait-fig,
  .hero .diagram,
  .hero .e8-fig { grid-column: 1; grid-row: auto; }

  .figure { max-width: 15rem; }
  .diagram { max-width: 100%; }

  .entry {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .year {
    padding: 0 0 0.3rem;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
  }
}

/* --- print ---------------------------------------------------- */

@media print {
  :root { --paper: #fff; --ink: #000; --muted: #333; --link: #000; }
  nav, .e8, footer { display: none; }
  .entry { break-inside: avoid; border-bottom: 0; padding: 0.4rem 0; }
  .links a { background: none; padding: 0; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.7em;
    word-break: break-all;
  }
}
