/* =============================================================
   WLWYB WEB 3.0 -- Dossier Overlay System (DVPT-M05)
   Loads over 001-b2b/index.html when a case card is clicked.
   ============================================================= */

/* ---- Overlay = backdrop scrim ------------------------------ */

.dossier-overlay {
  position: fixed;
  inset: 0;
  /* Below the bottom nav (450) so the navbar stays visible over an open file;
     the lightbox (600) and consent banner (500) still sit above. */
  z-index: 400;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease-cinematic);
}

.dossier-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Sliding panel (the stage) ----------------------------- */

.dossier-panel {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--color-void);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-overlay);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 320ms var(--ease-cinematic), transform 420ms var(--ease-cinematic);
}

.dossier-overlay.is-open .dossier-panel {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Header bar ------------------------------------------- */

.dossier-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-7);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-void);
}

.dossier-close-btn {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2) 0;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  transition: color 200ms ease;
}

.dossier-close-btn:hover { color: var(--color-primary); }

.dossier-bar-id {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-muted);
  letter-spacing: var(--tracking-widest);
  white-space: nowrap;
}

/* ---- Scrollable body -------------------------------------- */

.dossier-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  max-width: none;
  width: 100%;
}

/* ---- Stage: hero object, then the file -------------------- */

.dossier-stage {
  display: flex;
  flex-direction: column;
}

/* The model, lit like an exhibition object on a near-black void.
   A wide band so the landscape renders read at size. */
.dossier-hero {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: clamp(300px, 44vh, 460px);
  margin: 0;
  background: var(--color-void);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Custom glow behind the object -- position + size driven per image via
   --gx/--gy (center) and --gw/--gh (ellipse size) with --gs (strength). */
.dossier-hero-light {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    var(--gw, 85%) var(--gh, 72%) at var(--gx, 50%) var(--gy, 52%),
    rgba(245, 240, 224, var(--gs, 0.30)) 0%,
    rgba(245, 240, 224, calc(var(--gs, 0.30) * 0.42)) 26%,
    rgba(10, 10, 9, 0) 64%);
  opacity: 0;
  animation: dossier-light 1400ms var(--ease-cinematic) 120ms both;
}

/* The transparent object floats bright on the void, glow behind it */
.dossier-hero-img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  filter: drop-shadow(0 26px 50px rgba(0, 0, 0, 0.55));
  transform: scale(1);
  animation: dossier-reveal 1300ms var(--ease-cinematic) 80ms both;
}

.dossier-hero-pending {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-cell);
}

.dossier-hero-pending span {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  letter-spacing: var(--tracking-wider);
  color: var(--color-muted);
}

/* Gentle floor gradient: grounds the object and keeps the caption legible
   without flattening the lit model above it. */
.dossier-hero-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to top, rgba(10, 10, 9, 0.92) 0%, rgba(10, 10, 9, 0.5) 44%, rgba(10, 10, 9, 0));
}

.dossier-hero-cap {
  position: absolute;
  left: var(--space-8);
  right: var(--space-8);
  bottom: var(--space-7);
  z-index: 4;
  margin: 0;
}

/* Client logo: a quiet exhibition-label mark, top-right of the stage.
   White-on-dark SVG, kept small and softened so it reads as a watermark. */
.dossier-hero-logo {
  position: absolute;
  top: var(--space-6);
  right: var(--space-8);
  z-index: 4;
  height: 24px;
  width: auto;
  max-width: 140px;
  opacity: 0.55;
  pointer-events: none;
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.5));
  animation: dossier-assemble 600ms var(--ease-cinematic) 720ms both;
}

/* The file: copy band under the object. Prose left, facts rail right. */
.dossier-file {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-7) var(--space-8);
}

@media (min-width: 901px) {
  .dossier-file {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
    gap: var(--space-8);
    padding: var(--space-6) var(--space-9) var(--space-8);
  }
}

