/* ============================================================
   Carmen — Ethereal Gallery
   Near-black violet canvas · warm gold · Cormorant Garamond / Jost
   ============================================================ */

:root {
  --bg:        #0c0b10;
  --bg-soft:   #14121a;
  --bg-elev:   #1a1722;
  --ink:       #ece8e1;   /* warm off-white */
  --ink-dim:   #a39f98;
  --ink-faint: #6f6b66;
  --gold:      #c9a24b;
  --gold-lt:   #e3c884;
  --hairline:  rgba(201, 162, 75, 0.22);
  --line-soft: rgba(236, 232, 225, 0.08);

  --serif: "Cormorant Garamond", "Hoefler Text", Garamond, "Times New Roman", serif;
  --sans:  "Jost", "Avenir Next", "Century Gothic", system-ui, sans-serif;

  --maxw: 1320px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* atmospheric base wash behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(201, 162, 75, 0.10), transparent 55%),
    radial-gradient(90% 70% at 85% 110%, rgba(96, 60, 120, 0.14), transparent 60%),
    var(--bg);
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--gold); color: var(--bg); }

:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

/* ── film grain overlay ── */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 1%); }
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* hold the nav contents inside the same centred column as the rest of the site */
  padding: 1.3rem max(clamp(1.25rem, 4vw, 3rem), calc((100% - var(--maxw)) / 2 + clamp(1.25rem, 4vw, 3rem)));
  transition: background 0.5s var(--ease), padding 0.5s var(--ease), border-color 0.5s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(12, 11, 16, 0.72);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line-soft);
}
.nav__brand {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), color 0.3s;
}
.nav.is-scrolled .nav__brand { opacity: 1; transform: none; }
.nav__brand:hover { color: var(--gold-lt); }

.nav__links {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}
.nav__links a {
  position: relative;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 0.3rem 0;
  transition: color 0.3s;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); }

/* keep the full name + links on one line on small screens */
@media (max-width: 560px) {
  .nav { padding-left: 1rem; padding-right: 1rem; }
  .nav__brand { font-size: 1rem; letter-spacing: 0.06em; }
  .nav__links { gap: 1rem; }
  .nav__links a { font-size: 0.62rem; letter-spacing: 0.16em; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: stretch;          /* the frame fills the hero height */
  overflow: hidden;
}

/* keeps the header in the same centred column as the rest of the site */
.hero__frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 6rem 0 4rem;
}

/* the self-portrait (painting XI) blended into the header */
.hero__portrait {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 58%;
  z-index: 0;
  /* anchor LEFT so the face is never cropped on tall windows (cover trims the hair on the right instead) */
  background: url("../paintings/IMG-20260618-WA0022.jpg") no-repeat left center;
  background-size: cover;
  filter: grayscale(0.16) saturate(0.95) contrast(1.02) brightness(0.86);
  /* feather the figure out of the dark canvas */
  -webkit-mask-image: radial-gradient(118% 125% at 78% 42%, #000 26%, rgba(0,0,0,0.55) 52%, transparent 80%);
          mask-image: radial-gradient(118% 125% at 78% 42%, #000 26%, rgba(0,0,0,0.55) 52%, transparent 80%);
  opacity: 0.95;
  animation: portrait-in 2.4s var(--ease) 0.15s both;
}
@keyframes portrait-in {
  from { opacity: 0; transform: scale(1.05); }
  to   { opacity: 0.95; transform: none; }
}

/* legibility scrim: darkest over the text (left), clears over the face (right) */
.hero__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--bg) 4%, rgba(12,11,16,0.82) 32%, rgba(12,11,16,0.16) 60%, transparent 80%),
    linear-gradient(0deg, var(--bg) 2%, transparent 24%);
}

.hero__glow {
  position: absolute;
  top: 38%; left: 50%;
  width: min(70vw, 720px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(201, 162, 75, 0.20), rgba(201,162,75,0.05) 42%, transparent 68%);
  filter: blur(20px);
  z-index: 0;
  animation: breathe 9s ease-in-out infinite;
}
@keyframes breathe {
  0%,100% { opacity: 0.75; transform: translate(-50%,-50%) scale(1); }
  50%     { opacity: 1;    transform: translate(-50%,-50%) scale(1.08); }
}
.hero__inner { position: relative; z-index: 3; padding-inline: clamp(1.25rem, 4vw, 3rem); }

.hero__eyebrow {
  margin: 0 0 1.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0;
  animation: rise 1s var(--ease) 0.2s forwards;
}
.hero__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.4rem, 12vw, 9rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--ink);
  /* letters spread apart on load */
  opacity: 0;
  animation: spread 1.6s var(--ease) 0.35s forwards;
}
.hero__title span { display: block; }
.hero__title::after {
  content: "";
  display: block;
  width: 0;
  height: 1px;
  margin: 1.4rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: line-grow 1.4s var(--ease) 1.1s forwards;
}
.hero__subtitle {
  margin: 1.5rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 3vw, 1.9rem);
  letter-spacing: 0.34em;
  text-transform: lowercase;
  color: var(--gold-lt);
  opacity: 0;
  animation: rise 1s var(--ease) 0.9s forwards;
}
.hero__statement {
  max-width: 33ch;
  margin: 2.4rem auto 0;
  font-size: 1rem;
  color: var(--ink-dim);
  opacity: 0;
  animation: rise 1s var(--ease) 1.2s forwards;
}

