/* -------------------------
   Project Detail Page
   Page-specific styles only.
   Shared styles live in styles.css.
   ------------------------- */

/* -------------------------
   Project Hero
   ------------------------- */

.project-hero {
  padding-top: var(--space-7);
  padding-bottom: var(--space-4);
}

.project-hero__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  column-gap: var(--space-2);
}

.project-hero__title {
  grid-column: 1 / -1;
  font-size: clamp(3rem, 6vw + 0.5rem, 4rem);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-tight);
  line-height: 1.1;
  /* Overrides `.hero__title` from styles.css (also on this h1) */
  text-transform: none;
  white-space: normal;
}

.project-hero__title .hero__line--sub {
  color: var(--color-muted);
  white-space: normal;
  letter-spacing: var(--letter-spacing-body);
  line-height: 1.1;
}

/* Room for descenders inside overflow:hidden mask; negative margin keeps line rhythm */
.project-hero__title .hero__line {
  padding-bottom: 0.15em;
  margin-bottom: -0.15em;
}

.project-hero__meta {
  grid-column: 1 / -1;
  margin-top: var(--space-7);
}

.project-hero__meta-list {
  display: flex;
  flex-direction: column;
}

.project-hero__meta-item {
  padding-block: var(--space-2);
}

.project-hero__meta-item:first-child {
  padding-top: 0;
}

.project-hero__label {
  font-size: 1.25rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
}

.project-hero__value {
  margin-top: 4px;
  font-size: 1.25rem;
  color: var(--color-muted);
  letter-spacing: var(--letter-spacing-body);
  line-height: var(--line-height-body);
}

.project-hero__image {
  margin-top: var(--space-8);
}

.project-hero__image img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-md);
}

@media (min-width: 768px) {
  .project-hero__grid {
    grid-template-columns: repeat(12, 1fr);
  }

  .project-hero__title {
    font-size: clamp(4rem, 1rem + 5vw, 6rem);
  }

  .project-hero__meta {
    grid-column: 1 / 7;
    margin-top: var(--space-7);
  }
}

@media (min-width: 1024px) {
  .project-hero {
    padding-bottom: var(--space-9);
  }

  .project-hero__grid {
    column-gap: var(--space-4);
    align-items: end;
  }

  .project-hero__title {
    grid-column: 1 / 9;
    grid-row: 1;
  }

  .project-hero__meta {
    grid-column: 9 / 13;
    grid-row: 1;
    margin-top: 0;
    align-self: end;
  }

  .project-hero__label {
    font-size: var(--text-xl);
  }

  .project-hero__value {
    font-size: var(--text-xl);
  }

  .project-hero__image {
    margin-top: var(--space-9);
  }
}

@media (min-width: 1440px) {
  .project-hero__title {
    grid-column: 1 / 8;
    font-size: 6rem;
  }

  .project-hero__meta {
    grid-column: 9 / 13;
  }
}

/* -------------------------
   Project Section (editorial layout)
   ------------------------- */

.project-section {
  padding-block: var(--space-7) var(--space-9);
  border-top: 1px solid var(--color-border);
}

/* No divider line after hero image or after galleries / video / standalone images (carousel / media blocks) */
.project-hero + .project-section,
.gallery + .project-section,
.project-video + .project-section,
.project-app + .project-section,
.project-image + .project-section {
  border-top: none;
}

/* Quote after editorial sections: top rule only in this context (About page quote has no rule) */
.project-section + .quote {
  border-top: 1px solid var(--color-border);
}

.project-section__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  column-gap: var(--space-2);
}

.project-section__label {
  grid-column: 1 / -1;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-regular);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  text-transform: uppercase;
}

.project-section__body {
  grid-column: 1 / -1;
  margin-top: var(--space-3);
}

.project-section__heading {
  font-size: 2.5rem;
  font-weight: var(--font-weight-regular);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  line-height: 1.2;
}

.project-section__subheading {
  margin-top: var(--space-5);
  font-size: 1.75rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  line-height: 1.2;
}

.project-section__text {
  font-size: var(--text-lg);
  color: var(--color-text);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-body);
}

.project-section__text:first-of-type {
  margin-top: var(--space-4);
}

.project-section__text + .project-section__text,
.project-section__body ul + .project-section__text,
.project-section__body ol + .project-section__text {
  margin-top: 32px;
}

.project-section__body ul,
.project-section__body ol {
  margin-top: 20px;
  padding-left: 1.25em;
  font-size: var(--text-lg);
  color: var(--color-text);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-body);
}

.project-section__body li {
  margin-top: 20px;
}

.project-section__body li:first-child {
  margin-top: 0;
}

