/* PROJECT HERO
   ---------------------------------------- */

.project-hero {
  position: relative;
  width: 100%;

  /* We reserve extra space below the sticky hero */
  height: calc(90vh + 80vh);
}

.project-hero-block {
  position: relative;
  width: 100%;
  height: calc(100vh + 800px);
}

/* State 1: Hero image stuck at top */
.project-hero-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  z-index: 2; /* Sits ON TOP of the text initially */
  overflow: hidden;
}

.project-hero-inner {
  height: 98vh;
  width: 100%;

  overflow: hidden;

  transform-origin: center center;
  transform: scale(var(--hero-scale, 1));
  border-radius: var(--hero-radius, 0px);
  will-change: transform, border-radius;
}

.project-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;

  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: block;
}

/* State 2: Meta text fixed behind hero */
.project-hero-meta {
  position: fixed;

  top: calc(90vh + 24px);
  left: 50%;
  transform: translateX(-50%);
  width: 76vw;
  z-index: 1;

  text-align: center;
  pointer-events: auto;
  opacity: 1;
  padding: 0;
}

/* State 3: Released text (scrolls with page) */
.project-hero-meta.is-released {
  position: absolute;
  top: calc(800px + 90vh + 24px);
  left: 50%;
  transform: translateX(-50%);
  bottom: auto;
}

/* Inner layout that matches hero width exactly */
.meta-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: var(--text);
}

/* Optional alignment tweaks */
.project-meta-title {
  font-family: var(--font-display);
  font-size: var(--h5);
  line-height: 1.3;
  letter-spacing: 0;
  font-weight: 500; /* Medium */
  text-align: left;
}

.meta-client {
  color: var(--text-secondary);
  text-align: center;
}

.meta-role {
  color: var(--text-secondary);
  text-align: right;
}

.project-hero-kicker {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.project-hero-title {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.1;
}

.project-hero-summary {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  opacity: 0.9;
}

/* Project window layer (above Home) */
.project-window {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;

  /* hide without killing layout */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.project-window.is-visible {
  pointer-events: auto;
}
.project-window-inner,
#windowContainer {
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.project-window-inner {
  position: relative;
  z-index: 10;
  width: 98vw;
  height: 98dvh;

  background: var(--page-bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);

  /* keep defaults, GSAP will animate */
  opacity: 0;
  transform: scale(0.96);

  transform-origin: center center;
  will-change: transform, border-radius;
  overflow: hidden;
  border-radius: 24px;
}

.project-window.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Simple header + close button for now */
.project-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 13px;
}

.project-window-title {
  font-weight: 500;
  color: #111111;
}

.project-window-close {
  position: absolute;
  top: 12px;
  left: 16px;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;

  z-index: 999; /* always on top inside the window */
}

/* reuse your global focus-visible, but make sure the hitbox is nice */
.project-window-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 999px;
}

/* Home window traffic dots hit area */
.window-controls-hit {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 16px;
  padding-left: 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.window-controls-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.project-window-body {
  position: relative;
  overflow-y: auto;
  max-height: 98vh;
}

.project-body {
  --col-gap: 24px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--col-gap);
  width: 100%;
  padding: 0 40px; /* spacing from hero */
}

.span-12 {
  grid-column: span 12;
}
.span-8 {
  grid-column: span 8;
}
.span-6 {
  grid-column: span 6;
}
.span-4 {
  grid-column: span 4;
}
.span-3 {
  grid-column: span 3;
}

.project-one-liner {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: center;
  height: 78vh;
  text-align: center;
  color: var(--text);
}

.project-one-liner .h1 {
  display: inline-block;
  justify-self: center;
  text-align: center;
}

.project-one-liner {
  perspective: 1200px;
}

.one-liner-small {
  height: 70vh;
  padding-top: 25vh;
}

.split-word {
  display: inline-block;
  white-space: pre;
}

.storyTag {
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 24px;
}

/* Bento block padding spacing */

#contextBlock {
  padding-bottom: 120px;
}

#problemBlock {
  padding: 120px 0;
}

.project-section-header {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-5);
}

/* ----------------------------------------
   PROJECTS SECTION
---------------------------------------- */

.projects {
  display: flex;
  flex-direction: column;
  gap: 80px;
  padding: 100px 0;
}

.project-heading {
  align-items: center !important;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------
   GRID
---------------------------------------- */

.home-project-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  row-gap: 80px;
}

.home-project-grid .project-spacer {
  pointer-events: none;
  border: 0;
  background: transparent;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
}

.project-image {
  width: 100%;
  aspect-ratio: 3 / 4.5;
  border: none;
  padding: 0;

  background-image: var(--card-bg);
  background-size: cover;
  background-position: center;
  border-radius: 16px;
  overflow: hidden; /* critical */
}

