/* ── Corporate Case Detail (/khach-doan/:id) ──────────────────────────
   Reuses the site's shared tokens from landing.css (--ink, --muted,
   --ochre, --border, --sand, --sun) and the same gallery+lightbox
   mechanism as tour-detail.css's .dst-td-gallery, renamed to a ccd-
   prefix. The hero tag pill echoes the "ink-stamp" motif already
   established for this section on the landing page (.pe-stamp). */

.ccd-hero {
  margin-top: 68px;
  /* Height follows content — no fixed min-height. The gap down to the
     gallery lives entirely in .ccd-marquee's own top padding (below), not
     here, so header + gallery read as one flow instead of two boxes
     stacked with a hard rule between them. */
  padding: clamp(2.5rem, 5vw, 3.5rem) clamp(2rem, 8vw, 7rem) 0;
  text-align: center;
}
.ccd-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: clamp(1rem, 2.5vw, 2rem);
  text-decoration: none;
  transition: color 0.2s;
}
.ccd-back:hover { color: var(--ink); }
/* The category badge as a "confirmed" ink-stamp, not a flat pill — the same
   device the landing page's Previous Events dossier uses on each event
   photo (.pe-stamp): IBM Plex Mono, sun-orange ink, a faint tilt like it was
   pressed by hand. This page is the record a dossier card links to, so it
   carries the same mark. */
.ccd-tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sun);
  background: #fff;
  border: 1.5px solid var(--sun);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  white-space: nowrap;
  transform: rotate(-3deg);
  box-shadow: 0 2px 6px rgba(18, 54, 66, 0.1);
  margin-bottom: clamp(1rem, 2vw, 1.25rem);
}
.ccd-title {
  font-family: var(--font-display);
  /* Editorial, not landing-page-hero: 28px mobile → ~38px tablet → capped
     at 44px desktop. */
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 24ch;
  margin: 0 auto;
  text-wrap: balance;
}

/* ── Video ── */
.ccd-video {
  padding: clamp(2rem, 3vw, 3rem) clamp(2rem, 8vw, 7rem) clamp(4rem, 8vw, 6rem);
  display: flex;
  justify-content: center;
}
.ccd-video-frame {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--sand);
  box-shadow: 0 24px 60px rgba(18,54,66,0.14);
}
.ccd-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ── Gallery — infinite horizontal marquee, right→left. Any photo count
   (0/1/2/3.../20+) works: the track is the (capped, see MAX_MARQUEE_IMAGES
   in the page component) photo set repeated `--repeat` times: every repeat
   is byte-identical, so animating exactly one repeat-width always loops
   seamlessly with no JS width measurement, and repeat count scales up for
   small photo counts so 2-3 photos never show a visible gap. Every tile
   opens the lightbox (unchanged) at its original photo index. */
