/* ==========================================================================
   Design system — cream & maroon
   All visual decisions live in the tokens below. Change a token, not a rule.
   ========================================================================== */

:root {
  /* Color */
  --color-bg: #f3f0e9;          /* cream (softly desaturated) */
  --color-surface: #e9e4da;     /* deeper cream for cards / code */
  --color-paper: #fbf9f5;       /* card stock for paintings and photos */
  --color-text: #6b1a2a;        /* maroon */
  --color-heading: #4a0e1b;     /* deep maroon */
  --color-muted: #8a4b56;       /* soft maroon for meta text */
  --color-accent: #9c2a3f;      /* brighter maroon for hover / focus */
  --color-rule: rgba(107, 26, 42, 0.18);
  --color-shadow-rgb: 74, 14, 27; /* deep maroon, used as rgba(var(--color-shadow-rgb), alpha) */
  --color-pop: #c7d33b;         /* chartreuse accent: fills and marks only, never text */
  --color-pop-soft: rgba(199, 211, 59, 0.5); /* the chartreuse at half strength: text selection */

  /* Type families (overridden live by the font lab in development) */
  --font-heading: "Lora", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-ui: "IBM Plex Mono", ui-monospace, monospace;

  /* Type scale (1.25 ratio) */
  --text-xs: 0.8rem;
  --text-sm: 0.9rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.6rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  --leading-tight: 1.15;
  --leading-body: 1.65;
  --heading-weight: 500;

  /* Space (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Layout */
  --measure: 53rem;   /* content width */
  --wide: 60rem;      /* header / footer width */
  --radius: 4px;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html { accent-color: var(--color-text); }

::selection { background: var(--color-pop-soft); color: var(--color-heading); }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  color: var(--color-heading);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin: var(--space-12) 0 var(--space-4);
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p, ul, ol { margin: 0 0 var(--space-4); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--color-rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--color-accent); text-decoration-color: var(--color-pop); text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

strong { color: var(--color-heading); font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--color-rule); margin: var(--space-12) 0; }

img, embed, video { max-width: 100%; height: auto; }

code, pre {
  font-family: var(--font-ui);
  font-size: 0.9em;
  background: var(--color-surface);
  border-radius: var(--radius);
}
code { padding: 0.1em 0.3em; }
pre { padding: var(--space-4); overflow-x: auto; }

/* ---------- Layout ---------- */

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--space-6); }
.content { max-width: var(--measure); margin: 0 auto; padding: 0 var(--space-6); }

main { padding: var(--space-8) 0 var(--space-16); }

/* ---------- Header ---------- */

.site-header { border-bottom: 1px solid var(--color-rule); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}
.site-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--heading-weight);
  color: var(--color-heading);
  text-decoration: none;
}
.site-nav { display: flex; flex-wrap: wrap; gap: var(--space-6); }
.site-nav a {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-muted);
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--color-pop);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 0.4em;
}

/* ---------- Page ---------- */

.page-title { margin-top: var(--space-8); }
.page-content > :first-child { margin-top: 0; }

/* Section headings: a rule above sets each section apart */
.page-content h2 {
  position: relative;
  margin-top: var(--space-16);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-rule);
  font-weight: 600;
}
.page-content > h2:first-child { padding-top: 0; border-top: 0; }
/* A short chartreuse mark where each section rule begins */
.page-content h2::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 2.5rem;
  height: 3px;
  background: var(--color-pop);
}
.page-content > h2:first-child::before { display: none; }
.page-content h3 {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-rule);
  margin-top: var(--space-12);
}

/* Centered figures (images / embeds directly in content) */
.page-content img, .page-content embed {
  display: block;
  margin: var(--space-6) auto;
  border-radius: var(--radius);
}

/* ---------- Home ---------- */

.intro {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
  margin-bottom: var(--space-8);
}
.page-content img.profile {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  margin: 0;
}
.intro h1 { margin-top: 0; }
@media (max-width: 600px) {
  .intro { grid-template-columns: minmax(0, 1fr); }
  .page-content img.profile { width: 9rem; }
}

