/* ===========================================================
   Chitralahar — minimal light photography CMS
   Public stylesheet (also provides shared tokens/buttons/forms)
   =========================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f5f2;
  --bg-sink: #eceae4;
  --ink: #1a1814;
  --ink-2: #565049;
  --ink-3: #8d877c;
  --line: #e9e6df;
  --line-2: #d9d5cc;
  --accent: #1a1814;
  --danger: #b23b2e;
  --ok: #2f7d52;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;

  --max: 1340px;
  --read: 700px;
  --radius: 3px;
  --shadow-sm: 0 1px 2px rgba(26, 24, 20, .05);
  --shadow: 0 4px 24px rgba(26, 24, 20, .08);
  --shadow-lg: 0 18px 60px rgba(26, 24, 20, .16);
  --ease: cubic-bezier(.22, .61, .25, 1);
  --header-h: 68px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a { color: var(--ink); text-decoration: none; transition: color .2s var(--ease), opacity .2s var(--ease); }
a:hover { color: var(--ink-2); }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; line-height: 1.15; letter-spacing: -.01em; color: var(--ink); margin: 0 0 .5em; }

::selection { background: #1a1814; color: #fff; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: clamp(20px, 5vw, 56px); }
.wrap-read { width: 100%; max-width: var(--read); margin-inline: auto; padding-inline: clamp(20px, 5vw, 32px); }

.site-main { flex: 1 0 auto; padding-bottom: 88px; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.wordmark {
  font-family: var(--font-serif); font-size: 1.5rem; font-weight: 500;
  letter-spacing: -.01em;
}
.wordmark.has-logo { display: inline-flex; align-items: center; }
.brand-logo {
  display: block; width: auto; max-width: 260px; object-fit: contain;
  height: clamp(30px, 4.5vw, 42px);
}

/* Admin-controlled home hero banner */
.home-hero { width: 100%; margin-bottom: 6px; }
.home-hero img { display: block; width: 100%; max-height: 72vh; object-fit: cover; }

/* Home slideshow ("Slider" template) */
.home-slider {
  position: relative; width: 100%;
  height: clamp(380px, 66vh, 780px);
  overflow: hidden; background: var(--bg-sink); margin-bottom: 6px;
}
.slider-track { position: absolute; inset: 0; }
.slide {
  position: absolute; inset: 0; display: block;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .9s var(--ease), visibility .9s var(--ease);
}
.slide.is-active { opacity: 1; visibility: visible; pointer-events: auto; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 56px clamp(20px, 5vw, 64px) clamp(28px, 4vw, 48px);
  color: #fff; font-family: var(--font-serif);
  background: linear-gradient(to top, rgba(0, 0, 0, .58), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.slide-cap strong { font-size: clamp(1.2rem, 2.6vw, 2rem); font-weight: 500; letter-spacing: -.01em; }
.slide-sub { font-family: var(--font-sans); font-size: .95rem; opacity: .92; }
.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .85); color: #1a1814;
  font-size: 1.7rem; line-height: 1; transition: background .15s var(--ease);
}
.slider-btn:hover { background: #fff; }
.slider-prev { left: clamp(12px, 2vw, 26px); }
.slider-next { right: clamp(12px, 2vw, 26px); }
.slider-dots {
  position: absolute; left: 0; right: 0; bottom: 16px; z-index: 2;
  display: flex; justify-content: center; gap: 9px;
}
.slider-dot {
  width: 9px; height: 9px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .9); background: transparent;
  transition: background .15s var(--ease);
}
.slider-dot.is-active { background: #fff; }

/* Photo tags */
.photo-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag-chip {
  display: inline-block; font-size: .76rem; letter-spacing: .03em;
  padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink-2); transition: border-color .15s var(--ease), color .15s var(--ease);
}
.tag-chip:hover { border-color: var(--ink); color: var(--ink); }
.site-nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 36px); }
.site-nav a {
  font-size: .82rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); position: relative; padding: 4px 0;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.is-active { color: var(--ink); }
