:root {
  --color-bg: #001882;
  --color-surface: rgba(8, 31, 151, 0.18);
  --color-border: rgba(255, 255, 255, 0.14);
  --color-text: #faf4e6;
  --color-text-muted: rgba(250, 244, 230, 0.88);
  --color-focus: #e5c100;

  --container-max: 1440px;
  --gutter: clamp(24px, 4vw, 60px);

  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  --transition-fast: 180ms ease;
  --transition-main: 320ms ease;
  --header-height: 80px;

  --section-gap: clamp(1.5rem, 4vw, 3rem);
  --hero-offset-from-header: clamp(3rem, 5vw, 4.5rem);
  --page-bottom-space: clamp(2rem, 5vw, 4rem);

  --story-panel-space: clamp(2rem, 5vw, 7rem);
  --story-panel-gap: 1rem;
  --story-copy-width: 16rem;
  --story-copy-width-mobile-panel: 11rem;
  --story-title-line-gap: 24px;
  --story-arrow-gap: 0.5rem;

  --story-media-width: clamp(28rem, 42vw, 44rem);
  --story-media-height: clamp(16rem, 28vw, 25rem);

  --mobile-flow-gap: clamp(0.75rem, 1.2vw, 1rem);

  --hero-copy-max-width: 32rem;
  --hero-min-height: clamp(34rem, 68svh, 44rem);

  --focus-ring: 2px solid var(--color-focus);
  --focus-offset: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Neue Haas Grotesk Display Pro", "Host Grotesk", "Raleway", "Figtree", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img,
svg {
  height: auto;
}

video {
  width: 100%;
  height: auto;
}

a,
button {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

.container {
  width: min(100%, var(--container-max));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 5000;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-text);
  color: #111111;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

/* =========================
   Header
========================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  padding-block: 1rem;
  background: var(--color-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.header-logo {
  width: 120px;
  height: auto;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.main-nav a {
  position: relative;
  font-size: 0.95rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
  opacity: 0.96;
  transition: opacity var(--transition-fast);
}

.main-nav a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -0.375rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-fast);
}

.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a[aria-current="page"] {
  opacity: 1;
  outline: none;
}

.main-nav a:hover::after,
.main-nav a:focus-visible::after,
.main-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* =========================
   Hero
========================= */

.project-hero {
  min-height: var(--hero-min-height);
  display: flex;
  align-items: flex-start;
  padding-top: calc(var(--header-height) + var(--hero-offset-from-header));
  padding-bottom: var(--section-gap);
}

.project-hero-inner {
  display: grid;
  grid-template-columns: minmax(18rem, var(--hero-copy-max-width)) minmax(18rem, 1fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: center;
}

.project-hero-copy {
  max-width: var(--hero-copy-max-width);
}

.project-title {
  margin: 0;
}

.project-logo {
  width: min(100%, 26.25rem);
}

.project-summary {
  max-width: 32rem;
  margin: var(--space-lg) 0 0;
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  line-height: 1.7;
  color: var(--color-text-muted);
}

.project-hero-media {
  margin: 0;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  min-width: 0;
}

.project-mockup {
  width: min(100%, 44rem);
  object-fit: contain;
  transform: translate(0, -1.25rem);
}

/* =========================
   Horizontal Story
========================= */

.horizontal-story {
  position: relative;
  margin-top: 0;
}

.horizontal-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
  background: var(--color-bg);
}

.horizontal-track-wrap {
  width: min(100%, var(--container-max));
  margin-inline: auto;
  padding-inline: var(--gutter);
  overflow: hidden;
}

.horizontal-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding-right: 0;
  will-change: transform;
}

.horizontal-track::after {
  content: "";
  flex: 0 0 var(--gutter);
}

.story-panel {
  position: relative;
  width: min(
    calc(100vw - (2 * var(--gutter))),
    calc(var(--story-copy-width) + var(--story-media-width) + var(--story-panel-gap))
  );
  min-width: min(
    calc(100vw - (2 * var(--gutter))),
    calc(var(--story-copy-width) + var(--story-media-width) + var(--story-panel-gap))
  );
  flex: 0 0 auto;
  isolation: isolate;
}

.story-panel + .story-panel {
  margin-left: var(--story-panel-space);
}

.story-panel-inner {
  display: grid;
  grid-template-columns: var(--story-copy-width) var(--story-media-width);
  gap: var(--story-panel-gap);
  align-items: end;
  position: relative;
  z-index: 1;
  transform: translate3d(0, 160%, 0);
  clip-path: inset(100% 0 0 0);
  will-change: transform, clip-path;
}

.story-copy {
  display: inline-flex;
  align-items: flex-end;
  gap: var(--story-arrow-gap);
  align-self: end;
  width: var(--story-copy-width);
  max-width: none;
  padding-bottom: 10px;

}

.story-title-group {
  display: inline-flex;
  align-items: flex-end;
  gap: var(--story-title-line-gap);
}

.story-line {
  width: 1px;
  background: var(--color-text);
  opacity: 0.7;
  flex: 0 0 1px;
}

.story-copy h3 {
  margin: 0;
  font-size: clamp(1.75rem, 2.6vw, 2.875rem);
  line-height: 1;
  font-weight: 500;
  text-wrap: balance;
}

.story-arrow {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  opacity: 0.7;
  margin-bottom: 0;
}

.story-media {
  width: var(--story-media-width);
  height: var(--story-media-height);
  margin: 0;
  justify-self: start;
  display: flex;
  align-items: flex-end;
  align-self: end;
  flex: 0 0 auto;
  overflow: visible;
}

.story-media-visual {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center bottom;
  transform: scale(0.6);
  will-change: transform;
  background: transparent;
}

video.story-media-visual {
  object-fit: contain;
  border: 0;
}

/* =========================
   Mobile mockups panel
========================= */

.story-panel--mobile {
  width: max-content;
  min-width: max-content;
}

.story-panel--mobile .story-panel-inner {
  grid-template-columns: var(--story-copy-width-mobile-panel) auto;
  gap: var(--story-panel-gap);
  align-items: end;
}

.story-panel--mobile .story-copy {
  width: var(--story-copy-width-mobile-panel);
}

.story-media--mobile {
  width: auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: var(--mobile-flow-gap);
  align-self: end;
}

.mobile-flow-card {
  width: auto;
  height: var(--story-media-height);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  overflow: visible;
  flex: 0 0 auto;
  margin: 0;
}

.mobile-flow-card .story-media-visual {
  width: auto !important;
  height: 100% !important;
  max-width: none;
  object-fit: contain;
}

/* =========================
   Project credits
========================= */

.project-credits {
  padding-top: var(--section-gap);
  padding-bottom: var(--page-bottom-space);
  min-height: 45svh;
  margin-bottom: 0;
  overflow: visible;
}

.project-details-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) repeat(3, minmax(12rem, 1fr));
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: end;
  overflow: visible;
}

