/* ============================================================
   PORTAFOLIO PAGE (portafolio.html) — page-specific layout
   Load AFTER styles/main.css and styles/home.css. The hero
   mechanics, card and section helpers are reused from home.css;
   this file only carries the portfolio-specific overrides.
   Mobile breakpoint: 768px (in sync with --breakpoint-md).
   ============================================================ */

/* ============================================================
   HERO — full-bleed photo with the page title pinned low-left
   and a quiet caption at the bottom edge.
   ============================================================ */
.hero--portafolio {
  /* Stronger bottom scrim so the title + caption read over the photo */
  background-image: linear-gradient(180deg, rgba(5, 7, 6, 0.35) 0%, rgba(5, 7, 6, 0) 30%, rgba(5, 7, 6, 0.55) 100%),
                    url("/images/portafolio/arte-visual-hero-portafolio.jpg");
}

/* Title centered in the flexible upper area, caption pinned to the
   bottom edge — same split as the home hero, minus the button. */
.hero__content--portafolio {
  grid-template-rows: 1fr auto;
}

.hero__title--display {
  align-self: center;
  font-size: var(--font-size-headline-2);
  letter-spacing: var(--letter-spacing-tight);
}

/* Bottom caption — small, uppercase, muted white */
.hero__caption--foot {
  font-size: var(--font-size-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

/* ============================================================
   PROYECTOS DESTACADOS — large featured project alongside a
   grid of square thumbnails. The featured card carries an
   overlaid caption (eyebrow + title + author + "Ver más" link)
   pinned to its lower edge over a soft scrim.

   The tall card holds its place while the thumbnails pin and ride
   down alongside it (see .featured__grid).
   ============================================================ */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 534fr) minmax(0, 648fr);
  gap: var(--space-24);
  align-items: start;
}

/* --- Left: large portrait with overlaid caption --- */
.featured__main {
  position: relative;
  overflow: hidden;
}
.featured__main-img {
  display: block;
  width: 100%;
  aspect-ratio: 534 / 803;   /* matches placehold.co/534x803 */
  object-fit: cover;
  background-color: var(--color-grey-light);
}

.featured__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-24);
  color: var(--color-white);
  /* Bottom-up scrim keeps the caption legible over the photo */
  background: linear-gradient(180deg, rgba(5, 7, 6, 0) 0%, rgba(5, 7, 6, 0.55) 100%);
}
.featured__overlay > * + * { margin-top: var(--space-16); }

.featured__eyebrow {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-book);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}

.featured__title {
  font-size: var(--font-size-headline-1);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}

/* Author line on the left, "Ver más" link pinned to the right */
.featured__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-24);
}
.featured__by { color: rgba(255, 255, 255, 0.85); }
.featured__link { letter-spacing: 0.08em; }

/* --- Right: 3-column grid of square thumbnails --- */
/* The thumbs pin and ride down the featured card as the page scrolls,
   then release at its lower edge. The travel is the slack left in the
   row — the card's height minus the thumbs' — so the card being the
   taller column is what drives the effect, and align-items: start on
   .featured is what leaves that slack rather than stretching it away. */
.featured__grid {
  position: sticky;
  top: calc(var(--space-24) * 4);   /* clears the solid navbar */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-16);
}
.featured__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;       /* matches placehold.co/200x200 */
  object-fit: cover;
  background-color: var(--color-grey-light);
  transition: opacity 0.2s ease;
}
.featured__thumb-link:hover .featured__thumb { opacity: 0.85; }

/* ============================================================
   PROYECTOS DESTACADOS (mobile) — horizontal card carousel that
   replaces the .featured grid on small screens. Hidden on
   desktop; revealed (and .pd-desktop hidden) in the <=768px
   media query below.
   ============================================================ */
.pd-mobile { display: none; }

/* Label reads as "Proyectos destacados >" with a trailing chevron */
.pd-mobile__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
}
.pd-mobile__arrow { font-size: 1.25em; line-height: 1; }

/* Swipeable row; cards are fixed-width so the next one peeks in */
.pd-mobile__track {
  display: flex;
  gap: var(--space-16);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* Hide the scrollbar but keep the swipe/scroll working */
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / old Edge */
}
.pd-mobile__track::-webkit-scrollbar { display: none; }  /* Chrome / Safari */

.pd-card {
  flex: 0 0 72%;
  max-width: 300px;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
}
.pd-card__img {
  display: block;
  width: 100%;
  aspect-ratio: 280 / 420;
  object-fit: cover;
  background-color: var(--color-grey-light);
}