.site-nav a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--ink);
}
.nav-admin { opacity: .55; }

/* ---------------- Footer ---------------- */
.site-footer { flex-shrink: 0; border-top: 1px solid var(--line); padding: 40px 0; margin-top: auto; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; }
.footer-name { font-family: var(--font-serif); font-size: 1.05rem; margin: 0; }
.footer-links { display: flex; gap: 12px; align-items: center; }
.footer-links a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--bg-soft); color: var(--ink-2);
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), transform .18s var(--ease);
}
.footer-links a:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); transform: translateY(-2px); }
.footer-links svg { width: 18px; height: 18px; display: block; }
.footer-meta { font-size: .82rem; color: var(--ink-3); letter-spacing: .02em; }
.footer-meta { margin: 0; }
.footer-meta a { color: var(--ink-3); }
.footer-meta a:hover { color: var(--ink); }

/* ---------------- Flash ---------------- */
.flash-stack { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.flash {
  padding: 12px 16px; border-radius: var(--radius); font-size: .9rem;
  border: 1px solid var(--line-2); background: var(--bg-soft);
}
.flash-success { border-color: #bfe0cd; background: #eef7f1; color: #1f5e3c; }
.flash-error { border-color: #ecc4be; background: #fbeeec; color: #8f2c20; }

/* ---------------- Page intro ---------------- */
.page-intro { padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(28px, 4vw, 44px); }
.page-title { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 400; letter-spacing: -.02em; margin: 0; }
.page-sub { color: var(--ink-3); font-size: 1.02rem; margin: .5rem 0 0; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.filter {
  font-size: .8rem; letter-spacing: .04em; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-2); background: transparent;
}
.filter:hover { border-color: var(--ink); color: var(--ink); }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.subfilter-bar { margin-top: 10px; }
.subfilter-bar .filter { font-size: .74rem; padding: 5px 13px; }
.photo-cat-sep { opacity: .5; }

/* ---------------- Gallery (mosaic / bento tiles) ---------------- */
/* A packed grid of varied tile sizes — each photo's class (set in the template by
   aspect ratio) makes wide landscapes span 2 columns, portraits span 2 rows, and
   the occasional feature span 2×2. Equal gutters, dense packing (no holes), and
   photos keep their orientation rather than being forced into squares. Base
   columns are capped at 4 via the (100% - 3*gap)/4 minimum. */
.gallery {
  --gap: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(210px, (100% - 3 * var(--gap)) / 4), 1fr));
  grid-auto-rows: 300px;
  grid-auto-flow: dense;
  gap: var(--gap);
}
.g-item { margin: 0; min-width: 0; }
.g-item.is-wide { grid-column: span 2; }
.g-item.is-tall { grid-row: span 2; }
.g-item.is-big  { grid-column: span 2; grid-row: span 2; }
.g-fill { display: none; }
.g-link { display: block; position: relative; overflow: hidden; border-radius: var(--radius); background: var(--bg-soft); width: 100%; height: 100%; }
.g-link img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .8s var(--ease), opacity .4s var(--ease);
  backface-visibility: hidden;
}
.g-link:hover img { transform: scale(1.035); }
@media (max-width: 620px) { .gallery { --gap: 8px; grid-auto-rows: 230px; } }
@media (max-width: 460px) {
  .g-item.is-wide, .g-item.is-big { grid-column: span 1; }
  .g-item.is-big { grid-row: span 1; }
}
.g-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 16px 14px; color: #fff; font-size: .85rem; letter-spacing: .02em;
  background: linear-gradient(to top, rgba(20, 18, 16, .55), rgba(20, 18, 16, 0));
  opacity: 0; transform: translateY(6px); transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.g-link:hover .g-cap { opacity: 1; transform: translateY(0); }

