/* ==========================================================================
   GLEN THEME — PORTFOLIO TEMPLATES
   Supplements splash-staging.css (required) which provides the card grid,
   contact-panel, container, icon-circle, and philosophy section styles.
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. CATEGORY ARCHIVE HERO
   Dark banner above the card grid: eyebrow + h1 + optional description.
   ------------------------------------------------------------------------- */

.port-hero {
  background: #fff;
  padding-top: calc(var(--gt-nav-height, 64px) + 2rem + 20px);
  padding-bottom: calc((clamp(2.25rem, 2.25rem + 2vw, 4.5rem) - 30px) * 0.6);
}

.port-hero__title {
  font-size: clamp(1.75rem, 1.15rem + 2.4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: #1d2438;
  margin-bottom: 0;
}

.port-hero__desc {
  font-size: clamp(1rem, 0.875rem + 0.5vw, 1.125rem);
  line-height: 1.65;
  color: #4b5563;
  max-width: 58ch;
  margin-top: 1rem;
}

/* -------------------------------------------------------------------------
   2. PORTFOLIO WORK SECTION
   The work-grid used on category archives — overrides .work background
   to stay white and removes the top padding offset used by the splash hero.
   ------------------------------------------------------------------------- */

.port-work {
  background: var(--surface-light);
  padding-top: clamp(1.2rem, 0.9rem + 0.9vw, 1.8rem);
  padding-bottom: var(--space-section-end);
}

/* Constrain category-page card grid to the same width as the homepage container */
.port-work .work-grid-outer {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.port-work .section-head {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  text-align: left;
}

.port-work .section-head__eyebrow::after {
  left: 0;
  transform: none;
}

.port-work .section-head__title {
  margin-inline: 0;
}

.work-card__no-thumb {
  width: 100%;
  height: 100%;
  background: var(--c-grey-200);
}

/* ── Portfolio category page: work-card overrides ──────────────────────── */

/* Lighter gradient overlay (~30% reduction vs splash-staging.css base); top tint increased ~40% */
body.portfolio-category-page .work-card__media::after {
  background:
    linear-gradient(to bottom, rgba(10, 13, 26, 0.80) 0%, rgba(10, 13, 26, 0.29) 28%, transparent 52%),
    linear-gradient(to top,    rgba(10, 13, 26, 0.57) 0%, rgba(10, 13, 26, 0.21) 28%, transparent 52%);
}

/* Index aligns with first-line baseline of title; max-width wraps long titles at ~90% */
body.portfolio-category-page .work-card__meta {
  align-items: baseline;
  max-width: 90%;
}

/* Hide category/discipline label (CTA occupies bottom-right instead) */
body.portfolio-category-page .work-card__disciplines {
  display: none;
}

/* CTA: bottom-right corner */
body.portfolio-category-page .work-card__hover {
  top: auto;
  bottom: 0;
  left: auto;
  right: 0;
}

/* Match homepage cat-card hover: more pronounced scale + shadow */
@media (hover: hover) {
  body.portfolio-category-page .work-card:hover .work-card__media,
  body.portfolio-category-page .work-card:focus-within .work-card__media {
    transform: scale(1.03);
    box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.55);
  }
}

/* -------------------------------------------------------------------------
   3. PORTFOLIO CONTACT SECTION
   Simplified version of the philosophy section contact panel.
   Uses the same .philosophy dark background from splash-staging.css.
   Only the right-column content differs from the Creative Work version.

   IMPORTANT: splash-staging.css sets .contact-panel and .philosophy__intro
   children to opacity:0 + translateY(24px) as animation start states,
   lifted only when splash-staging.js adds .is-animated to .philosophy.
   Portfolio pages don't load splash-staging.js, so we override here.
   ------------------------------------------------------------------------- */

.portfolio-category-page .philosophy .contact-panel,
.portfolio-single-page   .philosophy .contact-panel,
.portfolio-archive-page  .philosophy .contact-panel,
.portfolio-category-page .philosophy__intro .section-head__eyebrow,
.portfolio-single-page   .philosophy__intro .section-head__eyebrow,
.portfolio-archive-page  .philosophy__intro .section-head__eyebrow,
.portfolio-category-page .philosophy__intro .philosophy__title,
.portfolio-single-page   .philosophy__intro .philosophy__title,
.portfolio-archive-page  .philosophy__intro .philosophy__title,
.portfolio-category-page .philosophy__intro .philosophy__body,
.portfolio-single-page   .philosophy__intro .philosophy__body,
.portfolio-archive-page  .philosophy__intro .philosophy__body {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

.port-contact__heading {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--ink-on-dark);
  margin-bottom: 1.5rem;
}

.port-contact__body {
  font-size: var(--fs-body);
  line-height: 1.72;
  color: rgba(255, 255, 255, 0.75);
}

.port-contact__body + .port-contact__body {
  margin-top: 1.125rem;
}

.port-contact__links {
  margin-top: clamp(2rem, 1.5rem + 1.5vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* -------------------------------------------------------------------------
   4. PORTFOLIO GATEWAY (archive-portfolio.php)
   Shown at /portfolio/ if has_archive is enabled. Grid of 6 category tiles.
   ------------------------------------------------------------------------- */

.port-gateway {
  background: var(--c-hero-navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.port-gateway__hero {
  padding-top: calc(var(--gt-nav-height, 64px) + clamp(3rem, 2rem + 3vw, 5rem));
  padding-bottom: clamp(2.5rem, 2rem + 2vw, 4rem);
  background: var(--c-hero-navy);
}

.port-gateway__eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-orange);
  margin-bottom: 0.875rem;
}

.port-gateway__title {
  font-size: clamp(2.25rem, 1.5rem + 3vw, 4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink-on-dark);
  margin-bottom: 1rem;
}

.port-gateway__subtitle {
  font-size: var(--fs-body);
  color: var(--ink-on-dark-muted);
  max-width: 50ch;
}

.port-gateway__grid-section {
  background: var(--surface-light);
  padding: clamp(3rem, 2rem + 3vw, 5.5rem) 0;
  flex: 1;
}

.port-category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.75rem, 0.5rem + 0.75vw, 1.25rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.port-category-card {
  display: block;
  background: var(--c-grey-100);
  border: 1px solid var(--c-grey-200);
  border-radius: var(--radius-md);
  padding: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  text-decoration: none;
  color: var(--ink-on-light);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}

.port-category-card:hover,
.port-category-card:focus-visible {
  border-color: var(--c-orange);
  box-shadow: 0 4px 20px rgba(255, 84, 15, 0.12);
  transform: translateY(-2px);
  outline: none;
}

.port-category-card__count {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-orange);
  margin-bottom: 0.75rem;
}

.port-category-card__name {
  font-size: clamp(1.125rem, 0.9rem + 0.75vw, 1.375rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink-on-light);
  margin-bottom: 0.625rem;
}

.port-category-card__desc {
  font-size: var(--fs-body-sm);
  line-height: 1.55;
  color: var(--ink-on-light-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.port-category-card__cta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-orange);
}

.port-category-card__cta .icon-circle {
  --size: 28px;
  background: var(--c-orange);
  color: #fff;
}

/* -------------------------------------------------------------------------
   5. PORTFOLIO SINGLE POST
   Individual /portfolio/{slug}/ pages — noindex, follow.
   ------------------------------------------------------------------------- */

.port-single-hero {
  background: #f9f9f8;
  padding-top: calc(var(--gt-nav-height, 64px) + 2rem + 20px);
  padding-bottom: calc(clamp(2.25rem, 2.25rem + 2vw, 4.5rem) - 30px);
}

/* Shared: gap between breadcrumb and hero title on both page types */
.port-hero .port-breadcrumb,
.port-single-hero .port-breadcrumb {
  margin-bottom: calc(1rem + 10px);
}

.port-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: #9ca3af;
  list-style: none;
  margin: 0;
  padding: 0;
}

.port-breadcrumb li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.port-breadcrumb li + li::before {
  content: "›";
  color: #9ca3af;
}

.port-breadcrumb a {
  color: #9ca3af;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

.port-breadcrumb a:hover {
  color: var(--c-orange);
}

.port-breadcrumb [aria-current="page"] {
  color: #6b7280;
  font-weight: 500;
}

.port-single__featured {
  background: #000;
  line-height: 0;
}

body.postid-89069 .port-single__featured,
body.postid-89069 .port-single-hero,
body.postid-89069 .port-single__body {
  background: #fff;
}

.port-single__featured img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
}

.port-single__body {
  background: #f9f9f8;
}

/* ── portfolio_top (default): info above, gallery below ── */

.port-single__info {
  padding-top: clamp(0.44rem, 0.34rem + 0.34vw, 0.67rem);
  padding-bottom: clamp(2rem, 1.5rem + 1.5vw, 3rem);
  border-bottom: 1px solid var(--c-grey-200);
}

.port-single__artwork {
  padding: clamp(2.5rem, 2rem + 2vw, 4rem) 0 clamp(3rem, 2.5rem + 2vw, 5rem);
}

/* ── portfolio_bottom: gallery above, info below ── */

.port-single__body--bottom .port-single__artwork {
  padding-top: clamp(2rem, 1.5rem + 1.5vw, 3rem);
  padding-bottom: clamp(1.5rem, 1rem + 1vw, 2rem);
}

.port-single__info--below {
  border-top: 1px solid var(--c-grey-200);
  border-bottom: none;
  padding: clamp(0.44rem, 0.34rem + 0.34vw, 0.67rem) 0 clamp(3rem, 2.5rem + 2vw, 5rem);
}

/* ── Info section: title + 2-column grid (excerpt | detail fields) ── */

.port-single__info .container,
.port-single__info--below .container {
  /* Allow full container width — title and grid use the full column. */
}

.port-single__info-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: clamp(2rem, 3vw, 4rem);
  align-items: start;
}