.project-details-intro {
  display: inline-flex;
  align-items: flex-end;
  gap: var(--story-arrow-gap);
  align-self: end;
  width: 16rem;
}

.project-details-title-group {
  display: inline-flex;
  align-items: stretch;
  gap: var(--story-title-line-gap);
}

.project-details-line {
  width: 1px;
  background: var(--color-text);
  opacity: 0.7;
  flex: 0 0 1px;
}

.project-details-title {
  margin: 0;
  font-size: clamp(1.75rem, 2.6vw, 2.875rem);
  line-height: 1;
  font-weight: 500;
  text-wrap: balance;
}

.project-details-arrow {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  opacity: 0.7;
  margin-bottom: 0.2rem;
}

.credits-col {
  min-width: 0;
  align-self: end;
  overflow: visible;
}

.credits-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-xs);
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  line-height: 1.5;
  color: var(--color-text-muted);
}

.credits-reveal {
  transform: translate3d(0, 140%, 0) scale(0.82);
  clip-path: inset(100% 0 0 0);
  transform-origin: center bottom;
  will-change: transform, clip-path;
  overflow: visible;
}

/* =========================
   Large tablet / narrow desktop
========================= */

@media (max-width: 1180px) {
  :root {
    --story-copy-width: 14rem;
    --story-copy-width-mobile-panel: 10rem;
    --story-media-width: clamp(22rem, 46vw, 34rem);
    --story-media-height: clamp(14rem, 30vw, 21rem);
  }

  .story-panel--mobile {
    width: max-content;
    min-width: max-content;
  }
}

/* =========================
   Tablet
========================= */