.dossier-file-main { max-width: 620px; }

/* Facts rail: spec items + claim tags, mono data layer */
.dossier-file-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.dossier-spec-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dossier-spec-item {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  line-height: var(--leading-normal);
  color: var(--color-secondary);
  letter-spacing: var(--tracking-wide);
}

/* Aftermatter: supplemental views, full width under the file */
.dossier-aftermatter {
  border-top: 1px solid var(--color-border);
  padding: var(--space-7) var(--space-7) var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

@media (min-width: 901px) {
  .dossier-aftermatter { padding: var(--space-7) var(--space-9) var(--space-10); }
}

.dossier-aftermatter-label {
  font-family: var(--font-mono);
  font-size: var(--size-2xs);
  color: var(--color-muted);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}

/* ---- Accession + meta ------------------------------------- */

.dossier-accession {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-muted);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  display: block;
  margin-bottom: var(--space-3);
}

.dossier-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}

.dossier-meta-item {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-dim);
  letter-spacing: var(--tracking-wide);
}

.dossier-meta-sep {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-muted);
  user-select: none;
}

/* ---- Title ------------------------------------------------ */

.dossier-title {
  font-family: var(--font-display);
  font-size: clamp(var(--size-2xl), 4.5vw, var(--size-3xl));
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-bright);
  margin: var(--space-3) 0 var(--space-4);
  max-width: 640px;
  text-wrap: balance;
}

/* ---- Hero caption: metadata assembles over the lit object - */

.dossier-hero-cap .dossier-accession {
  color: var(--color-dim);
  margin-bottom: var(--space-2);
  animation: dossier-assemble 600ms var(--ease-cinematic) 520ms both;
}

.dossier-hero-cap .dossier-title {
  font-size: clamp(var(--size-2xl), 6vw, var(--size-3xl));
  margin-bottom: var(--space-4);
  max-width: 18ch;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
  animation: dossier-assemble 700ms var(--ease-cinematic) 600ms both;
}

.dossier-hero-cap .dossier-meta {
  margin-bottom: 0;
  animation: dossier-assemble 600ms var(--ease-cinematic) 720ms both;
}

.dossier-hero-cap .dossier-meta-item { color: var(--color-secondary); }

@keyframes dossier-light {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes dossier-reveal {
  0%   { opacity: 0; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes dossier-assemble {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Divider ---------------------------------------------- */

.dossier-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-7) 0;
}

/* ---- Copy: essence line + paragraph + spec ---------------- */

/* Essence line: the idea in one breath. Sits under the title, lighter. */
.dossier-lede {
  font-family: var(--font-display);
  font-size: clamp(var(--size-md), 1.6vw, var(--size-lg));
  font-weight: 500;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-primary);
  max-width: 28ch;
  text-wrap: balance;
  margin: 0 0 var(--space-4);
}

/* The paragraph: the moment + the proof, boardroom register. */
.dossier-prose {
  font-family: var(--font-primary);
  font-size: var(--size-base);
  line-height: var(--leading-loose);
  color: var(--color-primary);
  max-width: 600px;
  margin: 0;
}

/* The hard facts, held in the mono data layer. */
.dossier-spec {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  line-height: var(--leading-normal);
  color: var(--color-muted);
  letter-spacing: var(--tracking-wide);
  max-width: 600px;
  margin: var(--space-6) 0 0;
}

/* ---- Sections (legacy fallback) --------------------------- */

.dossier-section {
  margin-bottom: var(--space-6);
}

.dossier-section:last-of-type { margin-bottom: 0; }

.dossier-section-label {
  font-family: var(--font-mono);
  font-size: var(--size-2xs);
  color: var(--color-muted);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  display: block;
  margin-bottom: var(--space-4);
}

.dossier-section-text {
  font-family: var(--font-primary);
  font-size: var(--size-base);
  line-height: var(--leading-loose);
  color: var(--color-primary);
  max-width: 600px;
}

/* ---- Testimonial ------------------------------------------ */

.dossier-testimonial-quote {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: 500;
  font-style: italic;
  line-height: var(--leading-snug);
  color: var(--color-primary);
  max-width: 560px;
  margin: 0 0 var(--space-3);
}

.dossier-testimonial-cite {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-dim);
  letter-spacing: var(--tracking-wide);
  font-style: normal;
  display: block;
}