.project-image-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;

  transform: scale(1);
  will-change: transform;
}

.project-meta-outer {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.project-meta-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-title {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tag {
  font-size: 12px; /* caption */
  padding: 8px;
  border-radius: 8px;
  background: var(--frame-bg);
  color: var(--text-secondary);
}
/* ----------------------------------------
   CARD BASE
---------------------------------------- */

.project-tile {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 5;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  margin: 0;

  background-color: var(--project-card-bg);
  background-image: var(--card-bg);
  background-size: cover;
  background-position: center;
}

.project-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: none;
}

.project-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

.project-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ----------------------------------------
   CARD INNER LAYOUT
---------------------------------------- */

.project-card-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------
   TOP LOGO AREA
---------------------------------------- */

.project-card-top {
  padding: 16px;
}

.project-card-logo {
  height: 56px;
  width: 56px;
  display: block;
  border-radius: 16px;
}

/* ----------------------------------------
   BOTTOM META AREA
---------------------------------------- */

.project-card-bottom {
  position: relative;
  margin-top: auto;
  height: 140px;
  padding: 0px 24px 28px 24px;
  display: flex;
  align-items: flex-end;
  text-align: left;
}

.project-card-bottom-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Strong blur band */
.project-card-bottom-bg::after {
  content: "";
  position: absolute;
  inset: 0;

  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);

  -webkit-mask-image: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 40%,
    rgba(0, 0, 0, 0) 700%
  );

  mask-image: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 40%,
    rgba(0, 0, 0, 0) 70%
  );
}

/* Mid blur band */
.project-card-bottom-bg::before {
  content: "";
  position: absolute;
  inset: 0;

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  background: color-mix(in srgb, var(--project-card-bg) 6%, transparent);

  -webkit-mask-image: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 65%,
    rgba(0, 0, 0, 0) 100%
  );

  mask-image: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 65%,
    rgba(0, 0, 0, 0) 100%
  );
}

/* Bottom surface fade */
.project-card-bottom::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;

  background: linear-gradient(
    to top,
    var(--project-card-bg) 0%,
    transparent 80%
  );
}

.project-card-bottom.no-blur .project-card-bottom-bg {
  display: none;
}

/* ----------------------------------------
   META TEXT
---------------------------------------- */

/* Navigation */
.project-section-nav {
  position: absolute;
  bottom: 0;

  left: 0;
  right: 0;

  width: max-content;
  margin: 0 auto;

  pointer-events: none;
  z-index: 999;
}

.project-section-nav {
  pointer-events: none;
}

.project-section-nav-inner,
.project-section-nav-inner * {
  pointer-events: auto;
}

.project-section-nav .prog-blur,
.project-section-nav .header-gradient {
  position: absolute;
  inset: 0;
}

.project-nav {
  position: absolute;
  justify-content: center;
  overflow: visible;

  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 4px 5px;
  border-radius: 56px;
  transform-origin: center center;

  background: var(--nav-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
}

.project-section-nav-inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px; /* Fixed height is cleaner for sliding text */
  padding: 0 24px;
  background: var(--nav-bg); /* Ensure you have a background set */
  border-radius: 999px;
  overflow: hidden;
  box-sizing: border-box;
  /* We let GSAP handle the width, but min-width prevents crushing */
  min-width: 120px;
  pointer-events: auto;
}

/* The Text Labels */
.mobile-section-label {
  position: relative;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  z-index: 2;
  will-change: transform, opacity;
}

/* The "Old" label being animated out */
.mobile-section-label.is-outgoing {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
  z-index: 1;
}

.nav-link--icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.upArrow {
  aspect-ratio: 1/1;
  height: 18px;
}

.project-hero-meta {
  width: 100%;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  text-align: left;
}

/* Column spans */
.meta-spacer {
  grid-column: span 1;
}

/* Content */

.meta-block {
  grid-column: span 2;
}

.meta-main-block {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  grid-column: span 4;
}

.meta-main-block .meta-block {
  grid-column: auto;
}
.meta-primary {
  grid-column: span 4;
}

.meta-title {
  margin-bottom: 6px;
}

.meta-value {
  color: var(--text-secondary);
}

.project-section {
  grid-column: 1 / -1; /* full width */
  padding: 60px 0;

  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: 24px;
  row-gap: 80px;
}

.project-ender {
  grid-column: 1 / -1; /* full width */
  width: 100%;
  text-align: center;
  padding: 80px 0px 240px 0px;
}

.side-project-block {
  display: flex;
  flex-direction: column;
  gap: 24px;
  grid-column: 1 / -1;
}