/* ---------------- Single photo view ---------------- */
.view-photo .site-main { padding-bottom: 56px; }
.photo-view { padding-top: clamp(24px, 4vw, 44px); }
.photo-frame { display: flex; justify-content: center; }
.photo-frame img { max-height: 82vh; width: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.photo-meta {
  display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: flex-end; justify-content: space-between;
  max-width: 980px; margin: 26px auto 0;
}
.photo-title { font-size: 1.7rem; font-weight: 400; margin: 0 0 .25rem; }
.photo-caption { color: var(--ink-2); margin: 0; max-width: 60ch; }
.photo-cat { margin: .5rem 0 0; }
.photo-cat a { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.photo-nav { display: flex; gap: 22px; font-size: .85rem; color: var(--ink-2); }
.photo-nav a:hover { color: var(--ink); }
.photo-nav-all { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }

/* ---------------- Blog list ---------------- */
.post-list { display: grid; gap: clamp(34px, 5vw, 58px); max-width: 1040px; }
.post-card { display: grid; grid-template-columns: 1fr; gap: 18px; }
.post-card:has(.post-card-cover) { grid-template-columns: minmax(0, 360px) 1fr; align-items: start; }
.post-card-cover { overflow: hidden; border-radius: var(--radius); background: var(--bg-soft); aspect-ratio: 4 / 3; }
.post-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.post-card-cover:hover img { transform: scale(1.04); }
.post-card-date { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin: 0 0 .5rem; }
.post-card-title { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 400; margin: 0 0 .5rem; }
.post-card-title a:hover { color: var(--ink-2); }
.post-card-excerpt { color: var(--ink-2); margin: 0 0 .9rem; max-width: 62ch; }
.readmore { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; }
.readmore:hover { border-color: var(--ink); }

/* ---------------- Article (post + about) ---------------- */
.article { padding-top: clamp(28px, 5vw, 56px); }
.article-head { text-align: center; }
.article-date { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); margin: 0 0 1rem; }
.article-title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 400; letter-spacing: -.02em; margin: 0 auto; max-width: 16ch; }
.article-lede { color: var(--ink-2); font-size: 1.15rem; margin: 1.1rem auto 0; max-width: 56ch; }
.article-cover { margin: clamp(34px, 5vw, 60px) auto; }
.article-cover img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.article-body { margin-top: clamp(28px, 4vw, 44px); }
.article-foot { margin-top: 56px; padding-top: 26px; border-top: 1px solid var(--line); }
.back-link { font-size: .85rem; color: var(--ink-2); }

.about { padding-top: clamp(40px, 6vw, 80px); }
.about-title { text-align: center; max-width: none; }
.about-portrait { margin: clamp(28px, 4vw, 44px) auto; max-width: 420px; }
.about-portrait img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.about-body { margin-top: 8px; }
.about-contact { margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 22px; }
.about-contact a { font-size: .85rem; letter-spacing: .03em; color: var(--ink-2); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; }
.about-contact a:hover { color: var(--ink); }

/* ---------------- Prose (rendered markdown) ---------------- */
.prose { font-size: 1.08rem; line-height: 1.8; color: #2a2620; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.3em; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 2em 0 .6em; }
.prose h2 { font-size: 1.7rem; }
.prose h3 { font-size: 1.35rem; }
.prose a { border-bottom: 1px solid var(--line-2); }
.prose a:hover { border-color: var(--ink); }
.prose img { border-radius: var(--radius); margin: 1.6em 0; box-shadow: var(--shadow-sm); }
.prose blockquote {
  margin: 1.6em 0; padding: .2em 0 .2em 1.4em; border-left: 2px solid var(--ink);
  font-family: var(--font-serif); font-size: 1.3rem; font-style: italic; color: var(--ink);
}
.prose ul, .prose ol { margin: 0 0 1.3em; padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--bg-soft); padding: .15em .4em; border-radius: 4px; }
.prose pre { background: var(--bg-soft); padding: 18px; border-radius: var(--radius); overflow: auto; margin: 1.6em 0; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: .96rem; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; }

