/* ===== PopUp — Case Detail (case.php) — minimalista ===== */
/* Depende de styles.css (tokens) e cases.css (topbar, lightbox) */

/* ---- HERO SPLIT — mídia fixa (sticky) enquanto o conteúdo rola ao lado ---- */
.cd-split {
  padding: clamp(92px,11vh,124px) 0 60px;
}
.cd-split-wrap {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(32px,5vw,64px);
  align-items: start;
}
.cd-split-media {
  position: sticky;
  top: 92px;
}
.cd-split-content {
  display: flex;
  flex-direction: column;
  padding-top: 6px;
}

.cd-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 26px;
}
.cd-breadcrumb a { color: inherit; transition: color .2s; }
.cd-breadcrumb a:hover { color: var(--fg); }
.cd-breadcrumb .sep { opacity: .35; font-size: 10px; }

.cd-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cd-case-no {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
}
.cd-seg-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--faint);
  border: 1px solid var(--line-2);
  padding: 4px 13px;
  border-radius: 999px;
}

.cd-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(32px, 4.4vw, 58px);
  line-height: .94;
  letter-spacing: -.03em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 20px;
}

.cd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 26px;
}
.cd-tags span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .05em;
  color: var(--violet-2);
  border: 1px solid rgba(124, 92, 255, .28);
  background: rgba(124, 92, 255, .07);
  padding: 5px 13px;
  border-radius: 999px;
}

.cd-desc {
  font-size: clamp(15.5px, 1.4vw, 17.5px);
  line-height: 1.68;
  color: var(--fg);
  margin-bottom: 24px;
}

.cd-cta-inline {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  border: 1px solid var(--line-2);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--panel);
  transition: background .25s, color .25s, border-color .25s;
  width: fit-content;
  margin-bottom: 36px;
}
.cd-cta-inline:hover { background: var(--panel-2); color: var(--fg); border-color: var(--line); }
.cd-cta-inline svg { flex-shrink: 0; }

/* Info card — flows naturally in the content column (the media column
   handles the sticky behaviour, so this doesn't need to pin itself) */
.cd-info-col {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--panel);
}

/* ---- MAIN MEDIA ---- */
.cd-main-media-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg, 18px);
  background: var(--panel);
  border: 1px solid var(--line);
  width: 100%;
  aspect-ratio: var(--ar, 16/9);
  max-height: 84vh;
  margin: 0 auto;
  transition: width .5s var(--ease), height .5s var(--ease);
}
.cd-main-media-wrap img,
.cd-main-media-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* No media placeholder */
.cd-main-media-wrap.cd-no-media {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(130% 130% at 15% 0%, rgba(124, 92, 255, .1), transparent 55%),
    radial-gradient(90% 100% at 85% 100%, rgba(34, 227, 195, .07), transparent 55%),
    var(--panel);
}
.cd-no-media-msg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--faint);
}
.cd-info-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cd-info-item:last-child { border-bottom: 0; }
.cd-info-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--faint);
}
.cd-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.4;
}

/* ---- GALLERY / TODOS OS ARQUIVOS ---- */
.cd-gallery {
  padding: 52px 0 60px;
  border-bottom: 1px solid var(--line);
}
.cd-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.cd-gcount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
}

/* each file loads inside a phone-screen mockup — a lively, dynamic wall
   of devices instead of a flat image grid */
.cd-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 36px 20px;
  justify-items: center;
}
.cd-gallery-grid:has(.cd-gitem:only-child) { grid-template-columns: minmax(200px, 260px); }

