/* Carousel, intro + static map, figures, figure carousel, stats. Loaded after refined.css. */

.brand { letter-spacing: .02em; }

/* ---------- Image boxes that take a real image when it exists ---------- */
.ph { position: relative; overflow: hidden; }
.ph > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--gray-box); }
.grid-2 .card .ph > img { object-fit: cover; }          /* work-page cards: 16:10 crop */
.ph.hero { aspect-ratio: 16 / 9; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); margin: var(--s4) 0 var(--s2); padding-block: var(--s3); border-block: 1px solid var(--line); }
.stat strong { display: block; font-family: var(--font-head); font-weight: 500; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.1; white-space: nowrap; color: var(--ink); }
.stat span { display: block; font-size: var(--fs-small); color: var(--ink-soft); line-height: 1.4; margin-top: 4px; }

/* ---------- Carousel: images only, not interactive ---------- */
.carousel { overflow: hidden; padding-block: var(--s4); pointer-events: none; cursor: default; }
.car-track { display: flex; width: max-content; animation: car-scroll 110s linear infinite; }
@keyframes car-scroll { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.car-item { flex: 0 0 auto; width: clamp(250px, 26vw, 340px); padding-right: var(--s3); }
.car-card { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 10px; background: #e4e1d3; box-shadow: 0 2px 12px rgba(0, 0, 0, .08); }
.car-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (prefers-reduced-motion: reduce) {
  .carousel { overflow-x: auto; pointer-events: auto; scroll-snap-type: x proximity; }
  .car-track { animation: none; }
  .car-item { scroll-snap-align: start; }
  .car-item[data-copy] { display: none; }
}

/* ---------- Intro + static map ---------- */
.intro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); align-items: center; padding-block: var(--s5) var(--s6); }
.intro h1 { margin-bottom: var(--s2); }
.intro .sub { font-size: 1.125rem; color: var(--ink); font-weight: 400; margin-bottom: var(--s3); }
.intro .btn { margin-top: var(--s2); }


/* ---------- Figure carousel ---------- */
.figcar { --fig-h: clamp(460px, 76vh, 760px); margin-top: var(--s3); }
.figcar-stage { position: relative; height: var(--fig-h); background: transparent; border-radius: 14px; }
.figcar-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 14px; }
.figcar-track::-webkit-scrollbar { display: none; }
.figcar-track:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.figcar-slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; margin: 0; }
.figcar-slide img { width: calc(100% - 96px); height: calc(var(--fig-h) - 32px); object-fit: contain; background: transparent; mix-blend-mode: multiply; border-radius: 0; box-shadow: none; cursor: default; }
.figcar-ph { width: min(560px, calc(100% - 112px)); height: calc(var(--fig-h) - 32px); background: #e4e1d3; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #4a5636; font-size: var(--fs-small); }
.figcar-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: #fff; color: #2d3b1f; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); display: grid; place-items: center; cursor: pointer; transition: opacity 200ms var(--ease), box-shadow 200ms var(--ease); z-index: 2; }
.figcar-btn.prev { left: 12px; }
.figcar-btn.next { right: 12px; }
.figcar-btn:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(0, 0, 0, .22); }
.figcar-btn:disabled { opacity: .35; cursor: default; }
.figcar-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.figcar-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); min-width: 0; margin-top: var(--s1); }
.figcar-dots { display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; }
.figcar-dot { width: 24px; height: 24px; border: 0; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; }
.figcar-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background 200ms var(--ease), transform 200ms var(--ease); }
.figcar-dot[aria-current="true"]::before { background: var(--accent); transform: scale(1.3); }
.figcar-count { font-size: var(--fs-small); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.figcar-caption { margin: var(--s1) 0 0; font-size: var(--fs-small); color: var(--ink-soft); min-height: 1.6em; }

@media (max-width: 899px) {
  .intro-grid { grid-template-columns: 1fr; gap: var(--s4); padding-block: var(--s4) var(--s5); }
}
@media (max-width: 767px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .figcar-btn { width: 40px; height: 40px; }
  .figcar-slide img, .figcar-ph { max-width: calc(100% - 100px); }
  .figcar-slide img { width: calc(100% - 88px); }
}
@media (prefers-reduced-motion: reduce) { .figcar-track { scroll-behavior: auto; } }

/* ==========================================================
   Case-study layout: header + thumbs, sticky menu bar, 30/70 rows
   ========================================================== */
html { scroll-padding-top: 140px; }

.case-head { display: grid; grid-template-columns: 5fr 7fr; gap: var(--s5); align-items: center; padding-block: var(--s3) var(--s5); }
.case-head h1 { font-size: var(--fs-h1); }
.case-head .back { margin-top: 0; }
.meta-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: var(--s3) 0 0; }
.meta-compact .tools { grid-column: 1 / -1; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; pointer-events: none; }
.thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: #f3f2ea; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }

/* Sticky in-page menu as a horizontal bar */
.toc.toc-bar { position: sticky; top: var(--header-h); z-index: 20; margin: 0; padding: 0; background: var(--header-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.toc-bar ul { display: flex; gap: var(--s3); overflow-x: auto; border-left: 0; }
.toc-bar a { margin: 0; padding: 14px 4px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.toc-bar a.active { border-bottom-color: var(--accent); }

/* Two-column section rows */
.case-row { display: grid; grid-template-columns: 3fr 7fr; gap: var(--s5); align-items: start; padding-block: var(--s5); border-bottom: 1px solid var(--line); }
.case-text { position: sticky; top: 136px; align-self: start; }
.case-text h2 { margin-bottom: var(--s2); }
.case-visuals { display: grid; gap: var(--s3); min-width: 0; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.vfig { margin: 0; min-width: 0; }
.vfig img, .vfig .vph { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--gray-box); box-shadow: 0 2px 12px rgba(0, 0, 0, .08); }
.vfig .vph { aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); font-size: var(--fs-small); }
.vfig figcaption { margin-top: 8px; font-size: var(--fs-small); color: var(--ink-soft); line-height: 1.4; }
.case-visuals .figcar { margin-top: 0; }

/* 4-step flow diagram */
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.flow li { position: relative; display: flex; flex-direction: column; gap: 8px; background: var(--sky); border-radius: 12px; padding: 16px; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -22px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-size: 1.125rem; }
.flow-n { font-family: var(--font-head); font-size: 1.5rem; line-height: 1; color: var(--accent); }
.flow-t { font-size: var(--fs-small); line-height: 1.4; color: var(--ink); font-weight: 400; }

/* Stat tiles */
.stat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { background: var(--sky); border-radius: 12px; padding: 16px 20px; }
.tile strong { display: block; font-family: var(--font-head); font-weight: 500; font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.15; white-space: nowrap; color: var(--ink); }
.tile span { display: block; margin-top: 4px; font-size: var(--fs-small); line-height: 1.4; color: var(--ink-soft); }

.impact-list { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--s1); color: var(--ink-soft); }

/* Smaller project buttons */
.case-row .btn, .contact-box .btn { min-height: 40px; padding: 8px 18px; font-size: .9375rem; }
.pills .pill { min-height: 36px; padding: 4px 14px; font-size: .875rem; }

@media (max-width: 1000px) {
  .flow { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .flow li::after { display: none; }
}
@media (max-width: 799px) {
  .case-head { grid-template-columns: 1fr; gap: var(--s4); }
  .case-row { grid-template-columns: 1fr; gap: var(--s3); padding-block: var(--s4); }
  .case-text { position: static; }
  .fig-pair { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; }
  .stat-tiles { grid-template-columns: 1fr 1fr; }
  .toc-bar ul { gap: var(--s2); }
}

/* Single-figure carousels hide their controls */
.figcar--single .figcar-btn, .figcar--single .figcar-meta { display: none; }
.figcar--single .figcar-slide img { width: calc(100% - 32px); }
.figcar--single .figcar-caption { margin-top: var(--s1); }

/* Header document links */
.meta-compact .doc-links { grid-column: 1 / -1; }
.doc-links dd { display: flex; flex-wrap: wrap; gap: var(--s2); font-size: var(--fs-small); }

/* Wider case-study pages so figures can be larger */
.wrap.case-wide { --max: 1360px; }
.case-row { gap: var(--s4); }

/* Zoom button + viewer */
.figcar-zoom { position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; color: #2d3b1f; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); display: grid; place-items: center; cursor: pointer; z-index: 2; transition: box-shadow 200ms var(--ease), opacity 200ms var(--ease); }
.figcar-zoom:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(0, 0, 0, .22); }
.figcar-zoom:disabled { opacity: .35; cursor: default; }
.figcar-zoom svg, .zoom-bar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zoomdlg { width: min(96vw, 1500px); height: 92vh; max-width: none; max-height: none; padding: 0; border: 0; border-radius: 14px; background: var(--bg); color: var(--ink); overflow: hidden; }
.zoomdlg[open] { display: flex; flex-direction: column; }
.zoomdlg::backdrop { background: rgba(20, 28, 12, .6); }
.zoom-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; }
.zoom-bar button { min-width: 40px; height: 40px; padding: 0 12px; border: 0; border-radius: 20px; background: #fff; color: #2d3b1f; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); display: inline-flex; align-items: center; justify-content: center; font: 500 14px var(--font-body); cursor: pointer; }
.zoom-view { flex: 1; min-height: 0; overflow: hidden; display: grid; place-items: center; touch-action: none; }
.zoom-view img { max-width: 96%; max-height: 100%; object-fit: contain; mix-blend-mode: multiply; user-select: none; -webkit-user-drag: none; transform-origin: center; }
.zoom-cap { margin: 0; padding: 10px 16px 14px; font-size: var(--fs-small); color: var(--ink-soft); text-align: center; }

/* Background, datasets, methodology blocks */
.info-block h3 { font-size: 1.375rem; margin: 0 0 var(--s1); }
.info-bullets { margin: var(--s1) 0 0; padding-left: 1.25rem; display: grid; gap: 6px; color: var(--ink-soft); }
.info-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.info-card { background: var(--sky); border-radius: 12px; padding: 16px 18px; }
.info-card strong { display: block; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.info-card p { margin: 0; font-size: var(--fs-small); line-height: 1.55; color: var(--ink-soft); }
.refs { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--s1); font-size: var(--fs-small); color: var(--ink-soft); }
.refs a { margin-left: 4px; }
@media (max-width: 799px) { .info-cards { grid-template-columns: 1fr; } .zoomdlg { height: 88vh; } }
@media (prefers-reduced-motion: reduce) { .zoom-view img { transition: none; } }

/* No backgrounds behind figures: they sit on the page background. */
.figcar-slide img, .zoom-view img { background: transparent; }
/* Dark mode: maps are drawn for light backgrounds, so keep a light surface behind them. */
[data-theme="dark"] .figcar-stage, [data-theme="dark"] .zoomdlg { background: #fdfcf7; }
[data-theme="dark"] .zoomdlg, [data-theme="dark"] .zoom-cap { color: #2d3b1f; }
[data-theme="dark"] .figcar-caption, [data-theme="dark"] .figcar-count { color: var(--ink-soft); }

/* Header presentation carousel */
.head-deck { min-width: 0; }
.head-deck .figcar { --fig-h: clamp(300px, 44vh, 460px); margin-top: 0; }
.vlabel { font-size: 1.125rem; margin: var(--s2) 0 0; color: var(--ink); }
.deck-link { font-size: var(--fs-small); justify-self: start; }
.info-card a { white-space: nowrap; }

/* Home hero topographic background (home page only) */
.home-hero { position: relative; isolation: isolate; --topo-o: .3; }
.hero-topo { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: url("images/topo-bg.svg") center / cover no-repeat; opacity: var(--topo-o); -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%); mask-image: linear-gradient(to bottom, #000 55%, transparent 100%); }

/* Berkeley page: header image + PDF embed */
.head-hero { min-width: 0; }
.head-hero img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: var(--gray-box); box-shadow: 0 2px 12px rgba(0, 0, 0, .08); }
.pdf-embed { width: 100%; height: min(86vh, 900px); min-height: 520px; border: 0; border-radius: 12px; background: var(--gray-box); }

/* ---------- Home sections: About, Methods, Experience, Work ---------- */
#about .two-col { grid-template-columns: 1fr 2fr; }
#work .pills { margin-top: var(--s3); }

/* ---------- Zoom viewer: scrollable, nothing cut off ---------- */
.zoom-view { display: flex; overflow: auto; place-items: initial; touch-action: auto; }
.zoom-view img { flex: none; margin: auto; max-width: none; max-height: none; transform: none; }

/* ---------- 16:9 deck carousels fill their frame ---------- */
.figcar--deck .figcar-stage { height: auto; aspect-ratio: 16 / 9; }
.figcar--deck .figcar-track { height: 100%; }
.figcar--deck .figcar-slide img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
.case-head-text { align-self: center; }

/* ---------- Project title weights ---------- */
.t-bold { font-weight: 700; color: var(--ink); }
.t-light { font-weight: 400; }

/* ---------- About: photo left (sticky), text right ---------- */
.about-text .lede { margin-top: 0; }
.about-sub { font-size: 1.25rem; margin: var(--s4) 0 var(--s1); }
#about .two-col { display: block; }

/* ---------- Experience & Collaborations ---------- */
.exp-title { font-family: var(--font-head); letter-spacing: .06em; }

/* Fade in once on scroll (only when JS is running) */

@media (max-width: 899px) {
}

/* ---------- Carousel is clickable now ---------- */
.carousel { pointer-events: auto; }
.carousel:hover .car-track, .carousel:focus-within .car-track { animation-play-state: paused; }
.car-item { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.car-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.car-title { position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .94); color: #2d3b1f; font: 500 14px/1.35 var(--font-body); opacity: 0; transform: translateY(4px); transition: opacity 200ms var(--ease), transform 200ms var(--ease); pointer-events: none; z-index: 1; }
.car-item:hover .car-title, .car-item:focus-visible .car-title { opacity: 1; transform: none; }
.intro-sub { font-size: 1.25rem; margin: var(--s3) 0 var(--s1); }

/* ---------- Zoom viewer: previous / next ---------- */
.zoom-body { position: relative; flex: 1; min-height: 0; display: flex; }
.zoom-body .zoom-view { flex: 1; min-width: 0; }
.zoom-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: #fff; color: #2d3b1f; box-shadow: 0 2px 10px rgba(0, 0, 0, .18); display: grid; place-items: center; cursor: pointer; z-index: 3; transition: opacity 200ms var(--ease); }
.zoom-nav.prev { left: 14px; }
.zoom-nav.next { right: 14px; }
.zoom-nav:disabled { opacity: .35; cursor: default; }
.zoom-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zoom-nav[hidden] { display: none; }

/* ---------- Logos: always shown whole, never cropped ---------- */

/* ---------- Logo wall: one tidy grid, no staggering ---------- */

/* ---------- Logo grid (3 columns, centred, large) ---------- */

/* ---------- Map: just the country, no box ---------- */

/* ---------- Logos: big, no backgrounds, same in light and dark ---------- */

/* ---------- Experience: logos left, write-up right; original logo colours in both modes ---------- */

/* ==========================================================
   Logos: ONE set of rules (light and dark share the same sizes)
   ========================================================== */
.logo-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5) var(--s4); align-items: start; }
.logo-col { display: contents; }
.logo-item { order: var(--i); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; min-width: 0; background: none; border: 0; box-shadow: none; }
.logo-img { width: 100%; height: 170px; display: flex; align-items: center; justify-content: center; margin-bottom: var(--s1); }
.logo-img img { display: block; width: auto; height: auto; max-width: 100%; max-height: 150px; object-fit: contain; }
.logo-item strong { font-weight: 700; color: var(--ink); line-height: 1.3; font-size: 1.0625rem; }
.logo-item em { font-style: italic; font-size: 1rem; color: var(--ink-soft); line-height: 1.4; }
/* Dark mode: a light plate behind each logo; the logo itself stays the same size */
[data-theme="dark"] .logo-img img { box-sizing: content-box; background: #fdfcf7; padding: 10px 14px; border-radius: 10px; max-width: calc(100% - 28px); max-height: 150px; }
/* Fade in once on scroll */
.js .logo-item { opacity: 0; transform: translateY(12px); transition: opacity .4s ease-out, transform .4s ease-out; }
.js .logo-item.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .logo-item { opacity: 1; transform: none; transition: none; } }
@media (max-width: 899px) {
  .logo-wall { grid-template-columns: repeat(2, 1fr); gap: var(--s5) var(--s3); }
  .logo-img { height: 140px; }
  .logo-img img, [data-theme="dark"] .logo-img img { max-height: 120px; }
}

/* ---------- Experience: logos on the LEFT, write-up on the RIGHT (stacks only on phones) ---------- */
.exp-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s5); align-items: start; }
.exp-text { order: 0; max-width: none; }
.exp-text p { max-width: 52ch; }
@media (max-width: 900px) { .exp-grid { grid-template-columns: 3fr 2fr; gap: var(--s4); } }
@media (max-width: 640px) { .exp-grid { grid-template-columns: 1fr; } .exp-text { order: -1; } }

/* ==========================================================
   Desktop-sized home page: each section fills the screen, with a scroll-down arrow
   ========================================================== */
html.is-home { scroll-padding-top: var(--header-h); }
.is-home .wrap { --max: 1240px; }
.snap { position: relative; min-height: calc(100vh - var(--header-h)); display: flex; flex-direction: column; justify-content: center; padding-block: var(--s5) 104px; }
.home-hero.snap { padding-block: 0 104px; }
.snap > .wrap { width: min(100% - 64px, var(--max)); }
.scroll-down { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); display: grid; place-items: center; z-index: 3; animation: bob 2.2s ease-in-out infinite; transition: background-color 200ms var(--ease), border-color 200ms var(--ease); }
.scroll-down:hover { background: var(--sky); border-color: var(--accent); }
.scroll-down svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .scroll-down { animation: none; } }
@media (max-width: 899px) { .snap, .home-hero.snap { min-height: 0; padding-block: var(--s5); } .scroll-down { display: none; } }