/* When there are no detail fields, excerpt spans full width. */
.port-single__info-grid--full {
  grid-template-columns: 1fr;
}

.port-single__info-excerpt {
  /* No extra styles needed; inherits grid cell flow. */
}

/* ── Detail fields column ── */

.port-single__details {
  padding-left: clamp(1.5rem, 2vw, 2.5rem);
  border-left: 1px solid var(--c-grey-200);
}

.port-detail-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.port-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.125rem;
}

.port-detail__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-grey-400);
}

.port-detail__value {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-on-light-muted);
  margin: 0;
}

.port-detail__value a {
  color: var(--c-orange);
  text-decoration: none;
}

.port-detail__value a:hover {
  text-decoration: underline;
}

/* ── sidebar_right / sidebar_left: two-column ── */

.port-single__body--sidebar {
  padding: clamp(0.55rem, 0.44rem + 0.44vw, 0.88rem) 0 clamp(3rem, 2.5rem + 2vw, 5rem);
}

.port-single__cols {
  display: flex;
  gap: clamp(2rem, 4vw, 4.5rem);
}

/* sidebar_left reverses column order */
.port-single__cols--left {
  flex-direction: row-reverse;
}

.port-single__body--sidebar .port-single__artwork {
  flex: 65;
  min-width: 0;
  padding: 0;
}

