:root {
  --wine: #6E1726;
  --wine-dark: #4D0F1A;
  --ink: #1C1416;
  --cream: #F4EEE6;
  --cream-2: #E6DCD1;
  --blush: #E3A7B0;
  --muted: #45393C;
  --muted-light: #CFC3C6;
  --rule: #CDBFB4;
  --serif: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --sans: 'Work Sans', 'Helvetica Neue', Arial, sans-serif;
  --gutter: clamp(20px, 6vw, 80px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); font-size: 18px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--wine); }
a:hover { color: var(--wine-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--blush); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; }
p { margin: 0; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--cream); padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { background: var(--ink); color: var(--cream); padding: 0 var(--gutter); min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 15px; font-weight: 500; }
.site-header .mark { letter-spacing: 3px; text-transform: uppercase; font-weight: 600; color: var(--cream); text-decoration: none; }
.site-header nav { display: flex; gap: clamp(16px, 3vw, 32px); flex-wrap: wrap; }
.site-header nav a { color: var(--cream); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.site-header nav a:hover { color: var(--blush); }
.site-header nav a.contact { text-decoration: underline; }

/* Banner */
.banner { height: clamp(300px, 46vw, 600px); background: var(--ink); overflow: hidden; }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner svg { width: 100%; height: 100%; }

/* Intro */
.intro { margin: -180px var(--gutter) 0; position: relative; background: var(--wine); color: #F7EFE6; padding: clamp(32px, 5vw, 56px) clamp(24px, 5vw, 64px); display: flex; gap: 32px 48px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.intro h1 { display: flex; flex-direction: column; gap: 10px; }
.intro .first { font-size: clamp(56px, 11vw, 128px); line-height: 0.9; letter-spacing: -0.02em; }
.intro .last { font-size: clamp(28px, 4vw, 48px); line-height: 1; font-style: italic; }
.intro p { font-size: clamp(18px, 2vw, 22px); line-height: 1.5; max-width: 600px; margin-top: 18px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px; font-size: 16px; font-weight: 600; text-decoration: none; border: 2px solid transparent; }
.btn-cream { background: var(--cream); color: var(--ink); }
.btn-cream:hover { background: #fff; color: var(--ink); }
.btn-outline-cream { border-color: var(--cream); color: var(--cream); }
.btn-outline-cream:hover { background: var(--cream); color: var(--ink); }
.btn-row { display: flex; gap: 16px; flex-wrap: wrap; }

/* Work */
.section-bar { margin: 96px var(--gutter) 0; padding-bottom: 20px; display: flex; justify-content: space-between; font-size: 14px; letter-spacing: 3px; text-transform: uppercase; font-weight: 600; border-bottom: 2px solid var(--ink); }
.project { margin: 0 var(--gutter); padding: 72px 0; display: flex; gap: clamp(32px, 5vw, 56px); align-items: center; border-bottom: 1px solid var(--rule); }
.project:last-of-type { border-bottom: 2px solid var(--ink); }
.project.flip { flex-direction: row-reverse; }
.project .text { flex: 1 1 0; display: flex; flex-direction: column; gap: 16px; }
.eyebrow { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; font-weight: 600; color: var(--wine); }
.project h2 { font-size: clamp(44px, 6vw, 64px); line-height: 1; }
.project .text p { color: var(--muted); }
.project .text a { font-weight: 600; }
.project .media { flex: 0 0 min(600px, 50%); aspect-ratio: 16 / 10; background: var(--ink); overflow: hidden; }
.project .media img { width: 100%; height: 100%; object-fit: cover; }
.project .media .fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--blush); font-family: var(--serif); font-size: clamp(32px, 4vw, 48px); padding: 24px; text-align: center; }

/* Research */
.research { margin: 80px var(--gutter); background: var(--ink); color: var(--cream); padding: clamp(32px, 5vw, 64px); display: flex; gap: 56px; align-items: center; }
.research .text { flex: 1 1 0; display: flex; flex-direction: column; gap: 20px; }
.research .eyebrow { color: var(--blush); }
.research h2 { font-size: clamp(36px, 4.5vw, 52px); line-height: 1.05; }
.research .meta { font-size: 15px; color: var(--muted-light); }
.research .meta a { color: var(--blush); }
.research p.summary { color: var(--muted-light); }
.research svg { flex: 0 0 340px; width: 340px; height: 340px; }

/* About */
.about { padding: 0 var(--gutter) 80px; display: flex; gap: 64px; align-items: center; }
.about .portrait-frame { flex: 0 0 360px; width: 360px; aspect-ratio: 9 / 11; margin: 0; overflow: hidden; background: var(--ink); }
.about .portrait, .about .portrait-placeholder, .about .portrait-placeholder svg { width: 100%; height: 100%; display: block; }
.about .portrait { object-fit: cover; }
.about .text { flex: 1 1 0; display: flex; flex-direction: column; gap: 20px; }
.about .lead { font-family: var(--serif); font-size: clamp(28px, 3.4vw, 38px); line-height: 1.25; }
.about .now { color: var(--muted); }
.about a { font-weight: 600; }

/* Contact */
[hidden] { display: none !important; }
.contact-section { background: var(--wine); color: var(--cream); padding: 64px var(--gutter); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 48px; align-items: start; }
.contact-section h2 { font-size: clamp(44px, 6vw, 56px); line-height: 1; }
.contact-section .contact-lede { margin-top: 16px; color: #F0D9DC; font-size: 18px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
.form input, .form textarea { font: inherit; font-size: 17px; padding: 12px 14px; border: 2px solid transparent; background: var(--cream); color: var(--ink); min-height: 48px; }
.form textarea { min-height: 140px; resize: vertical; }
.form .hidden { position: absolute; left: -9999px; }
.form button { align-self: flex-start; cursor: pointer; font-family: inherit; }
.site-footer { background: var(--ink); color: var(--muted-light); padding: 24px var(--gutter); font-size: 14px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted-light); }

@media (max-width: 860px) {
  .project, .project.flip { flex-direction: column; align-items: stretch; padding: 56px 0; }
  .project .media { flex-basis: auto; width: 100%; }
  .research { flex-direction: column; align-items: stretch; }
  .research svg { width: 100%; max-width: 280px; height: auto; align-self: center; flex-basis: auto; }
  .about { flex-direction: column; align-items: stretch; }
  .about .portrait-frame { width: 100%; max-width: 360px; flex-basis: auto; }
  .contact-section { grid-template-columns: minmax(0, 1fr); }
  .intro { margin-top: -96px; }
}

/* ===== Additions ===== */
.status { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; padding: 8px 14px; border: 1px solid var(--blush); color: var(--blush); font-size: 14px; font-weight: 600; letter-spacing: 0.5px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blush); }