.cd-gitem {
  position: relative;
  width: 100%;
  max-width: 240px;
  cursor: pointer;
  perspective: 900px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.cd-gitem.in { opacity: 1; transform: none; }
.cd-gitem:focus-visible { outline: 2px solid var(--cyan); outline-offset: 6px; border-radius: 34px; }

/* phone chassis — dark bezel + notch, regardless of site theme.
   aspect-ratio starts at a reasonable placeholder and is overridden inline
   by JS once the real image/video dimensions are known, so the screen
   always matches the file's real proportions instead of cropping it. */
.cd-phone {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  padding: 9px;
  border-radius: 34px;
  background: linear-gradient(155deg, #2c2c35, #0b0b10);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 24px 50px -22px rgba(0,0,0,.65);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
  transform-style: preserve-3d;
  will-change: transform;
}
.cd-gitem:hover .cd-phone,
.cd-gitem:focus-visible .cd-phone {
  box-shadow: 0 34px 70px -26px rgba(0,0,0,.75);
}
.cd-phone-notch {
  position: absolute;
  top: 9px; left: 50%;
  transform: translateX(-50%);
  width: 32%;
  height: 16px;
  background: #0b0b10;
  border-radius: 10px;
  z-index: 3;
}
.cd-phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 25px;
  background: #000;
}
.cd-phone-screen img,
.cd-phone-screen video {
  display: block;
  width: 100%;
  height: 100%;
  /* the frame's aspect-ratio is set inline to match the file's real
     proportions (see gallery tilt/fit script), so "contain" never has to
     letterbox — it's just the safety net against rounding, never a crop. */
  object-fit: contain;
  transition: transform .65s var(--ease);
}
.cd-gitem:hover .cd-phone-screen img,
.cd-gitem:hover .cd-phone-screen video { transform: scale(1.05); }

/* overlay — bounded to the phone screen */
.cd-gitem-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 9, .46);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity .22s;
}
.cd-gitem:hover .cd-gitem-overlay,
.cd-gitem:focus-visible .cd-gitem-overlay { opacity: 1; }
.cd-gitem-overlay svg { width: 26px; height: 26px; color: #fff; }
.cd-gitem-name {
  max-width: 84%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: rgba(255,255,255,.9);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* always-visible kind chip — image/video */
.cd-gitem-kind {
  position: absolute;
  top: 14px; left: 10px;
  z-index: 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.9);
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ---- PDF item ---- */
.cd-gitem--pdf {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  cursor: pointer;
  border-radius: var(--r);
  transition: background .25s, border-color .25s;
}
.cd-gitem--pdf:hover { background: var(--panel-2); border-color: var(--line-2); }
.cd-gitem--pdf .cd-pdf-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(124, 92, 255, .14);
  border: 1px solid rgba(124, 92, 255, .22);
  display: grid;
  place-items: center;
  color: var(--violet-2);
}
.cd-gitem--pdf .cd-pdf-icon svg { width: 20px; height: 20px; }
.cd-gitem--pdf .cd-pdf-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.cd-gitem--pdf .cd-pdf-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cd-gitem--pdf .cd-pdf-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.cd-gitem--pdf .cd-pdf-open {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cyan);
}
.cd-gitem--pdf .cd-pdf-open svg { width: 14px; height: 14px; }

/* ---- OUTROS TRABALHOS ---- */
.cd-more {
  padding: 52px 0 60px;
  border-bottom: 1px solid var(--line);
}
.cd-more-all {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

/* ---- CTA ---- */
.cd-cta-final {
  border-top: 1px solid var(--line);
  padding: 72px 0 0;
}

/* ---- PREV / NEXT NAV ---- */
.cd-nav { border-top: 1px solid var(--line); }
.cd-nav-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.cd-nav-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 30px 36px;
  text-decoration: none;
  color: var(--fg);
  border-right: 1px solid var(--line);
  transition: background .25s;
}
.cd-nav-item:last-child { border-right: 0; }
.cd-nav-item:hover { background: var(--panel); }
.cd-nav-empty { border-right: 1px solid var(--line); }

.cd-nav-dir {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}
.cd-nav-dir svg { width: 13px; height: 13px; color: var(--cyan); flex-shrink: 0; }
.cd-nav-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: clamp(18px, 2.5vw, 30px);
  letter-spacing: -.02em;
  line-height: 1.05;
  transition: color .2s;
}
.cd-nav-item:hover .cd-nav-name { color: var(--cyan); }
.cd-nav-seg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}
.cd-nav-next { text-align: right; }
.cd-nav-next .cd-nav-dir { justify-content: flex-end; }

/* ---- [data-rise] ---- */
[data-rise] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .65s var(--ease), transform .65s var(--ease);
}
[data-rise].in { opacity: 1; transform: none; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .cd-split-wrap { display: block; }
  .cd-split-media { position: static; margin-bottom: 32px; }
}
@media (max-width: 580px) {
  .cd-nav-wrap { grid-template-columns: 1fr; }
  .cd-nav-item { padding: 22px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .cd-nav-item:last-child { border-bottom: 0; }
  .cd-nav-empty { display: none; }
  .cd-nav-next { text-align: left; }
  .cd-nav-next .cd-nav-dir { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  [data-rise], .cd-gitem {
    transition: none !important; opacity: 1 !important; transform: none !important;
  }
  .cd-gitem img, .cd-gitem video, .cd-phone { transition: none !important; }
}