.port-single__body--sidebar .port-single__info {
  flex: 35;
  min-width: 0;
  padding: 0;
  border: none;
}

.port-single__body--sidebar .port-single__info-inner {
  max-width: none;
  position: sticky;
  top: calc(var(--gt-nav-height, 64px) + 2rem);
}

/* Sidebar detail fields: full-width stack (no left border, tighter spacing). */
.port-single__body--sidebar .port-detail-list {
  gap: 0.75rem;
}

.port-single__body--sidebar .port-single__details {
  padding-left: 0;
  border-left: none;
  margin-top: 0;
}

/* Remove top gap so first gallery item has no extra leading space */
.port-single__content > :first-child {
  margin-top: 0;
}

.port-single__title {
  font-size: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink-on-light);
  margin-bottom: 1.25rem;
}

.port-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.port-category-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  /* #b83a00 on white = 5.4:1 — passes WCAG AA (4.5:1 required for small text) */
  color: #b83a00;
  background: rgba(255, 84, 15, 0.08);
  border: 1px solid rgba(255, 84, 15, 0.2);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.875rem;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.port-category-chip:hover {
  background: rgba(255, 84, 15, 0.16);
  border-color: var(--c-orange);
}

.port-single__meta {
  font-size: 0.875rem;
  color: var(--ink-on-light-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--c-grey-200);
}

.port-single__meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.port-single__meta-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-grey-400);
}

.port-single__meta-value {
  color: var(--ink-on-light-muted);
}

.port-single__excerpt {
  font-size: var(--fs-body-sm);
  line-height: 1.7;
  color: var(--ink-on-light-muted);
  margin-bottom: 2rem;
}

/* Content rendered for non-Uncode posts (e.g. InDesign iframe embeds) */
.port-single__content {
  margin-bottom: 0;
}

/* <p><iframe> pattern — raw embeds in post content.
   Base styles apply to all such iframes. Aspect-ratio splits on source:
   - Catalogue viewers (issuu-style square embeds): 1/1
   - YouTube / Vimeo / Wistia: 16/9
   Narrowed from .port-single__content iframe to avoid touching WPBakery
   iframes nested deeper in the DOM (e.g. inside .wpb_video_wrapper). */
.port-single__content > p > iframe {
  width: 100% !important;
  max-width: 100%;
  height: auto !important;
  display: block;
  border: 1px solid var(--c-grey-200) !important;
  border-radius: var(--radius-sm);
  aspect-ratio: 1 / 1; /* default: catalogue viewers */
}

.port-single__content > p > iframe[src*="youtube"],
.port-single__content > p > iframe[src*="youtu.be"],
.port-single__content > p > iframe[src*="vimeo"],
.port-single__content > p > iframe[src*="wistia"] {
  aspect-ratio: 16 / 9;
  border: none !important;
}

.port-single__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-on-light-muted);
  text-decoration: none;
  margin-top: 2rem;
  transition: color var(--dur-fast) var(--ease);
}

.port-single__back:hover {
  color: var(--c-orange);
}

.port-single__back svg {
  transform: scaleX(-1);
  flex-shrink: 0;
}

.port-single__divider {
  border: none;
  border-top: 1px solid var(--c-grey-200);
  margin: 0 0 2rem;
}

