/* Rideekanda Gallery — base styles
   Palette + density are CSS custom properties that get rewritten by the Tweaks panel. */

:root {
  --bg: #f3ecdc;
  --paper: #faf6ea;
  --ink: #2a2418;
  --muted: rgba(42, 36, 24, .58);
  --line: rgba(42, 36, 24, .14);
  --accent: #6b5a3c;
  --tile-radius: 2px;
  --gap: 28px;
  --max-w: 1240px;
  --col-w: clamp(220px, 26vw, 360px);

  /* placeholder gradient tones, set per palette */
  --t1: #c9b994;
  --t2: #8b7d5b;
  --t3: #5a5238;
  --t4: #a89875;
  --t5: #736548;
  --t6: #d8c9a4;
  --t7: #9b8e6a;
  --t8: #4a4332;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Lora', Georgia, serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(ellipse 1200px 600px at 50% -120px, rgba(255,255,255,.55), transparent 60%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle paper grain over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .12 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

body[data-grain="0"]::before { display: none; }
body[data-grain="0"] .tile .grain, body[data-grain="0"] .lb-frame .grain { display: none; }

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

.shell {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Top mark ── */
.topmark {
  display: flex;
  justify-content: center;
  padding: 56px 0 0;
}
.topmark img { width: 56px; height: auto; opacity: .9; display: block; }

/* ── Back nav ── */
.back-nav {
  padding: 24px 0 0;
}
.back-link {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease;
}
.back-link:hover {
  color: var(--ink);
}

/* ── Hero ── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 0 12px;
}
.hero .lotus {
  width: clamp(150px, 18vw, 220px);
  height: auto;
  display: block;
  opacity: .98;
  margin-bottom: 40px;
  filter: drop-shadow(0 4px 14px rgba(58, 38, 18, .12));
}
.hero .tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.25;
  letter-spacing: .005em;
  color: var(--ink);
  margin: 0 0 28px;
}
.hero .place {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.hero .rule {
  width: 1px;
  height: 40px;
  background: var(--line);
  margin: 28px auto 0;
}

/* ── Intro paragraph ── */
.intro {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 0 80px;
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: clamp(19px, 1.8vw, 22px);
  line-height: 1.55;
  color: var(--ink);
  text-wrap: pretty;
}
.intro .lead {
  font-size: 11px;
  letter-spacing: .32em;
  text-transform: uppercase;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 18px;
}

/* ── Gallery grid ── */
.gallery-section {
  padding: 24px 0 120px;
}
.section-label {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 10.5px;
  letter-spacing: .36em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  font-family: 'Cormorant Garamond', serif;
  margin: 0 0 48px;
}
.section-label .line {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-label .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.grid {
  columns: var(--cols, 3);
  column-gap: var(--gap);
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 var(--gap);
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  aspect-ratio: var(--tile-ar, 4 / 5);
  border-radius: var(--tile-radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 1px 2px rgba(0,0,0,.06);
  transition: transform .9s cubic-bezier(.2,.7,.2,1), opacity .9s ease;
  opacity: 0;
  transform: translateY(18px);
  will-change: transform, opacity;
}
.tile.in {
  opacity: 1;
  transform: translateY(0);
}
.tile .ph {
  position: absolute;
  inset: 0;
  background: var(--tile-bg);
  transition: transform 1.4s cubic-bezier(.2,.7,.2,1), filter .6s ease;
}
.tile .grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.tile .vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 60%, transparent 55%, rgba(0,0,0,.18) 100%);
}
/* Real photo image inside tile */
.tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transition: opacity .6s ease, transform 1.4s cubic-bezier(.2,.7,.2,1), filter .6s ease;
}
.tile-img.loaded {
  opacity: 1;
}
.tile:hover .tile-img {
  transform: scale(1.04);
  filter: brightness(1.04) saturate(1.05);
}
.tile:hover .ph {
  transform: scale(1.04);
  filter: brightness(1.04) saturate(1.05);
}

/* Video play affordance */
.tile .play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .3s ease, transform .4s cubic-bezier(.2,.7,.2,1);
}
.tile .play svg { width: 18px; height: 18px; fill: rgba(255,255,255,.95); transform: translateX(2px); }
.tile:hover .play { background: rgba(255,255,255,.32); transform: translate(-50%, -50%) scale(1.06); }

/* Index numeral in the corner — quiet identifier */
.tile .idx {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: .2em;
  color: rgba(255,255,255,.78);
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}

/* Caption overlay (when enabled) */
.tile .cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 14px 12px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.35;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
  letter-spacing: .005em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s ease, transform .35s ease;
}
.tile:hover .cap, body[data-captions="1"] .tile .cap { opacity: 1; transform: translateY(0); }