.project-section__body ul {
  list-style: disc;
}

.project-section__body ol {
  list-style: decimal;
}

.project-section__body .link-btn {
  margin-top: var(--space-5);
}

/* Dense filled icons (e.g. new-tab): slightly smaller than global .link-btn__icon--sm */
.project-section__body .link-btn__icon--sm {
  width: 0.65em;
  height: 0.65em;
}

/* Collapsible list inside project sections (reuses resume.css collapsible styles).
   Direct child of .project-section__grid — full width on mobile, right column on desktop (matches resume list). */
.project-section__collapsibles {
  grid-column: 1 / -1;
  margin-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

@media (min-width: 768px) {
  .project-section__grid {
    grid-template-columns: repeat(12, 1fr);
  }

  .project-section__label {
    grid-column: 1 / 4;
  }

  .project-section__body {
    grid-column: 6 / 13;
    margin-top: 0;
  }

  .project-section__collapsibles {
    grid-column: 6 / 13;
  }

  .project-section__heading {
    font-size: 3rem;
  }

  .project-section__subheading {
    font-size: 2rem;
  }

  .project-section__text:first-of-type {
    margin-top: var(--space-4);
  }

  .project-section__text + .project-section__text {
    margin-top: 32px;
  }
}

@media (min-width: 1024px) {
  .project-section {
    padding-block: var(--space-9) var(--space-10);
  }

  .project-section__grid {
    column-gap: var(--space-4);
  }

  .project-section__label {
    grid-column: 1 / 4;
    font-size: var(--text-xl);
  }

  .project-section__body {
    grid-column: 6 / 13;
  }

  .project-section__heading {
    font-size: 4rem;
    line-height: 1.1;
  }

  .project-section__subheading {
    font-size: 2.5rem;
    line-height: 1.1;
  }

  .project-section__text {
    font-size: var(--text-xl);
  }

  .project-section__text:first-of-type {
    margin-top: var(--space-4);
  }

  .project-section__text + .project-section__text {
    margin-top: 32px;
  }

  .project-section__body ul,
  .project-section__body ol {
    font-size: var(--text-xl);
  }

  .project-section__body .link-btn {
    font-size: var(--text-xl);
    margin-top: var(--space-5);
  }
}

@media (min-width: 1440px) {
  .project-section__label {
    grid-column: 1 / 4;
  }

  .project-section__body {
    grid-column: 6 / 11;
  }
}

/* -------------------------
   Project video (case study embed)
   ------------------------- */

.project-video {
  padding-block: var(--space-4) var(--space-7);
}

.project-video__media {
  width: 100%;
  display: block;
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
}

/* YouTube / iframe embed (responsive 16:9) — same grid placement as .project-video__media */
.project-video__embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-surface);
}

.project-video__embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.project-video__caption {
  margin-top: var(--space-4);
  font-size: var(--text-lg);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  line-height: var(--line-height-body);
}

/* Heading + paragraph below embed — same type scale as project cards (`.project-card__title` / `__desc`) */
.project-video__info {
  margin-top: var(--space-3);
}

.project-video__info-heading {
  font-size: 1.875rem;
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  line-height: 1.3;
}

.project-video__info-text {
  margin-top: var(--space-2);
  font-size: var(--text-lg);
  color: var(--color-muted);
  letter-spacing: var(--letter-spacing-body);
  line-height: var(--line-height-body);
}

/* -------------------------
   Embedded app (SPA iframe — Lovable, etc.)
   ------------------------- */

.project-app {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  padding-block: var(--space-4) var(--space-7);
}

.project-app__embed {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-surface);
}

/* Iframe can capture wheel events; disable pointer events until user clicks to interact
   (see main.js + .project-app__embed--active). */
.project-app__embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none;
}

.project-app__embed--active iframe {
  pointer-events: auto;
}

/* Button is a sibling of the embed (not inside it) so mobile browsers do not route touches to the cross-origin iframe. */
.project-app__fullscreen {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: end;
  z-index: 3;
  margin-right: var(--space-2);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--color-text);
  background-color: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out-expo);
}

.project-app .project-video__info {
  grid-column: 1;
  grid-row: 2;
}

.project-app__fullscreen:hover {
  background-color: rgba(0, 0, 0, 0.75);
}

.project-app__fullscreen:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.project-app__fullscreen svg {
  width: 22px;
  height: 22px;
}

/* CSS pseudo-fullscreen: whole block covers viewport (mobile / no native Fullscreen API) */
.project-app--fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  background-color: var(--color-bg);
}

.project-app--fullscreen .project-app__embed {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  grid-column: auto;
  grid-row: auto;
}