/* -------------------------------------------------------------------------
   6. RESPONSIVE
   ------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .port-category-grid { grid-template-columns: repeat(2, 1fr); }

  /* Related works: 2 columns on tablet. */
  .port-related__grid { grid-template-columns: repeat(2, 1fr); }

  /* Info grid: stack on tablet when viewport is tight. */
  .port-single__info-grid {
    grid-template-columns: 1fr;
  }
  .port-single__details {
    padding-left: 0;
    border-left: none;
    padding-top: 1.5rem;
    border-top: 1px solid var(--c-grey-200);
  }

  /* Sidebar: stack on tablet. */
  .port-single__cols {
    flex-direction: column;
  }
  .port-single__cols--left {
    flex-direction: column;
  }
  .port-single__body--sidebar .port-single__info-inner {
    position: static;
  }

  /* Sidebar stacked: restore spacing and separator between artwork and info. */
  .port-single__body--sidebar .port-single__info {
    padding-top: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
    border-top: 1px solid var(--c-grey-200);
  }
}

/* Mobile (≤640px) */
@media (max-width: 640px) {
  .port-category-grid { grid-template-columns: 1fr; }

  /* Related works: single column on mobile. */
  .port-related__grid { grid-template-columns: repeat(2, 1fr); }

  /* Nav: hide long post titles, show only labels. */
  .port-nav__post-title { display: none; }

  .port-nav__inner {
    justify-content: center;
    gap: 1.5rem;
  }
}

/* -------------------------------------------------------------------------
   7. PORTFOLIO CONTENT GALLERY
   Renders images and videos from vc_gallery, vc_single_image, and
   _uncode_featured_media fallback inside .port-single__content.
   ------------------------------------------------------------------------- */

.port-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.port-gallery__item {
  margin: 0;
  line-height: 0;
}

.port-gallery__item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

.port-gallery__item--video {
  line-height: 0;
  aspect-ratio: var(--ar, 16 / 9);
}

.port-gallery__item--video--portrait {
  width: 50%;
  margin-inline: auto;
}

.port-gallery__item--video video {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--radius-sm);
  background: #000;
}

.port-gallery__item--embed {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.port-gallery__item--embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Single-item gallery: expand to full content width */
.port-gallery:has(.port-gallery__item:only-child) {
  grid-template-columns: 1fr;
}

/* Column-count overrides — set by vc_gallery single_width attribute.
   Placed before the mobile @media so the later rule wins at ≤640px. */
.port-gallery--cols-1 { grid-template-columns: 1fr; }
.port-gallery--cols-3 { grid-template-columns: repeat(3, 1fr); }
.port-gallery--cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 640px) {
  .port-gallery {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* Portrait / landscape image treatment ─────────────────────────────────────
   Classes applied by JS after load (naturalHeight vs naturalWidth).
   Gallery figures get the class → flex centering constrains the img width.
   Non-gallery imgs (WPBakery content) get the class directly on the <img>.
   Portrait → 50% width. Landscape → 80% width. Square → unchanged.
   -------------------------------------------------------------------------- */

.port-gallery__item.port-img--portrait,
.port-gallery__item.port-img--landscape {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.port-gallery__item.port-img--portrait img {
  width: 50%;
  height: auto;
}

.port-gallery__item.port-img--landscape img {
  width: 80%;
  height: auto;
}

.port-single__content img.port-img--portrait {
  max-width: 50%;
  display: block;
  margin-left: auto;
  margin-right: auto;
  height: auto;
}

.port-single__content img.port-img--landscape {
  max-width: 80%;
  display: block;
  margin-left: auto;
  margin-right: auto;
  height: auto;
}

/* -------------------------------------------------------------------------
   8. CAROUSEL
   Interactive image/video carousel rendered from vc_gallery type="carousel".
   JS in assets/js/portfolio-carousel.js handles transitions, touch, and ARIA.
   ------------------------------------------------------------------------- */

.port-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  user-select: none;
  touch-action: pan-y;
}

/* ── Single-item: slide transition ── */
.port-carousel--single .port-carousel__track {
  display: flex;
  transition: transform 400ms ease;
  will-change: transform;
}

.port-carousel--single .port-carousel__slide {
  flex: 0 0 100%;
}

/* ── Single-item: fade transition (overrides slide track/slide rules above) ── */
.port-carousel--fade .port-carousel__track {
  display: grid;
  grid-template-columns: 1fr;
  transition: none;
}

.port-carousel--fade .port-carousel__slide {
  grid-column: 1;
  grid-row: 1;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
  /* override flex: 0 0 100% from --single */
  flex: none;
}

.port-carousel--fade .port-carousel__slide.is-active {
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
}

/* Single-slide fade carousel: the only slide is always visible (JS guard skips
   initialisation when slides.length < 2, so is-active is never applied). */
.port-carousel--fade .port-carousel__slide:only-child {
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
}

/* ── Multi-item: slide transition ── */
.port-carousel--multi .port-carousel__track {
  display: flex;
  transition: transform 400ms ease;
  will-change: transform;
}

.port-carousel--multi .port-carousel__slide {
  flex-shrink: 0; /* width is set by JS; prevent flex compression */
}

/* ── Images and figures inside slides ── */
.port-carousel__slide figure {
  margin: 0;
  line-height: 0;
}

.port-carousel__slide figure img,
.port-carousel__slide img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

/* ── Prev / Next buttons ── */
.port-carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  padding: 0;
  transition: background 200ms ease, opacity 200ms ease;
  flex-shrink: 0;
}

.port-carousel__btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.port-carousel__btn:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 3px;
}

