/* ======================================================================
   DESIGN TOKENS
   ====================================================================== */
:root {
  color-scheme: light;
  --bg:        #F5F6F2;   /* sage-white — airy, contemporary */
  --fg:        #1B1D1A;   /* forest near-black */
  --accent:    #5E7D6F;   /* eucalyptus — calm, positive, modern */
  --muted:     #6C6F6B;   /* sage-neutral gray */
  --mid:       #E7EAE4;   /* soft sage-white for alternate sections */

  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --nav-h:  66px;
  --max-w:  1440px;
  --gap:    20px;
  --ease:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-s: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur:    300ms;
}

/* ======================================================================
   RESET & BASE
   ====================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 18px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ======================================================================
   PERFORMANCE HELPERS
   - content-visibility skips rendering offscreen sections/items
   ====================================================================== */
@supports (content-visibility: auto) {
  .gallery-section,
  .about-section,
  .contact-section,
  footer {
    content-visibility: auto;
    contain-intrinsic-size: 900px;
  }

  .g-item {
    content-visibility: auto;
    contain-intrinsic-size: 420px;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 8px 16px;
  background: var(--fg);
  color: white;
  font-size: 0.8rem;
  z-index: 9999;
}
.skip-link:focus { left: 8px; }

/* ======================================================================
   NAVIGATION
   ====================================================================== */
#site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  transition: background var(--dur) var(--ease-s),
              box-shadow var(--dur) var(--ease-s);
}
#site-nav.scrolled {
  background: rgba(247, 244, 239, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.07);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.94);
  transition: color var(--dur);
}
#site-nav.scrolled .nav-brand { color: var(--fg); }
.nav-brand:hover { opacity: 0.65; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 44px;
}
.nav-links a {
  position: relative;
  font-size: 0.67rem;
  font-weight: 400;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  transition: color var(--dur);
  padding-bottom: 2px;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 380ms var(--ease);
}
.nav-links a:hover { color: #fff; }
.nav-links a:hover::after { width: 100%; }
#site-nav.scrolled .nav-links a { color: var(--muted); }
#site-nav.scrolled .nav-links a:hover { color: var(--fg); }
#site-nav.scrolled .nav-links a.active { color: var(--fg); }
#site-nav.scrolled .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: #fff; }
.nav-links a.active::after { width: 100%; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: white;
  transition: background var(--dur);
}
#site-nav.scrolled .hamburger span { background: var(--fg); }

/* Mobile menu */
#mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 400ms var(--ease), visibility 400ms var(--ease);
}
#mobile-menu.open { transform: translateX(0); visibility: visible; }
#mobile-menu ul { list-style: none; text-align: center; }
#mobile-menu li + li { margin-top: 28px; }
#mobile-menu a {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 300;
  color: var(--fg);
  transition: color var(--dur);
}
#mobile-menu a:hover { color: var(--accent); }
.mobile-close {
  position: absolute;
  top: 20px; right: 26px;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur);
  line-height: 1;
}
.mobile-close:hover { color: var(--fg); }

/* ======================================================================
   HERO
   ====================================================================== */
#hero {
  position: relative;
  height: 100vh;
  min-height: 620px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('images/hero.jpg');
  background-size: cover;
  background-position: center 35%;
  overflow: hidden;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    155deg,
    rgba(0,0,0,0.14) 0%,
    rgba(0,0,0,0.40) 48%,
    rgba(0,0,0,0.66) 100%
  );
}
.hero-content {
  position: relative;
  text-align: center;
  color: white;
  padding: 0 24px;
  /* Entrance animation */
  animation: heroReveal 1.2s var(--ease) both;
}
@keyframes heroReveal {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-label {
  display: block;
  font-size: 0.67rem;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  opacity: 0.58;
  margin-bottom: 24px;
}
.hero-content h1 {
  font-family: var(--font-serif);
  font-size: clamp(5rem, 13vw, 11rem);
  font-weight: 300;
  line-height: 0.96;
  letter-spacing: 0.02em;
  margin-bottom: 30px;
}
.hero-tagline {
  font-size: 0.88rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  opacity: 0.70;
  line-height: 2.1;
}

.scroll-arrow {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.42);
  animation: bob 2.4s ease-in-out infinite;
  transition: color var(--dur);
}
.scroll-arrow:hover { color: white; }
@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(10px); }
}

/* ======================================================================
   GALLERY SECTIONS
   ====================================================================== */
.gallery-section {
  padding: 96px 40px 112px;
}
.gallery-section.alt { background: var(--mid); }

.section-head {
  max-width: var(--max-w);
  margin: 0 auto 60px;
}
.label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.label.light { color: rgba(255,255,255,0.42); }

.section-head h2 {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.02;
  margin-bottom: 10px;
}
.section-head p {
  font-size: 0.88rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-top: 4px;
}

/* CSS columns masonry — no JS needed, gaps never appear */
.gallery-masonry {
  max-width: var(--max-w);
  margin: 0 auto;
  column-gap: var(--gap);
}
.gallery-masonry.cols-3 { columns: 3; }
.gallery-masonry.cols-4 { columns: 4; }