/* Case studies */
.case { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; margin: 8px 0 4px; }
.case div { border-top: 1px solid var(--rule); padding-top: 10px; }
.case dt { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; color: var(--ink); }
.case dd { margin: 4px 0 0; color: var(--muted); font-size: 16px; line-height: 1.55; }
.quote { margin: 8px 0 0; padding: 20px 24px; background: var(--cream-2); }
.quote p { font-family: var(--serif); font-size: 22px; line-height: 1.35; color: var(--ink); }
.quote footer { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* Explorations */
.explore { margin: 0 var(--gutter) 96px; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 48px; align-items: center; }
.explore .text { display: flex; flex-direction: column; gap: 18px; }
.explore h2 { font-size: clamp(36px, 4.5vw, 52px); line-height: 1.05; }
.explore .text p { color: var(--muted); }
.plot { background: #FBF7F2; border: 2px solid var(--ink); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.plot canvas { width: 100%; height: 280px; display: block; }
.formula { font-family: var(--serif); font-size: 22px; min-height: 30px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 16px; border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.slider { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 600; }
.slider input { flex: 1; accent-color: var(--wine); min-height: 44px; }
.slider output { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

.about .beyond { color: var(--muted); }

@media (max-width: 860px) {
  .explore { grid-template-columns: minmax(0, 1fr); }
  .case { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Explainer page ===== */
.page-hero { background: var(--wine); color: #F7EFE6; padding: clamp(48px, 8vw, 96px) var(--gutter); display: flex; flex-direction: column; gap: 20px; }
.page-hero .eyebrow { color: #F0D9DC; }
.page-hero h1 { font-size: clamp(44px, 7vw, 88px); line-height: 1; max-width: 1000px; }
.page-hero p { font-size: clamp(18px, 2vw, 22px); max-width: 720px; }
.page-hero .status { border-color: #F0D9DC; color: #F7EFE6; }
.page-hero .status::before { background: #F0D9DC; }
.article { max-width: 760px; margin: 0 auto; padding: 72px var(--gutter) 24px; }
.article section { padding: 40px 0; border-top: 1px solid var(--rule); }
.article section:first-child { border-top: 0; padding-top: 0; }
.article .num { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; font-weight: 600; color: var(--wine); }
.article h2 { font-size: clamp(32px, 4vw, 44px); line-height: 1.1; margin: 10px 0 18px; }
.article p { margin: 0 0 16px; color: #2E2528; font-size: 19px; line-height: 1.7; }
.article ul { margin: 0 0 16px; padding-left: 22px; color: #2E2528; font-size: 19px; line-height: 1.7; }
.article li { margin-bottom: 8px; }
.article figure { margin: 28px 0; }
.article figure svg { width: 100%; height: auto; display: block; background: #FBF7F2; border: 1px solid var(--rule); }
.article figcaption { margin-top: 10px; font-size: 15px; color: var(--muted); line-height: 1.5; }
.callout { background: var(--ink); color: var(--cream); padding: 28px 32px; margin: 24px 0; }
.callout p { color: var(--cream); margin: 0; font-family: var(--serif); font-size: 26px; line-height: 1.3; }
.note { background: var(--cream-2); padding: 18px 22px; margin: 20px 0; font-size: 17px; line-height: 1.6; color: var(--muted); }
.numbers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.numbers div { border: 2px solid var(--ink); padding: 18px; }
.numbers strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; color: var(--wine); }
.numbers span { font-size: 15px; color: var(--muted); line-height: 1.45; display: block; margin-top: 6px; }

.anim { background: var(--ink); color: var(--cream); padding: 24px; margin: 28px calc(-1 * min(120px, 8vw)); display: flex; flex-direction: column; gap: 16px; }
.anim canvas { width: 100%; height: 440px; display: block; }
.anim .controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.anim button { font: inherit; font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 20px; border: 2px solid var(--cream); background: var(--cream); color: var(--ink); cursor: pointer; }
.anim button.ghost { background: transparent; color: var(--cream); }
.anim input[type=range] { flex: 1; min-width: 160px; accent-color: var(--blush); min-height: 44px; }
.anim .readout { font-size: 15px; color: var(--muted-light); font-variant-numeric: tabular-nums; min-width: 220px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
@media (max-width: 860px) {
  .anim { margin: 28px 0; padding: 16px; }
  .anim canvas { height: 560px; }
  .numbers { grid-template-columns: minmax(0, 1fr); }
}

/* Project detail and about pages */
.detail { max-width: 900px; margin: 0 auto; padding: 56px var(--gutter) 24px; display: flex; flex-direction: column; gap: 24px; }
.detail .hero-media { width: 100%; aspect-ratio: 16 / 9; background: var(--ink); overflow: hidden; }
.detail .hero-media img { width: 100%; height: 100%; object-fit: cover; }
.detail .hero-media .fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--blush); font-family: var(--serif); font-size: clamp(32px, 5vw, 56px); text-align: center; padding: 24px; }
.detail p { font-size: 19px; line-height: 1.7; color: #2E2528; margin: 0 0 16px; }
.detail h2 { font-size: clamp(28px, 3.6vw, 38px); margin: 24px 0 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--cream-2); }
.empty-note { background: var(--cream-2); padding: 18px 22px; font-size: 17px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 20px; padding: 16px 0; border-top: 1px solid var(--rule); }
.timeline .when { font-weight: 600; color: var(--wine); }
.project .media a, .project .media { display: block; }
.project .media a:hover img, .project .media a:focus-visible img { opacity: 0.88; }
@media (max-width: 860px) { .timeline li { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* Smith chart explorer */
.smith { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.smith canvas { width: 100%; aspect-ratio: 1 / 1; display: block; }
.smith .rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; font-size: 15px; }
.smith .rows div { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--rule); padding-top: 8px; }
.smith .rows span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.smith .phase { font-family: var(--serif); font-size: 22px; }
.smith .foot { font-size: 14px; color: var(--muted); }

/* About page rhythm: images, pull quotes, dividers */
.a-section { padding: 8px 0 4px; }
.a-body { display: flex; gap: 36px; align-items: flex-start; }
.a-body .words { flex: 1 1 0; min-width: 0; }
.a-body figure { flex: 0 0 300px; width: 300px; margin: 6px 0 0; }
.a-body figure img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--cream-2); display: block; }
.a-body figure figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.a-body.flip { flex-direction: row-reverse; }
.pull { margin: 22px 0; padding: 18px 0 18px 24px; border-left: 3px solid var(--wine); font-family: var(--serif); font-size: clamp(24px, 3vw, 30px); line-height: 1.3; color: var(--ink); }
.ornament { display: flex; justify-content: center; padding: 30px 0 18px; }
.ornament svg { width: 180px; height: 34px; }
@media (max-width: 860px) {
  .a-body, .a-body.flip { flex-direction: column; }
  .a-body figure { width: 100%; flex-basis: auto; max-width: 360px; }
}

/* Six-item navigation */
.site-header nav { gap: clamp(12px, 2.2vw, 28px); }
.site-header nav a[aria-current="page"] { color: var(--blush); text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 720px) {
  .site-header { padding-top: 8px; padding-bottom: 8px; row-gap: 4px; }
  .site-header nav { font-size: 14px; }
  .site-header nav a { min-height: 38px; }
}

/* Paper link in the explainer hero */
.page-hero .hero-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 4px; }
.page-hero .hero-actions .btn { font-size: 17px; min-height: 56px; padding: 0 32px; }
.page-hero .hero-note { font-size: 15px; color: #F0D9DC; max-width: 420px; line-height: 1.45; }

/* Direct contact details */
.contact-details { margin: 28px 0 0; display: flex; flex-direction: column; gap: 14px; }
.contact-details div { display: flex; flex-direction: column; gap: 2px; }
.contact-details dt { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; color: #F0D9DC; }
.contact-details dd { margin: 0; font-family: var(--serif); font-size: clamp(22px, 2.6vw, 28px); line-height: 1.25; }
.contact-details a { color: var(--cream); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; overflow-wrap: anywhere; display: inline-block; min-height: 44px; padding-top: 6px; }
.contact-details a:hover { color: #fff; }