/* Title on the left, year pinned to the right */
.pd-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-16);
  margin-top: var(--space-16);
}
.pd-card__title {
  font-size: 14px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  text-transform: uppercase;
}
.pd-card__year {
  flex: none;
  font-size: 14px;
  font-weight: var(--font-weight-book);
  color: var(--color-black);
}
.pd-card__place {
  margin-top: var(--space-8);
  font-size: 14px;
  color: var(--color-black);
}

/* ============================================================
   DESTINOS — full-bleed featured destination with an overlaid
   caption (title centered, description + "Ver más" pinned low)
   alongside a vertical rail of thumbnails that spans its height.
   Desktop/tablet only; hidden on mobile (see media query below).
   ============================================================ */
.destino-feature__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: var(--space-16);
  align-items: stretch;
}

/* --- Left: large landscape image with overlaid caption --- */
.destino-feature__main {
  position: relative;
  overflow: hidden;
}
.destino-feature__main-img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1075 / 647;   /* matches placehold.co/1075x647 */
  object-fit: cover;
  background-color: var(--color-grey-light);
}

/* Overlay fills the image: the auto margins push the title toward
   the vertical center and pin the foot block to the lower edge. */
.destino-feature__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-24);
  color: var(--color-white);
  background: linear-gradient(180deg, rgba(5, 7, 6, 0) 40%, rgba(5, 7, 6, 0.55) 100%);
}
.destino-feature__title {
  margin-top: auto;
  font-size: var(--font-size-headline-1);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}
.destino-feature__foot {
  margin-top: auto;
  max-width: 46ch;
}
.destino-feature__desc {
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
  color: rgba(255, 255, 255, 0.85);
}
.destino-feature__link {
  margin-top: var(--space-16);
  letter-spacing: 0.08em;
  text-transform: none;
}

/* --- Right: vertical rail of thumbnails, stretched to the image --- */
.destino-feature__rail {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: var(--space-16);
}
.destino-feature__thumb-link {
  display: block;
  overflow: hidden;
}
.destino-feature__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: var(--color-grey-light);
  transition: opacity 0.2s ease;
}
.destino-feature__thumb-link:hover .destino-feature__thumb { opacity: 0.85; }

/* DESTINOS DESTACADOS reuses the shared destinations carousel
   (.destinations-track / .destination-card) defined in home.css,
   wired by scripts/carousel.js — identical to the home page. */

/* ============================================================
   TEASERS — tabbed header (Teasers / Film) over a 4-column
   grid of landscape thumbnails.
   ============================================================ */
.tabs {
  display: inline-flex;
  gap: var(--space-24);
}
.tab {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}
.tab:hover { color: var(--color-text); }
.tab.is-active {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.teasers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-24);
}
.teasers-grid[hidden] { display: none; }
.teasers-grid__item { display: block; }
.teasers-grid__img {
  display: block;
  width: 100%;
  aspect-ratio: 278 / 185;   /* matches placehold.co/278x185 */
  object-fit: cover;
  background-color: var(--color-grey-light);
  transition: opacity 0.2s ease;
}
.teasers-grid__item:hover .teasers-grid__img { opacity: 0.85; }

/* ============================================================
   FOTOGRAFÍA DESTACADA — large featured image with prev/next
   arrows, alongside a heading and a 2-column scrolling grid of
   thumbnails. The active thumbnail is lifted to full opacity;
   the rest stay dimmed. Behaviour: scripts/featured-gallery.js
   ============================================================ */
.fotografia {
  position: relative;                       /* anchor for the absolute aside */
  display: grid;
  grid-template-columns: minmax(0, 1fr) 480px;
  gap: var(--space-24);
}

/* --- Left: large featured image with overlaid arrows --- */
.fotografia__main {
  position: relative;
  overflow: hidden;
}
.fotografia__main-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 529 / 528;   /* matches placehold.co/529x528 */
  object-fit: cover;
  background-color: var(--color-grey-light);
}

.fotografia__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--icon-size-md) + var(--space-16));  /* 40px control */
  height: calc(var(--icon-size-md) + var(--space-16));
  color: var(--color-black);
  background-color: rgba(255, 255, 255, 0.9);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(5, 7, 6, 0.15);
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.fotografia__arrow:hover { background-color: var(--color-white); }
.fotografia__arrow--prev { left: var(--space-16); }
.fotografia__arrow--next { right: var(--space-16); }

/* --- Right: heading + scrolling thumbnail grid ---
   Absolutely pinned so the featured image drives the height;
   the thumbnail grid fills the leftover space and scrolls. */
.fotografia__aside {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  display: flex;
  flex-direction: column;
}

.fotografia__head { flex: 0 0 auto; margin-bottom: var(--space-24); }
.fotografia__title {
  font-size: var(--font-size-headline-2);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}