.port-carousel__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.port-carousel__btn--prev { left: 8px; }
.port-carousel__btn--next { right: 8px; }

/* ── Dot indicators ── */
.port-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 4px;
}

.port-carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--c-grey-300, #bbb);
  cursor: pointer;
  padding: 0;
  transition: background 200ms ease, transform 200ms ease;
}

.port-carousel__dot.is-active,
.port-carousel__dot[aria-selected='true'] {
  background: var(--c-orange);
  transform: scale(1.35);
}

.port-carousel__dot:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 3px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .port-carousel--single .port-carousel__track,
  .port-carousel--multi  .port-carousel__track {
    transition: none;
  }
  .port-carousel--fade .port-carousel__slide {
    transition: none;
  }
}

/* -------------------------------------------------------------------------
   9. CONTENT BLOCK SPACING — portfolio single posts (artwork column only)
   Targets direct children of .port-single__content using adjacent-sibling
   selectors. "Visual blocks" are .port-gallery, .port-carousel, figure, and
   standalone .port-gallery__item elements (vc_single_image video/image).
   Text blocks are any p or heading element from vc_column_text / vc_custom_heading.

   Scoped exclusively to .port-single__content — does not affect case studies,
   category archives, or any other template.
   ------------------------------------------------------------------------- */

/* Trailing margin reset: all visual blocks use margin-top only.
   Zeroing margin-bottom prevents collapse from absorbing the smaller
   caption margin-top (visual→text rule below). */
.port-single__content > :is(.port-gallery, .port-carousel, figure, .port-gallery__item) {
  margin-bottom: 0;
}

/* Baseline top margin for standalone figure / video (vc_single_image direct child) */
.port-single__content > figure,
.port-single__content > .port-gallery__item {
  margin-top: 1.5rem;
}

/* Higher-specificity first-child reset — prevents baseline rules above from
   adding leading space before the opening visual block. The baseline rules
   for figure (0,1,1) and .port-gallery__item (0,2,0) are declared later in
   source than the :first-child rule in §5, so they win the cascade unless
   overridden here with extra specificity. */
.port-single__content > figure:first-child,
.port-single__content > .port-gallery__item:first-child,
.port-single__content > .port-gallery:first-child,
.port-single__content > .port-carousel:first-child {
  margin-top: 0;
}

/* Visual → visual: clear breathing room between stacked image blocks.
   Minimum 3rem (48px) ensures mobile never feels crowded; scales
   to ~61px at 1443px desktop and caps at 4.5rem (72px). */
.port-single__content > :is(.port-gallery, .port-carousel, figure, .port-gallery__item)
  + :is(.port-gallery, .port-carousel, figure, .port-gallery__item) {
  margin-top: clamp(3rem, 2rem + 2vw, 4.5rem);
}

/* Text → visual: descriptor leads into its image with comfortable separation. */
.port-single__content > :is(p, h2, h3, h4, h5, h6)
  + :is(.port-gallery, .port-carousel, figure, .port-gallery__item) {
  margin-top: 1.25rem;
}

/* Visual → text: caption stays clearly associated but not cramped. */
.port-single__content > :is(.port-gallery, .port-carousel, figure, .port-gallery__item)
  + :is(p, h2, h3, h4, h5, h6) {
  margin-top: 1rem;
}

/* WordPress classic-editor alignment — .aligncenter is not provided by a
   custom theme without wp-block-styles. Scoped to portfolio content only. */
.port-single__content .aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.port-single__content .alignleft {
  float: left;
  margin-right: 1.5em;
  margin-bottom: 1em;
}

.port-single__content .alignright {
  float: right;
  margin-left: 1.5em;
  margin-bottom: 1em;
}

/* Classic-editor raw image pattern: text <p> → image-only <p>.
   Applies to pages that embed images as plain WordPress <img> tags in <p>
   rather than using [vc_gallery] shortcodes (e.g. Rival Research page).
   Matches only when the following <p> contains a single <img> with no
   other element siblings (img:only-child excludes the text+br+img case). */
.port-single__content > p + p:has(> img:only-child) {
  margin-top: 1.25rem;
}

/* Classic-editor mixed pattern: descriptor text + <br> + image in same <p>.
   The <br> contributes one line-height (24px) of space — replace it with a
   controlled block margin so the gap matches the text-p → img-p rule above. */