.project-app--fullscreen .project-app__fullscreen {
  position: fixed;
  top: calc(var(--space-2) + env(safe-area-inset-top, 0px));
  right: calc(var(--space-2) + env(safe-area-inset-right, 0px));
  bottom: auto;
  left: auto;
  margin: 0;
  z-index: 10000;
  grid-column: auto;
  grid-row: auto;
  align-self: auto;
  justify-self: auto;
}

.project-app--fullscreen .project-app__embed iframe {
  pointer-events: auto;
}

.project-app--fullscreen .project-video__info {
  display: none;
}

/* Intro copy above full-width video (landscape) — same scale as .project-section__heading */
.project-video__body {
  margin-bottom: var(--space-5);
}

.project-video__heading {
  font-size: 2.5rem;
  font-weight: var(--font-weight-regular);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  line-height: 1.2;
}

.project-video__text {
  margin-top: var(--space-4);
  font-size: var(--text-lg);
  color: var(--color-text);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-body);
}

/* Only when intro text is the first child (no heading above), e.g. link-only YouTube fallback */
.project-video__body > .project-video__text:first-child {
  margin-top: 0;
}

.project-video__body .link-btn {
  margin-top: var(--space-5);
}

.project-video__body .link-btn__icon--sm {
  width: 0.65em;
  height: 0.65em;
}

/* Portrait / mobile-upright screen recordings — intro + narrow video; grid-aligned on desktop */
.project-video--portrait .project-video__body {
  margin-bottom: var(--space-4);
}

.project-video--portrait .project-video__heading {
  font-size: 2.5rem;
  font-weight: var(--font-weight-regular);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  line-height: 1.2;
}

.project-video--portrait .project-video__text {
  font-size: var(--text-lg);
  color: var(--color-text);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-body);
}

.project-video--portrait .project-video__text:first-of-type {
  margin-top: var(--space-4);
}

.project-video--portrait .project-video__media {
  max-width: none;
}

@media (min-width: 768px) {
  .project-video {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    padding-block: var(--space-6) var(--space-7);
  }

  .project-video__body {
    grid-column: 6 / 13;
  }

  .project-video__media {
    grid-column: 1 / -1;
  }

  .project-video__embed,
  .project-video__caption,
  .project-video__info {
    grid-column: 1 / -1;
  }

  .project-video__heading {
    font-size: 3rem;
  }

  .project-video--portrait .project-video__heading {
    font-size: 3rem;
  }

  .project-video--portrait .project-video__media {
    max-width: 50%;
    margin-inline: auto;
  }

  .project-app {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    padding-block: var(--space-6) var(--space-7);
  }

  .project-app__embed,
  .project-app .project-video__info {
    grid-column: 1 / -1;
  }

  .project-app__fullscreen {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .project-app__embed {
    grid-row: 1;
    aspect-ratio: auto;
    height: 570px;
  }

  .project-app .project-video__info {
    grid-row: 2;
  }
}

@media (min-width: 1024px) {
  .project-app {
    padding-block: var(--space-7) var(--space-9);
    column-gap: var(--space-4);
  }

  .project-video {
    padding-block: var(--space-7) var(--space-9);
    column-gap: var(--space-4);
  }

  .project-video__heading {
    font-size: 4rem;
    line-height: 1.1;
  }

  .project-video__body {
    margin-bottom: var(--space-7);
  }

  .project-video__text {
    font-size: var(--text-xl);
  }

  .project-video__body .link-btn {
    font-size: var(--text-xl);
  }

  .project-video__caption {
    font-size: var(--text-xl);
  }

  .project-video__info {
    margin-top: var(--space-4);
  }

  .project-video__info-heading {
    font-size: 2.5rem;
  }

  .project-video__info-text {
    font-size: var(--text-xl);
  }

  .project-video--portrait {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--space-4);
  }

  .project-video--portrait .project-video__body {
    grid-column: 6 / 13;
    margin-bottom: var(--space-5);
  }

  .project-video--portrait .project-video__heading {
    font-size: 4rem;
    line-height: 1.1;
  }

  .project-video--portrait .project-video__text {
    font-size: var(--text-xl);
  }

  .project-video--portrait .project-video__media {
    max-width: none;
    width: 100%;
    margin-inline: 0;
    grid-column: 6 / 9;
  }
}

@media (min-width: 1440px) {
  .project-video__body {
    grid-column: 6 / 11;
  }

  .project-video--portrait .project-video__media {
    grid-column: 6 / 9;
  }
}

/* -------------------------
   Gallery / Carousel
   ------------------------- */