.fotografia__subtitle {
  margin-top: var(--space-8);
  color: var(--color-text-muted);
}

.fotografia__thumbs {
  flex: 1 1 auto;
  min-height: 0;                /* let the grid shrink to the image height */
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-16);
  align-content: start;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* legacy Edge */
}
.fotografia__thumbs::-webkit-scrollbar { display: none; } /* Chromium/Safari */

.fotografia__thumb {
  display: block;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: none;
  opacity: 0.5;                 /* dimmed until selected / hovered */
  transition: opacity 0.2s ease;
}
.fotografia__thumb:hover { opacity: 0.85; }
.fotografia__thumb.is-active { opacity: 1; }   /* chosen image → full opacity */
.fotografia__thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background-color: var(--color-grey-light);
}

/* "Ver más" link below the grid — mobile only (see media query) */
.fotografia__more { display: none; }

/* ============================================================
   PROPUESTAS — split block: text aligned to the site container
   on the left, a full-bleed square image flush to the right
   edge of the viewport.
   ============================================================ */
.propuesta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

/* Text column: its inner is capped to half the container width and
   pushed right so its gutter lines up with the rest of the page. */
.propuesta__inner {
  width: 100%;
  max-width: calc(var(--container-max) / 2);
  margin-left: auto;
  padding-inline: var(--container-gutter);
}
.propuesta__inner > * + * { margin-top: var(--space-16); }

.propuesta__title {
  font-size: var(--font-size-headline-1);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  text-transform: capitalize;
}
.propuesta__lead {
  max-width: 60ch;
  color: var(--color-text-muted);
}
.propuesta__link { margin-top: var(--space-24); }

/* Image column: bleeds to the right edge of the viewport */
.propuesta__media { align-self: stretch; }
.propuesta__media-img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;        /* matches placehold.co/583x583 */
  object-fit: cover;
  background-color: var(--color-grey-light);
}

.portafolio_destacado_mobile { display: none; }

/* ============================================================
   RESPONSIVE  (<= 768px)
   ============================================================ */
@media (max-width: 1024px) {
  .teasers-grid { grid-template-columns: repeat(2, 1fr); }

  .fotografia { grid-template-columns: minmax(0, 1fr) 320px; }
  .fotografia__aside { width: 320px; }
}
@media (max-width: 768px) {

  .portafolio_hero_title { text-transform: capitalize !important; }
  .portafolio_hero_subtitle { display: none; }
  .portafolio_teasers_section { background: var(--color-grey-light); }
  .fotografia__main-img { display: none; }
  .fotografia__title { font-weight: var(--font-weight-bold); text-transform: uppercase; }
  .fotografia__subtitle { color: #1B1A18B2; font-size: 14px; }

  .portafolio_destacado_mobile { display: block; }

  /* Proyectos destacados: swap the .featured grid for the swipe carousel */
  .pd-desktop { display: none; }
  .pd-mobile { display: block; }

  /* Destinos featured: desktop-only — hidden on mobile */
  .destino-feature { display: none; }

  .teasers-grid { grid-template-columns: repeat(2, 1fr); }

  /* Fotografía destacada: stack image over the heading + thumbs */
  .fotografia { grid-template-columns: 1fr; }
  .fotografia__aside {
    position: static;
    width: auto;
    margin-top: var(--space-24);
  }
  /* Thumb grid gets a soft blurred fade at the bottom so the last row
     dissolves into the page and hints there's more behind "Ver más". */
  .fotografia__thumbs {
    position: relative;
    overflow: visible;
    min-height: 0;
  }
  .fotografia__thumbs::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 140px;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.75) 55%,
      var(--color-bg) 100%
    );
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 70%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 70%);
  }

  .fotografia__more {
    display: block;
    width: fit-content;
    margin: var(--space-24) auto 0;
    text-align: center;
  }

  /* Propuestas: text over a full-width image */
  .portafolio_propuesta__section { background: var(--color-grey-light); }
  .propuesta { display: flex; flex-direction: column-reverse; }
  .propuesta__inner {
    max-width: none;
    padding-block: var(--space-100);
  }
  .propuesta__media { order: 1; }
  .propuesta__media-img { padding: var(--space-24); }
  .propuesta__title { font-weight: var(--font-weight-bold); text-transform: uppercase; } 
  .propuesta__lead { color: #1B1A18; }
  .propuesta__link { color: var(--color-black); background-color: transparent; border: 1px solid var(--color-black); padding: var(--space-8) var(--space-16); border-radius: 4px; text-decoration: none; text-transform: uppercase; width: fit-content; }
}
