@import url("https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@100,400;100,450;100,500;100,600;100,700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

/*
  Portfolio blinds + fluid Work/Lab scroll restore
  - keeps the blinds page transition
  - restores scroll-reactive Work/Lab cards
  - does not use iframes/snapshots/body replacement for page navigation
  - does not re-render Work/Lab cards during mode switching
*/

:root {
  --portfolio-font-primary: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --portfolio-font-secondary: "IBM Plex Mono", "Courier New", monospace;
  --portfolio-blinds-duration: 560ms;
  --portfolio-blinds-stagger: 24ms;
  --portfolio-blinds-ease: cubic-bezier(.78, 0, .22, 1);
  --portfolio-blinds-bg: var(--bg, #ffffff);
  --portfolio-blinds-fg: var(--text, #050505);
}

body {
  font-family: var(--portfolio-font-primary) !important;
}

.brand,
.project-title,
.section-copy-title h1,
.masthead-title h1,
.contact-masthead h1,
.statement p,
.project-card .project-title,
.recognition-title,
.about-copy,
.copy-block p,
.text-image-copy,
.submission-popup-title {
  font-family: var(--portfolio-font-primary) !important;
}

.nav-button,
.nav-link,
.theme-button,
.subnav-button,
.filter-label,
.section-heading,
.pill,
.meta-word,
.copy-kicker,
.detail-label,
.submit-button,
.field label,
.form-status,
.back-link,
.jump-link,
.back-to-top,
.site-rights,
.recognition-meta,
.project-footer a,
.module-caption,
.media-caption,
.project-cta-label,
.cta-note,
.submission-popup-kicker,
.submission-popup-close {
  font-family: var(--portfolio-font-secondary) !important;
}

.nav-button,
.nav-link,
.theme-button,
.subnav-button,
.filter-label,
.section-heading,
.pill,
.meta-word,
.copy-kicker,
.detail-label,
.back-link,
.jump-link,
.site-rights,
.field label,
.submit-button,
.form-status,
.recognition-meta {
  letter-spacing: 0.055em !important;
}

.brand {
  cursor: pointer;
  text-decoration: none !important;
}

.brand:hover,
.brand:focus-visible {
  text-decoration: underline !important;
  text-underline-offset: .18em;
  outline: none;
}

.theme-button {
  min-width: 74px;
}

body,
.site-shell,
.topbar,
.mode,
.contact-masthead,
.contact-body,
.project-masthead,
.project-body,
.project-footer,
.site-rights,
.nav-button,
.nav-link,
.theme-button,
.subnav-button,
.back-to-top,
.field input,
.field textarea,
.submit-button {
  transition:
    background-color 300ms ease,
    background 300ms ease,
    color 300ms ease,
    border-color 300ms ease;
}

body.is-theme-fading {
  transition: background 300ms ease, color 300ms ease;
}

/* Early full-cover fallback before JS creates the individual slats. */
html.portfolio-blinds-boot::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: var(--portfolio-blinds-boot-bg, #ffffff);
  pointer-events: all;
}

html.portfolio-blinds-boot[data-blinds-theme="dark"]::before {
  background: var(--portfolio-blinds-boot-bg, #050505);
}

.portfolio-blinds-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  pointer-events: all;
  background: transparent;
  color: var(--portfolio-blinds-fg);
  contain: strict;
}

.portfolio-blinds-overlay[data-direction="column"] {
  flex-direction: row;
}

.portfolio-blinds-slat {
  position: relative;
  flex: 1 1 0;
  min-height: 1px;
  margin-bottom: -2px;
  background: var(--portfolio-blinds-bg);
  box-shadow:
    0 2px 0 var(--portfolio-blinds-bg),
    0 -1px 0 var(--portfolio-blinds-bg);
  transform: translateZ(0) scaleY(0);
  transform-origin: 50% 0%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  transition:
    transform var(--portfolio-blinds-duration) var(--portfolio-blinds-ease),
    background-color 300ms ease,
    box-shadow 300ms ease;
}

.portfolio-blinds-slat:last-child {
  margin-bottom: 0;
}

.portfolio-blinds-overlay[data-direction="column"] .portfolio-blinds-slat {
  min-width: 1px;
  min-height: auto;
  margin-bottom: 0;
  margin-right: -2px;
  box-shadow:
    2px 0 0 var(--portfolio-blinds-bg),
    -1px 0 0 var(--portfolio-blinds-bg);
  transform: translateZ(0) scaleX(0);
  transform-origin: 0% 50%;
}

.portfolio-blinds-overlay[data-direction="column"] .portfolio-blinds-slat:last-child {
  margin-right: 0;
}

/*
  Slight overscale intentionally overlaps neighbouring slats when fully closed.
  This removes sub-pixel seams/gaps on high-DPI displays and while the browser
  is compositing the transform animation.
*/
.portfolio-blinds-overlay.is-closed .portfolio-blinds-slat {
  transform: translateZ(0) scaleY(1.045);
}

.portfolio-blinds-overlay[data-direction="column"].is-closed .portfolio-blinds-slat {
  transform: translateZ(0) scaleX(1.045);
}

html.portfolio-blinds-transitioning,
html.portfolio-blinds-transitioning body {
  overflow: hidden !important;
}

html.portfolio-blinds-transitioning .submission-popup-backdrop,
html.portfolio-blinds-transitioning [data-submit-popup] {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* If old failed layers are still present, neutralise them. */
.portfolio-v4-underlay,
.portfolio-v5-underlay,
.portfolio-snapshot-layer,
.portfolio-reveal-layer,
.portfolio-transition-panel,
.portfolio-snapshot-frame,
.portfolio-reveal-frame {
  display: none !important;
}

/* Fluid Work/Lab scrolling. Only targets the real rendered grids. */
html.portfolio-fluid-scroll-ready #workGrid,
html.portfolio-fluid-scroll-ready #labGrid {
  isolation: isolate;
}

html.portfolio-fluid-scroll-ready #workGrid > .project-card,
html.portfolio-fluid-scroll-ready #labGrid > .project-card {
  --fluid-card-y: 0px;
  --fluid-card-rotate: 0deg;
  --fluid-media-y: 0px;
  --fluid-media-scale: 1.035;
  transform:
    translate3d(0, var(--fluid-card-y), 0)
    rotate(var(--fluid-card-rotate)) !important;
  transition:
    transform 150ms linear,
    opacity 460ms cubic-bezier(.18, .92, .2, 1),
    clip-path 520ms cubic-bezier(.18, .92, .2, 1) !important;
  will-change: transform, opacity, clip-path;
}

html.portfolio-fluid-scroll-ready #workGrid > .project-card:not(.is-fluid-visible),
html.portfolio-fluid-scroll-ready #labGrid > .project-card:not(.is-fluid-visible) {
  opacity: 0.001;
  clip-path: inset(0 0 10% 0);
}

html.portfolio-fluid-scroll-ready #workGrid > .project-card.is-fluid-visible,
html.portfolio-fluid-scroll-ready #labGrid > .project-card.is-fluid-visible {
  opacity: 1;
  clip-path: inset(0 0 0 0);
}

