/* ==========================================================================
   Photo gallery - Romain Mellaza
   Dark editorial theme, mobile first, no framework, no webfont.
   ========================================================================== */

:root {
  --bg: #0c0d10;
  --surface: #14161b;
  --text: #ecebe6;
  --muted: #9a9ca5;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #f0b968;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: clamp(1rem, 4vw, 3.5rem);
  --header-h: 4.25rem;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

@view-transition {
  navigation: auto;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: #000;
}

/* ---------- Header ---------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.4s, backdrop-filter 0.4s, transform 0.5s var(--ease), border-color 0.4s;
  border-bottom: 1px solid transparent;
}

.site-header.is-solid,
.site-header.is-scrolled {
  background: rgba(12, 13, 16, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-color: var(--line);
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.92rem;
}

.site-header nav a {
  color: var(--muted);
  transition: color 0.25s;
}

.site-header nav a:hover {
  color: var(--text);
}

.nav-cta {
  color: var(--text) !important;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  transition: background 0.25s, border-color 0.25s !important;
}

.nav-cta:hover {
  background: var(--text);
  color: #000 !important;
}

/* ---------- Typography helpers -------------------------------------- */
.eyebrow {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent);
  font-weight: 500;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.7rem;
  border-radius: 99px;
  background: var(--text);
  color: #000;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.35s var(--ease), background 0.25s, box-shadow 0.35s;
}

.btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.link-arrow {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.25s;
}

.link-arrow span {
  display: inline-block;
  transition: transform 0.35s var(--ease);
}

.link-arrow:hover {
  color: var(--text);
}

.link-arrow:hover span {
  transform: translateX(5px);
}

/* ---------- Home hero ------------------------------------------------ */
.hero,
.cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--c, #000);
}

.hero {
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  display: flex;
  align-items: flex-end;
}

.hero-slides {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: var(--c);
  transition: opacity 1.6s ease;
}

.slide.is-active {
  opacity: 1;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

.slide.is-active img,
.slide.is-leaving img {
  animation: kenburns 9s linear forwards;
}

.slide:nth-child(even).is-active img,
.slide:nth-child(even).is-leaving img {
  animation-name: kenburns-alt;
}

@keyframes kenburns {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.14) translate3d(-1.5%, -1%, 0); }
}

@keyframes kenburns-alt {
  from { transform: scale(1.14) translate3d(1.5%, 1%, 0); }
  to { transform: scale(1.02) translate3d(0, 0, 0); }
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgba(12, 13, 16, 0.92) 0%, rgba(12, 13, 16, 0.35) 38%, rgba(12, 13, 16, 0) 62%),
    linear-gradient(to bottom, rgba(12, 13, 16, 0.55), rgba(12, 13, 16, 0) 22%);
}

.hero-content {
  width: 100%;
  padding: 0 var(--pad) clamp(5.5rem, 12vh, 8rem);
  max-width: 1500px;
  will-change: transform, opacity;
}

.hero-title {
  font-size: clamp(2.9rem, 10.5vw, 9rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 0.95;
  margin-bottom: 1.4rem;
}

.word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
}

.word > span {
  display: inline-block;
}

.js .word > span {
  transform: translateY(110%);
  animation: rise 1.1s var(--ease) forwards;
  animation-delay: calc(0.3s + var(--i) * 0.12s);
}

.js .hero-in {
  opacity: 0;
  transform: translateY(18px);
  animation: fade-up 1s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes rise {
  to { transform: none; }
}

@keyframes fade-up {
  to { opacity: 1; transform: none; }
}

.hero-sub {
  margin: 0 0 2rem;
  max-width: 34rem;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  color: rgba(236, 235, 230, 0.82);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.hero-bars {
  position: absolute;
  right: var(--pad);
  bottom: clamp(1.6rem, 4vh, 3rem);
  display: flex;
  gap: 6px;
}

.hero-bars button {
  position: relative;
  width: clamp(18px, 3vw, 34px);
  height: 18px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.hero-bars button::before,
.hero-bars button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.hero-bars button::after {
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
}

.hero-bars button.is-done::after {
  transform: scaleX(1);
}

.hero-bars button.is-active::after {
  animation: progress var(--dur, 6s) linear forwards;
}

@keyframes progress {
  to { transform: scaleX(1); }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.2rem;
  width: 22px;
  height: 36px;
  margin-left: -11px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  display: none;
}

.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 3px;
  background: #fff;
  animation: wheel 1.8s ease-in-out infinite;
}

@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { opacity: 0; }
}

@media (min-width: 900px) and (min-height: 640px) {
  .scroll-cue { display: block; }
}

/* ---------- Sections & cards ----------------------------------------- */
.section,
.inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 8rem) var(--pad) 2rem;
}

.inner {
  padding-top: calc(var(--header-h) + clamp(2rem, 6vw, 5rem));
  min-height: 80vh;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.section-head h2,
.page-head h1 {
  font-size: clamp(2rem, 5.5vw, 4rem);
}

.page-head {
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.8rem, 4vw, 2.6rem) clamp(1rem, 2vw, 1.75rem);
}

@media (min-width: 640px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .card-big { grid-column: span 2; grid-row: span 1; }
  .card-big .card-media { aspect-ratio: 16 / 9.3; }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-media {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 14px;
  aspect-ratio: 4 / 3;
  background: var(--c, var(--surface));
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--ease), filter 0.6s;
}

.card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.35), transparent 45%);
  opacity: 0;
  transition: opacity 0.5s;
}

.card:hover .card-media img,
.card:focus-visible .card-media img {
  transform: scale(1.06);
}

