/*
Theme Name:   Hello Elementor Child — Ajanta Portfolio
Theme URI:    https://ajantastudio.co.uk
Description:  Child theme of Hello Elementor. Adds coded templates for the Projects portfolio (CPT slug: portfolio) — single project pages and the portfolio archive grid. Everything else is inherited from the parent theme and Elementor.
Author:       Ajanta Studio
Template:     hello-elementor
Version:      1.4.0
Text Domain:  hello-elementor-child
*/

/* =====================================================
   Ajanta Studio portfolio — design tokens
   Matches the site design system:
   Cormorant Garamond (headings) / Outfit (body)
   Gallery White · Charcoal · Stone · Putty
   ===================================================== */

:root {
  --ajanta-gallery-white: #f6f4ef;
  --ajanta-charcoal:      #2b2a27;
  --ajanta-stone:         #8c867b;
  --ajanta-putty:         #d9d3c6;
  --ajanta-max-width:     1140px;
  --ajanta-font-display:  "Cormorant Garamond", Georgia, serif;
  --ajanta-font-body:     "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* =====================================================
   Shared layout
   ===================================================== */

.ajanta-portfolio-wrap {
  max-width: var(--ajanta-max-width);
  margin: 0 auto;
  padding: 0 24px;
  font-family: var(--ajanta-font-body);
  color: var(--ajanta-charcoal);
}

.ajanta-portfolio-wrap a {
  color: inherit;
}

/* Eyebrow label — small caps line above headings */
.ajanta-eyebrow {
  font-family: var(--ajanta-font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ajanta-stone);
  margin: 0 0 12px;
}

/* =====================================================
   Single project  (single-portfolio.php)
   ===================================================== */

.ajanta-project {
  padding: 72px 0 96px;
}

.ajanta-project__title {
  font-family: var(--ajanta-font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 32px;
}

.ajanta-project__hero {
  margin: 0 0 48px;
}

.ajanta-project__hero img {
  display: block;
  width: 100%;
  height: min(62vh, 640px);
  object-fit: cover;
}

/* Post content — intro text + Gutenberg gallery */
.ajanta-project__content {
  font-size: 1.05rem;
  line-height: 1.75;
}

.ajanta-project__content > p {
  max-width: 720px;
}

/* Gutenberg gallery block inside project content */
.ajanta-project__content .wp-block-gallery {
  margin: 48px 0 0;
  gap: 14px;
}

.ajanta-project__content .wp-block-gallery .wp-block-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.25s ease;
}

.ajanta-project__content .wp-block-gallery a:hover img,
.ajanta-project__content .wp-block-gallery a:focus-visible img {
  opacity: 0.88;
}

/* Fallback: gallery of attached images when no gallery block exists */
.ajanta-project__fallback-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}

.ajanta-project__fallback-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Prev / next project navigation */
.ajanta-project__nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--ajanta-putty);
  font-size: 0.95rem;
}

.ajanta-project__nav a {
  text-decoration: none;
  color: var(--ajanta-charcoal);
  transition: color 0.2s ease;
}

.ajanta-project__nav a:hover,
.ajanta-project__nav a:focus-visible {
  color: var(--ajanta-stone);
}

.ajanta-project__nav-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ajanta-stone);
  margin-bottom: 4px;
}

.ajanta-project__nav-next {
  text-align: right;
  margin-left: auto;
}

/* Back to portfolio link */
.ajanta-project__back {
  display: inline-block;
  margin-top: 40px;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--ajanta-putty);
  padding-bottom: 3px;
  transition: border-color 0.2s ease;
}

.ajanta-project__back:hover,
.ajanta-project__back:focus-visible {
  border-color: var(--ajanta-charcoal);
}

/* Top variant of the back link, above the eyebrow */
.ajanta-project__back--top {
  margin: 0 0 32px;
}

/* =====================================================
   Portfolio archive grid  (archive-portfolio.php)
   ===================================================== */

.ajanta-archive {
  padding: 72px 0 96px;
}

.ajanta-archive__title {
  font-family: var(--ajanta-font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.1;
  margin: 0 0 16px;
}

.ajanta-archive__intro {
  max-width: 640px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ajanta-stone);
  margin: 0 0 56px;
}

.ajanta-archive__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px 24px;
}

.ajanta-card {
  display: block;
  text-decoration: none;
  color: var(--ajanta-charcoal);
}

.ajanta-card__image {
  overflow: hidden;
  background: var(--ajanta-putty);
  margin-bottom: 16px;
}

.ajanta-card__image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.ajanta-card:hover .ajanta-card__image img,
.ajanta-card:focus-visible .ajanta-card__image img {
  transform: scale(1.035);
}

.ajanta-card__title {
  font-family: var(--ajanta-font-display);
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 0 0 6px;
}

.ajanta-card__eyebrow {
  margin: 0 0 8px;
}

.ajanta-card__location {
  font-size: 0.9rem;
  color: var(--ajanta-stone);
  margin: 0 0 10px;
}