.port-single__content > p:has(> br + img) > br {
  display: none;
}
.port-single__content > p:has(> br + img) > img {
  display: block;
  margin-top: 1.25rem;
}

/* Centre block-level images in classic-editor <p> content (both patterns above). */
.port-single__content > p > img {
  margin-inline: auto;
}

/* Body copy typography — standardised to match .port-single__excerpt.
   Scoped to portfolio-single-page body class for specificity over Uncode.
   Targets all <p> in the rendered content area (WPBakery + classic editor).
   Headings, metadata, labels, and navigation are unaffected. */
.portfolio-single-page .port-single__content p {
  font-family: inherit;
  font-size: var(--fs-body-sm);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: normal;
  color: var(--ink-on-light-muted);
  margin-bottom: 1rem;
}

/* Section title typography — standardised to match the reference heading:
   "Direction 1 - How may I help you today?" (post 90797).
   Computed reference: 1.5rem / weight 700 / line-height 1.5 / #1d2438 / no transform.
   margin-bottom is a 1rem baseline + 20% = 1.2rem for clear heading-to-body separation.

   Covers:
     • <h2>–<h6> used as section titles in WPBakery content (post 90797 h2, post 88800 h4)
     • Standalone <strong> direct-children of .wpb_wrapper used as block subheadings
       (not inline <strong> inside <p>, which remains body-copy weight) — post 89069 */
.portfolio-single-page .port-single__content h2,
.portfolio-single-page .port-single__content h3,
.portfolio-single-page .port-single__content h4,
.portfolio-single-page .port-single__content h5,
.portfolio-single-page .port-single__content h6 {
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: normal;
  color: #1d2438;
  font-style: normal;
  text-transform: none;
  margin-top: 1.8rem;
  margin-bottom: 1.2rem;
}

/* Prevent <strong> inside headings from compounding weight (700 → 900) */
.portfolio-single-page .port-single__content :is(h2, h3, h4, h5, h6) strong {
  font-weight: inherit;
}

/* Standalone <strong> as block subheading (direct child of .port-single__content
   — WPBakery wrappers strip to flat HTML in this template context, so the
   subheading <strong> lands directly under the content div, not inside
   .wpb_wrapper. Safe: inline <strong> always lives inside <p>, never directly
   under .port-single__content). */
.portfolio-single-page .port-single__content > strong {
  display: block;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: normal;
  color: #1d2438;
  font-style: normal;
  text-transform: none;
  margin-top: 1.8rem;
  margin-bottom: 1.2rem;
}

/* -------------------------------------------------------------------------
   10. RELATED WORKS
   Appended after the portfolio post body. Mirrors Uncode's "Related Works"
   content block (post 87086 — an uncode_index of recent portfolio items).
   ------------------------------------------------------------------------- */

.port-related {
  background: #eff2f7;
  border-top: 1px solid var(--c-grey-200);
  padding: clamp(3rem, 2.5rem + 2vw, 5rem) 0;
}

.port-related__heading {
  font-size: clamp(1rem, 0.875rem + 0.4vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-on-light);
  margin-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
}

.port-related__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.75rem, 0.5rem + 0.75vw, 1.25rem);
}

.port-related__card {
  display: block;
  text-decoration: none;
  color: var(--ink-on-light);
  border: 1px solid var(--c-grey-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-light);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}

.port-related__card:hover,
.port-related__card:focus-visible {
  border-color: var(--c-grey-400);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
  outline: none;
}

.port-related__media {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--c-grey-100);
}

.port-related__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms var(--ease);
}

.port-related__card:hover .port-related__img {
  transform: scale(1.04);
}

.port-related__no-thumb {
  width: 100%;
  height: 100%;
  background: var(--c-grey-200);
}

.port-related__title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0.875rem 1rem;
  color: var(--ink-on-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -------------------------------------------------------------------------
   11. POST NAVIGATION
   Previous / Next portfolio item + "Main Portfolio" index link.
   Mirrors Uncode's _uncode_portfolio_navigation section.
   ------------------------------------------------------------------------- */

.port-nav {
  border-top: 1px solid var(--c-grey-200);
  padding: clamp(1.5rem, 1rem + 1.5vw, 2.5rem) 0;
  background: #f7f7f5;
}

.port-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.port-nav__prev,
.port-nav__next {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.port-nav__prev { justify-content: flex-start; }
.port-nav__next { justify-content: flex-end; text-align: right; }

.port-nav__prev svg,
.port-nav__next svg {
  flex-shrink: 0;
  color: var(--c-orange);
}

.port-nav__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-grey-400);
  display: block;
}

.port-nav__post-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-on-light);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 28ch;
  transition: color var(--dur-fast) var(--ease);
}

.port-nav__prev:hover .port-nav__post-title,
.port-nav__next:hover .port-nav__post-title {
  color: var(--c-orange);
}