@keyframes spread {
  from { opacity: 0; letter-spacing: 0.5em; filter: blur(8px); }
  to   { opacity: 1; letter-spacing: 0.02em; filter: blur(0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes line-grow { to { width: min(40vw, 280px); } }

.hero__scroll {
  position: absolute;
  bottom: 2.2rem;
  left: 0; right: 0;
  margin-inline: auto;
  width: max-content;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  font-size: 0.65rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: 0;
  animation: rise 1s var(--ease) 1.6s forwards;
  transition: color 0.3s;
}
.hero__scroll:hover { color: var(--gold-lt); }
.hero__scroll-line {
  width: 1px; height: 46px;
  background: linear-gradient(var(--gold), transparent);
  position: relative;
  overflow: hidden;
}
.hero__scroll-line::after {
  content: "";
  position: absolute; top: -50%; left: 0;
  width: 100%; height: 50%;
  background: var(--gold-lt);
  animation: drip 2.2s ease-in-out infinite;
}
@keyframes drip {
  0%   { top: -50%; }
  100% { top: 100%; }
}

/* desktop: name reads on the left of the column, portrait bleeds to its right edge */
@media (min-width: 901px) {
  .hero__frame { text-align: left; }
  .hero__inner { max-width: 52%; }
  .hero__statement { margin-left: 0; margin-right: 0; max-width: 34ch; }
  .hero__title::after { margin-left: 0; margin-right: auto; }
  .hero__glow { left: 32%; }
  .hero__scroll {
    left: 0;
    right: auto;
    width: 52%;              /* same width as the text column (.hero__inner) */
    margin-inline: 0;
    align-items: center;     /* centre the label + gold line within that column */
  }
}

/* mobile/tablet: portrait fades in full-bleed behind the centred name */
@media (max-width: 900px) {
  .hero__portrait {
    width: 100%;
    background-position: center 16%;
    -webkit-mask-image: radial-gradient(130% 80% at 50% 25%, #000 12%, rgba(0,0,0,0.5) 45%, transparent 74%);
            mask-image: radial-gradient(130% 80% at 50% 25%, #000 12%, rgba(0,0,0,0.5) 45%, transparent 74%);
    opacity: 0.5;
  }
  .hero__frame::after {
    background:
      radial-gradient(125% 78% at 50% 30%, rgba(12,11,16,0.42), var(--bg) 80%),
      linear-gradient(0deg, var(--bg) 4%, transparent 32%);
  }
}

/* wider than the column: fade the portrait's right edge into the dark margin */
@media (min-width: 1321px) {
  .hero__frame::after {
    background:
      linear-gradient(90deg, var(--bg) 3%, rgba(12,11,16,0.82) 30%, rgba(12,11,16,0.15) 58%, rgba(12,11,16,0) 74%, rgba(12,11,16,0) 86%, var(--bg) 100%),
      linear-gradient(0deg, var(--bg) 2%, transparent 24%);
  }
}

/* ============================================================
   SECTION HEADINGS
   ============================================================ */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}
.section-head__index {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gold);
}
.section-head__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 3rem);
  letter-spacing: 0.04em;
  margin: 0;
}
.section-head__count {
  margin-left: auto;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  align-self: center;
}

/* ============================================================
   WORKS / GALLERY (CSS columns masonry)
   ============================================================ */
.works { padding: clamp(5rem, 12vh, 9rem) 0 clamp(3rem, 8vh, 6rem); }

.gallery {
  max-width: var(--maxw);
  margin: clamp(2.5rem, 6vh, 4rem) auto 0;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  column-count: 3;
  column-gap: clamp(0.9rem, 1.8vw, 1.6rem);
}
@media (max-width: 900px) { .gallery { column-count: 2; } }
@media (max-width: 560px) { .gallery { column-count: 1; } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: clamp(0.9rem, 1.8vw, 1.6rem);
  break-inside: avoid;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  /* reveal */
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.tile.is-in { opacity: 1; transform: none; }

.tile__img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
  filter: saturate(0.92) brightness(0.97);
}
.tile:hover .tile__img,
.tile:focus-visible .tile__img {
  transform: scale(1.045);
  filter: saturate(1.05) brightness(1.02);
}

/* gold caption veil on hover */
.tile__veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem 1.2rem;
  background: linear-gradient(to top, rgba(8,7,11,0.78) 0%, rgba(8,7,11,0.18) 45%, transparent 75%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.tile:hover .tile__veil,
.tile:focus-visible .tile__veil { opacity: 1; }
.tile__title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink);
  transform: translateY(8px);
  transition: transform 0.5s var(--ease);
}
.tile:hover .tile__title { transform: none; }
.tile__meta {
  margin-top: 0.25rem;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-lt);
  transform: translateY(8px);
  transition: transform 0.55s var(--ease) 0.04s;
}
.tile:hover .tile__meta { transform: none; }