/* News: "Month YYYY - text" paragraphs rendered as a timeline-ish list */
/* News: quiet list on a thin rule, with a small year label marked in chartreuse */
.page-content .news-year {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-8) 0 var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--color-muted);
}
.page-content .news-year:first-child { margin-top: 0; }
.news-year::before {
  content: "";
  width: 1rem;
  height: 2px;
  background: var(--color-pop);
}
.news-item { padding-left: var(--space-4); border-left: 2px solid var(--color-rule); }
.news-date {
  margin-right: var(--space-1);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ---------- Publications ---------- */

.publications .page-content p,
.selected-pubs p { margin-bottom: var(--space-6); }
.publications .page-content em,
.selected-pubs em { color: var(--color-muted); }
.publications .page-content a[href],
.selected-pubs a[href] {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
}

.hint { color: var(--color-muted); font-style: italic; }

/* ---------- Projects (research page) ---------- */

.project {
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
  margin: var(--space-8) 0 var(--space-10, 2.5rem);
}

/* Thumbnail card beside each project; links to the project page */
.page-content .project-thumb {
  flex: 0 0 13rem;
  width: 13rem;
  margin: 0.35rem 0 0;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow:
    0 1px 1px rgba(var(--color-shadow-rgb), 0.06),
    0 8px 18px -12px rgba(var(--color-shadow-rgb), 0.45);
  transition: box-shadow 0.2s, transform 0.2s;
}
a.project-thumb:hover {
  transform: translateY(-2px);
  box-shadow:
    0 1px 1px rgba(var(--color-shadow-rgb), 0.06),
    0 14px 26px -12px rgba(var(--color-shadow-rgb), 0.5);
}
.page-content .project-thumb img { display: block; width: 100%; margin: 0; border-radius: 0; }

/* Override the eyebrow style .page-content h3 uses elsewhere */
.page-content .project-title {
  margin: 0 0 var(--space-1);
  padding: 0;
  border: 0;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: var(--heading-weight);
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-transform: none;
  color: var(--color-heading);
}
.project-meta {
  margin-bottom: var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.project-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.project-links a {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
}
.project-links a::after { content: " →"; }

@media (max-width: 600px) {
  .project { flex-direction: column; gap: var(--space-3); }
  .page-content .project-thumb { width: 100%; flex-basis: auto; }
}

/* ---------- Clothesline (about page) ---------- */

.clothesline-group {
  /* Clotheslines break out of the text column: wider, centered, never wider than the screen */
  --line-width: min(65.5rem, calc(100vw - 2 * var(--space-6)));
  width: var(--line-width);
  margin: var(--space-8) 0 var(--space-4) calc((100% - var(--line-width)) / 2);
}
.clothesline-label {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.clothesline { position: relative; touch-action: pan-y; }
.clothesline-rope { display: none; }
.clothesline-items {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: var(--space-4) 0 0;
}
.clothesline-item { flex: 1; }

/* Live (JS) mode: cards are positioned along the rope by clothesline.js */
.clothesline.is-live .clothesline-rope {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}
.clothesline-rope path {
  fill: none;
  stroke: var(--color-text);
  stroke-width: 1.25;
  stroke-linecap: round;
  opacity: 0.75;
}
.clothesline.is-live .clothesline-items { display: block; padding: 0; }
.clothesline.is-live .clothesline-item {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 50% 0;
  will-change: transform;
}

.clothesline-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 5px;
  border: 0;
  border-radius: 1px;
  background: var(--color-paper);
  box-shadow:
    0 1px 1px rgba(var(--color-shadow-rgb), 0.08),
    0 10px 20px -10px rgba(var(--color-shadow-rgb), 0.45);
  cursor: zoom-in;
  transition: box-shadow 0.2s;
}
.clothesline-card:hover {
  box-shadow:
    0 1px 1px rgba(var(--color-shadow-rgb), 0.08),
    0 16px 28px -12px rgba(var(--color-shadow-rgb), 0.5);
}
.clothesline-card:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.page-content .clothesline-card img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border-radius: 0;
}

/* Polaroid: photo with a title strip underneath */
.clothesline-card.is-polaroid { padding: 7px 7px 0; }
.clothesline-title {
  display: block;
  padding: 0.55rem 0.25rem 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--color-text);
  text-align: center;
}

/* Wooden clothespin straddling the rope */
.clothespin {
  position: absolute;
  z-index: 1;
  top: -13px;
  left: 50%;
  width: 9px;
  height: 26px;
  margin-left: -4.5px;
  border-radius: 2px 2px 3px 3px;
  background: linear-gradient(90deg, #b8875a 0%, #dcb88e 45%, #c99d70 100%);
  box-shadow: 0 1px 2px rgba(var(--color-shadow-rgb), 0.35);
}
.clothespin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  bottom: 3px;
  border-left: 1px solid rgba(var(--color-shadow-rgb), 0.35);
}

/* ---------- Lightbox ---------- */

.lightbox {
  max-width: min(92vw, 56rem);
  max-height: 92vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.lightbox::backdrop {
  background: rgba(43, 8, 16, 0.78);
  backdrop-filter: blur(4px);
}
.lightbox[open] { animation: lightbox-in 0.25s ease-out; }
@keyframes lightbox-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
}
.lightbox figure { margin: 0; }
.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  background: var(--color-paper);
  padding: 8px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
}
.lightbox figcaption {
  margin-top: var(--space-3);
  text-align: center;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-bg);
}
.lightbox-close {
  position: absolute;
  top: -2.25rem;
  right: 0;
  border: 0;
  background: none;
  color: var(--color-bg);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open] { animation: none; }
}

/* ---------- Footer animation ---------- */

.footer-art {
  height: 120px;
  margin-top: var(--space-8);
  cursor: crosshair;
  touch-action: pan-y;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.footer-art canvas { display: block; width: 100%; height: 100%; }

/* ---------- Easter egg: type "eht" (assets/js/lensing.js) ---------- */

.eht-on, .eht-on * { cursor: none !important; }
.eht-hole {
  position: fixed;
  z-index: 2000;
  top: -26px;
  left: -26px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  pointer-events: none;
  /* shadow, then a lopsided photon ring (brighter on the approaching side) */
  background:
    radial-gradient(circle, #000 0 55%, transparent 56%),
    conic-gradient(from 200deg, #fbe2a0, #d6622a 30%, #6b1a2a 55%, #a83a2a 75%, #fbe2a0);
  -webkit-mask: radial-gradient(circle, #000 0 66%, transparent 72%);
  mask: radial-gradient(circle, #000 0 66%, transparent 72%);
  filter: drop-shadow(0 0 6px rgba(214, 98, 42, 0.55));
  display: none;
}
.eht-on .eht-hole { display: block; }
.eht-toast {
  position: fixed;
  z-index: 2001;
  left: 50%;
  bottom: var(--space-6);
  transform: translate(-50%, 8px);
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  background: var(--color-heading);
  color: var(--color-bg);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.eht-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--color-rule);
  padding: var(--space-8) 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4); }
.site-footer ul { display: flex; gap: var(--space-6); list-style: none; margin: 0; padding: 0; }
.site-footer a { text-decoration: none; }