/* ---------------- Empty / error states ---------------- */
.empty-state { text-align: center; padding: clamp(60px, 12vw, 140px) 0; color: var(--ink-2); }
.empty-title { font-family: var(--font-serif); font-size: 1.6rem; color: var(--ink); margin: 0 0 .4rem; }
.empty-state a { border-bottom: 1px solid var(--line-2); }
.empty-state a:hover { border-color: var(--ink); }
.error-page .error-code { font-family: var(--font-serif); font-size: 4rem; color: var(--ink-3); margin: 0; }

/* ---------------- Buttons (shared) ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: .88rem; font-weight: 500; letter-spacing: .01em;
  padding: 11px 20px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); cursor: pointer; transition: all .2s var(--ease); line-height: 1;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { filter: brightness(1.15); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding-inline: 8px; }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { background: #fff; border-color: #e0bdb7; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.linklike { background: none; border: none; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; }
.linklike:hover { color: var(--ink); }
.linklike.danger { color: var(--danger); }
.linklike.danger:hover { color: #000; }

/* ---------------- Forms (shared base) ---------------- */
input[type=text], input[type=password], input[type=email], input[type=url], textarea, select {
  width: 100%; font-family: var(--font-sans); font-size: .98rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 11px 13px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(26, 24, 20, .08);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }

/* ---------------- Lightbox ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: rgba(250, 249, 246, .985);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .28s var(--ease);
}
.lightbox.is-open { display: flex; opacity: 1; }
.lb-stage { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 94vw; }
.lb-img {
  max-width: 92vw; max-height: 84vh; width: auto; object-fit: contain;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  transition: opacity .2s var(--ease); background: #fff;
  cursor: zoom-in;
}
/* Zoomed: the photo at its full pixel size, pan by scrolling. */
.lightbox.is-zoomed { overflow: auto; }
.lightbox.is-zoomed .lb-stage { margin: auto; max-width: none; }
.lightbox.is-zoomed .lb-img { max-width: none; max-height: none; border-radius: 0; cursor: zoom-out; }
/* Slideshow: dark room (fullscreen is requested by main.js where supported). */
.lightbox.lb-dark { background: rgba(0, 0, 0, .99); backdrop-filter: none; -webkit-backdrop-filter: none; }
.lightbox.lb-dark .lb-cap { color: rgba(255, 255, 255, .72); }
.lightbox.lb-dark .lb-btn { background: rgba(34, 34, 34, .8); border-color: rgba(255, 255, 255, .16); color: #eee; }
.lightbox.lb-dark .lb-img { background: transparent; box-shadow: none; }
.lb-img.is-loading { opacity: .35; }
.lb-cap { font-size: .9rem; color: var(--ink-2); text-align: center; max-width: 70ch; min-height: 1.2em; }
.lb-btn {
  position: absolute; background: rgba(255, 255, 255, .7); border: 1px solid var(--line);
  color: var(--ink); cursor: pointer; border-radius: 999px;
  width: 46px; height: 46px; font-size: 1.5rem; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--ease); backdrop-filter: blur(6px);
}
.lb-btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lb-close { top: 22px; right: 22px; font-size: 1.7rem; }
.lb-play { top: 22px; left: 22px; }
.lb-play .lb-ic-pause { display: none; }
.lb-play.playing .lb-ic-play { display: none; }
.lb-play.playing .lb-ic-pause { display: block; }
.lb-prev { left: 22px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 22px; top: 50%; transform: translateY(-50%); }
body.lb-locked { overflow: hidden; }

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) {
  .post-card, .post-card:has(.post-card-cover) { grid-template-columns: 1fr; }
  .photo-meta { flex-direction: column; align-items: flex-start; }
  .lb-prev { left: 10px; } .lb-next { right: 10px; }
  .lb-btn { width: 42px; height: 42px; }
  .site-nav { gap: 16px; }
}
@media (max-width: 520px) {
  .wordmark { font-size: 1.3rem; }
  .site-nav a { font-size: .74rem; }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .g-link:hover img { transform: none; }
}