/* ---------- Work thumbnails that cycle through slides ---------- */
.ph.cycle { background: #fff; }
.ph.cycle > img { opacity: 0; object-fit: contain; background: #fff; transition: opacity 700ms ease; }
.ph.cycle > img.on { opacity: 1; }

/* ---------- Work thumbnails: whole slide visible, fast crossfade ---------- */
.grid-2 .card .ph { aspect-ratio: 16 / 9; }
.grid-2 .card .ph.cycle > img { object-fit: contain; transition: opacity 400ms ease; }

/* ---------- One always-visible scroll arrow, bottom left ---------- */
.scroll-next { position: fixed; left: 24px; bottom: 24px; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); display: grid; place-items: center; z-index: 60; cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); transition: background-color 200ms var(--ease), border-color 200ms var(--ease); }
.scroll-next:hover { background: var(--sky); border-color: var(--accent); }
.scroll-next svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 300ms var(--ease); animation: bob-y 2.2s ease-in-out infinite; }
.scroll-next.up svg { transform: rotate(180deg); animation: none; }
@keyframes bob-y { 0%, 100% { translate: 0 -2px; } 50% { translate: 0 4px; } }
@media (prefers-reduced-motion: reduce) { .scroll-next svg { animation: none; } }
.snap { padding-bottom: var(--s6); }
.home-hero.snap { padding-bottom: 0; }

