/* ═══════════════════════════════════════════════════════════
   viewer.css — Shared project-page viewer & gallery styles
   Used by: vanguard, mirage, modulo, cayman,
            beyondthehorizon, withinthequiet
   Edit here once → every project page updates.
   ═══════════════════════════════════════════════════════════ */

  /* ═══════════ DYNAMIC PROJECT GALLERY (masonry) ═══════════ */
  #projectGallery.project-gallery {
    column-count: 3;
    column-gap: 6px;
    margin: 0 auto;
    max-width: 100%;
    padding: 0;
  }
  #projectGallery .masonry-item {
    break-inside: avoid;
    margin: 0 0 6px 0;
    display: block;
    overflow: hidden;
    background: #131316;
    cursor: pointer;
    position: relative;
    aspect-ratio: auto;
    transition: transform 0.4s cubic-bezier(0.25,0,0,1);
  }
  #projectGallery .masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: filter 0.4s, transform 0.6s cubic-bezier(0.25,0,0,1);
  }
  #projectGallery .masonry-item:hover {
    transform: translateY(-2px);
  }
  #projectGallery .masonry-item:hover img {
    filter: brightness(0.9);
    transform: scale(1.02);
  }
  .project-gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: rgba(232,228,220,0.3);
    font-weight: 700;
  }
  @media (max-width: 900px) {
    #projectGallery.project-gallery { column-count: 2; column-gap: 4px; }
    #projectGallery .masonry-item { margin-bottom: 4px; }
  }
  @media (max-width: 600px) {
    #projectGallery.project-gallery { column-count: 1; }
  }

  /* Project image viewer (same as index page) */
  .proj-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5,5,5,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='2.2' fill='%23f93208'/%3E%3Cline x1='5' y1='5' x2='11.5' y2='11.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='27' y1='5' x2='20.5' y2='11.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='27' y1='27' x2='20.5' y2='20.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='5' y1='27' x2='11.5' y2='20.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 16 16, crosshair;
  }
  .proj-lightbox.open { opacity: 1; pointer-events: auto; }
  .proj-lightbox img {
    max-width: 82vw;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='2.2' fill='%23f93208'/%3E%3Cline x1='5' y1='5' x2='11.5' y2='11.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='27' y1='5' x2='20.5' y2='11.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='27' y1='27' x2='20.5' y2='20.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='5' y1='27' x2='11.5' y2='20.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 16 16, crosshair;
  }
  .proj-lightbox-close {
    position: absolute;
    top: 1.5rem; right: 1.5rem;
    background: none;
    border: none;
    color: white;
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1010;
  }
  .proj-lightbox-close svg { width: 14px; height: 14px; stroke: white; stroke-width: 2; fill: none; }

  /* Lightbox arrows */
  .proj-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
    z-index: 1010;
  }
  .proj-lightbox-arrow:hover {
    background: rgba(249,50,8,0.9);
    border-color: rgba(249,50,8,0.9);
  }
  .proj-lightbox-arrow.prev { left: 2rem; }
  .proj-lightbox-arrow.next { right: 2rem; }
  .proj-lightbox-arrow svg { width: 24px; height: 24px; stroke: white; stroke-width: 2; fill: none; }
  @media (max-width: 700px) {
    .proj-lightbox-arrow { width: 40px; height: 40px; }
    .proj-lightbox-arrow.prev { left: 0.5rem; }
    .proj-lightbox-arrow.next { right: 0.5rem; }
    .proj-lightbox-arrow svg { width: 20px; height: 20px; }
  }

  /* Filmstrip — iPhone Photos scrubber style */
  .proj-filmstrip-wrap {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    z-index: 1005;
    pointer-events: none;
  }
  .proj-filmstrip-counter {
    font-family: var(--font-display);
    font-size: 0.65rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    pointer-events: auto;
  }
  .proj-filmstrip-counter strong { color: var(--accent, #f93208); }

  /* The filmstrip container (holds strip + fixed indicator) */
  .proj-filmstrip-container {
    position: relative;
    width: 92vw;
    max-width: 720px;
    pointer-events: auto;
  }

  /* Center calibrator line (orange, always at horizontal center) */
  .proj-filmstrip-indicator {
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: 50%;
    width: 2px;
    background: var(--accent, #f93208);
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(249,50,8,0.6);
  }
  .proj-filmstrip-indicator::before,
  .proj-filmstrip-indicator::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 2px;
    background: var(--accent, #f93208);
  }
  .proj-filmstrip-indicator::before { top: 0; }
  .proj-filmstrip-indicator::after { bottom: 0; }

  .proj-filmstrip {
    display: flex;
    gap: 4px;
    padding: 8px 50% 8px 50%;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.08);
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
    scroll-snap-type: x mandatory;
    user-select: none;
  }
  .proj-filmstrip.dragging {
    cursor: grabbing;
    scroll-snap-type: none;
  }
  .proj-filmstrip::-webkit-scrollbar { display: none; }
  .proj-filmstrip-thumb {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    opacity: 0.5;
    scroll-snap-align: center;
    transition: opacity 0.2s ease-out, transform 0.25s ease-out;
    will-change: transform, opacity;
    border: 1px solid transparent;
  }
  .proj-filmstrip-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
  }
  .proj-filmstrip:not(.dragging) .proj-filmstrip-thumb:hover {
    opacity: 0.85;
    transform: translateY(-2px) scale(1.06);
  }
  .proj-filmstrip-thumb.active {
    opacity: 1;
    transform: translateY(-4px) scale(1.18);
  }
  @media (max-width: 700px) {
    .proj-filmstrip-thumb { width: 42px; height: 42px; }
    .proj-filmstrip { padding: 6px 50% 6px 50%; }
    .proj-filmstrip-wrap { bottom: 1rem; }
    .proj-filmstrip-container { width: 95vw; }
  }


  /* Pulsing scroll indicator (same as index) */
  .proj-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    display: block;
  }
  .proj-scroll-arrow {
    width: 72px;
    height: 72px;
    border: 1.5px solid rgba(249,50,8,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f93208;
    background: rgba(0,0,0,0.35);
    animation: proj-scroll-bounce 2s ease-in-out infinite;
    transition: background 0.3s, border-color 0.3s;
    pointer-events: none;
  }
  .proj-scroll-hint:hover .proj-scroll-arrow {
    background: rgba(249,50,8,0.9);
    border-color: #f93208;
    color: #ffffff;
  }
  .proj-scroll-arrow svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
  }
  @keyframes proj-scroll-bounce {
    0%, 100% { transform: translateY(0); opacity: 0.85; }
    50% { transform: translateY(8px); opacity: 1; }
  }
  @media (max-width: 700px) {
    .proj-scroll-arrow { width: 56px; height: 56px; }
    .proj-scroll-arrow svg { width: 22px; height: 22px; }
    .proj-scroll-hint { bottom: 1.5rem; }
  }

  /* Return button (same as index) */
  .return-button-wrap {
    background: var(--bg, #0a0a0a);
    padding: 4rem 2rem 3rem 2rem;
    text-align: center;
    z-index: 20;
    position: relative;
  }
  .return-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid rgba(249,50,8,0.5);
    border-radius: 999px;
    color: #f93208;
    font-family: var(--font-display);
    font-size: 0.65rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.35s, color 0.35s, transform 0.35s;
  }
  .return-button:hover {
    background: rgba(249,50,8,0.9);
    color: #ffffff;
    transform: translateY(-2px);
  }
  .return-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: transform 0.35s;
  }
  .return-button:hover svg { transform: translateY(-3px); }
  @media (max-width: 700px) {
    .return-button-wrap { padding: 3rem 1rem 2rem 1rem; }
    .return-button { padding: 0.85rem 1.5rem; font-size: 0.6rem; }
  }

  /* Ensure hero has relative positioning for scroll-hint */
  .project-hero { position: relative; }


  /* ══ Lightbox cursor system ══
     Version D: red dot + exploded cross segments (on bg + main image only).
     All other lightbox elements (arrows, close, filmstrip) keep cursor:none
     so the site's custom dot/ring stays visible and working. */
  .proj-lightbox,
  .proj-lightbox img#projLightboxImg {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='2.2' fill='%23f93208'/%3E%3Cline x1='5' y1='5' x2='11.5' y2='11.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='27' y1='5' x2='20.5' y2='11.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='27' y1='27' x2='20.5' y2='20.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Cline x1='5' y1='27' x2='11.5' y2='20.5' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 16 16, crosshair !important;
  }
  /* Interactive elements keep cursor:none → the site's JS dot/ring serves them */
  .proj-lightbox-arrow,
  .proj-lightbox-close,
  .proj-filmstrip-counter,
  .proj-filmstrip,
  .proj-filmstrip *,
  .proj-filmstrip-thumb {
    cursor: none !important;
  }

  /* JS dot/ring hidden ONLY while hovering the cross-cursor zones */
  body.cross-cursor-zone .cursor-dot,
  body.cross-cursor-zone .cursor-ring {
    opacity: 0 !important;
    visibility: hidden !important;
  }



  /* Freeze page scroll while lightbox is open — both axes */
  body.lightbox-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    touch-action: none;
    overscroll-behavior: none;
  }

  /* Hide custom cursor entirely on mobile / touch devices */
  @media (hover: none), (pointer: coarse), (max-width: 700px) {
    .cursor-dot, .cursor-ring { display: none !important; }
    *, *::before, *::after { cursor: auto !important; }
  }


  /* ═══════════ LIGHTBOX CAPTION BOX (stacked) ═══════════ */
  .proj-lightbox-caption {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    max-width: 320px;
    z-index: 1006;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.35s, transform 0.35s;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.08);
    border-left: 2px solid var(--accent, #f93208);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .proj-lightbox-caption.visible { opacity: 1; transform: translateY(0); }
  .proj-caption-title {
    font-family: var(--font-display); font-size: 0.8rem;
    letter-spacing: 0.15em; text-transform: uppercase;
    color: #fff; font-weight: 700; line-height: 1.4;
  }
  .proj-caption-title:empty { display: none; }
  .proj-caption-text {
    font-family: var(--font-serif); font-style: italic;
    font-size: 0.82rem; line-height: 1.6; color: rgba(232,228,220,0.75);
  }
  .proj-caption-text:empty { display: none; }
  .proj-caption-meta {
    display: flex; flex-direction: column; gap: 0.35rem;
    padding-top: 0.3rem; border-top: 1px solid rgba(255,255,255,0.08);
  }
  .proj-caption-meta:empty { display: none; }
  .proj-caption-meta-row {
    display: flex; align-items: baseline; gap: 0.6rem;
    font-family: var(--font-display); font-size: 0.5rem;
    letter-spacing: 0.25em; text-transform: uppercase; font-weight: 700;
  }
  .proj-caption-meta-row .k { color: var(--accent, #f93208); min-width: 62px; flex-shrink: 0; }
  .proj-caption-meta-row .v { color: rgba(232,228,220,0.6); letter-spacing: 0.15em; }
  @media (max-width: 700px) {
    .proj-lightbox-caption {
      top: 4.5rem; left: 0.8rem; right: auto; max-width: 240px;
      padding: 0.7rem 0.9rem; gap: 0.4rem;
    }
    .proj-caption-title { font-size: 0.62rem; }
    .proj-caption-text { font-size: 0.7rem; }
    .proj-caption-meta-row { font-size: 0.45rem; }
    .proj-caption-meta-row .k { min-width: 52px; }
  }


  /* Scroll progress bar (top of page) */
  .scroll-progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0%;
    background: var(--accent, #f93208);
    z-index: 300;
    pointer-events: none;
    transition: width 0.1s linear;
  }

  /* Back to top button */
  .back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: rgba(10,10,10,0.8);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(232,228,220,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, background 0.3s, border-color 0.3s;
  }
  .back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
  }
  .back-to-top:hover {
    background: rgba(249,50,8,0.9);
    border-color: rgba(249,50,8,0.9);
    color: #fff;
  }
  .back-to-top svg {
    width: 18px; height: 18px;
    stroke: currentColor; stroke-width: 2; fill: none;
  }


  /* Reading progress indicator (right side) */
  .scroll-indicator {
    position: fixed;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    z-index: 90;
    pointer-events: none;
  }
  .scroll-indicator-track {
    width: 2px;
    height: 120px;
    background: rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
  }
  .scroll-indicator-thumb {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 0%;
    background: var(--accent, #f93208);
    transition: height 0.1s linear;
  }
  .scroll-indicator-pct {
    font-family: var(--font-display);
    font-size: 0.5rem;
    letter-spacing: 0.2em;
    color: rgba(232,228,220,0.4);
    font-weight: 700;
    writing-mode: vertical-rl;
  }


  /* Mobile: hide side scroll indicator (must come after base rules) */
  @media (max-width: 900px) {
    .scroll-indicator { display: none !important; }
  }