.port-nav__index {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-on-light-muted);
  text-decoration: none;
  flex-shrink: 0;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--c-grey-200);
  border-radius: var(--radius-pill);
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.port-nav__index:hover {
  color: var(--c-orange);
  border-color: var(--c-orange);
}

/* "Change Category" dropdown — replaces "Main Portfolio" on public portfolio pages */
.port-nav__cat-wrap {
  position: relative;
  flex-shrink: 0;
}

.port-nav__cat-select {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-on-light-muted);
  background: transparent;
  padding: 0.5rem 2.125rem 0.5rem 1.25rem;
  border: 1px solid var(--c-grey-200);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
  line-height: 1.4;
}

.port-nav__cat-select:hover,
.port-nav__cat-select:focus-visible {
  color: var(--c-orange);
  border-color: var(--c-orange);
}

.port-nav__cat-select:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 2px;
}

.port-nav__cat-arrow {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--c-grey-400, #9ca3af);
  display: flex;
  align-items: center;
  line-height: 0;
}

/* -------------------------------------------------------------------------
   FOOTER — category archive + individual portfolio pages
   ------------------------------------------------------------------------- */

body.portfolio-category-page #gt-footer,
body.portfolio-single-page   #gt-footer {
  background: #eff2f7;
}

body.portfolio-category-page .gt-footer__copy,
body.portfolio-single-page   .gt-footer__copy {
  color: rgba(29, 36, 56, 0.5);
}

/* =========================================================================
   12. PAGE-SPECIFIC OVERRIDES
   Targeted rules scoped to individual portfolio post IDs. Applied after all
   global rules so specificity wins cleanly without !important where possible.
   ========================================================================= */

/* ── Rebel | Point of Sale Designs (89610) ──────────────────────────────────
   Reduce the second featured artwork (sole .port-carousel) to 70% width. */
.postid-89610 .port-carousel {
  width: 70%;
  margin-inline: auto;
}

/* ── Alida – ATTN Infographic (90519) ───────────────────────────────────────
   Increase infographic width by ~20% (landscape 80% → 100%). */
.postid-90519 .port-gallery__item.port-img--landscape img,
.postid-90519 .port-gallery__item.port-img--portrait img {
  width: 100%;
}

/* ── Northern Star Alaskan Mining Site Infographic (90506) ──────────────────
   Display at 100% of the content container width. */
.postid-90506 .port-gallery__item img {
  width: 100%;
}

/* ── Customer Intelligence Summit Infographic (87260) ───────────────────────
   Four sketch images: override 3-column grid to 2×2. */
.postid-87260 .port-gallery--cols-3 {
  grid-template-columns: repeat(2, 1fr);
}
/* Infographic beneath: override portrait 50% constraint to 100%. */
.postid-87260 .port-single__content img.port-img--portrait {
  max-width: 100%;
}

/* ── Reach3 / Rival / Angus Reid — desktop + mobile mockup pairs ────────────
   Both mockups live in a single <p>. Display side by side at the same visual
   height using object-fit: cover cropped to the top of each design. */
.postid-90763 .port-single__content > p,
.postid-90757 .port-single__content > p,
.postid-90746 .port-single__content > p {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  justify-content: center;
}

.postid-90763 .port-single__content > p > img,
.postid-90757 .port-single__content > p > img,
.postid-90746 .port-single__content > p > img {
  height: 580px;
  width: auto;
  max-width: 70%;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--radius-sm);
  /* Override the global portrait 50% rule */
  margin-inline: 0;
}

/* Narrower allowance for the mobile mockup (always last in source order) */
.postid-90763 .port-single__content > p > img:last-of-type,
.postid-90757 .port-single__content > p > img:last-of-type,
.postid-90746 .port-single__content > p > img:last-of-type {
  max-width: 30%;
}

@media (max-width: 640px) {
  .postid-90763 .port-single__content > p,
  .postid-90757 .port-single__content > p,
  .postid-90746 .port-single__content > p {
    flex-direction: column;
    align-items: center;
  }
  .postid-90763 .port-single__content > p > img,
  .postid-90757 .port-single__content > p > img,
  .postid-90746 .port-single__content > p > img {
    max-width: 90%;
    height: 320px;
  }
  .postid-90763 .port-single__content > p > img:last-of-type,
  .postid-90757 .port-single__content > p > img:last-of-type,
  .postid-90746 .port-single__content > p > img:last-of-type {
    max-width: 60%;
  }
}

/* ── MiniMill | Personalized Voice-Activated Bobble Heads (89069) ────────────
   Three targeted layout changes scoped by post ID + :has() filename selectors.
   All rules are scoped to .postid-89069 and override the existing snippet
   that sets standalone figure.port-gallery__item to 50% / centred.

   1. Tinkercad baseplate + voicechip GIFs: display side by side at the same
      visual size as minimill-elena-head.gif (2-col grid, 80% img within column).
   2. website-minimill-packaging-1.gif: increase displayed size by ~50%
      (75% of content column vs the existing 50%).
   3. minimill-packaging.gif + minimill-painting.gif: display side by side
      with 1rem gap, matching gallery spacing used elsewhere on the page.
   ─────────────────────────────────────────────────────────────────────────── */

