/* Shared styles for inner pages */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100vh;
  color: #fff;
  font-family: 'Inter', sans-serif;
}

/* Default hyperlink color (overridden by specific elements like .logo, .menu-list a, etc.) */
a { color: #D1617F; }
a:hover { color: #e58aa0; }

/* DEFAULT — very dark cinematic background with only a hint of red at the edges */
body {
  background-color: #020102;
  background-image:
    radial-gradient(ellipse 50% 60% at 90% 10%, rgba(90, 15, 35, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 5% 100%, rgba(40, 10, 25, 0.5) 0%, transparent 65%),
    radial-gradient(ellipse 100% 90% at 50% 50%, rgba(0, 0, 0, 0.6) 60%, transparent 100%),
    linear-gradient(160deg, #080306 0%, #020102 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ─── PRESET BACKGROUNDS ─── */

/* AURORA — cyan + red glow, black core (matches the reference photo) */
body.bg-aurora {
  background-color: #000;
  background-image:
    radial-gradient(ellipse 55% 50% at 50% 38%, rgba(220, 30, 20, 0.8) 0%, rgba(220,30,20,0.3) 30%, transparent 60%),
    radial-gradient(ellipse 35% 40% at 50% 55%, rgba(0, 180, 200, 0.65) 0%, transparent 55%),
    radial-gradient(ellipse 70% 35% at 50% 75%, rgba(255, 110, 30, 0.45) 0%, transparent 60%),
    radial-gradient(ellipse 80% 90% at 50% 50%, rgba(0,0,0,0.85) 60%, #000 95%);
}

/* EMBER — vertical red/orange streaks */
body.bg-ember {
  background-color: #0a0204;
  background-image:
    linear-gradient(180deg, transparent 30%, rgba(255,80,40,0.18) 60%, rgba(180,40,15,0.4) 90%),
    radial-gradient(ellipse 50% 70% at 30% 80%, rgba(255,100,40,0.55) 0%, transparent 60%),
    radial-gradient(ellipse 40% 80% at 75% 100%, rgba(220, 50, 20, 0.6) 0%, transparent 65%),
    radial-gradient(ellipse 90% 60% at 50% 30%, rgba(40, 5, 10, 0.95) 0%, transparent 70%);
}

/* PLASMA — purple/pink swirls */
body.bg-plasma {
  background-color: #08020e;
  background-image:
    radial-gradient(ellipse 60% 60% at 25% 30%, rgba(180, 30, 220, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 75%, rgba(255, 50, 130, 0.5) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 60% 20%, rgba(80, 30, 220, 0.6) 0%, transparent 55%),
    linear-gradient(160deg, #1a0428 0%, #08020e 100%);
}

/* SOLAR — bright yellow/orange */
body.bg-solar {
  background-color: #1a0a02;
  background-image:
    radial-gradient(ellipse 50% 60% at 70% 30%, rgba(255, 200, 60, 0.65) 0%, transparent 55%),
    radial-gradient(ellipse 90% 90% at 50% 110%, rgba(255, 100, 20, 0.7) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 50% 50%, rgba(255, 60, 0, 0.4) 0%, transparent 60%),
    linear-gradient(160deg, #2a0a02 0%, #0a0200 100%);
}

/* OCEAN — deep blue tones */
body.bg-ocean {
  background-color: #02060f;
  background-image:
    radial-gradient(ellipse 70% 50% at 25% 30%, rgba(30, 120, 220, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 60% 70% at 80% 80%, rgba(20, 180, 200, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse 80% 80% at 50% 50%, rgba(0, 20, 60, 0.95) 60%, transparent 90%),
    linear-gradient(160deg, #021530 0%, #02060f 100%);
}

/* MIDNIGHT — moody black + subtle highlights */
body.bg-midnight {
  background-color: #050507;
  background-image:
    radial-gradient(ellipse 50% 50% at 30% 30%, rgba(255,255,255,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 75% 70%, rgba(141, 1, 47, 0.35) 0%, transparent 55%),
    linear-gradient(160deg, #08080a 0%, #020202 100%);
}

/* CUSTOM image background — applied via inline style by JS */
body.bg-custom { background-color: #000; }

/* Grain overlay sits on top of the gradient, behind everything else */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.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 0.8 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* All content sits above the grain */
.page { position: relative; z-index: 1; }

/* ──────────────────────────────────────────────────────────
   PROJECT PAGE THEME (#2 + #9 blend)
   Dark moody background, big centered title, cinematic vibe
   ────────────────────────────────────────────────────────── */
body.project-page {
  background-color: #020102;
  background-image:
    radial-gradient(ellipse 50% 60% at 90% 10%, rgba(90, 15, 35, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 5% 100%, rgba(40, 10, 25, 0.5) 0%, transparent 65%),
    radial-gradient(ellipse 100% 90% at 50% 50%, rgba(0, 0, 0, 0.6) 60%, transparent 100%),
    linear-gradient(160deg, #080306 0%, #020102 100%);
}

/* Center the pinned title on project pages (project pages keep absolute layout) */
body.project-page .item.pinned-title,
body.project-page .item[data-id="title-pin"],
body.gallery-page .item.pinned-title,
body.gallery-page .item[data-id="title-pin"] {
  left: 50% !important;
  transform: translateX(-50%) !important;
  text-align: center;
  width: min(900px, 90vw) !important;
}
body.project-page .item.pinned-title .text-content,
body.gallery-page .item.pinned-title .text-content {
  text-align: center;
  font-family: 'Kirang Haerang', cursive !important;
  font-size: clamp(1.6rem, 3.2vw, 2.8rem) !important;
  letter-spacing: 0.005em;
  white-space: nowrap !important;
  overflow: visible !important;
  line-height: 1.05;
}
/* The subtitle credit line — centered below the title (auto-created as a pinned item) */
body.project-page .item.pinned-credit,
body.gallery-page .item.pinned-credit,
body.project-page .item[data-id="credit-pin"],
body.gallery-page .item[data-id="credit-pin"],
body.project-page .item[data-id="credit-pin-2"],
body.gallery-page .item[data-id="credit-pin-2"],
body.project-page .item[data-id="cr1"],
body.gallery-page .item[data-id="cr1"] {
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: min(1000px, 90vw) !important;
  text-align: center;
}
body.project-page .item.pinned-credit .text-content,
body.gallery-page .item.pinned-credit .text-content,
body.project-page .item[data-id="cr1"] .text-content,
body.gallery-page .item[data-id="cr1"] .text-content {
  text-align: center !important;
  white-space: nowrap;
}

/* All defaults for the page title use Kirang Haerang */
.page-title {
  font-family: 'Kirang Haerang', cursive;
}
/* Override page-title font for project pages */
body.project-page .page-title,
body.project-page .text-content {
  /* leave editor styling alone — user controls font */
}

/* ──────────────────────────────────────────────────────────
   GALLERY (parent) PAGE — freeform layout (same as project pages).
   Cards placed absolutely, snap to grid, drag anywhere.
   ────────────────────────────────────────────────────────── */
/* Title centered at top — same as project pages */
body.gallery-page .item.pinned-title {
  left: 50% !important;
  transform: translateX(-50%);
  text-align: center;
  width: min(900px, 90vw) !important;
}

/* ──────────────────────────────────────────────────────────
   REDESIGNED MENU OVERLAY (cinematic)
   ────────────────────────────────────────────────────────── */
.menu-overlay.cinema {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.menu-overlay.cinema::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #000;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.5s cubic-bezier(.77,0,.175,1);
}
.menu-overlay.cinema.is-open::before { transform: scaleY(1); }
.menu-overlay.cinema .menu-list {
  left: 8vw;
  gap: 0.6rem;
}
.menu-overlay.cinema .menu-list a {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2.5rem, 6.5vw, 5.5rem);
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  line-height: 1.05;
  color: rgba(255,255,255,0.85);
  position: relative;
  /* Fast transitions for hover-on AND hover-off */
  transition: color 0.15s ease, transform 0.2s ease;
  transform: translateY(40px);
  opacity: 0;
}
/* Use animation (not transition) for the stagger reveal — keeps hover fast */
@keyframes menuItemReveal {
  to { opacity: 1; transform: translateY(0); }
}
.menu-overlay.cinema.is-open .menu-list a {
  animation: menuItemReveal 0.5s cubic-bezier(.77,0,.175,1) forwards;
}
.menu-overlay.cinema .menu-list a .idx {
  font-family: 'Space Grotesk', sans-serif;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: rgba(255,255,255,0.35);
  position: relative;
  top: -1.4em;
  transition: color 0.15s ease;
}
.menu-overlay.cinema .menu-list a:hover {
  color: #8D012F;
  transform: translateX(14px);
}
.menu-overlay.cinema .menu-list a:hover .idx {
  color: rgba(141,1,47,0.8);
}
/* Stagger reveal — use animation-delay (not transition-delay) so hover responds instantly */
.menu-overlay.cinema.is-open .menu-list a:nth-child(1) { animation-delay: 0.30s; }
.menu-overlay.cinema.is-open .menu-list a:nth-child(2) { animation-delay: 0.36s; }
.menu-overlay.cinema.is-open .menu-list a:nth-child(3) { animation-delay: 0.42s; }
.menu-overlay.cinema.is-open .menu-list a:nth-child(4) { animation-delay: 0.48s; }
.menu-overlay.cinema.is-open .menu-list a:nth-child(5) { animation-delay: 0.54s; }
.menu-overlay.cinema.is-open .menu-list a:nth-child(6) { animation-delay: 0.60s; }
/* Tagline on the right side */
.menu-overlay.cinema .menu-aside {
  position: absolute;
  right: 8vw; bottom: 6vh;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  text-align: right;
  line-height: 1.8;
  opacity: 0;
  transition: opacity 0.6s 0.5s;
}
.menu-overlay.cinema.is-open .menu-aside { opacity: 1; }

/* ──────────────────────────────────────────────────────────
   SNAP-TO-GRID VISUAL HINT (only in edit mode)
   ────────────────────────────────────────────────────────── */
body.editing .board {
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0;
}

/* ── BOUNDARY GUIDELINES (visible only in edit mode, persist across pages) ── */
.guide-line { position: absolute; display: none; z-index: 20; pointer-events: none; }
body.editing .guide-line { display: block; }
.guide-line.vertical {
  width: 1px; top: 0; bottom: 0;
  background: rgba(255, 180, 180, 0.45);
  cursor: ew-resize; pointer-events: auto;
}
.guide-line.horizontal {
  height: 1px; left: 0; right: 0;
  background: rgba(255, 180, 180, 0.45);
  cursor: ns-resize; pointer-events: auto;
}
.guide-line.middle { background: rgba(255, 220, 100, 0.45); }
.guide-line:hover, .guide-line.dragging-guide {
  background: rgba(141, 1, 47, 0.85) !important;
}
.guide-line .label {
  position: absolute;
  font-family: 'Inter', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.7);
  padding: 2px 6px;
  white-space: nowrap;
  pointer-events: none;
}
.guide-line.vertical .label { top: 60px; left: 6px; }
.guide-line.horizontal .label { left: 10px; top: 4px; }
/* widen hit-target */
.guide-line.vertical::after, .guide-line.horizontal::after {
  content: ''; position: absolute;
}
.guide-line.vertical::after { left: -5px; right: -5px; top: 0; bottom: 0; }
.guide-line.horizontal::after { top: -5px; bottom: -5px; left: 0; right: 0; }

/* ──────────────────────────────────────────────────────────
   PAGE FOOTER — Minimal Corner (option 4)
   Stacked links on the left, big signature on the right
   ────────────────────────────────────────────────────────── */
.page-footer {
  margin-top: 8rem;
  padding: 4rem 2.5rem 2.5rem;
  display: grid;
  grid-template-areas:
    "sig  links"
    "loc  links";
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0 2rem;
  position: relative;
  z-index: 5;
}
.page-footer .pf-sig {
  grid-area: sig;
  font-family: 'Kirang Haerang', cursive;
  font-size: clamp(3rem, 6vw, 5rem);
  color: rgba(255,255,255,0.95);
  line-height: 0.95;
  letter-spacing: 0.005em;
}
.page-footer .pf-stack {
  grid-area: loc;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  line-height: 2.2;
  color: rgba(255,255,255,0.55);
}
.page-footer .pf-links {
  grid-area: links;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
}
.pf-link-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}
.pf-link-btn:hover { transform: translateY(-3px); background: rgba(255,255,255,0.18); }
.pf-link-btn.pf-email:hover  { background: #8D012F; border-color: #8D012F; }
.pf-link-btn.pf-linkedin:hover { background: #0a66c2; border-color: #0a66c2; }
.pf-link-btn.pf-imdb:hover   { background: #f5c518; border-color: #f5c518; }
.pf-link-btn svg { width: 22px; height: 22px; fill: currentColor; }
.pf-link-btn.pf-imdb {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: -0.02em;
  color: #fff;
}

@media (max-width: 1000px) {
  .page-footer {
    grid-template-areas:
      "sig"
      "loc"
      "links";
    grid-template-columns: 1fr;
    padding: 2.5rem 1.5rem;
    gap: 0.5rem 0;
  }
  .page-footer .pf-sig { font-size: 2.2rem; }
  .page-footer .pf-links { padding-bottom: 0; padding-top: 0.5rem; }
}

/* Remove rounding everywhere on cards/items by default */
.item, .item .media-wrap, .film-card, .film-card .film-img, .film-card .film-title,
.contact-widget, .social-widget a { border-radius: 0 !important; }

/* Desktop: hide the mobile-only natural <img>; the bg-div handles pan/zoom */
.item .media-wrap .image-natural { display: none; }

/* ─── Vertical-edge navigation arrows (more creative) ─── */
.page-nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  text-decoration: none;
  color: rgba(255,255,255,0.55);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0.8rem;
  transition: color 0.3s ease;
}
.page-nav-arrow:hover { color: #fff; }

/* The actual arrow is a thin line that grows on hover */
.page-nav-arrow .line {
  display: inline-block;
  width: 30px;
  height: 1px;
  background: currentColor;
  position: relative;
  transition: width 0.4s cubic-bezier(.77,0,.175,1);
}
.page-nav-arrow .line::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 8px;
  height: 1px;
  background: currentColor;
  transform-origin: center;
}
.page-nav-arrow.prev .line::after {
  left: 0;
  transform: translateY(-50%) rotate(-30deg);
  transform-origin: left center;
}
.page-nav-arrow.next .line::after {
  right: 0;
  transform: translateY(-50%) rotate(30deg);
  transform-origin: right center;
}
.page-nav-arrow.prev .line::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 8px;
  height: 1px;
  background: currentColor;
  transform: translateY(-50%) rotate(30deg);
  transform-origin: left center;
}
.page-nav-arrow.next .line::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 0;
  width: 8px;
  height: 1px;
  background: currentColor;
  transform: translateY(-50%) rotate(-30deg);
  transform-origin: right center;
}

.page-nav-arrow:hover .line { width: 60px; }

/* Vertical "PREV / NEXT" label that rotates beside it */
.page-nav-arrow .dir {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: 500;
  font-size: 0.65rem;
  letter-spacing: 0.45em;
}
.page-nav-arrow.next .dir {
  writing-mode: vertical-lr;
  transform: none;
}

/* Project name appears on hover */
.page-nav-arrow .label {
  font-family: 'Kirang Haerang', cursive;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 1.1rem;
  color: #fff;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 0.5s cubic-bezier(.77,0,.175,1), opacity 0.3s;
}
.page-nav-arrow:hover .label {
  max-width: 280px;
  opacity: 1;
}

.page-nav-arrow.prev { left: 0.3rem; flex-direction: row; }
.page-nav-arrow.next { right: 0.3rem; flex-direction: row-reverse; }

@media (max-width: 1000px) {
  .page-nav-arrow { gap: 0.5rem; padding: 0.5rem; }
  .page-nav-arrow .line { width: 18px; }
  .page-nav-arrow:hover .line { width: 30px; }
  .page-nav-arrow .label { font-size: 0.9rem; }
}

.page {
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

/* Top nav */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Take the back arrow out of the logo-stack height calculation so Menu
   centers against just the logo, not logo + back-btn. */
.logo-stack { position: relative; line-height: 1; }
.back-btn {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.4rem;
}
/* Match the visual height of the logo so flex-center actually centers. */
.menu-btn {
  line-height: 1;
  align-self: center;
}
.menu-btn .burger { align-self: center; }

.logo-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}
.logo {
  font-family: 'Kirang Haerang', cursive;
  font-weight: 400;
  font-size: 1.85rem;
  color: #fff;
  letter-spacing: 0.01em;
  text-decoration: none;
  display: block;
  line-height: 1;
}
.back-btn {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 1.3rem;
  color: rgba(255,255,255,0.55);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s, transform 0.2s;
}
.back-btn:hover { color: #fff; transform: translateX(-3px); }

/* Back/menu button */
.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  font-family: 'Kirang Haerang', cursive;
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0;
  z-index: 300;
  position: relative;
  transition: opacity 0.2s;
}
.menu-btn:hover { opacity: 0.7; }

.burger {
  width: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.burger span {
  display: block;
  height: 1.5px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.35s cubic-bezier(.77,0,.175,1), opacity 0.2s;
  transform-origin: center;
}
.menu-open .burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-open .burger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-open .burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Page title (top left) */
.page-title {
  font-family: 'Archivo Black', sans-serif;
  font-weight: 400;
  font-size: clamp(2.5rem, 6vw, 5rem);
  letter-spacing: 0.01em;
  margin-top: 4rem;
  margin-bottom: 2rem;
  line-height: 1;
}

/* Where you'll drop your content */
.content {
  margin-top: 1rem;
  min-height: 50vh;
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

/* Menu overlay (same as homepage) */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.menu-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}
.menu-list {
  position: absolute;
  left: 5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.menu-list a {
  font-family: 'Archivo Black', sans-serif;
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  letter-spacing: 0.01em;
  line-height: 1;
  opacity: 0;
  transform: translateX(-30px);
  transition:
    opacity 0.5s cubic-bezier(.77,0,.175,1),
    transform 0.5s cubic-bezier(.77,0,.175,1),
    color 0.2s;
}
.menu-overlay.is-open .menu-list a { opacity: 1; transform: translateX(0); }
.menu-list a:nth-child(1) { transition-delay: 0.08s; }
.menu-list a:nth-child(2) { transition-delay: 0.14s; }
.menu-list a:nth-child(3) { transition-delay: 0.20s; }
.menu-list a:nth-child(4) { transition-delay: 0.26s; }
.menu-list a:nth-child(5) { transition-delay: 0.32s; }
.menu-list a:nth-child(6) { transition-delay: 0.38s; }
.menu-list a:hover { color: #8D012F; }

@media (max-width: 1000px) {
  .page { padding: 1.5rem 1.2rem; }
  .menu-list { left: 2rem; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — phones & narrow/half-screen windows (≤ 1000px)
   Items flow top-to-bottom in DOM order.
   Editor UI is hidden entirely on touch devices.
═══════════════════════════════════════════════════════════ */
@media (max-width: 1000px) {

  /* ── Hide all editor chrome ── */
  .editor-toolbar,
  .text-toolbar,
  .edit-badge { display: none !important; }

  /* ── Glow cursor is meaningless on touch ── */
  #cursor-glow,
  .cursor-glow,
  .cursor-dot,
  [class*="cursor"] { display: none !important; }

  /* ── Board becomes a vertical flex column ── */
  /* Stack into a single column. This applies both when viewing AND when
     editing on a narrow window, so you can edit the mobile layout in place
     (use the 📱 ↑ ↓ badges on each item to set the mobile order). */
  .board {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    padding-top: 4.5rem !important;
    padding-bottom: 3rem !important;
    min-height: auto !important;
  }
  /* Give the title some breathing room from the photos/videos below it */
  .board > .item.pinned-title,
  .board > .item[data-id="title-pin"] { margin-bottom: 1rem !important; }

  /* On gallery (parent) pages the centered "Index" button sits just below
     the title. On mobile the cards stack tight under the title, leaving no
     room for it — so reserve a gap here. page-nav.js drops the button into
     this space. */
  body.gallery-page .board > .item.pinned-title,
  body.gallery-page .board > .item[data-id="title-pin"] { margin-bottom: 3.6rem !important; }

  /* First auto credit-pin (the main subtitle) — sits closer to the title */
  .board > .item[data-id="credit-pin"],
  .board > .item[data-id="cr1"] { margin-top: -1.2rem !important; }

  /* All OTHER pinned credits (credit-pin-2 and 📌-pinned text items) — cluster
     under the main subtitle. Kept smaller than the 1rem row-gap so a long /
     multi-line pinned caption can never overlap the line above it. */
  .board > .item.pinned-credit:not([data-id="credit-pin"]):not([data-id="cr1"]) {
    margin-top: -0.6rem !important;
  }
  /* ── Force every iframe (Vimeo, YouTube etc.) to fill the full row width ── */
  .board > .item iframe { width: 100% !important; max-width: 100% !important; }
  .board > .item .embed-wrap { width: 100% !important; }

  /* ── PDFs: tall on mobile so the pages are readable ── */
  .board > .item.pdf-item .media-wrap {
    height: 90vh !important;
    min-height: 90vh !important;
  }
  .board > .item.pdf-item iframe { height: 100% !important; }

  /* ── Interactive sketches (p5js/OpenProcessing): big enough to be readable
       while keeping a portrait shape (poster-friendly). ── */
  .board > .item.embed-tall .embed-wrap {
    height: 90vh !important;
    min-height: 90vh !important;
    padding-top: 0 !important;
    overflow: hidden !important;
  }
  .board > .item.embed-tall iframe {
    height: 100% !important;
    width: 100% !important;
  }

  /* ── Embed aspect overrides (set via ⚙ → Mobile shape in editor) ── */
  .board > .item.embed-portrait .embed-wrap {
    padding-top: 177.78% !important;   /* 9:16 portrait Reels / TikTok */
  }
  .board > .item.embed-square .embed-wrap {
    padding-top: 100% !important;      /* 1:1 square */
  }
  /* General text items (NOT title and NOT pinned subtitles): float free of neighbors
     so text always has breathing room from any photo/video above or below. */
  .board > .item:has(> .text-content):not(.pinned-title):not([data-id="title-pin"]):not(.pinned-credit) {
    margin-top: 0.8rem !important;
    margin-bottom: 0.6rem !important;
  }
  /* Pull consecutive captions a little closer (the tighter look). The pull is
     kept SMALLER than the .board row-gap (1rem) on purpose, so even if the
     mobile reorder makes a caption land under a photo/video instead of another
     caption, it can never overlap it — it just sits a touch closer. */
  .board > .item:has(> .text-content):not(.pinned-title):not([data-id="title-pin"]):not(.pinned-credit)
      + .item:has(> .text-content):not(.pinned-title):not([data-id="title-pin"]):not(.pinned-credit) {
    margin-top: -0.6rem !important;
  }
  .board > .item:has(> .text-content) .text-content {
    padding: 0.05rem 0.5rem !important;
    text-align: center !important;
    line-height: 1.25 !important;
  }
  /* Text items stay full-width on the .item, but the .text-content INSIDE is
     narrower + centered. This is the reliable way to center on every browser. */
  .board > .item .text-content {
    max-width: 82% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
    display: block !important;
  }
  /* Belt-and-suspenders: force every text item to center on the cross-axis */
  .board > .item:has(> .text-content) {
    align-self: stretch !important;
    text-align: center !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
  }
  /* The text block itself: full-width with centered text content */
  .board > .item .text-content {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 9% !important;
    padding-right: 9% !important;
    text-align: center !important;
    display: block !important;
    box-sizing: border-box !important;
  }
  /* (No negative margin between consecutive text items — see note above.
     Base .board gap + each text item's own margin keep things clear of the
     media above, regardless of how items are reordered for mobile.) */

  /* ── Every item: strip absolute position, go full-width ── */
  .board > .item {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    transform: none !important;
    z-index: auto !important;
    margin: 0 !important;
    order: var(--mob-order, 99);
  }
  .board > .item .media-wrap,
  .board > .item .image-bg {
    min-height: 0 !important;
    max-height: none !important;
  }

  /* ── Title + subtitle always lead. Everything else follows the 📱 badge number. ── */
  .board > .item[data-id="title-pin"],
  .board > .item.pinned-title  { order: -100 !important; }
  .board > .item[data-id="cr1"],
  .board > .item[data-id="credit-pin"],
  .board > .item[data-id="credit-pin-2"],
  .board > .item.pinned-credit { order: -99 !important; }

  /* Embeds follow the 📱 ↑↓ order like every other item — no forced "stay at top" */
  /* Default embed shape: LANDSCAPE 16:9 (regular Vimeo/YouTube videos).
     Override per-item via ⚙ → Mobile shape for portrait Reels. */
  .board > .item.embed-item .embed-wrap,
  .board > .item.embed-item .media-wrap {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-top: 56.25% !important;
    overflow: hidden !important;
    background: #000;
  }
  /* Explicit portrait override (set via ⚙ → Mobile shape = Portrait) */
  .board > .item.embed-item.embed-portrait .embed-wrap,
  .board > .item.embed-item.embed-portrait .media-wrap {
    height: 90vh !important;
    padding-top: 0 !important;
  }
  /* Explicit square override */
  .board > .item.embed-item.embed-square .embed-wrap,
  .board > .item.embed-item.embed-square .media-wrap {
    padding-top: 100% !important;
  }
  .board > .item.embed-item iframe,
  .board > .item.embed-item .embed-wrap > *,
  .board > .item.embed-item .media-wrap > * {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
  }

  /* ── Media items (images + videos + PDFs) ── */
  .board > .item .media-wrap {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    background: transparent !important;
  }
  /* On mobile, hide the desktop pan/zoom bg-div and show the natural <img> */
  .board > .item .media-wrap .image-bg { display: none !important; }
  .board > .item .media-wrap .image-natural {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
  }
  /* Videos: natural ratio, full width */
  .board > .item .media-wrap > video {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
    transform: none !important;
    object-fit: contain !important;
  }

  /* ── Text items: let content set the height ── */
  .board > .item .text-content {
    height: auto !important;
    min-height: 1em !important;
    white-space: pre-wrap !important;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem) !important;
  }

  /* ── Film cards: wider landscape format ── */
  .film-card {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
  }
  /* film-img fills the card absolutely (already inset:0 in editor.css) */
  .film-card .film-img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* ── Distortion blobs rely on absolute layout — hide on mobile ── */
  .bg-layer { display: none !important; }

  /* ── Pinned title: keep font size + centered text (width/centering handled above) ── */
  .board > .item.pinned-title,
  .board > .item[data-id="title-pin"] {
    left: 0 !important;
    transform: none !important;
    text-align: center !important;
  }
  .board > .item.pinned-title .text-content,
  .board > .item[data-id="title-pin"] .text-content {
    font-size: clamp(1.6rem, 7vw, 2.6rem) !important;
    white-space: normal !important;
    text-align: center !important;
  }

  /* ── Pinned credit/subtitle ── */
  .board > .item.pinned-credit,
  .board > .item[data-id="credit-pin"],
  .board > .item[data-id="credit-pin-2"],
  .board > .item[data-id="cr1"] {
    left: 0 !important;
    transform: none !important;
    text-align: center !important;
  }

  /* ── Nav: smaller logo on mobile ── */
  .logo { font-size: 1.4rem !important; white-space: nowrap !important; overflow: visible !important; }

  /* ── Footer ── */
  .page-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 2.5rem 1.5rem;
    margin-top: 3rem;
  }
  .page-footer .pf-sig { font-size: 2.2rem; }

  /* ── Index button: sit just below the page title on mobile ── */
  .index-trigger.parent,
  .index-trigger.project {
    top: 4rem !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    font-size: 0.7rem !important;
    padding: 0.25rem 0.7rem !important;
    letter-spacing: 0.12em !important;
    margin-bottom: 1.2rem !important;
  }
  /* Push page content down so the title sits clearly below the Index button */
  .board { padding-top: 3.5rem !important; }
  .index-trigger.parent:hover,
  .index-trigger.project:hover { transform: translateX(-50%) scale(1.04) !important; }

  /* ── Prev/Next arrows: CSS-drawn triangles on mobile (no emoji rendering) ── */
  .page-nav-arrow .label { display: none !important; }
  .page-nav-arrow .dir { display: none !important; }
  .page-nav-arrow .line { display: none !important; }
  .page-nav-arrow {
    position: absolute !important;
    top: 12rem !important;
    transform: none !important;
    padding: 0.4rem !important;
    font-size: 0 !important;            /* no text content rendered */
    line-height: 0 !important;
  }
  /* Pure CSS triangles using border trick — won't render as emoji on iOS */
  .page-nav-arrow::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
  }
  .page-nav-arrow.prev::before {
    border-right: 10px solid rgba(255,255,255,0.85);
  }
  .page-nav-arrow.next::before {
    border-left: 10px solid rgba(255,255,255,0.85);
  }
  .page-nav-arrow:hover::before,
  .page-nav-arrow.prev:hover::before { border-right-color: #fff; }
  .page-nav-arrow.next:hover::before { border-left-color: #fff; }
  .page-nav-arrow.prev { left: 0.2rem !important; }
  .page-nav-arrow.next { right: 0.2rem !important; }

  /* Bottom-of-page duplicate arrows (mobile only) */
  .page-nav-arrow-bottom {
    display: flex !important;
  }
}
/* Hide bottom arrows on desktop */
.page-nav-arrow-bottom { display: none; }
@media (max-width: 1000px) {
  /* Re-enter mobile @media block for any further mobile rules */
  .placeholder-noop-rule {}

  /* ── Menu overlay ── */
  .menu-overlay.cinema .menu-list { left: 1.5rem; gap: 0.3rem; }
  .menu-overlay.cinema .menu-list a { font-size: clamp(1.8rem, 9vw, 3rem) !important; }
  .menu-overlay.cinema .menu-aside { display: none; }
}