.ccd-marquee {
  overflow: hidden;
  /* This top padding is the entire header→gallery gap (.ccd-hero has none
     of its own) — 24px mobile up to 48px desktop, replacing the old
     hero-bottom-padding + marquee-top-padding + border-bottom stack that
     read as two separate, too-far-apart sections. */
  padding: clamp(1.5rem, 3vw, 3rem) 0 0;
  /* Fade the two edges so tiles read as "continuing" past the frame rather
     than hard-cut — cheap, GPU-composited, purely decorative. */
  mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 48px, #000 calc(100% - 48px), transparent 100%);
}
.ccd-marquee-track {
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  padding: 0 clamp(1rem, 4vw, 2rem);
  animation: ccd-marquee 32s linear infinite;
}
.ccd-marquee:hover .ccd-marquee-track,
.ccd-marquee:focus-within .ccd-marquee-track {
  animation-play-state: paused;
}
/* Single-photo case: no loop, no duplication — just a static strip. */
.ccd-marquee-track--static { animation: none; }
@keyframes ccd-marquee {
  to { transform: translate3d(calc(-100% / var(--repeat, 2)), 0, 0); }
}
.ccd-marquee-tile {
  margin: 0;
  flex: 0 0 auto;
  height: clamp(150px, 14vw, 190px);
  aspect-ratio: 4 / 3;
}
.ccd-marquee-tile button {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: none;
  border-radius: 12px;
  background: var(--sand);
  padding: 0;
  cursor: pointer;
}
.ccd-marquee-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.ccd-marquee-tile button:hover img { transform: scale(1.05); }
.ccd-marquee-tile button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ── Lightbox ── */
.ccd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 2rem);
}
.ccd-lightbox[hidden] { display: none; }
.ccd-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18,54,66,0.82);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}
.ccd-lightbox-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: min(1100px, 94vw);
  max-height: 88vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 30px 80px -24px rgba(4,32,43,0.7);
  padding: 0.9rem;
}
.ccd-lightbox-stage {
  grid-column: 2;
  grid-row: 1 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--sand);
  display: grid;
  place-items: center;
  min-height: 40vh;
  max-height: 78vh;
}
.ccd-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
.ccd-lightbox-close {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.ccd-lightbox-close:hover { color: var(--ochre); border-color: var(--ochre); }
.ccd-lightbox-close:focus-visible,
.ccd-lightbox-nav:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ccd-lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.ccd-lightbox-nav:hover { color: var(--ochre); border-color: var(--ochre); }
.ccd-lightbox-prev { grid-column: 1; grid-row: 1 / 3; }
.ccd-lightbox-next { grid-column: 3; grid-row: 1 / 3; }
.ccd-lightbox-counter {
  grid-column: 1 / 4;
  grid-row: 3;
  justify-self: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

/* ── Description ── */
.ccd-body {
  /* No bottom padding here — the gap down to Video lives entirely in
     .ccd-video's own top padding, so the two sections don't each add their
     own spacing on top of the other. Top padding is the whole
     Gallery→Description gap — 24px mobile up to 48px desktop. */
  padding: clamp(1.5rem, 3vw, 3rem) clamp(2rem, 8vw, 7rem) 0;
  display: flex;
  justify-content: center;
}
.ccd-content {
  max-width: 900px;
  width: 100%;
  font-size: clamp(1.05rem, 1.6vw, 1.15rem);
  line-height: 1.85;
  color: var(--ink);
}
.ccd-content p { margin-bottom: 1.6em; }
.ccd-content ul {
  margin: 0 0 1.6em;
  padding-left: 1.3em;
}
.ccd-content li { margin-bottom: 0.5em; }
.ccd-content li::marker { color: var(--ochre); }
/* Without an explicit rule, <strong>/<b> only get the UA default "bolder"
   step, which reads as barely-different from the surrounding text at this
   page's weight/size — same fix as destination.css's --content-bold-weight
   rules for .dst-day-desc etc. Colored with --ochre (this page's accent,
   already used for the bullet marker above) rather than plain ink, so a
   bolded word pops at a glance instead of just reading slightly heavier. */
.ccd-content strong, .ccd-content b { font-weight: 700; color: var(--ochre); }
.ccd-content .ccd-heading { margin: 0.5em 0 0.8em; }
.ccd-content > :last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .ccd-lightbox-panel { grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.5rem; padding: 0.5rem; }
  .ccd-lightbox-stage { min-height: 30vh; }
}

@media (max-width: 560px) {
  .ccd-marquee-track { gap: 12px; }
  .ccd-marquee-tile { height: clamp(100px, 32vw, 140px); }
}

/* Respect reduced-motion: freeze the loop and let people swipe/scroll the
   (already-duplicated) track by hand instead of forcing continuous motion. */
@media (prefers-reduced-motion: reduce) {
  .ccd-marquee-tile img,
  .ccd-lightbox-panel { transition: none; }
  .ccd-marquee-track { animation: none; }
  .ccd-marquee {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    mask-image: none;
    -webkit-mask-image: none;
  }
}
