/* ── 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;
  padding: clamp(4rem, 8vw, 6rem) clamp(2rem, 8vw, 7rem) clamp(2.5rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--border);
}
.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: 1.75rem;
  text-decoration: none;
  transition: color 0.2s;
}
.ccd-back:hover { color: var(--ink); }
.ccd-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ochre);
  margin-bottom: 1rem;
}
.ccd-hero-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
}
.ccd-tag {
  flex-shrink: 0;
  font-size: 0.68rem;
  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.85rem;
  white-space: nowrap;
}
.ccd-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--ink);
  max-width: 900px;
}

/* ── Video ── */
.ccd-video {
  padding: clamp(2rem, 4vw, 3rem) clamp(2rem, 8vw, 7rem) 0;
  display: flex;
  justify-content: center;
}
.ccd-video-frame {
  position: relative;
  width: 100%;
  max-width: 1000px;
  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 — a uniform grid of fixed-size tiles, so every photo (any
   count, any source aspect ratio) reads at the same size instead of the
   lopsided "1 big + 4 small" layout this replaced. Every tile opens the
   lightbox at its own index. */
.ccd-gallery {
  /* Flexbox, not grid: justify-content:center on a wrapping flex container
     centers each ROW independently, so a lone leftover tile from an odd
     photo count centers itself in its own row instead of sitting
     left-aligned under a centered grid block. */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) clamp(2rem, 8vw, 7rem) 0;
}
.ccd-gallery-tile {
  margin: 0;
  /* Fixed size, never grows/shrinks to fill leftover row space — the
     bug this whole layout exists to avoid. */
  flex: 0 0 auto;
  width: clamp(220px, 30vw, 340px);
}
.ccd-gallery-tile button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: none;
  border-radius: 10px;
  background: var(--sand);
  padding: 0;
  cursor: pointer;
}
.ccd-gallery-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-gallery-tile button:hover img { transform: scale(1.05); }
.ccd-gallery-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 {
  padding: clamp(3rem, 6vw, 5rem) clamp(2rem, 8vw, 7rem) clamp(5rem, 8vw, 7rem);
  display: flex;
  justify-content: center;
}
.ccd-content {
  max-width: 640px;
  width: 100%;
  font-size: clamp(1.05rem, 1.6vw, 1.15rem);
  line-height: 1.85;
  color: var(--ink);
}
.ccd-content p {
  white-space: pre-line;
  margin-bottom: 1.6em;
}
.ccd-content p:last-child { margin-bottom: 0; }
.ccd-first-p::first-letter {
  font-family: var(--font-display);
  font-size: 4.1em;
  font-weight: 500;
  font-style: italic;
  float: left;
  line-height: 0.78;
  margin: 0.06em 0.15em 0 0;
  color: var(--ochre);
}

@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 (prefers-reduced-motion: reduce) {
  .ccd-gallery-tile img,
  .ccd-lightbox-panel { transition: none; }
}