/* corner index plate */
.tile__plate {
  position: absolute;
  top: 0.7rem; left: 0.7rem;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: var(--ink);
  background: rgba(8,7,11,0.5);
  border: 1px solid var(--hairline);
  padding: 0.2rem 0.5rem;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.tile:hover .tile__plate { opacity: 1; }

/* ============================================================
   ABOUT
   ============================================================ */
.about { padding: clamp(5rem, 12vh, 9rem) 0; }
.about__body {
  max-width: 64ch;
  margin: clamp(2rem, 5vh, 3.2rem) auto 0;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}
.about__lead {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 1.8rem;
}
.about__body p { color: var(--ink-dim); margin: 0 0 1.4rem; }
.about__body em { color: var(--gold-lt); font-style: italic; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact { padding: clamp(5rem, 12vh, 9rem) 0 clamp(4rem, 9vh, 7rem); }
.contact__body {
  max-width: var(--maxw);
  margin: clamp(2rem, 5vh, 3.2rem) auto 0;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  text-align: center;
}
.contact__line {
  font-size: 0.74rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.4rem;
}
.contact__email {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 6vw, 3.6rem);
  color: var(--ink);
  position: relative;
  transition: color 0.4s;
}
.contact__email::after {
  content: "";
  position: absolute; left: 0; bottom: 0.1em;
  width: 100%; height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.5s var(--ease);
}
.contact__email:hover { color: var(--gold-lt); }
.contact__email:hover::after { transform: scaleX(1); }

.contact__social {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2.2rem;
  margin: 2.6rem 0 0;
  padding: 0;
}
.contact__social a {
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color 0.3s;
}
.contact__social a:hover { color: var(--gold-lt); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem clamp(1.25rem, 4vw, 3rem);
  border-top: 1px solid var(--line-soft);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3.5rem);
  background: rgba(7, 6, 10, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
}
.lightbox__img {
  max-width: min(92vw, 1100px);
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--hairline);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
.lightbox.is-open .lightbox__img { transform: scale(1); opacity: 1; }

.lightbox__caption {
  margin-top: 1.3rem;
  text-align: center;
  max-width: 60ch;
}
.lightbox__caption .t {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink);
}
.lightbox__caption .m {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-lt);
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  background: none;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.3s, transform 0.3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.lightbox__close:hover,
.lightbox__nav:hover { color: var(--gold-lt); }

.lightbox__close {
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2.2rem);
  font-size: 2.4rem;
  line-height: 1;
}
.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: 1;
  padding: 0.5rem;
}
.lightbox__nav:hover { transform: translateY(-50%) scale(1.15); }
.lightbox__nav--prev { left: clamp(0.5rem, 2vw, 2rem); }
.lightbox__nav--next { right: clamp(0.5rem, 2vw, 2rem); }

@media (max-width: 560px) {
  .lightbox__img { max-height: 70vh; }
  .lightbox__nav { font-size: 2.2rem; }
}

/* --- lightbox zoom & pan --- */
.lightbox { overflow: hidden; touch-action: none; }
.lightbox__img {
  cursor: zoom-in;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.lightbox__close,
.lightbox__nav { z-index: 5; }
.lightbox__nav { transition: color 0.3s, transform 0.3s var(--ease), opacity 0.3s var(--ease); }
.lightbox__caption { transition: opacity 0.3s var(--ease); }
.lightbox.is-zoomed .lightbox__img { cursor: grab; }
.lightbox.is-panning .lightbox__img { cursor: grabbing; }
.lightbox.is-zoomed .lightbox__caption,
.lightbox.is-zoomed .lightbox__nav { opacity: 0; pointer-events: none; }

.lightbox__zoom {
  position: absolute;
  bottom: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2.2rem);
  display: flex;
  gap: 0.45rem;
  z-index: 5;
}
.lightbox__zoom button {
  width: 2.4rem;
  height: 2.4rem;
  background: none;
  border: 1px solid var(--hairline);
  color: var(--ink-dim);
  opacity: 0.55;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.3s, color 0.3s, border-color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.lightbox__zoom button:hover { opacity: 1; color: var(--gold-lt); border-color: var(--gold-lt); }
.lightbox:not(.is-zoomed) #lb-zoom-out { opacity: 0.25; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  .tile { opacity: 1; transform: none; }
  .hero__title, .hero__eyebrow, .hero__subtitle, .hero__statement,
  .hero__scroll, .nav__brand { opacity: 1; transform: none; }
  .hero__title::after { width: min(40vw, 280px); }
  .grain { animation: none; }
}