.side-project-block > * {
  width: 100%;
}

.phone-pair {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
}

.phone-col {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.project-carousel-dots {
  display: none;
}

/* MOBILE PILL (inside your bottom project nav) */
.project-nav-pill {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
}

.project-nav-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 999px;
}

/* The pill container that GSAP resizes */
.project-nav-pill-inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0px;
  overflow: hidden;
  box-sizing: border-box;

  will-change: width;
}

/* Label */
.mobile-section-label {
  position: relative;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  will-change: transform, opacity;
}

/* Outgoing label becomes absolute so incoming can slide in */
.mobile-section-label.is-outgoing {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
}

/* BOTTOM SHEET */
.project-section-sheet {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.project-section-sheet[aria-hidden="false"] {
  pointer-events: auto;
}

.project-section-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
}

.project-section-sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
  max-height: min(70vh, 560px);

  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 24px;

  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);

  overflow: hidden;
  opacity: 0;
}

.project-section-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  margin: 10px auto 8px;
}

.project-section-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.project-section-sheet-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.project-section-sheet-close {
  border: none;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
}

.project-section-sheet-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

.project-section-sheet-list {
  padding: 10px;
  overflow: auto;
  max-height: calc(70vh - 64px);
}

.project-section-sheet-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 12px;
  border-radius: 14px;

  border: 1px solid transparent;
  background: transparent;

  cursor: pointer;
  text-align: left;
}

.project-section-sheet-item:hover {
  background: color-mix(in srgb, var(--frame-bg) 60%, transparent);
}

.project-section-sheet-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.project-section-sheet-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.project-section-sheet-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.close-button {
  position: fixed;
  top: 16px;
  right: 16px;
  width: auto;
  padding: 8px 12px;
  border-radius: 18px;
  z-index: 999;
  cursor: pointer;

  background-color: var(--nav-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px) saturate(125%) brightness(1.1);
}

/* Doctor flow */
.flow-section {
  padding: 48px;
}

.flow-wrapper {
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
}

.flow-step {
  max-width: 320px;
  flex: 1;
}

.flow-card {
  background: var(--page-bg);
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 24px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.flow-badge {
  display: inline-block;
  background: var(--frame-bg);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: auto;
  width: fit-content;
}

.flow-card h3 {
  color: var(--text);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  margin: 0;
}

.flow-arrow {
  font-size: 36px;
  line-height: 1;
  margin-top: 140px;
  opacity: 0.6;
}

.project-window.no-hero-mode .project-hero-block {
  display: none;
}

@media (max-width: 900px) {
  .project-hero-meta.is-released {
    top: calc(800px + 90vh + 72px);
  }

  .project-meta-title {
    font-size: var(--h3);
  }

  .project-image {
    aspect-ratio: 3 / 3.7;
  }

  .meta-primary,
  .meta-block {
    grid-column: span 1;
  }
  .project-section-nav-inner {
    padding: 0px 8px;
  }

  /* Project grid to mobile */
  .home-project-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;

    padding: 0 16px;
    gap: 20px;

    -webkit-overflow-scrolling: touch;
  }

  [data-carousel] {
    touch-action: pan-y;
  }

  .project-card {
    flex: 0 0 90%;
    scroll-snap-align: center;
    opacity: 1;
    transition:
      transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.4s ease;
  }

  .project-card:not(.is-active) {
    opacity: 0.5;
  }

  .project-card.is-active {
    opacity: 1;
    transform: scale(1);
  }

  .project-spacer {
    display: none;
  }

  /* hide scrollbars */
  .home-project-grid::-webkit-scrollbar {
    display: none;
  }

  .project-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
  }

  .project-carousel-dots button {
    width: 1px;
    height: 6px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.2s ease;
  }

  .project-carousel-dots button.active {
    background: white;
  }

  .meta-main-block {
    display: flex;
    justify-content: space-between;
    gap: 24px;
  }

  .meta-block {
    width: 100%;
  }

  /* Prevent inner blocks from trying to span old columns */
  .meta-main-block .meta-block {
    grid-column: auto;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .meta-spacer {
    display: none;
  }

  .projects {
    gap: 24px;
    padding: 0px;
  }

  .project-hero-meta {
    padding: 0px 24px;
  }

  .project-hero-block {
    margin-bottom: 250px;
  }
  .project-body {
    padding: 0px 24px;
  }
  .project-one-liner {
    height: auto;
    padding: 80px 0px;
  }

  .flow-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }

  .flow-arrow {
    transform: rotate(90deg);
    margin: 0;
  }

  .flow-step {
    max-width: 100%;
  }
}