.ajanta-card__cta {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ajanta-putty);
  padding-bottom: 3px;
  transition: border-color 0.2s ease;
}

.ajanta-card:hover .ajanta-card__cta,
.ajanta-card:focus-visible .ajanta-card__cta {
  border-color: var(--ajanta-charcoal);
}

/* Location line under the single project title */
.ajanta-project__location {
  font-size: 1rem;
  color: var(--ajanta-stone);
  margin: -20px 0 32px;
}

.ajanta-card__excerpt {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ajanta-stone);
  margin: 0;
}

/* Empty state */
.ajanta-archive__empty {
  padding: 64px 0;
  color: var(--ajanta-stone);
  font-size: 1.05rem;
}

/* Pagination */
.ajanta-archive__pagination {
  margin-top: 64px;
  font-size: 0.95rem;
}

.ajanta-archive__pagination .page-numbers {
  display: inline-block;
  padding: 6px 12px;
  margin-right: 6px;
  text-decoration: none;
  border: 1px solid var(--ajanta-putty);
  color: var(--ajanta-charcoal);
}

.ajanta-archive__pagination .page-numbers.current {
  background: var(--ajanta-charcoal);
  border-color: var(--ajanta-charcoal);
  color: var(--ajanta-gallery-white);
}

/* =====================================================
   Lightbox — stage on top, thumbnail filmstrip below
   ===================================================== */

.ajanta-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  background: rgba(28, 27, 25, 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ajanta-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ajanta-lightbox__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 0;
  padding: 56px 16px 8px;
}

.ajanta-lightbox__image {
  width: calc(100% - 140px); /* stage minus the two arrows */
  height: 100%;
  object-fit: contain;       /* fills the stage, upscaling small images, no cropping */
}

.ajanta-lightbox__btn {
  background: none;
  border: none;
  color: var(--ajanta-gallery-white);
  font-family: var(--ajanta-font-body);
  cursor: pointer;
  padding: 12px;
  line-height: 1;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.ajanta-lightbox__btn:hover,
.ajanta-lightbox__btn:focus-visible {
  opacity: 1;
}

.ajanta-lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 2rem;
  z-index: 2;
}

.ajanta-lightbox__counter {
  position: absolute;
  top: 26px;
  left: 28px;
  color: var(--ajanta-gallery-white);
  font-family: var(--ajanta-font-body);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  opacity: 0.7;
  z-index: 2;
}

/* Architectural line arrows */
.ajanta-lightbox__prev svg,
.ajanta-lightbox__next svg {
  display: block;
  transition: transform 0.25s ease;
}

.ajanta-lightbox__next:hover svg,
.ajanta-lightbox__next:focus-visible svg {
  transform: translateX(6px);
}

.ajanta-lightbox__prev:hover svg,
.ajanta-lightbox__prev:focus-visible svg {
  transform: translateX(-6px);
}

/* Thumbnail filmstrip */
.ajanta-lightbox__thumbs {
  display: flex;
  gap: 10px;
  padding: 14px 24px 20px;
  overflow-x: auto;
  scrollbar-width: thin;
  justify-content: safe center;
}

.ajanta-lightbox__thumb {
  flex: 0 0 auto;
  width: 108px;
  height: 76px;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.ajanta-lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ajanta-lightbox__thumb:hover,
.ajanta-lightbox__thumb:focus-visible {
  opacity: 0.85;
}

.ajanta-lightbox__thumb.is-active {
  opacity: 1;
  border-color: var(--ajanta-gallery-white);
}

/* =====================================================
   Album mode: only the hero shows on the page.
   The gallery block still exists in the content (it feeds
   the lightbox) but is visually hidden.
   ===================================================== */

.ajanta-project__content .wp-block-gallery,
.ajanta-project__fallback-gallery {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ajanta-project__hero a {
  display: block;
  cursor: zoom-in;
}

/* Hint under the hero */
.ajanta-project__hero {
  position: relative;
}

.ajanta-project__hero::after {
  content: "View album";
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 8px 16px;
  background: rgba(28, 27, 25, 0.78);
  color: var(--ajanta-gallery-white);
  font-family: var(--ajanta-font-body);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 1024px) {
  .ajanta-archive__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .ajanta-project { padding: 48px 0 64px; }
  .ajanta-archive { padding: 48px 0 64px; }

  .ajanta-archive__grid,
  .ajanta-project__fallback-gallery {
    grid-template-columns: 1fr;
  }

  .ajanta-project__hero img {
    height: 42vh;
  }
}

/* Accessibility: visible focus, reduced motion */
.ajanta-portfolio-wrap a:focus-visible,
.ajanta-lightbox__btn:focus-visible {
  outline: 2px solid var(--ajanta-stone);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .ajanta-card__image img,
  .ajanta-lightbox,
  .ajanta-project__content .wp-block-gallery img {
    transition: none;
  }
}