/* 1a. Tinkercad/voicechip gallery: collapse from 4-col to 2-col so each
       column matches the heads gallery (343px per column at 703px container). */
.postid-89069 .port-gallery.port-gallery--cols-4:has(img[src*="minimill-tinkercad-baseplate-website"]) {
  grid-template-columns: repeat(2, 1fr);
}

/* 1b. Tinkercad/voicechip images: override portrait 50% rule → 80% of column,
       matching the landscape treatment applied to elena-head.gif. */
.postid-89069 .port-gallery:has(img[src*="minimill-tinkercad-baseplate-website"]) .port-gallery__item.port-img--portrait img {
  width: 80%;
}

/* 2.  Packaging animation GIF: increase from existing 50% to 75% of content
       column (~+50% in displayed pixels). Double-class selector beats snippet
       specificity (0,4,2 vs 0,3,1) without !important. */
.postid-89069 .port-single__content > img.wp-image-89116.port-img--landscape {
  width: 75%;
  max-width: 75%;
}

/* 3a. Packaging + painting GIFs: float side by side with 1rem gap.
       Both figures are adjacent siblings with no elements between them. */
.postid-89069 .port-single__content > figure.port-gallery__item:has(img[src*="minimill-packaging.gif"]),
.postid-89069 .port-single__content > figure.port-gallery__item:has(img[src*="minimill-painting.gif"]) {
  float: left;
  width: calc(50% - 0.5rem);
  max-width: calc(50% - 0.5rem);
  margin: 1em 0;
}

.postid-89069 .port-single__content > figure.port-gallery__item:has(img[src*="minimill-packaging.gif"]) {
  margin-right: 1rem;
}

/* 3b. Clear floats at the resin-coat paragraph that follows the image pair. */
.postid-89069 p.mm-resin-coat {
  clear: both;
}

/* ── MiniMill responsive: collapse all overrides at ≤640px ──────────────── */
@media (max-width: 640px) {
  .postid-89069 .port-gallery.port-gallery--cols-4:has(img[src*="minimill-tinkercad-baseplate-website"]) {
    grid-template-columns: 1fr;
  }

  .postid-89069 .port-single__content > figure.port-gallery__item:has(img[src*="minimill-packaging.gif"]),
  .postid-89069 .port-single__content > figure.port-gallery__item:has(img[src*="minimill-painting.gif"]) {
    float: none;
    width: 80%;
    max-width: 80%;
    margin: 1em auto;
  }
}

/* ── Post 90797 — Creative Exploration module ────────────────────────────── */
.postid-90797 .pp-ce__module {
  margin-bottom: 3.5rem;
}
.postid-90797 .pp-ce__direction {
  margin-bottom: 4rem;
}
.postid-90797 .pp-ce__direction:last-child {
  margin-bottom: 0;
}
.postid-90797 .pp-ce__meta {
  margin-bottom: 1.5rem;
}
.postid-90797 .pp-ce__number {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-orange);
  margin-bottom: 0.375rem;
}
.postid-90797 .pp-ce__title {
  font-size: clamp(1.125rem, 1.5vw + 0.75rem, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 0.625rem;
  color: rgba(0, 0, 0, 0.9);
}
.postid-90797 .pp-ce__desc {
  font-size: 0.9375rem;
  line-height: 1.72;
  color: rgba(0, 0, 0, 0.6);
  margin: 0;
  max-width: 58ch;
}
.postid-90797 .pp-ce__thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.5rem, 1vw, 0.875rem);
}
.postid-90797 .pp-ce__thumbs img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
@media (max-width: 640px) {
  .postid-90797 .pp-ce__thumbs {
    grid-template-columns: repeat(2, 1fr);
  }
  .postid-90797 .pp-ce__direction {
    margin-bottom: 3rem;
  }
}

/* ── Post 87260 — CIS sketch gallery: 2-col, 15% wider ─────────────────── */
.postid-87260 .port-gallery {
  grid-template-columns: repeat(2, 1fr);
  width: 105%;
  margin-left: -2.5%;
}

/* ── Post 87260 — white header banner and content background ────────────── */
.postid-87260 .port-single-hero,
.postid-87260 .port-single__body {
  background: #ffffff;
}

/* ── Post 87260 — 3× gap between sketch gallery and infographic ─────────── */
.postid-87260 .port-single__content > .port-gallery + p {
  margin-top: 3.75rem;
}

/* Mobile: hide per-item titles in Other Projects grid (image only). */
@media (max-width: 640px) {
  .port-related__title { display: none; }
}