/* ── API status messages ── */
.api-status {
  max-width: 560px;
  margin: 0 auto 32px;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.api-status.loading {
  background: rgba(42, 36, 24, .06);
  color: var(--muted);
}
.api-status.error {
  background: rgba(180, 80, 40, .08);
  color: rgba(140, 50, 20, .75);
}
.api-status.info {
  background: rgba(42, 36, 24, .04);
  color: var(--muted);
  font-style: italic;
}
.api-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Footer ── */
.footer {
  padding: 80px 0 60px;
  text-align: center;
  border-top: 1px solid var(--line);
  margin-top: 56px;
}
.footer .mono {
  width: 42px;
  height: auto;
  margin: 0 auto 22px;
  opacity: .8;
  display: block;
}
.footer .mono img { width: 100%; height: auto; display: block; }
.footer p {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer .note {
  margin-top: 14px;
  text-transform: none;
  letter-spacing: .04em;
  font-style: italic;
  font-size: 14px;
  font-family: 'Cormorant Garamond', serif;
  color: var(--muted);
}

/* ── Lightbox ── */
.lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(18, 14, 6, .92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}
.lb[data-open="1"] { opacity: 1; pointer-events: auto; }
.lb-stage {
  position: relative;
  width: min(88vw, 1100px);
  height: min(80vh, 1080px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.lb-frame {
  position: relative;
  max-width: 100%;
  max-height: calc(100% - 60px);
  height: auto;
  width: auto;
  /* aspect-ratio comes from inline style per item */
  border-radius: 2px;
  overflow: hidden;
  background: #1a140a;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  transition: opacity .25s ease;
}
/* let the frame size itself from height first, so portraits get tall */
.lb-frame { height: min(72vh, 980px); }
.lb-frame.swap { opacity: 0; }
.lb-frame .ph {
  position: absolute; inset: 0;
  background: var(--tile-bg);
}
.lb-frame .grain {
  position: absolute; inset: 0;
  opacity: .4; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.lb-frame .vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,.35) 100%);
}
/* Full-res image in lightbox */
.lb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
}
.lb-frame.has-img {
  background: #0a0806;
}
.lb-frame.has-img .ph {
  opacity: .3;
}

.lb-frame .play.big {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 84px; height: 84px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.6);
  display: flex; align-items: center; justify-content: center;
}
.lb-frame .play.big svg { width: 30px; height: 30px; fill: rgba(255,255,255,.95); transform: translateX(3px); }

.lb-meta {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  color: rgba(246, 240, 224, .85);
}
.lb-meta .num {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: .36em;
  color: rgba(246, 240, 224, .55);
  text-transform: uppercase;
}
.lb-meta .num.right { justify-self: end; }
.lb-meta .cap {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  letter-spacing: .005em;
  text-align: center;
  text-wrap: balance;
  max-width: 480px;
}

/* Lightbox controls */
.lb-x, .lb-nav {
  position: absolute;
  appearance: none;
  border: 1px solid rgba(246, 240, 224, .35);
  background: transparent;
  color: rgba(246, 240, 224, .85);
  font-family: 'Cormorant Garamond', serif;
  cursor: pointer;
  border-radius: 50%;
  transition: background .25s ease, color .25s ease, border-color .25s ease, transform .3s ease;
  z-index: 2;
}
.lb-x {
  top: 28px;
  right: 28px;
  width: 44px; height: 44px;
  font-size: 18px;
  line-height: 1;
}
.lb-nav {
  top: 50%;
  width: 52px; height: 52px;
  transform: translateY(-50%);
  font-size: 22px;
  line-height: 1;
}
.lb-nav.prev { left: max(24px, calc((100vw - min(78vw, 880px)) / 2 - 70px)); }
.lb-nav.next { right: max(24px, calc((100vw - min(78vw, 880px)) / 2 - 70px)); }
.lb-x:hover, .lb-nav:hover {
  background: rgba(246, 240, 224, .12);
  border-color: rgba(246, 240, 224, .6);
}
.lb-nav:active { transform: translateY(-50%) scale(.96); }

/* Small screens */
@media (max-width: 880px) {
  .grid { --cols: 3; gap: 12px; }
  .lb-nav { width: 42px; height: 42px; font-size: 18px; }
  .lb-nav.prev { left: 12px; }
  .lb-nav.next { right: 12px; }
  .lb-x { top: 18px; right: 18px; width: 38px; height: 38px; }
  .hero { padding: 56px 0 64px; }
  .intro { padding: 48px 0 64px; }
  .shell { padding: 0 22px; }
}
@media (max-width: 520px) {
  .grid { --cols: 3; gap: 8px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .tile, .tile .ph, .lb, .lb-frame, .lb-nav { transition: none !important; }
}
