/* Design tokens. All text/background pairs below meet WCAG AA (4.5:1 or better). */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --ink: #111111;          /* on --bg: 17:1 */
  --muted: #4a4a48;        /* on --bg: 8:1  */
  --line: #dcdcd7;
  --accent: #0e5a61;       /* on white: 7.6:1 */
  --accent-soft: #e2eded;
  --todo-bg: #fff3c4;
  --todo-ink: #5c4400;     /* on --todo-bg: 7.5:1 */
  --radius: 28px;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65; font-weight: 400;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: absolute; left: 16px; top: -60px; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 100; text-decoration: none; }
.skip-link:focus { top: 12px; }

.wrap { width: min(var(--max), 100% - 32px); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(246,246,243,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }
.brand { font-family: var(--serif); font-size: 1.6rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.nav-toggle { display: none; }
.site-nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; align-items: center; }
.site-nav a { display: inline-block; padding: 8px 14px; color: var(--ink); text-decoration: none; border-radius: 999px; font-size: 1rem; }
.site-nav a:hover { background: var(--accent-soft); }
.site-nav a[aria-current="page"] { background: var(--ink); color: #fff; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; cursor: pointer; }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--line); display: none; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; padding: 12px 16px 20px; gap: 4px; }
  .site-nav a { display: block; padding: 14px 16px; }
}

/* ---------- Buttons & tags ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: 13px 26px; border-radius: 999px; text-decoration: none; font-weight: 500; border: 2px solid var(--ink); font-size: 1rem; cursor: pointer; font-family: inherit; }
.btn:hover { background: #2a2a2a; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--accent-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.tag { display: inline-block; background: var(--accent-soft); color: #073f45; border-radius: 999px; padding: 3px 12px; font-size: .875rem; }
.todo { background: var(--todo-bg); color: var(--todo-ink); padding: 0 6px; border-radius: 4px; font-weight: 500; }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 8px; }
.hero-panel {
  border-radius: var(--radius); padding: clamp(32px, 7vw, 88px) clamp(24px, 6vw, 80px);
  background:
    radial-gradient(900px 400px at 85% 10%, rgba(255,255,255,.95), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, #cfdcdc, transparent 65%),
    linear-gradient(135deg, #e8ebeb, #f3f3f0 55%, #dde6e6);
  border: 1px solid var(--line); position: relative; overflow: hidden;
}
.eyebrow { font-size: .95rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(3rem, 10vw, 7.2rem); line-height: .95; letter-spacing: -.02em; margin: 0 0 24px; }
.hero .lede { max-width: 38rem; font-size: clamp(1.1rem, 2.2vw, 1.35rem); color: var(--muted); margin: 0 0 28px; font-weight: 300; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Sections ---------- */
section { padding: 64px 0; }
h2.section-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.01em; line-height: 1.1; margin: 0 0 12px; }
.section-intro { color: var(--muted); max-width: 40rem; margin: 0 0 36px; }

.focus-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.focus-item { border-top: 1px solid var(--ink); padding-top: 18px; }
.focus-item h3 { text-transform: uppercase; letter-spacing: .04em; font-weight: 400; font-size: 1.15rem; margin: 0 0 8px; }
.focus-item p { margin: 0; color: var(--muted); }
@media (max-width: 720px) { .focus-row { grid-template-columns: 1fr; } }

.statement { text-align: center; padding: 90px 0; }
.statement p { text-transform: uppercase; font-weight: 300; letter-spacing: .02em; font-size: clamp(1.3rem, 3.2vw, 2.1rem); line-height: 1.35; max-width: 46rem; margin: 0 auto; }