.card:hover .card-media::after {
  opacity: 1;
}

.card-text {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 1rem;
}

.card-kicker {
  grid-column: 1 / -1;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.card-title {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-count {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.card-count .arrow {
  display: inline-block;
  transition: transform 0.4s var(--ease);
}

.card:hover .card-count .arrow {
  transform: translateX(6px);
  color: var(--accent);
}

/* ---------- Stats ----------------------------------------------------- */
.stats {
  display: flex;
  justify-content: center;
  gap: clamp(3rem, 12vw, 9rem);
  padding: clamp(4rem, 9vw, 7rem) var(--pad);
  text-align: center;
}

.stats strong {
  display: block;
  font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stats span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
}

/* ---------- Collection page ------------------------------------------- */
.cover {
  height: 72vh;
  height: 72svh;
  min-height: 380px;
  display: flex;
  align-items: flex-end;
}

.cover-img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 120%;
  object-fit: cover;
  will-change: transform;
}

.cover-content {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 var(--pad) clamp(2rem, 6vw, 4rem);
}

.back {
  display: inline-block;
  margin-bottom: clamp(2rem, 6vh, 4rem);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.25s, transform 0.35s var(--ease);
}

.back:hover {
  color: #fff;
  transform: translateX(-4px);
}

.cover-title {
  font-size: clamp(2.4rem, 8vw, 6.5rem);
  letter-spacing: -0.04em;
}

.cover-count {
  margin: 1rem 0 0;
  color: rgba(236, 235, 230, 0.75);
}

.grid-wrap {
  max-width: 1900px;
  margin: 0 auto;
  padding: clamp(0.5rem, 2vw, 1.5rem) clamp(0.35rem, 1.5vw, 1.5rem);
}

/* Justified rows, pure CSS: each item's width follows its aspect ratio. */
.grid {
  --h: 170px;
  --gap: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

@media (min-width: 600px) { .grid { --h: 220px; --gap: 6px; } }
@media (min-width: 1100px) { .grid { --h: 270px; --gap: 8px; } }
@media (min-width: 1700px) { .grid { --h: 320px; } }

.grid::after {
  content: "";
  flex-grow: 1000000;
}

.ph {
  position: relative;
  display: block;
  overflow: hidden;
  flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--h));
  aspect-ratio: var(--r);
  background: var(--c);
  border-radius: 4px;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease), opacity 0.7s ease, filter 0.4s;
}

.js .ph img:not(.is-loaded) {
  opacity: 0;
}

.ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.35s;
}

@media (hover: hover) {
  .ph:hover img {
    transform: scale(1.05);
  }
  .ph:hover::after {
    background: rgba(0, 0, 0, 0.18);
  }
}

.next {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 8rem) var(--pad) 2rem;
  text-align: center;
}

.next .card {
  text-align: left;
  margin-bottom: 2rem;
}

/* ---------- Scroll reveal --------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--rd, 0s);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Footer ----------------------------------------------------- */
.site-footer {
  margin-top: clamp(3rem, 8vw, 6rem);
  padding: 3rem var(--pad) calc(3rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.3rem 0;
}

.footer-mail a {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: var(--text);
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.25s, color 0.25s;
}

.footer-mail a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.footer-credit a {
  color: var(--text);
}

.heart {
  display: inline-block;
  color: #ef5b6b;
  animation: beat 1.6s ease-in-out infinite;
}

@keyframes beat {
  0%, 60%, 100% { transform: scale(1); }
  20% { transform: scale(1.25); }
  40% { transform: scale(1.05); }
}

/* ---------- Lightbox ---------------------------------------------------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(6, 7, 9, 0.96);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.lb.is-open {
  display: block;
}

.lb-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.lb-img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  background: var(--c, #111);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  will-change: transform;
  cursor: zoom-in;
}

.lb-img.is-zoomed {
  cursor: zoom-out;
}

.lb-top,
.lb-bar {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(0.9rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.9rem max(1rem, env(safe-area-inset-left));
  transition: opacity 0.4s, transform 0.4s var(--ease);
  pointer-events: none;
}

.lb-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

.lb-top > * {
  pointer-events: auto;
}

.lb-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.05em;
}

.lb-actions {
  display: flex;
  gap: 0.5rem;
}

.lb-btn,
.lb-nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background 0.25s, transform 0.3s var(--ease), opacity 0.4s;
}

.lb-btn:hover,
.lb-nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lb-btn svg,
.lb-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lb-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 52px;
  height: 52px;
  margin-top: -26px;
}

.lb-prev { left: max(0.75rem, env(safe-area-inset-left)); }
.lb-next { right: max(0.75rem, env(safe-area-inset-right)); }
.lb-prev:hover { transform: translateX(-3px); }
.lb-next:hover { transform: translateX(3px); }

.lb.is-idle .lb-top { opacity: 0; transform: translateY(-10px); }
.lb.is-idle .lb-nav { opacity: 0; }
.lb.is-idle { cursor: none; }

@media (max-width: 700px) {
  .lb-nav {
    width: 42px;
    height: 42px;
    margin-top: -21px;
    background: rgba(0, 0, 0, 0.35);
  }
  .lb-prev { left: 0.4rem; }
  .lb-next { right: 0.4rem; }
}

@media (hover: none) {
  .lb-nav { opacity: 0.85; }
}

body.lb-lock {
  overflow: hidden;
}

/* ---------- Reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .slide.is-active img,
  .slide.is-leaving img { animation: none !important; }
  @view-transition { navigation: none; }
}