html.portfolio-fluid-scroll-ready #workGrid > .project-card .media-layer,
html.portfolio-fluid-scroll-ready #workGrid > .project-card .image-placeholder,
html.portfolio-fluid-scroll-ready #labGrid > .project-card .media-layer,
html.portfolio-fluid-scroll-ready #labGrid > .project-card .image-placeholder {
  top: -8% !important;
  height: 116% !important;
  transform:
    translate3d(0, var(--fluid-media-y), 0)
    scale(var(--fluid-media-scale)) !important;
  transform-origin: center;
  transition:
    transform 150ms linear,
    filter 360ms ease,
    opacity 360ms ease !important;
  will-change: transform;
}

html.portfolio-fluid-scroll-ready #workGrid > .project-card:hover,
html.portfolio-fluid-scroll-ready #workGrid > .project-card:focus-within,
html.portfolio-fluid-scroll-ready #labGrid > .project-card:hover,
html.portfolio-fluid-scroll-ready #labGrid > .project-card:focus-within {
  transform:
    translate3d(0, calc(var(--fluid-card-y) - 3px), 0)
    rotate(0deg) !important;
}

/* Keep filtered cards out without re-rendering the whole Work grid. */
.project-card.is-filtered-out,
.project-card[hidden] {
  display: none !important;
}

/* Dark-mode text contrast over media/black backgrounds. */
body[data-theme="dark"] .project-card .project-title,
body[data-theme="dark"] .project-card .project-description,
body[data-theme="dark"] .project-card .pill,
body[data-theme="dark"] .project-overlay,
body[data-theme="dark"] .project-overlay *,
body[data-theme="dark"] .media-stack,
body[data-theme="dark"] .media-stack *,
body[data-theme="dark"] .frame,
body[data-theme="dark"] .frame *,
body[data-theme="dark"] .project-footer a,
body[data-theme="dark"] .project-footer a *,
body[data-theme="dark"] .project-media-message,
body[data-theme="dark"] .hero,
body[data-theme="dark"] .hero *,
body[data-theme="dark"] .image-placeholder,
body[data-theme="dark"] .image-placeholder * {
  color: #ffffff !important;
}

