:root {
  --portfolio-paper: #f5f3ed;
  --portfolio-ink: #202826;
  --portfolio-soft: #eeeee8;
  --portfolio-accent: #80565b;
  --portfolio-line: #d8dbd5;
}

html { scroll-padding-top: 84px; }
body { background: var(--portfolio-paper); color: var(--portfolio-ink); }
a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid #a9514e; outline-offset: 4px; }
.shell { width: min(1240px, calc(100% - 64px)); }

.gallery-header { background: rgba(245, 243, 237, .94); }
.gallery-header .nav { min-height: 78px; }
.gallery-header .nav-links { gap: 28px; }
.gallery-header .nav-links a { font-size: 12px; }
.gallery-header .nav-cta { background: transparent; color: var(--portfolio-ink); border-color: var(--portfolio-line); }
.gallery-header .nav-cta:hover { background: var(--portfolio-ink); color: white; }

.gallery-hero {
  padding: clamp(60px, 7vw, 100px) 0 clamp(76px, 8vw, 120px);
  background: var(--portfolio-paper);
}
.gallery-hero .hero-layout {
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  gap: clamp(48px, 7vw, 112px);
  align-items: center;
}
.gallery-hero .hero-copy h1 {
  max-width: 10ch;
  font-size: clamp(68px, 7vw, 112px);
  font-weight: 650;
  line-height: .9;
  letter-spacing: -.077em;
}
.gallery-hero .hero-copy h1 span {
  display: block;
  margin-top: 8px;
  color: var(--portfolio-accent);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.068em;
}
.hero-kicker, .section-kicker {
  color: var(--portfolio-accent);
  font-size: 11px;
  letter-spacing: .12em;
}
.gallery-hero .hero-subtitle { max-width: 45ch; font-size: 17px; line-height: 1.6; }
.gallery-hero .button-row { gap: 12px; }
.gallery-hero .btn { font-size: 12px; }
.hero-footnote { display: flex; gap: 9px; margin: 36px 0 0; color: #66706b; font-size: 12px; font-weight: 700; }
.hero-footnote span[id] { color: var(--portfolio-ink); }

.latest-lab { padding: 0; overflow: hidden; border: 1px solid #c9d0c8; border-radius: 3px; box-shadow: 16px 16px 0 #dfe6dc; }
.lab-preview { position: relative; height: clamp(270px, 29vw, 370px); overflow: hidden; background: #17233c; }
.lab-preview iframe { display: block; width: 200%; height: 740px; border: 0; transform: scale(.5); transform-origin: top left; pointer-events: none; }
.latest-lab-heading { padding: 28px 32px 0; }
.latest-lab-heading > span { margin-bottom: 12px; background: #edf0eb; color: #536a5b; }
.latest-lab h2 { max-width: 23ch; font-size: clamp(26px, 2.5vw, 36px); line-height: 1.05; }
.latest-lab-heading p { max-width: 52ch; margin-top: 10px; }
.lab-result { margin: 22px 32px 0; padding: 18px 0 24px; font-size: 12px; text-decoration: none; }
.lab-result:hover { color: var(--portfolio-accent); }

.product-proof-section { padding: clamp(76px, 9vw, 128px) 0; background: #e8ece8; color: var(--portfolio-ink); }
.selected-heading { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr); gap: 40px; align-items: end; margin-bottom: 36px; }
.selected-heading h2 { max-width: 13ch; margin: 0; font-size: clamp(44px, 5.3vw, 76px); font-weight: 620; letter-spacing: -.065em; line-height: .96; }
.selected-heading > p { max-width: 35ch; margin: 0 0 5px; color: #5e6c67; font-size: 15px; line-height: 1.6; }
.product-rail { display: grid; grid-template-columns: 1.08fr .92fr; gap: 24px; }
.selected-project { min-width: 0; overflow: hidden; border: 1px solid #ccd2ca; background: #fdfdf9; }
.selected-preview { display: block; aspect-ratio: 1.48; overflow: hidden; background: #e2e6dd; }
.selected-preview img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.selected-preview:hover img { transform: scale(1.025); }
.selected-project-copy { padding: clamp(24px, 3vw, 36px); }
.project-index { color: var(--portfolio-accent); font: 800 11px/1.2 ui-monospace, SFMono-Regular, monospace; letter-spacing: .08em; text-transform: uppercase; }
.selected-project h3 { margin: 15px 0 8px; font-size: clamp(30px, 3vw, 44px); font-weight: 650; letter-spacing: -.055em; line-height: 1; }
.selected-project p { max-width: 46ch; min-height: 50px; margin: 0; color: #5c6964; font-size: 14px; line-height: 1.6; }
.project-bottom { display: flex; justify-content: space-between; gap: 18px; margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--portfolio-line); font-size: 12px; }
.project-bottom > span { color: #5c6964; }
.project-bottom strong { color: var(--portfolio-ink); }
.project-bottom a { color: var(--portfolio-ink); font-weight: 800; text-decoration: none; white-space: nowrap; }
.project-bottom a:hover { color: var(--portfolio-accent); }

.discovery-section { padding: clamp(76px, 9vw, 126px) 0; }
.section-intro { grid-template-columns: 42px minmax(0, 1.4fr) minmax(250px, .6fr); margin-bottom: 36px; }
.section-intro h2 { max-width: 14ch; font-size: clamp(46px, 5.3vw, 70px); }
.toolbar { grid-template-columns: minmax(220px, .6fr) minmax(0, 1.4fr); gap: 28px; align-items: end; }
.search-wrap input { height: 52px; border-color: #abb5ac; border-radius: 3px; }
.category-tabs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; overflow: visible; }
.category-tabs .filter-button, .more-filters summary { min-height: 42px; padding: 0 14px; border: 1px solid #ced5ce; border-radius: 3px; background: transparent; color: var(--portfolio-ink); font: 750 11px/1.2 var(--body); cursor: pointer; }
.category-tabs .filter-button:hover, .more-filters summary:hover { border-color: var(--portfolio-ink); }
.category-tabs .filter-button.is-active { background: var(--portfolio-ink); color: white; border-color: var(--portfolio-ink); }
.more-filters { position: relative; z-index: 4; }
.more-filters summary { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; list-style: none; }
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters summary::after { content: " ↓"; }
.more-filter-options { position: absolute; top: calc(100% + 8px); right: 0; display: flex; width: min(360px, 80vw); gap: 8px; flex-wrap: wrap; padding: 16px; border: 1px solid var(--portfolio-line); background: #fff; box-shadow: 0 16px 32px rgba(32,40,38,.12); }
.gallery-status { margin: 18px 0 10px; font-size: 12px; }
.skill-grid { display: block; border-top: 1px solid var(--portfolio-ink); }
.skill-index-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 88px 194px; gap: 24px; align-items: center; padding: 24px 0; border-bottom: 1px solid var(--portfolio-line); }
.skill-index-row:hover { background: #f7f8f4; }
.index-number { align-self: start; padding-top: 5px; color: var(--portfolio-accent); font: 800 11px/1 ui-monospace, SFMono-Regular, monospace; }
.index-main { min-width: 0; }
.index-main > span { display: block; margin-bottom: 6px; color: #64706a; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.index-main h3 { margin: 0 0 5px; font-size: clamp(23px, 2.5vw, 33px); font-weight: 650; letter-spacing: -.05em; line-height: 1.08; overflow-wrap: anywhere; }
.index-main p { display: -webkit-box; max-width: 74ch; margin: 0; overflow: hidden; color: #626d68; font-size: 13px; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.index-rating { display: grid; gap: 3px; }
.index-rating strong { font-size: 22px; letter-spacing: -.04em; }
.index-rating small { color: #67716d; font-size: 10px; }
.index-actions { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; justify-content: flex-end; font-size: 11px; }
.index-actions a { font-weight: 800; color: var(--portfolio-ink); text-decoration: none; }
.index-actions a:first-child { white-space: nowrap; }
.index-actions .index-source { font-size: 10px; color: #5b6a62; }
.index-actions button { padding: 0; border: 0; background: none; color: #5b6a62; font: inherit; font-weight: 800; cursor: pointer; }
.index-actions a:hover, .index-actions button:hover { color: var(--portfolio-accent); }
.gallery-more { margin: 28px 0 0; border-radius: 3px; font-size: 12px; font-weight: 800; }

.field-test-section { padding: clamp(76px, 9vw, 126px) 0; }
.field-test-heading { margin-bottom: 36px; }
.field-test-heading h2 { max-width: 15ch; }
.field-test-rail { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
.field-test-card { grid-column: span 2; grid-template-columns: minmax(0, 1fr); min-width: 0; border-radius: 2px; }
.field-test-card.is-compact { grid-column: span 3; }
.field-test-preview { display: block; position: relative; width: 100%; height: 206px; overflow: hidden; background: #d9dfd6; border-bottom: 1px solid var(--portfolio-line); }
.field-test-preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.field-test-preview iframe { display: block; width: 200%; height: 540px; border: 0; transform: scale(.5); transform-origin: top left; pointer-events: none; }
.field-test-card .field-test-copy { padding: 22px; }
.field-test-card .field-test-copy h3 { margin-top: 18px; font-size: 27px; }
.field-test-card .field-test-copy > p { display: -webkit-box; min-height: 66px; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.field-test-card.is-compact .field-test-copy > p { min-height: 0; }
.field-test-card.is-compact .field-test-copy { padding: 22px 26px; }
.field-test-card.is-compact .field-test-copy h3 { margin-top: 12px; }
.method-section { background: #fdfdf9; }

@media (max-width: 1080px) {
  .gallery-hero .hero-layout { grid-template-columns: 1fr; }
  .gallery-hero .hero-copy h1 { max-width: 13ch; }
  .latest-lab { max-width: 780px; }
  .section-intro { grid-template-columns: 42px 1fr; }
  .section-intro > p { grid-column: 2; }
  .skill-index-row { grid-template-columns: 28px minmax(0, 1fr) 78px; }
  .index-actions { grid-column: 2 / -1; justify-content: flex-start; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 32px, 1240px); }
  .gallery-hero { padding: 46px 0 72px; }
  .gallery-hero .hero-layout { gap: 42px; }
  .gallery-hero .hero-copy h1 { font-size: clamp(57px, 15.3vw, 82px); }
  .gallery-hero .hero-subtitle { font-size: 15px; }
  .hero-footnote { margin-top: 25px; }
  .latest-lab { box-shadow: 8px 8px 0 #dfe6dc; }
  .lab-preview { height: 220px; }
  .latest-lab-heading { padding: 24px 22px 0; }
  .lab-result { margin-inline: 22px; }
  .selected-heading { grid-template-columns: 1fr; gap: 14px; }
  .selected-heading h2 { font-size: 50px; }
  .product-rail { grid-template-columns: 1fr; gap: 18px; }
  .selected-preview { aspect-ratio: 1.55; }
  .selected-project-copy { padding: 22px; }
  .selected-project p { min-height: 0; }
  .project-bottom { flex-wrap: wrap; margin-top: 22px; }
  .section-intro { grid-template-columns: 1fr; }
  .section-intro > p { grid-column: auto; }
  .section-intro h2 { font-size: 52px; }
  .toolbar { grid-template-columns: 1fr; gap: 16px; }
  .category-tabs { flex-wrap: wrap; overflow: visible; }
  .skill-index-row { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px 12px; padding: 20px 0; }
  .index-main h3 { font-size: 24px; }
  .index-main p { -webkit-line-clamp: 2; }
  .index-rating { align-self: start; }
  .index-rating strong { font-size: 16px; }
  .index-rating small { display: none; }
  .index-actions { grid-column: 2 / -1; margin-top: 6px; }
  .field-test-rail { grid-template-columns: 1fr; }
  .field-test-card, .field-test-card.is-compact { grid-column: auto; }
  .field-test-preview { height: 210px; }
  .field-test-card .field-test-copy > p { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .selected-preview img { transition: none; }
}
