/* Tokens shared with alozanoroble.github.io/articles */
:root {
  --paper: #FCFBF8; --raised: #F4F3EE; --ink: #171B22; --muted: #5A6170;
  --rule: #DEDCD5; --accent: #0E6E68; --accent-soft: #E0EEEC;
  --pre: #8A5A16; --pre-soft: #F6EEE0;
  --serif: 'Spectral', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12151A; --raised: #191D24; --ink: #E6E9EC; --muted: #9AA3AE;
    --rule: #272D36; --accent: #57C1B8; --accent-soft: #12312F;
    --pre: #D9A441; --pre-soft: #2A2113;
  }
}
:root[data-theme="dark"] {
  --paper: #12151A; --raised: #191D24; --ink: #E6E9EC; --muted: #9AA3AE;
  --rule: #272D36; --accent: #57C1B8; --accent-soft: #12312F;
  --pre: #D9A441; --pre-soft: #2A2113;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 0.18em; }
a:hover { text-decoration: underline; }
.btn:hover, .feature:hover, .thumb:hover, .brand:hover, nav a:hover, .app h3 a:hover { text-decoration: none; }
em { font-style: italic; }

.wrap { max-width: 68rem; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* Header */
.top { border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 3.5rem; flex-wrap: wrap; }
.brand { font: 500 1.05rem var(--serif); color: var(--ink); text-decoration: none; }
nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
nav a:hover { color: var(--accent); }
@media (max-width: 560px) { nav { gap: 0.8rem; } nav a { font-size: 0.88rem; } .top { position: static; } }

/* Hero */
.hero { display: grid; gap: 2.5rem; padding-top: 3.5rem; padding-bottom: 2.5rem; align-items: start; }
@media (min-width: 880px) { .hero { grid-template-columns: 1.55fr 1fr; padding-top: 5rem; } }
.kicker { font: 500 0.8rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 0.75rem; }
h1 { font: 500 clamp(2.2rem, 5.5vw, 3.4rem)/1.08 var(--serif); margin: 0 0 1.25rem; letter-spacing: -0.01em; }
.lede { font: 400 1.3rem/1.5 var(--serif); margin-top: 0; }
.hero-text p { max-width: 38rem; }
.hero-links { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.75rem; }
.btn { display: inline-block; padding: 0.55rem 1.1rem; border-radius: 6px; font-weight: 600;
  background: var(--accent); color: var(--paper); text-decoration: none; border: 1px solid var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.08); }

.hero-side { display: grid; gap: 1.25rem; }
/* Side by side: the text's children join the hero grid directly, so the
   photo can start on the same row as the lede ("I am a Professor..."),
   below the kicker and the name however many lines the name takes. */
@media (min-width: 880px) {
  .hero { row-gap: 0; column-gap: 2.5rem; grid-template-rows: auto auto auto auto auto 1fr; }
  .hero-text { display: contents; }
  .hero-text > * { grid-column: 1; }
  .hero-text > p:not(.kicker) { margin-top: 0; margin-bottom: 1.0625rem; }  /* grid items do not collapse margins */
  .hero-text > .hero-links { margin-top: 0.7rem; }
  .hero-side { grid-column: 2; grid-row: 3 / 7; }
}
.portrait { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--rule); }
@media (max-width: 879px) {
  .hero-side { order: -1; }
  .portrait { max-width: 22rem; }
}

/* Sections */
.block { padding-top: 2.5rem; padding-bottom: 1.5rem; border-top: 1px solid var(--rule); margin-top: 1.5rem; }
h2 { font: 500 1.75rem var(--serif); margin: 0 0 1.25rem; }
h3 { font: 500 1.25rem/1.3 var(--serif); margin: 0 0 0.5rem; }
.section-note { color: var(--muted); margin-top: -0.5rem; }
.block > .section-note:last-child { margin-top: 1.5rem; }