body[data-theme="dark"] .project-card .project-description {
  color: rgba(255,255,255,.72) !important;
}

body[data-theme="dark"] .project-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.48) 50%, rgba(0,0,0,0) 100%) !important;
}

body[data-theme="dark"] .project-media,
body[data-theme="dark"] .media-stack,
body[data-theme="dark"] .frame,
body[data-theme="dark"] .project-footer a {
  background-color: #050505;
}

@media (max-width: 760px) {
  html.portfolio-fluid-scroll-ready #workGrid > .project-card,
  html.portfolio-fluid-scroll-ready #labGrid > .project-card {
    --fluid-card-y: 0px;
    --fluid-media-y: 0px;
    --fluid-media-scale: 1.02;
    transform: none !important;
  }

  html.portfolio-fluid-scroll-ready #workGrid > .project-card .media-layer,
  html.portfolio-fluid-scroll-ready #workGrid > .project-card .image-placeholder,
  html.portfolio-fluid-scroll-ready #labGrid > .project-card .media-layer,
  html.portfolio-fluid-scroll-ready #labGrid > .project-card .image-placeholder {
    top: -4% !important;
    height: 108% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-blinds-slat {
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }

  html.portfolio-fluid-scroll-ready #workGrid > .project-card,
  html.portfolio-fluid-scroll-ready #labGrid > .project-card,
  html.portfolio-fluid-scroll-ready #workGrid > .project-card .media-layer,
  html.portfolio-fluid-scroll-ready #labGrid > .project-card .media-layer,
  html.portfolio-fluid-scroll-ready #workGrid > .project-card .image-placeholder,
  html.portfolio-fluid-scroll-ready #labGrid > .project-card .image-placeholder {
    transform: none !important;
    transition-duration: 1ms !important;
  }

  html.portfolio-fluid-scroll-ready #workGrid > .project-card,
  html.portfolio-fluid-scroll-ready #labGrid > .project-card {
    opacity: 1 !important;
    clip-path: none !important;
  }
}

/* Routing refinement: base-page fades. Blinds are reserved for entering/leaving projects. */
html.portfolio-base-fade-boot .site-shell {
  opacity: 0;
}

html.portfolio-base-fading,
html.portfolio-base-fading body {
  overflow: hidden !important;
}

body.portfolio-base-fade-out .site-shell > :not(.topbar):not(.back-to-top):not(.submission-popup-backdrop):not([data-submit-popup]) {
  animation: portfolioBaseFadeOut 180ms ease both !important;
}

body.portfolio-base-fade-in .site-shell > :not(.topbar):not(.back-to-top):not(.submission-popup-backdrop):not([data-submit-popup]) {
  animation: portfolioBaseFadeIn 260ms ease both !important;
}

.mode.is-base-mode-fade-out {
  animation: portfolioBaseFadeOut 170ms ease both !important;
}

.mode.is-base-mode-fade-in {
  animation: portfolioBaseFadeIn 250ms ease both !important;
}

@keyframes portfolioBaseFadeOut {
  from { opacity: 1; filter: blur(0); }
  to { opacity: 0; filter: blur(2px); }
}

