/* ──────────────────────────────────────────────
   Adam Green Art Advisory — Custom Styles
   Layered on top of Tailwind CDN
   ────────────────────────────────────────────── */

/* Smooth page-level defaults */
html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #faf9f7;
}

body {
  position: relative;
  color: #1a1a18;
  font-family: 'Rubik', system-ui, -apple-system, sans-serif;
}

/* FOUC prevention: body starts hidden via inline style="opacity:0".
   JS clears it instantly after injecting components.
   This animation is the safety net — if JS is slow or fails,
   the page fades in after 2s so the user never sees a blank screen. */
@keyframes fouc-safety {
  to { opacity: 1; }
}
body[style*="opacity:0"] {
  animation: fouc-safety 0s 2s forwards;
}

/* Fixed header — simple opaque background, like test.html */
.header-main {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: #14351a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Offset body content below the fixed header */
body {
  padding-top: 72px;
}

@media (min-width: 1024px) {
  body {
    padding-top: 80px;
  }
}

#mobile-menu {
  top: 72px;
  transform: translateX(100%);
}

#mobile-menu.mobile-menu-ready {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-menu.mobile-menu-open {
  transform: translateX(0);
}

/* Selection */
::selection {
  background: #e8f0ea;
  color: #14351a;
}

/* Prevent iOS zoom on input focus */
@media (max-width: 639px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ── Nav link underline animation ────────── */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1.5px;
  background: #8b7a2e;
  transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              left 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-link:hover::after {
  width: 100%;
  left: 0;
}

/* Active nav links keep their underline */
.nav-link.text-brand::after,
.nav-link.text-white::after {
  width: 100% !important;
  left: 0 !important;
}

/* ── Service cards ───────────────────────── */
.service-card {
  padding: 1.5rem 0;
}

/* ── Scroll-reveal animations ────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal="delay-1"] { transition-delay: 0.1s; }
[data-reveal="delay-2"] { transition-delay: 0.2s; }
[data-reveal="delay-3"] { transition-delay: 0.35s; }
[data-reveal="delay-4"] { transition-delay: 0.5s; }

/* ── Image reveal ────────────────────────── */
.img-reveal {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.revealed .img-reveal {
  clip-path: inset(0 0 0 0);
}


/* ── Prose styling for body text ─────────── */
.prose-advisory p {
  font-size: 16px;
  line-height: 1.75;
  color: #6b6860;
  margin-bottom: 1.25em;
}

.prose-advisory p:last-child {
  margin-bottom: 0;
}

.prose-advisory a {
  color: #14351a;
  text-decoration: underline;
  text-decoration-color: #e4e0da;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.3s ease;
}

.prose-advisory a:hover {
  text-decoration-color: #8b7a2e;
}

.prose-advisory em {
  font-style: italic;
}

/* ── Focus visible ───────────────────────── */
*:focus-visible {
  outline: 2px solid #14351a;
  outline-offset: 2px;
}

/* ── Decorative grain texture overlay ────── */
.grain::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
}

/* ── Heading style for page titles ───────── */
.heading-display {
  font-family: 'Rubik', sans-serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #1a1a18;
}

/* ── Subtle horizontal rule ──────────────── */
.rule-gold {
  width: 40px;
  height: 1.5px;
  background: #8b7a2e;
  border: none;
}

/* ── Instagram magazine grid ─────────────── */
.ig-magazine {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
}

/* Invisible sizing element in first non-hero cell to set row height */
.ig-item:not(.ig-hero) {
  container-type: inline-size;
}

@media (min-width: 1024px) {
  .ig-magazine {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }
}

.ig-item {
  position: relative;
  overflow: hidden;
}

/* Use padding trick to create 4:5 ratio that feeds into grid row height */
.ig-item:not(.ig-hero)::before {
  content: '';
  display: block;
  padding-bottom: 125%; /* 5/4 for 4:5 */
}

.ig-item.ig-hero {
  grid-column: span 2;
  grid-row: span 2;
}

.ig-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ig-item:hover img {
  transform: scale(1.04);
}

/* Caption overlay — always visible */
.ig-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(0, 0, 0, 0.25) 55%,
    transparent 100%
  );
  padding: 2rem 0.625rem 0.5rem;
  transition: background 0.4s ease;
}

.ig-item:hover .ig-caption {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0.35) 60%,
    transparent 100%
  );
}

.ig-caption-text {
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 300;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
  transition: -webkit-line-clamp 0.3s;
}

.ig-item:hover .ig-caption-text {
  -webkit-line-clamp: 3;
}

.ig-hero .ig-caption {
  padding: 3rem 0.875rem 0.75rem;
}

.ig-hero .ig-caption-text {
  font-size: 13px;
  -webkit-line-clamp: 2;
  margin-bottom: 5px;
}

.ig-hero:hover .ig-caption-text {
  -webkit-line-clamp: 5;
}

/* Metadata row */
.ig-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.04em;
}

.ig-hero .ig-meta {
  font-size: 11px;
  gap: 6px;
}

.ig-meta svg {
  width: 11px;
  height: 11px;
  opacity: 0.7;
}

.ig-meta-dot {
  opacity: 0.35;
}

/* ── Hero Carousel ─────────────────────────── */
.carousel {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: #14351a;
}

.carousel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
}

@media (min-width: 1024px) {
  .carousel {
    top: 80px;
  }
}

.carousel-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

/* Skip fade-in on initial page load — removed by JS after first transition */
.carousel-slide.no-transition,
.carousel-slide.no-transition .carousel-label {
  transition: none !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.carousel-slide.prev {
  opacity: 0;
  z-index: 1;
}

/* Image container — centered artwork with breathing room */
.carousel-artwork {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 70%;
}

@media (max-width: 767px) {
  .carousel-artwork {
    max-width: 88%;
  }
}

.carousel-artwork img {
  max-width: 100%;
  max-height: 55vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 2px 12px rgba(0, 0, 0, 0.2);
}

@media (min-width: 1024px) {
  .carousel-artwork img {
    max-height: 62vh;
  }
}

/* Museum wall label — positioned below the artwork */
.carousel-label {
  margin-top: 1.5rem;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease 0.4s, transform 0.8s ease 0.4s;
}

.active .carousel-label {
  opacity: 1;
  transform: translateY(0);
}

.carousel-artist {
  font-family: 'Rubik', sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 4px;
}

.carousel-title {
  font-family: 'Rubik', sans-serif;
  font-weight: 300;
  font-style: italic;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
}

@media (min-width: 1024px) {
  .carousel-label {
    margin-top: 2rem;
  }
  .carousel-artist {
    font-size: 14px;
    letter-spacing: 0.14em;
  }
  .carousel-title {
    font-size: 15px;
  }
}

/* Controls bar — bottom center, above safe area on iOS */
.carousel-controls {
  position: absolute;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.carousel-nav {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: color 0.3s ease;
  background: none;
  border: none;
  padding: 0;
}

.carousel-nav:hover {
  color: rgba(255, 255, 255, 0.85);
}

.carousel-nav svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

/* Slide counter */
.carousel-counter {
  font-family: 'Rubik', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
}