.feature-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature { display: block; text-decoration: none; color: var(--ink); background: var(--raised);
  border: 1px solid var(--rule); border-radius: 10px; padding: 1.5rem; transition: border-color .15s, transform .15s; }
.feature:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature p { margin: 0 0 1rem; color: var(--muted); }
.tag { display: inline-block; font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--accent-soft); color: var(--accent); padding: 0.15rem 0.5rem; border-radius: 4px; margin-bottom: 0.75rem; }
.tag.pre { background: var(--pre-soft); color: var(--pre); }
.go { font: 500 0.85rem var(--mono); color: var(--accent); overflow-wrap: anywhere; }

.app-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
@media (min-width: 720px) { .app-grid { grid-template-columns: 1fr 1fr; } }
.app { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 1.25rem 1.4rem; display: flex; flex-direction: column; }
.thumb { display: block; margin: -1.25rem -1.4rem 1.1rem; background: var(--raised);
  border-bottom: 1px solid var(--rule); border-radius: 10px 10px 0 0; }
.fig { display: block; width: 100%; height: auto; }
.fig .ax { stroke: var(--rule); stroke-width: 1; }
.fig .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.fig .dash { stroke: var(--pre); stroke-width: 1.2; stroke-dasharray: 4 3; }
.fig .dot { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.fig .pt { fill: var(--ink); }
.fig .hl { fill: var(--pre); }
.fig .grid { fill: var(--muted); opacity: 0.45; }
.fig .edge { stroke: var(--muted); stroke-width: 1.3; }
.fig .arrowhead { fill: var(--muted); }
.fig .node { fill: var(--paper); stroke: var(--accent); stroke-width: 1.6; }
.fig .hlnode { fill: var(--accent-soft); }
.fig text { font: 500 11px var(--mono); fill: var(--ink); }
.fig .hlt { fill: var(--pre); }
.app:hover .thumb { background: var(--accent-soft); }
.app h3 a { color: var(--ink); text-decoration: none; }
.app h3 a:hover { color: var(--accent); }
.app p { margin: 0 0 0.9rem; color: var(--muted); }
.app .app-links { margin: auto 0 0; display: flex; gap: 1.1rem; font-weight: 600; font-size: 0.95rem; }

.link-list { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.contact { color: var(--muted); font-size: 0.95rem; overflow-wrap: anywhere; }

.foot { border-top: 1px solid var(--rule); margin-top: 2rem; padding-top: 1rem; padding-bottom: 2.5rem;
  color: var(--muted); font-size: 0.9rem; }

/* Group-law figure in the right-hand margin of wide screens only. Content is
   68rem wide; the figure fills the gutter and reaches 13rem into the page,
   i.e. partly behind the photo (right column), never behind the hero text. */
.bg-art { display: none; position: fixed; top: 0; bottom: 0; right: 0; z-index: -1; pointer-events: none;
  width: calc((100vw - 68rem) / 2 + 13rem); padding: 0 1.5rem 0 0; opacity: 0.16; }
@media (min-width: 1600px) { .bg-art { display: block; } }
.bg-art svg { width: 100%; height: 100%; display: block; overflow: visible; }
.bg-art * { vector-effect: non-scaling-stroke; }
.bg-art .axis { stroke: var(--muted); stroke-width: 1; }
.bg-art .curve { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.bg-art .secant { stroke: var(--pre); stroke-width: 1.5; stroke-dasharray: 6 5; }
.bg-art .reflect { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 4; }
.bg-art .pt { fill: var(--ink); }
.bg-art .pt.ghost { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.bg-art .pt.sum { fill: var(--pre); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bg-art { opacity: 0.22; } }
:root[data-theme="dark"] .bg-art { opacity: 0.22; }

/* Light/dark toggle */
nav { align-items: center; }
.theme-toggle { display: inline-grid; place-items: center; width: 2rem; height: 2rem; padding: 0;
  border: 1px solid var(--rule); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