/* ===========================================================
   Public templates — chosen in admin, applied via body[data-template].
   "minimal" is the default look defined above; the others override it.
   =========================================================== */

/* --- Noir: dark canvas, cinematic --- */
body[data-template="noir"] {
  --bg: #141210; --bg-soft: #1d1a17; --bg-sink: #262220;
  --ink: #f2eee7; --ink-2: #b6afa4; --ink-3: #837c71;
  --line: #2b2723; --line-2: #3b362f; --accent: #f2eee7;
}
body[data-template="noir"] .site-header { background: rgba(20, 18, 16, .8); }
body[data-template="noir"] .lightbox { background: rgba(13, 11, 9, .97); }
body[data-template="noir"] .lb-btn { background: rgba(44, 40, 36, .72); }
body[data-template="noir"] .btn { background: var(--bg-soft); }
body[data-template="noir"] ::selection { background: #f2eee7; color: #141210; }

/* --- Grid: uniform square tiles, orderly (no mosaic spans) --- */
body[data-template="grid"] .gallery { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: auto; grid-auto-flow: row; gap: 10px; }
body[data-template="grid"] .g-item { margin: 0; min-width: 0; grid-column: auto; grid-row: auto; }
body[data-template="grid"] .g-link { aspect-ratio: 1 / 1; height: auto; }
body[data-template="grid"] .g-link img { width: 100%; height: 100%; object-fit: cover; }

/* --- Frame: gallery-wall matting --- */
body[data-template="frame"] { --bg: #f3f1ea; }
body[data-template="frame"] .site-header { background: rgba(243, 241, 234, .82); }
body[data-template="frame"] .gallery { display: block; columns: 300px; column-gap: 30px; }
body[data-template="frame"] .g-item { margin-bottom: 30px; break-inside: avoid; min-width: 0; }
body[data-template="frame"] .g-link { background: #fff; padding: 12px; box-shadow: 0 2px 6px rgba(26, 24, 20, .08), 0 16px 34px rgba(26, 24, 20, .07); }
body[data-template="frame"] .g-link:hover img { transform: none; }
body[data-template="frame"] .g-cap { left: 12px; right: 12px; bottom: 12px; padding: 22px 12px 10px; }

/* --- Editorial: feature-led, serif accents --- */
body[data-template="editorial"] .gallery { columns: auto; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: auto; grid-auto-flow: row; gap: clamp(20px, 3vw, 36px); }
body[data-template="editorial"] .g-item { margin: 0; min-width: 0; grid-column: auto; grid-row: auto; }
body[data-template="editorial"] .g-item:first-child { grid-column: 1 / -1; }
body[data-template="editorial"] .g-cap { font-family: var(--font-serif); font-size: 1.02rem; }
body[data-template="editorial"] .page-intro { text-align: center; }

/* Frame & Editorial keep photos at their natural aspect ratio, not mosaic tiles. */
body[data-template="frame"] .g-link,
body[data-template="editorial"] .g-link { width: auto; height: auto; aspect-ratio: auto; }
body[data-template="frame"] .g-link img,
body[data-template="editorial"] .g-link img { height: auto; object-fit: initial; }
body[data-template="editorial"] .filter-bar { justify-content: center; }
body[data-template="editorial"] .page-title { font-size: clamp(2.4rem, 6vw, 4.2rem); }

/* ===========================================================
   Mobile menu + small-screen polish (all templates)
   =========================================================== */
.nav-toggle { display: none; }

@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; margin-right: -10px; padding: 11px;
    background: none; border: none; cursor: pointer; z-index: 60;
  }
  .nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s var(--ease), opacity .2s var(--ease); }
  .nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .site-nav {
    position: fixed; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 6px 0 10px; box-shadow: var(--shadow);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .site-nav.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .site-nav a { font-size: .92rem; letter-spacing: .04em; padding: 14px clamp(20px, 5vw, 56px); }
  .site-nav a.is-active::after { display: none; }
  .nav-admin { opacity: 1; }

  /* Layout templates collapse gracefully on phones */
  body[data-template="grid"] .gallery { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  body[data-template="editorial"] .gallery { grid-template-columns: 1fr; }
  body[data-template="frame"] .gallery { columns: 1; }
  .photo-meta { gap: 14px; }
}

/* ===========================================================
   Navigation dropdowns (managed menu structure)
   =========================================================== */
.nav-item { position: relative; display: inline-flex; align-items: center; }
.nav-caret { font-size: .65em; opacity: .55; margin-left: 1px; }
.nav-dropdown {
  position: absolute; top: calc(100% + 12px); left: 50%;
  transform: translateX(-50%) translateY(6px);
  display: flex; flex-direction: column; min-width: 170px; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); opacity: 0; visibility: hidden; z-index: 60;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.nav-item.has-children::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 14px; }
.nav-item.has-children:hover .nav-dropdown,
.nav-item.has-children:focus-within .nav-dropdown {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.nav-dropdown a { text-transform: none; letter-spacing: 0; font-size: .86rem; color: var(--ink-2); padding: 9px 12px; border-radius: 4px; white-space: nowrap; }
.nav-dropdown a::after { display: none !important; }
.nav-dropdown a:hover { background: var(--bg-soft); color: var(--ink); }
.nav-dropdown a.is-active { color: var(--ink); }

@media (max-width: 640px) {
  .site-nav { align-items: stretch; }
  .nav-item { display: block; width: 100%; }
  .nav-item.has-children::after { display: none; }
  .nav-caret { display: none; }
  .nav-dropdown {
    position: static; transform: none; opacity: 1; visibility: visible;
    box-shadow: none; border: none; background: transparent; padding: 0; min-width: 0;
  }
  /* The desktop hover rule otherwise re-applies translateX(-50%), shoving the
     stacked mobile dropdown off-screen — keep it put on hover/focus. */
  .nav-item.has-children:hover .nav-dropdown,
  .nav-item.has-children:focus-within .nav-dropdown {
    transform: none;
  }
  .nav-dropdown a { padding: 11px 20px 11px 42px; font-size: .9rem; }
}

/* ---------------- Contact form ---------------- */
.contact-form { display: flex; flex-direction: column; gap: 14px; margin: 30px 0 34px; }
.contact-form label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; color: var(--ink-2); }
.contact-form input, .contact-form textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--bg); color: var(--ink);
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--ink); }
.cf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .cf-row { grid-template-columns: 1fr; } }
.cf-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.contact-form .btn { align-self: flex-start; }