/* ---------- Project cards ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; list-style: none; margin: 0; padding: 0; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; height: 100%; }
.card:hover, .card:focus-within { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0,0,0,.09); }
.card-img { aspect-ratio: 16 / 10; background: #eceeed; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.card-body { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-type { margin: 0; font-size: .9rem; color: var(--muted); }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; line-height: 1.15; margin: 0; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.card h3 a:focus-visible { outline: none; }
.card p.summary { margin: 0; color: var(--muted); }

/* ---------- Filters ---------- */
.filters { display: grid; gap: 18px; margin-bottom: 30px; }
.filter-group { border: 0; margin: 0; padding: 0; }
.filter-group legend { font-size: .9rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: .95rem; background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.chip:hover { background: var(--accent-soft); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.result-count { color: var(--muted); margin: 0 0 18px; }
.empty { padding: 28px; border: 1px dashed var(--muted); border-radius: var(--radius); }

/* ---------- Page headings ---------- */
.page-head { padding: 56px 0 8px; }
.page-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: 1; letter-spacing: -.02em; margin: 0 0 14px; }
.page-head p { color: var(--muted); max-width: 40rem; margin: 0; font-weight: 300; font-size: 1.2rem; }

/* ---------- Project page ---------- */
.crumbs { font-size: .95rem; margin: 28px 0 0; }
.project-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -.02em; margin: 14px 0 20px; max-width: 18em; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border-top: 1px solid var(--ink); margin: 26px 0 0; }
.facts div { padding: 14px 18px 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.facts dd { margin: 0; }
.prose { max-width: 46rem; }
.prose h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.1; margin: 2.2em 0 .5em; }
.prose h3 { font-size: 1.25rem; font-weight: 600; margin: 1.8em 0 .4em; }
.prose h4 { font-size: 1.05rem; margin: 1.4em 0 .3em; }
.prose p, .prose li { margin: 0 0 1em; }
.prose ul { padding-left: 1.3em; }
.prose pre { background: #14201f; color: #eaf1f0; padding: 20px; border-radius: 16px; overflow-x: auto; font-size: .9rem; line-height: 1.5; max-width: 100%; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.table-scroll { overflow-x: auto; margin: 0 0 1.2em; }
.prose table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .98rem; background: var(--surface); }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--accent-soft); color: #073f45; }
.download { margin-top: 36px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- About / contact ---------- */
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; gap: 28px; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.panel h2, .panel h3 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; margin: 0 0 12px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; font-size: 1.2rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--ink); margin-top: 40px; padding: 40px 0 56px; color: var(--muted); }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 28px 64px; justify-content: space-between; }
.site-footer h2 { font-size: 1rem; color: var(--ink); margin: 0 0 8px; font-weight: 600; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer a { color: var(--ink); }
.small { font-size: .9rem; }
noscript .empty { margin: 24px 0; }

/* project prose: keep text readable but let the gallery use full width */
.prose { max-width: none; }
.prose > *:not(.viewer-wrap):not(.table-scroll) { max-width: 46rem; }
.prose .table-scroll { max-width: 60rem; }

/* long URLs and DOIs must wrap instead of forcing sideways scroll on phones */
.prose p, .prose li, .prose h2, .prose h3, .card, .facts dd { overflow-wrap: anywhere; }

/* ---------- Slideshow (shared by every project page) ---------- */
.viewer-wrap { margin: 36px 0 8px; max-width: 900px; }
.slideshow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.ss-stage { display: flex; align-items: center; justify-content: center; background: #ecedeb; border-radius: 18px; min-height: 240px; padding: 8px; }
.ss-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* max-height keeps tall (portrait) pages fully visible; width:auto keeps their proportions */
.ss-img { width: auto; height: auto; max-width: 100%; max-height: min(84vh, 1000px); border-radius: 6px; box-shadow: 0 2px 14px rgba(0,0,0,.12); background: #fff; }
.ss-controls { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 14px 0 4px; }
.ss-btn { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--ink); background: var(--ink); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-family: inherit; }
.ss-btn:hover:not(:disabled) { background: #2a2a2a; }
.ss-btn:disabled { background: transparent; color: #6b6b68; border-color: #b9b9b4; cursor: not-allowed; }
.ss-count { margin: 0; min-width: 6rem; text-align: center; font-size: 1.05rem; color: var(--ink); }
.download { margin-top: 18px; display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 720px) { .ss-img { max-height: 70vh; } .slideshow { padding: 10px; } .ss-stage { padding: 4px; } }

/* ---------- About page pieces ---------- */
.hero .current-role { max-width: 38rem; margin: -8px 0 28px; padding-left: 16px; border-left: 3px solid var(--accent); font-size: 1rem; color: var(--ink); }
.entry { margin-bottom: 1.6em; }
.entry h3 { margin-bottom: 2px; }
.prose .meta { color: var(--muted); font-size: .95rem; margin: 1em 0 .3em; }
.skill-h { font-size: .85rem !important; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500 !important; margin: 20px 0 8px !important; font-family: var(--sans) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ss-controls { position: relative; }
.ss-zoom { position: absolute; right: 4px; top: 50%; transform: translateY(-40%); font-size: .95rem; }
@media (max-width: 720px) { .ss-zoom { position: static; transform: none; } .ss-controls { flex-wrap: wrap; } .ss-zoom { flex-basis: 100%; text-align: center; } }