@keyframes portfolioBaseFadeIn {
  from { opacity: 0; filter: blur(2px); }
  to { opacity: 1; filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
  body.portfolio-base-fade-out .site-shell > :not(.topbar),
  body.portfolio-base-fade-in .site-shell > :not(.topbar),
  .mode.is-base-mode-fade-out,
  .mode.is-base-mode-fade-in {
    animation: none !important;
    filter: none !important;
  }
}


/* =========================================================
   TYPOGRAPHY + DARK CONTRAST PASS
   - Increase small editorial/UI type without changing titles/body scale.
   - In DARK theme, text sitting on the site's black/dark surfaces resolves
     to full white instead of muted grey.
   ========================================================= */

:root {
  --portfolio-meta-size: clamp(0.58rem, 0.62vw, 0.68rem);
  --portfolio-subheading-size: clamp(0.62rem, 0.68vw, 0.74rem);
  --portfolio-tag-size: clamp(0.62rem, 0.70vw, 0.76rem);
  --portfolio-footer-size: clamp(0.58rem, 0.64vw, 0.70rem);
  --portfolio-caption-size: clamp(0.68rem, 0.72vw, 0.78rem);
}

/* Subheadings / editorial labels */
.section-heading,
.filter-label,
.copy-kicker,
.detail-label,
.recognition-meta,
.project-cta-label,
.submission-popup-kicker {
  font-size: var(--portfolio-subheading-size) !important;
  line-height: 1.15 !important;
}

/* Tags / project metadata */
.pill,
.meta-word {
  font-size: var(--portfolio-tag-size) !important;
  line-height: 1.1 !important;
}

/* Footer + small utility copy */
.site-rights,
.form-status,
.field label,
.back-link,
.jump-link,
.cta-note,
.submission-popup-close {
  font-size: var(--portfolio-footer-size) !important;
  line-height: 1.3 !important;
}

/* Captions should remain secondary, but no longer microscopic. */
.module-caption,
.media-caption {
  font-size: var(--portfolio-caption-size) !important;
  line-height: 1.45 !important;
}

/* Slightly strengthen the small type after increasing it. */
.section-heading,
.filter-label,
.copy-kicker,
.detail-label,
.recognition-meta,
.project-cta-label,
.pill,
.meta-word,
.site-rights,
.form-status,
.field label,
.back-link,
.jump-link,
.cta-note,
.submission-popup-kicker,
.submission-popup-close {
  font-weight: 500 !important;
}

/*
  DARK THEME
  Use full white for all normal/muted/quiet text on the dark site canvas.
  Active white buttons keep their existing dark text through --active-text.
*/
body[data-theme="dark"] {
  --text: #ffffff !important;
  --muted: #ffffff !important;
  --quiet: #ffffff !important;
}

/* Hard-coded semi-transparent text colours used by older page CSS. */
body[data-theme="dark"] .section-copy-text,
body[data-theme="dark"] .masthead-text,
body[data-theme="dark"] .project-description,
body[data-theme="dark"] .recognition-description,
body[data-theme="dark"] .form-intro,
body[data-theme="dark"] .module-caption,
body[data-theme="dark"] .media-caption,
body[data-theme="dark"] .copy-block p,
body[data-theme="dark"] .text-image-copy,
body[data-theme="dark"] .detail-value,
body[data-theme="dark"] .cta-intro,
body[data-theme="dark"] .cta-note,
body[data-theme="dark"] .project-cta-label,
body[data-theme="dark"] .form-status,
body[data-theme="dark"] .site-rights,
body[data-theme="dark"] .section-heading,
body[data-theme="dark"] .filter-label,
body[data-theme="dark"] .copy-kicker,
body[data-theme="dark"] .detail-label,
body[data-theme="dark"] .recognition-meta,
body[data-theme="dark"] .back-link,
body[data-theme="dark"] .jump-link {
  color: #ffffff !important;
}

/* Remove opacity-based greying from dark-background labels. */
body[data-theme="dark"] .project-cta-label,
body[data-theme="dark"] .cta-note {
  opacity: 1 !important;
}

/* Project-card text over dark/image overlays is always white in dark theme. */
body[data-theme="dark"] .project-card .project-title,
body[data-theme="dark"] .project-card .project-description,
body[data-theme="dark"] .project-card .pill,
body[data-theme="dark"] .project-overlay,
body[data-theme="dark"] .project-overlay * {
  color: #ffffff !important;
}

/*
  Do not override project-specific hero/header contrast.
  When the project header is over a CMS-defined coloured hero, its existing
  --project-nav-text logic remains responsible for contrast.
*/
body[data-theme="dark"].project-template .topbar.is-over-hero,
body[data-theme="dark"].project-template .topbar.is-over-hero .brand,
body[data-theme="dark"].project-template .topbar.is-over-hero .nav-link,
body[data-theme="dark"].project-template .topbar.is-over-hero .theme-button {
  color: var(--project-nav-text) !important;
}

@media (max-width: 760px) {
  :root {
    --portfolio-meta-size: 0.62rem;
    --portfolio-subheading-size: 0.66rem;
    --portfolio-tag-size: 0.66rem;
    --portfolio-footer-size: 0.62rem;
    --portfolio-caption-size: 0.72rem;
  }
}


/* =========================================================
   TYPOGRAPHY + MOBILE PROJECT HERO PASS
   ========================================================= */

/* One more restrained size increase for the small editorial hierarchy. */
:root {
  --portfolio-meta-size: clamp(0.66rem, 0.70vw, 0.76rem);
  --portfolio-subheading-size: clamp(0.70rem, 0.76vw, 0.82rem);
  --portfolio-tag-size: clamp(0.70rem, 0.78vw, 0.84rem);
  --portfolio-footer-size: clamp(0.66rem, 0.72vw, 0.78rem);
  --portfolio-caption-size: clamp(0.74rem, 0.80vw, 0.86rem);
}

/*
  MOBILE PROJECT HERO
  The original project page forces the hero to ~82–88vh and positions
  image/video absolutely with object-fit: cover. That crops media on narrow
  screens. On mobile only, restore natural responsive media dimensions.
*/
@media (max-width: 820px) {
  body.project-template .hero {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    background: #050505;
  }

  body.project-template .hero .hero-image,
  body.project-template .hero .project-media.hero-image {
    position: relative !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
    display: block !important;
  }

  body.project-template .hero .hero-image > img,
  body.project-template .hero .hero-image > video,
  body.project-template .hero .project-media.hero-image > img,
  body.project-template .hero .project-media.hero-image > video {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  /* Embedded hero media cannot expose an intrinsic height like img/video.
     Give embeds a responsive 16:9 frame instead of the old viewport crop. */
  body.project-template .hero .hero-image > iframe,
  body.project-template .hero .hero-image > object,
  body.project-template .hero .hero-image > embed {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: contain !important;
  }
}

@media (max-width: 760px) {
  :root {
    --portfolio-meta-size: 0.70rem;
    --portfolio-subheading-size: 0.74rem;
    --portfolio-tag-size: 0.74rem;
    --portfolio-footer-size: 0.70rem;
    --portfolio-caption-size: 0.78rem;
  }
}


/* =========================================================
   MASK ON SCROLL / BEFORE–AFTER
   Native scroll-driven reveal inspired by the GSAP comparison pattern.
   ========================================================= */

.mask-scroll-module {
  --mask-scroll-progress: 0;
}

.mask-scroll-track {
  position: relative;
  width: 100%;
  min-height: 1px;
}

.mask-scroll-sticky {
  position: sticky;
  top: var(--mask-scroll-sticky-top, 80px);
  width: 100%;
  z-index: 1;
}

.mask-scroll-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #111;
  isolation: isolate;
}

.mask-scroll-track[data-mask-aspect="wide"] .mask-scroll-frame {
  aspect-ratio: 16 / 9;
}

.mask-scroll-track[data-mask-aspect="square"] .mask-scroll-frame {
  aspect-ratio: 1 / 1;
}

.mask-scroll-track[data-mask-aspect="portrait"] .mask-scroll-frame {
  width: min(100%, 860px);
  margin-inline: auto;
  aspect-ratio: 4 / 5;
}

.mask-scroll-layer {
  position: absolute;
  inset: 0;
}

.mask-scroll-layer.is-before {
  z-index: 1;
}

.mask-scroll-layer.is-after {
  z-index: 2;
  clip-path: inset(0 0 0 100%);
  will-change: clip-path;
}

.mask-scroll-layer .project-media {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
}

.mask-scroll-layer .project-media > img,
.mask-scroll-layer .project-media > video,
.mask-scroll-layer .project-media > iframe,
.mask-scroll-layer .project-media > object,
.mask-scroll-layer .project-media > embed {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.mask-scroll-edge {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: 100%;
  width: 1px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  pointer-events: none;
  transform: translateX(-0.5px);
  will-change: left;
}

.mask-scroll-labels {
  position: absolute;
  z-index: 5;
  inset: 14px 14px auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.mask-scroll-labels span {
  display: inline-flex;
  padding: 7px 9px;
  background: rgba(5,5,5,.72);
  color: #ffffff !important;
  font-family: var(--portfolio-font-secondary, "IBM Plex Mono", monospace);
  text-transform: uppercase;
  letter-spacing: .075em;
  font-size: var(--portfolio-tag-size, .74rem);
  line-height: 1;
}

@media (max-width: 820px) {
  .mask-scroll-module {
    width: 100%;
  }

  .mask-scroll-track[data-mask-aspect="portrait"] .mask-scroll-frame {
    width: min(100%, 620px);
  }

  .mask-scroll-labels {
    inset: 10px 10px auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mask-scroll-track {
    height: auto !important;
  }

  .mask-scroll-sticky {
    position: relative !important;
    top: auto !important;
  }

  .mask-scroll-layer.is-after {
    clip-path: inset(0 0 0 50%) !important;
  }

  .mask-scroll-edge {
    left: 50% !important;
  }
}