/* ---------------- EXIF details on the photo page ---------------- */
.photo-exif { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 18px 0 0; }
.photo-exif div { display: flex; gap: 6px; align-items: baseline; }
.photo-exif dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.photo-exif dd { margin: 0; font-size: .85rem; color: var(--ink-2); }

/* ---------------- Client proofing hearts ---------------- */
.g-item { position: relative; }
.proof-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .82); color: #b9b2a6; font-size: 1.15rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); transition: color .15s var(--ease), transform .15s var(--ease);
}
.proof-btn:hover { transform: scale(1.12); color: #c0392b; }
.proof-btn.picked { color: #c0392b; background: #fff; }
.proof-hint { margin-top: 14px; font-size: .88rem; }

/* ---------------- Video downloads (private albums) ---------------- */
.video-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.video-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-soft);
  transition: border-color .15s var(--ease);
}
.video-card:hover { border-color: var(--ink); }
.video-icon { font-size: .8rem; color: var(--ink-3); }
.video-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-size { font-size: .82rem; }
#videoPlayer { width: 100%; max-height: 70vh; border-radius: var(--radius); background: #000; margin-top: 4px; }
.shared-video { width: 100%; max-height: 70vh; border-radius: var(--radius); background: #000; margin-bottom: 18px; }

/* ---------------- Private client gallery ---------------- */
.private-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); margin: 0 0 8px; }
.album-download { margin: 20px 0 0; }
.lock-wrap { display: flex; justify-content: center; padding: clamp(48px, 11vw, 130px) 0; }
.lock-card { width: 100%; max-width: 380px; text-align: center; }
.lock-title { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 400; margin: 0 0 12px; }
.muted-text { color: var(--ink-3); margin: 0 0 22px; }
.lock-form { display: flex; flex-direction: column; gap: 12px; max-width: 280px; margin: 0 auto; }