@media (max-width: 1024px) {
  :root {
    --story-copy-width: 14rem;
    --story-copy-width-mobile-panel: 10rem;
    --story-media-width: clamp(22rem, 50vw, 34rem);
    --story-media-height: clamp(14rem, 32vw, 20rem);
  }

  .project-hero {
    min-height: auto;
    padding-top: calc(var(--header-height) + clamp(1.25rem, 3vw, 2rem));
    padding-bottom: clamp(2.5rem, 6vw, 4rem);
  }

  .project-hero-inner,
  .project-details-layout {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .project-hero-copy {
    max-width: 28rem;
  }

  .project-hero-media {
    justify-content: center;
    align-items: flex-start;
  }

  .project-mockup {
    width: min(100%, 40rem);
    transform: translate(0, -0.5rem);
  }

  .project-details-intro,
  .credits-col {
    align-self: start;
  }

  .story-panel {
    width: min(
      88vw,
      calc(var(--story-copy-width) + var(--story-media-width) + var(--story-panel-gap))
    );
    min-width: min(
      88vw,
      calc(var(--story-copy-width) + var(--story-media-width) + var(--story-panel-gap))
    );
  }
}

/* =========================
   Mobile
========================= */

@media (max-width: 720px) {
  :root {
    --gutter: 24px;
    --hero-offset-from-header: clamp(0.75rem, 3vw, 1.5rem);
    --mobile-section-space: 72px;
    --mobile-panel-space: 32px;
    --mobile-flow-gap: 20px;
  }

  .site-header {
    padding-block: 16px;
  }

  .header-inner {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .main-nav {
    gap: 16px;
  }

  .main-nav a {
    font-size: 0.88rem;
  }

  .project-hero {
    min-height: auto;
    padding-top: calc(var(--header-height) + var(--hero-offset-from-header));
    padding-bottom: var(--mobile-section-space);
  }

  .project-hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .project-hero-copy {
    order: 2;
    max-width: 100%;
  }

  .project-hero-media {
    order: 1;
    justify-content: center;
    align-items: center;
  }

  .project-logo {
    width: min(100%, 17.5rem);
  }

  .project-summary {
    max-width: 100%;
    margin-top: 1rem;
    font-size: 16px;
    line-height: 1.5;
  }

  .project-mockup {
    width: 100%;
    transform: none;
  }

  .horizontal-story {
    height: auto !important;
    padding-bottom: 32px;
  }

  .horizontal-sticky {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .horizontal-track-wrap {
    padding-inline: var(--gutter);
  }

  .horizontal-track {
    display: grid;
    gap: 40px;
    padding-right: 0;
    transform: none !important;
  }

  .horizontal-track::after {
    content: none;
  }

  .story-panel,
  .story-panel--mobile {
    width: 100%;
    min-width: 0;
    margin-left: 0 !important;
  }

  .story-panel-inner,
  .story-panel--mobile .story-panel-inner {
    grid-template-columns: 1fr;
    gap: 1rem;
    transform: none !important;
    clip-path: none !important;
  }

  .story-copy,
  .story-panel--mobile .story-copy {
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    align-self: start;
  }

  .story-title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
  }

  .story-line,
  .project-details-line,
  .story-arrow,
  .project-details-arrow {
    display: none;
  }

  .story-media {
    width: 100%;
    max-width: none;
    height: auto;
  }

  .story-media-visual {
    width: 100%;
    height: auto;
    transform: none !important;
  }

  .story-media--mobile {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-self: start;
  }

  .mobile-flow-card {
    width: 100%;
    height: clamp(340px, 68vw, 430px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
  }

  .mobile-flow-card .story-media-visual {
    width: auto !important;
    height: 100% !important;
    max-width: 100%;
    object-fit: contain;
  }

  .project-credits {
    padding-top: 0;
    padding-bottom: var(--mobile-section-space);
  }

  .project-details-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .project-details-intro {
    width: 100%;
    align-self: start;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .project-details-title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
  }

  .credits-reveal {
    transform: none !important;
    clip-path: none !important;
  }
}

/* =========================
   Reduced motion
========================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .story-panel-inner,
  .story-media-visual,
  .credits-reveal {
    transform: none !important;
    clip-path: none !important;
  }

  video.story-media-visual {
    animation: none !important;
  }
}