.g-item {
  break-inside: avoid;
  margin-bottom: var(--gap);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--mid);
}
.g-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 680ms var(--ease), opacity 500ms ease;
}
.g-item:hover img { transform: scale(1.04); }

/* Featured / signature paintings — full section width, live outside masonry div */
.g-item--featured {
  max-width: var(--max-w);
  margin: 0 auto var(--gap);
  display: block;
}
.g-item--featured img {
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: cover;
  object-position: center;
}

.g-item figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 72px 18px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.64));
  color: white;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 340ms var(--ease-s),
              transform 340ms var(--ease-s);
}
.g-item:hover figcaption {
  opacity: 1;
  transform: translateY(0);
}
@media (hover: none) {
  .g-item figcaption { opacity: 1; transform: translateY(0); }
}

/* ======================================================================
   SCROLL FADE-IN — scale + translate entrance with expo easing
   ====================================================================== */
.g-item,
.section-head,
.about-text,
.about-painting {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 700ms var(--ease),
              transform 700ms var(--ease);
}
.g-item.visible,
.section-head.visible,
.about-text.visible,
.about-painting.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ======================================================================
   ABOUT
   ====================================================================== */
.about-section {
  background: var(--fg);
  color: white;
  padding: 104px 40px 116px;
}
.about-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 88px;
  align-items: center;
}
.about-text h2 {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 4vw, 3.8rem);
  font-weight: 300;
  line-height: 1.12;
  margin: 16px 0 32px;
}
.about-text p {
  font-size: 0.94rem;
  line-height: 1.95;
  color: rgba(255,255,255,0.70);
  margin-bottom: 20px;
  letter-spacing: 0.01em;
}
.about-painting img {
  width: 100%;
  height: auto;
  display: block;
}
.btn-outline {
  display: inline-block;
  margin-top: 12px;
  padding: 14px 34px;
  border: 1px solid rgba(255,255,255,0.45);
  font-size: 0.67rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.70);
  transition: border-color var(--dur), color var(--dur);
}
.btn-outline:hover {
  border-color: white;
  color: white;
}

/* ======================================================================
   CONTACT
   ====================================================================== */
.contact-section {
  background: var(--accent);
  color: white;
  padding: 120px 40px;
  text-align: center;
}
.contact-inner h2 {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 6.5vw, 5.5rem);
  font-weight: 300;
  line-height: 1.06;
  margin: 16px 0 20px;
}
.contact-inner > p {
  font-size: 0.94rem;
  opacity: 0.70;
  margin-bottom: 44px;
  line-height: 1.95;
  letter-spacing: 0.02em;
}
.btn-solid {
  display: inline-block;
  padding: 16px 42px;
  background: white;
  color: var(--accent);
  font-size: 0.67rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background var(--dur), color var(--dur);
}
.btn-solid:hover {
  background: var(--fg);
  color: white;
}

/* ======================================================================
   FOOTER
   ====================================================================== */
footer {
  padding: 24px 40px;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-top: 1px solid var(--mid);
}

/* ======================================================================
   LIGHTBOX
   ====================================================================== */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10,9,8,0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 40px 40px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease-s), visibility var(--dur) var(--ease-s);
}
#lightbox.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}
#lb-img {
  max-width: 100%;
  max-height: 84vh;
  object-fit: contain;
  box-shadow: 0 32px 110px rgba(0,0,0,0.65);
}
#lb-caption {
  margin-top: 22px;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.36);
}
.lb-close {
  position: absolute;
  top: 18px; right: 26px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 1.3rem;
  cursor: pointer;
  transition: color var(--dur);
  line-height: 1;
}
.lb-close:hover { color: white; }
.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 2rem;
  cursor: pointer;
  padding: 24px 28px;
  transition: color var(--dur);
  line-height: 1;
}
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-prev:hover, .lb-next:hover { color: white; }
.lb-prev:disabled, .lb-next:disabled { opacity: 0; pointer-events: none; }

/* ======================================================================
   RESPONSIVE
   ====================================================================== */
@media (max-width: 1080px) {
  .gallery-masonry.cols-4 { columns: 3; }
}

@media (max-width: 820px) {
  .nav-links  { display: none; }
  .hamburger  { display: flex; }

  .gallery-masonry.cols-3,
  .gallery-masonry.cols-4 { columns: 2; }

  .about-inner { grid-template-columns: 1fr; gap: 44px; }
  .about-painting { order: -1; }

  .gallery-section { padding: 72px 24px 88px; }
  .nav-inner { padding: 0 24px; }
}

@media (max-width: 500px) {
  .gallery-masonry.cols-3,
  .gallery-masonry.cols-4 { columns: 1; }

  .hero-content h1 { font-size: 3.6rem; }
  .gallery-section { padding: 56px 18px 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-arrow { animation: none; }
  .hero-content { animation: none; }
  .g-item img { transition: none; }
  .g-item, .section-head, .about-text, .about-painting {
    opacity: 1;
    transform: none;
    transition: none;
  }
  #mobile-menu { transition: none; }
  #lightbox { transition: none; }
}