/* ===========================================================
   Viewer color schemes — cycled by the header dot, saved in
   localStorage. Kept LAST so they override template rules.
   =========================================================== */
.scheme-btn {
  width: 22px; height: 22px; margin-left: auto; margin-right: 16px;
  border-radius: 50%; border: 1px solid var(--line-2); cursor: pointer; flex-shrink: 0;
  background: linear-gradient(135deg, #fff 50%, #232323 50%);
  transition: transform .15s var(--ease);
}
.scheme-btn:hover { transform: scale(1.15); }
html[data-scheme="grey"] .scheme-btn { background: #2b2b2b; }
html[data-scheme="black"] .scheme-btn { background: #000; border-color: #555; }

html[data-scheme="grey"] body {
  --bg: #232323; --bg-soft: #2b2b2b; --bg-sink: #353535;
  --ink: #ececec; --ink-2: #b4b4b4; --ink-3: #878787;
  --line: #3a3a3a; --line-2: #484848; --accent: #ececec;
}
html[data-scheme="grey"] .site-header { background: rgba(35, 35, 35, .85); }
html[data-scheme="grey"] .lightbox { background: rgba(28, 28, 28, .97); }
html[data-scheme="grey"] .lb-btn { background: rgba(60, 60, 60, .72); }
html[data-scheme="grey"] ::selection { background: #ececec; color: #232323; }

html[data-scheme="black"] body {
  --bg: #000000; --bg-soft: #101010; --bg-sink: #1a1a1a;
  --ink: #f2f2f2; --ink-2: #ababab; --ink-3: #7c7c7c;
  --line: #242424; --line-2: #303030; --accent: #f2f2f2;
}
html[data-scheme="black"] .site-header { background: rgba(0, 0, 0, .8); }
html[data-scheme="black"] .lightbox { background: rgba(0, 0, 0, .97); }
html[data-scheme="black"] .lb-btn { background: rgba(34, 34, 34, .8); }
html[data-scheme="black"] ::selection { background: #f2f2f2; color: #000; }

/* light-on-white bits that both dark schemes need re-based */
html[data-scheme="grey"] .btn, html[data-scheme="black"] .btn,
html[data-scheme="grey"] .btn-danger, html[data-scheme="black"] .btn-danger,
html[data-scheme="grey"] .video-card, html[data-scheme="black"] .video-card {
  background: var(--bg-soft);
}
html[data-scheme="grey"] .contact-form input, html[data-scheme="grey"] .contact-form textarea,
html[data-scheme="black"] .contact-form input, html[data-scheme="black"] .contact-form textarea {
  background: var(--bg-soft); color: var(--ink); border-color: var(--line-2);
}

/* Slider template home: the slideshow IS the page — full viewport under the
   header, images letterboxed (object-fit: contain) so nothing is cropped. */
body.slider-home .site-main { padding-bottom: 0; }
body.slider-home .home-slider {
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h)); /* mobile browsers with dynamic UI chrome */
  margin-bottom: 0; background: var(--bg);
}
body.slider-home .slide img { object-fit: contain; }