.gallery {
  padding-block: var(--space-4) var(--space-7);
}

.gallery__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  border-radius: var(--radius-md);
}

.gallery__track::-webkit-scrollbar {
  display: none;
}

.gallery__item {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.gallery__image {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

.gallery__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
}

.gallery__nav {
  display: flex;
  column-gap: var(--space-1);
}

.gallery__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out-expo),
    color var(--duration-fast) var(--ease-out-expo);
}

.gallery__arrow:hover {
  background-color: var(--color-border);
}

.gallery__arrow:disabled {
  color: var(--color-muted);
  cursor: default;
  opacity: 0.4;
}

.gallery__arrow:disabled:hover {
  background-color: var(--color-surface);
}

.gallery__arrow svg {
  width: 20px;
  height: 20px;
}

.gallery__progress {
  display: flex;
  align-items: center;
  column-gap: var(--space-1);
  flex: 1;
  min-width: 0;
  margin-left: var(--space-2);
}

.gallery__progress-track {
  flex: 1;
  min-width: 0;
  height: 2px;
  background-color: var(--color-border);
  border-radius: 1px;
  overflow: hidden;
}

.gallery__progress-bar {
  height: 100%;
  background-color: var(--color-text);
  border-radius: 1px;
  transition: width var(--duration-fast) var(--ease-out-expo);
}

.gallery__progress-text {
  font-size: var(--text-sm);
  color: var(--color-muted);
  letter-spacing: var(--letter-spacing-body);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .gallery {
    padding-block: var(--space-6) var(--space-7);
  }
}

@media (min-width: 1024px) {
  .gallery {
    position: relative;
    padding-block: var(--space-7) var(--space-9);
  }

  /* Arrows overlay the image track; progress stays below (nav is out of flow) */
  .gallery__nav {
    position: absolute;
    top: var(--space-7);
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    aspect-ratio: 16 / 10;
    height: auto;
    box-sizing: border-box;
    padding-inline: var(--space-2);
    pointer-events: none;
  }

  .gallery__arrow {
    pointer-events: auto;
    background-color: rgba(22, 22, 22, 0.85);
    border-color: var(--color-border);
  }

  .gallery__arrow:hover {
    background-color: rgba(34, 34, 34, 0.95);
  }

  .gallery__arrow:disabled:hover {
    background-color: rgba(22, 22, 22, 0.85);
  }

  .gallery__controls {
    justify-content: center;
    margin-top: var(--space-4);
  }

  .gallery__progress {
    margin-left: 0;
  }

  .gallery__progress-text {
    font-size: var(--text-base);
  }
}

/* -------------------------
   Standalone full-width image
   ------------------------- */

.project-image {
  padding-block: var(--space-4) var(--space-7);
}

.project-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

@media (min-width: 768px) {
  .project-image {
    padding-block: var(--space-6) var(--space-7);
  }
}

@media (min-width: 1024px) {
  .project-image {
    padding-block: var(--space-7) var(--space-9);
  }
}

/* Portrait / tall standalone image — align with editorial column (matches .project-video--portrait media) */
@media (min-width: 768px) {
  .project-image--portrait {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
  }

  .project-image--portrait img {
    grid-column: 1 / -1;
    max-width: 60%;
    margin-inline: auto;
  }
}

@media (min-width: 1024px) {
  .project-image--portrait {
    column-gap: var(--space-4);
  }

  .project-image--portrait img {
    grid-column: 6 / 11;
    max-width: none;
    width: 100%;
    margin-inline: 0;
  }
}

/* -------------------------
   Next Project
   ------------------------- */

.project-next {
  padding-block: var(--space-7) var(--space-9);
  border-top: 1px solid var(--color-border);
}

.project-next__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  column-gap: var(--space-2);
}

.project-next__label {
  grid-column: 1 / -1;
  font-size: 2.5rem;
  font-weight: var(--font-weight-regular);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-body);
  line-height: 1.2;
}

.project-next__card {
  grid-column: 1 / -1;
  margin-top: var(--space-6);
}

@media (min-width: 768px) {
  .project-next__grid {
    grid-template-columns: repeat(12, 1fr);
  }

  .project-next__label {
    grid-column: 1 / 7;
    align-self: start;
    font-size: 3rem;
  }

  .project-next__card {
    grid-column: 7 / 13;
    margin-top: 0;
    max-width: none;
  }
}

@media (min-width: 1024px) {
  .project-next {
    padding-block: var(--space-9) var(--space-10);
  }

  .project-next__grid {
    column-gap: var(--space-4);
  }

  .project-next__label {
    font-size: 4rem;
    line-height: 1.1;
  }
}