/* ---- Photography grid ------------------------------------- */

/* Supplemental views read as secondary: a row of smaller thumbnails. */
.dossier-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 260px));
  gap: var(--space-4);
  justify-content: start;
}

/* Annual editions read as a prominent set: larger tiles that fill the row. */
.dossier-photo-grid.is-editions {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.dossier-photo {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.dossier-photo-item {
  position: relative;
  width: 100%;
  background: var(--color-void);
  overflow: hidden;
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Edition caption: year, then the model name */
.dossier-photo-cap {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.dossier-photo-year {
  font-family: var(--font-mono);
  font-size: var(--size-sm);
  color: var(--color-secondary);
  letter-spacing: var(--tracking-wide);
}

.dossier-photo-name {
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-muted);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

/* Each supplemental object gets its own custom glow, same vars as the hero */
.dossier-photo-light {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    var(--gw, 88%) var(--gh, 72%) at var(--gx, 50%) var(--gy, 54%),
    rgba(245, 240, 224, var(--gs, 0.26)) 0%,
    rgba(245, 240, 224, calc(var(--gs, 0.26) * 0.4)) 28%,
    rgba(10, 10, 9, 0) 66%);
}

.dossier-photo-item img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.5));
  transition: opacity 300ms ease;
}

/* ---- Claim tags ------------------------------------------- */

.dossier-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.dossier-tag {
  font-family: var(--font-mono);
  font-size: var(--size-2xs);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  padding: var(--space-1) var(--space-3);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ---- Lightbox --------------------------------------------- */

.dossier-lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.dossier-lightbox[hidden] { display: none; }

.lightbox-close {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--size-xs);
  color: var(--color-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  letter-spacing: var(--tracking-wide);
  transition: color 200ms;
  z-index: 1;
}

.lightbox-close:hover { color: var(--color-primary); }

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  cursor: default;
}

/* ---- Responsive ------------------------------------------- */

/* Desktop: leave the 300px evidence rail uncovered so all six
   files stay visible while one is open on the stage. */
@media (min-width: 901px) {
  .dossier-overlay { right: 300px; }
}

@media (max-width: 900px) {
  .dossier-bar { padding: var(--space-3) var(--space-5); }
  .dossier-hero { height: clamp(260px, 42vh, 420px); }
  .dossier-hero-logo { top: var(--space-5); right: var(--space-5); height: 18px; }
  .dossier-photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 220px)); }
  .dossier-title { font-size: var(--size-2xl); }
}

/* ---- Reduced motion --------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .dossier-overlay { transition: none; }
  .dossier-panel { transition: none; transform: none; }
  .dossier-photo-item img { transition: none; }
  .dossier-hero-img { animation: none; filter: none; transform: none; }
  .dossier-hero-light { animation: none; opacity: 1; }
  .dossier-hero-cap .dossier-accession,
  .dossier-hero-cap .dossier-title,
  .dossier-hero-cap .dossier-meta { animation: none; opacity: 1; transform: none; }
}

/* ---- Light mode ------------------------------------------- */

[data-theme="light"] .dossier-overlay {
  background: rgba(40, 38, 30, 0.4);
}

[data-theme="light"] .dossier-panel {
  background: #f5f4ef;
}

[data-theme="light"] .dossier-bar {
  background: #f5f4ef;
}

[data-theme="light"] .dossier-lightbox {
  background: rgba(240, 240, 228, 0.98);
}

[data-theme="light"] .dossier-photo-item {
  background: #e5e3dc;
}