/* ---------- Experience: logo bubbles, role on hover ---------- */

/* ---------- Half the side margins: container = (viewport + max-width) / 2 ---------- */
.wrap, .snap > .wrap { width: min(calc(50% + var(--max) / 2), calc(100% - 32px)); }

/* ==========================================================
   Experience: interactive bubble field (fisheye magnification)
   ========================================================== */

/* ==========================================================
   Experience: floating bubble cloud (fisheye)
   ========================================================== */
.bubble-stage { position: relative; height: 470px; border-radius: 18px; background: #f6f5ea; border: 1px solid #e4e6d8; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
.cloud-bubble { position: absolute; left: 0; top: 0; border-radius: 50%; background: #fff; box-shadow: 0 6px 18px rgba(45, 59, 31, .14); display: grid; place-items: center; outline: none; will-change: transform; cursor: default; }
.cloud-bubble:focus-visible { box-shadow: 0 0 0 3px var(--accent), 0 6px 18px rgba(45, 59, 31, .14); }
.cloud-bubble > img { width: 66%; height: 66%; object-fit: contain; display: block; pointer-events: none; }
.cloud-label { position: absolute; left: 0; top: 0; z-index: 99999; max-width: 240px; padding: 8px 12px; border-radius: 10px; background: #2d3b1f; color: #fdfcf7; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); opacity: 0; transition: opacity 150ms ease-out; pointer-events: none; }
.cloud-label.show { opacity: 1; }
.cloud-label strong { display: block; font-weight: 700; font-size: .9375rem; line-height: 1.25; color: #fdfcf7; }
.cloud-label em { display: block; margin-top: 3px; font-style: italic; font-size: .8125rem; line-height: 1.3; color: #e6ecd0; }
.cloud-hint { position: absolute; left: 14px; bottom: 10px; margin: 0; z-index: 1; font-size: .8125rem; line-height: 1.3; color: #4a5636; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .cloud-label { transition: none; } }
@media (max-width: 640px) { .bubble-stage { height: 420px; } }

/* ---------- Bubble stage: no background rectangle ---------- */
.bubble-stage { background: none; border: 0; border-radius: 0; overflow: visible; }

/* ---------- Skills pills ---------- */

/* ---------- Top carousel shows whole presentation title slides ---------- */
.car-card { background: #fff; }
.car-card img { object-fit: contain; }

/* ---------- Header lines up with the page body on every page (SV left edge, menu right edge) ---------- */
.site-header .wrap { --max: 1120px; }
.is-home .site-header .wrap { --max: 1240px; }
html:has(.case-wide) .site-header .wrap { --max: 1360px; }

/* ==========================================================
   First screen fits the window: carousel + intro + "View Work" + map all visible on open.
   Sizes scale with the window height.
   ========================================================== */
@media (min-width: 900px) {
  .home-hero.snap { height: calc(100vh - var(--header-h)); min-height: 520px; padding: 0 0 8px; justify-content: space-between; }
  .home-hero .carousel { flex: 0 0 auto; padding-block: 16px 6px; }
  .home-hero .car-item { width: min(clamp(220px, 26vw, 340px), 36vh); }
  .home-hero .intro-grid { flex: 1; min-height: 0; padding-block: 0 8px; align-items: center; }
  .home-hero .intro h1 { font-size: var(--fs-h1); margin-bottom: 8px; }
  .home-hero .intro .sub { font-size: clamp(14px, 2vh, 16px); margin-bottom: 12px; }
  .home-hero .intro p { margin-bottom: 12px; }
  .home-hero .intro .btn { margin-top: 6px; }
}

/* ==========================================================
   Brand: SV logo = favicon (dark-green rounded square, cream "SV")
   ========================================================== */
.brand { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: #2d3b1f; color: #fdfcf7; font-family: var(--font-head); font-weight: 600; font-size: 1.125rem; letter-spacing: .02em; line-height: 1; text-decoration: none; }
.brand:hover { color: #fdfcf7; }
[data-theme="dark"] .brand { box-shadow: inset 0 0 0 1px rgba(253, 252, 247, .22); }

/* ==========================================================
   Work filters: multi-category tags, fade
   ========================================================== */
.card { transition: opacity .25s ease; }
.card.fade-out { opacity: 0; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.card .card-tags .tag { margin: 0; }
.filter-note { margin: var(--s1) 0 var(--s2); color: var(--ink-soft); font-size: var(--fs-small); }
.link-btn { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }

/* ==========================================================
   Skills: four groups
   ========================================================== */

/* ==========================================================
   World map (CSS colours the land + borders; pins sit on top by %)
   ========================================================== */
.world-map { position: relative; width: 100%; aspect-ratio: 1000 / 437; }
.world-map > img, .world-map > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.world-map .country { fill: #dfe5cc; stroke: var(--bg); stroke-width: .7px; vector-effect: non-scaling-stroke; }
[data-theme="dark"] .world-map .country { fill: #34461f; }
.pins { position: absolute; inset: 0; }
.pin-wrap { position: absolute; width: 0; height: 0; }
.pin-wrap:hover, .pin-wrap:focus-within { z-index: 6; }
.pin { position: absolute; left: 0; top: 0; display: block; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #66723a; box-shadow: 0 0 0 1.5px var(--bg); transition: width .15s ease, height .15s ease, margin .15s ease; }
.pin::after { content: ""; position: absolute; inset: -6px; }
.pin-wrap:hover .pin, .pin:focus-visible { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.pin:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.pin-label { position: absolute; left: 0; bottom: 12px; transform: translateX(-50%); white-space: nowrap; padding: 4px 9px; border-radius: 7px; background: #2d3b1f; color: #fdfcf7; font: 500 12px/1.3 var(--font-body); box-shadow: 0 4px 14px rgba(0, 0, 0, .2); opacity: 0; pointer-events: none; transition: opacity .15s ease; text-align: center; }
.pin-label strong { display: block; font-weight: 600; color: #fdfcf7; }
.pin-label em { display: block; font-style: italic; font-size: 11px; color: #e6ecd0; }
.pin-wrap:hover .pin-label, .pin:focus-visible + .pin-label { opacity: 1; }
@media (min-width: 900px) {
  .home-hero .intro-grid { grid-template-columns: 1fr 1.25fr; }
  .home-hero .world-map { width: 100%; }
}

/* ==========================================================
   Top carousel: title slides only (no text, borders or links)
   ========================================================== */
.carousel { pointer-events: none; cursor: default; }
.carousel:hover .car-track { animation-play-state: running; }
.home-hero .car-item, .car-item { width: auto; flex: 0 0 auto; padding-right: 24px; cursor: default; display: block; }
.car-card { --ch: min(160px, 22vh); height: var(--ch); width: calc(var(--ch) * 16 / 9); aspect-ratio: auto; border: 0; border-radius: 10px; background: transparent; box-shadow: 0 2px 12px rgba(0, 0, 0, .08); overflow: hidden; position: relative; }
.car-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 10px; }
.car-title, .car-fallback { display: none; }
@media (max-width: 640px) { .car-card { --ch: 120px; } }

/* ---------- Top carousel: clickable again, title on hover, pauses while you aim ---------- */
.carousel { pointer-events: auto; }
.carousel:hover .car-track, .carousel:focus-within .car-track { animation-play-state: paused; }
.car-item, .home-hero .car-item { cursor: pointer; text-decoration: none; color: inherit; }
.car-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.car-title { display: block; position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .94); color: #2d3b1f; font: 500 14px/1.35 var(--font-body); opacity: 0; transform: translateY(4px); transition: opacity 200ms var(--ease), transform 200ms var(--ease); pointer-events: none; z-index: 2; }
.car-item:hover .car-title, .car-item:focus-visible .car-title { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .car-title { transition: none; } }

/* ---------- Dotted background also sits behind the top bar on the home page ---------- */
.is-home .hero-topo { top: calc(var(--header-h) * -1); }
.is-home .site-header { transition: background-color .2s ease, border-color .2s ease; }
.is-home .site-header.at-top { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }


/* ===== About: cutout photo + sketches, plain-bullet skills ===== */
#about { overflow-x: clip; }
.about-container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.about-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 56px; align-items: start; }
.about-grid > * { min-width: 0; }
.about-text { overflow-wrap: anywhere; position: relative; z-index: 3; }
.about-visual { position: relative; width: 100%; }
.about-photo { position: relative; z-index: 2; display: block; }
.about-photo img { display: block; width: 100%; height: auto; background: none; border: 0; border-radius: 0; box-shadow: none; }

.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 32px; margin-top: var(--s1); }
.skill-group { margin: 0; min-width: 0; }
.skill-label { margin: 0 0 6px; font-family: var(--font-body); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #66723a; }
[data-theme="dark"] .skill-label { color: #a9b985; }
.skill-list { margin: 0; padding-left: 1.2em; list-style: disc; font-size: 15px; line-height: 1.6; color: inherit; }
.skill-list li { margin: 0; }

/* sketches sit behind the cutout */
.sk { position: absolute; z-index: 1; left: 50%; top: 68%; width: var(--w); pointer-events: none;
  transform: translate(-50%, -50%) scale(.4); opacity: 0;
  transition: left 1000ms cubic-bezier(.2,.8,.2,1), top 1000ms cubic-bezier(.2,.8,.2,1), transform 1000ms cubic-bezier(.2,.8,.2,1), opacity 1000ms cubic-bezier(.2,.8,.2,1);
  transition-delay: calc(var(--i) * 150ms); }
.sk img { display: block; width: 100%; height: auto; }
.sk-house-1   { --i:0; --w:40%; --x:14%; --y:48%; --r:-8deg; --d:4.4s; z-index:1; }
.sk-villa     { --i:1; --w:52%; --x:20%; --y:67%; --r:-5deg; --d:5s;   z-index:1; }
.sk-colosseum { --i:2; --w:52%; --x:12%; --y:88%; --r:4deg;  --d:5.6s; z-index:2; }
.sk-temple    { --i:3; --w:36%; --x:86%; --y:50%; --r:8deg;  --d:4.8s; z-index:2; }
.sk-pavilion  { --i:4; --w:52%; --x:84%; --y:68%; --r:5deg;  --d:4.2s; z-index:1; }
.sk-house-2   { --i:5; --w:52%; --x:86%; --y:90%; --r:-3deg; --d:5.2s; z-index:2; }
.about-visual.in .sk { left: var(--x); top: var(--y); transform: translate(-50%, -50%) rotate(var(--r)) scale(1); opacity: .9; }
.about-visual.in .sk img { animation: sk-bob var(--d) ease-in-out infinite; animation-delay: calc(1000ms + var(--i) * 150ms); }
@keyframes sk-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
[data-theme="dark"] .sk img { filter: invert(1); }

@media (max-width: 799px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .about-visual { max-width: 420px; margin: 0 auto; }
  .skills-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .sk { transition: none; left: var(--x); top: var(--y); transform: translate(-50%, -50%) rotate(var(--r)) scale(1); opacity: .9; }
  .about-visual.in .sk img, .sk img { animation: none; }
}

/* Filter pills use the same category colours as the card tags */
.pills .pill[data-filter="Spatial Data & Analysis"] { background: var(--sky); border-color: transparent; color: var(--ink); }
.pills .pill[data-filter="Transportation & Infrastructure"] { background: var(--sage); border-color: transparent; color: var(--ink); }
.pills .pill[data-filter="Land Use Planning & Research"] { background: var(--lavender); border-color: transparent; color: var(--ink); }
.pills .pill[data-filter]:not([data-filter="all"]):hover { filter: brightness(.96); }
.pills .pill[aria-pressed="true"], .pills .pill[aria-pressed="true"]:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); filter: none; }
