/* ==========================================================================
   VIBEFRAME Lab - Our Case Studies
   High-craft frosted lilac aesthetic matching VIBEFRAME Design System
   ========================================================================== */

.case-studies-wrap {
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
}

/* --- Top Case Selector Grid --- */
.case-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.case-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 16px 18px 16px;
  border-radius: 16px;
  border: 1px solid #e2d1eb;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(247, 239, 251, 0.8));
  box-shadow: 0 4px 16px rgba(175, 140, 192, 0.07);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s,
              background 0.25s,
              box-shadow 0.25s;
  position: relative;
  min-height: 108px;
}

.case-nav-btn:hover {
  transform: translateY(-2px);
  border-color: #cb9de0;
  box-shadow: 0 8px 24px rgba(162, 115, 181, 0.14);
}

.case-nav-btn[aria-selected="true"] {
  border-color: #b37cd0;
  background: linear-gradient(145deg, #ffffff, #f0def7);
  box-shadow: 0 0 0 2px rgba(179, 124, 208, 0.35), 0 10px 28px rgba(162, 115, 181, 0.18);
  transform: translateY(-3px);
}

.case-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
}

.case-nav-num {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #a47bb4;
}

.case-nav-tag {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #926d9f;
  background: rgba(220, 195, 233, 0.35);
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(206, 175, 222, 0.45);
}

.case-nav-title {
  font-size: 17px;
  font-weight: 550;
  letter-spacing: -0.025em;
  color: #452656;
  margin: 0 0 4px;
  line-height: 1.2;
}

.case-nav-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: #887093;
  margin: 0;
}

/* --- Active Showcase Stage --- */
.case-showcase-stage {
  border-radius: 20px;
  border: 1px solid #e4d3ec;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(252, 248, 254, 0.92));
  box-shadow: 0 8px 32px rgba(160, 120, 180, 0.08);
  padding: 28px 30px;
  animation: caseFadeIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 480px;
}

@keyframes caseFadeIn {
  from {
    opacity: 0.3;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.case-badge-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid #ebddf2;
}

.case-badge-heading h3 {
  font-size: 22px;
  font-weight: 550;
  letter-spacing: -0.025em;
  color: #412452;
  margin: 0;
}

.case-badge-pill {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b5aa0;
  background: #f4e8f9;
  border: 1px solid #dcbfe9;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

/* --- Media Shell (Dark inset container matching Brand Film) --- */
.case-media-shell {
  position: relative;
  background: #140c1c;
  border: 1px solid #e1cdeb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(20, 12, 28, 0.18);
}

.case-media-shell video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #140c1c;
}

.case-poster-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(28, 16, 40, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: #ffffff;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s, border-color 0.2s;
  z-index: 4;
}

.case-poster-play svg {
  display: block;
  width: 30px;
  height: 30px;
  fill: currentColor;
  flex-shrink: 0;
}

.case-poster-play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(142, 85, 175, 0.9);
  border-color: #ffffff;
}

.case-poster-play[hidden] {
  display: none !important;
}

.case-media-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 10px;
  font-size: 12.5px;
  color: #8c7697;
}

.case-step-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9c6eab;
  margin: 0 0 8px;
  display: block;
}

/* ==========================================================================
   CASE 01: Music Notes
   ========================================================================== */
.music-stage-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 36px;
  align-items: start;
}

.music-audio-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.audio-track-card {
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid #e7d8ef;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(160, 120, 180, 0.05);
}

.audio-track-card h4 {
  font-size: 18px;
  font-weight: 550;
  color: #3b1f48;
  margin: 4px 0 12px;
}

.audio-waveform-btn {
  display: block;
  width: 100%;
  height: 64px;
  padding: 0;
  border-radius: 8px;
  background: #140c1c;
  overflow: hidden;
  border: 1px solid #362244;
  cursor: pointer;
  position: relative;
  transition: opacity 0.2s, border-color 0.2s;
}

.audio-waveform-btn:hover {
  border-color: #ba88d2;
}

.audio-waveform-btn img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.9;
}

.audio-track-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.audio-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 20px;
  border: 1px solid #dcbfe9;
  background: #fbf5fd;
  color: #6a3e7e;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.audio-play-btn svg {
  display: block;
  width: 12px;
  height: 12px;
  fill: currentColor;
  flex-shrink: 0;
}

.audio-play-btn svg.icon-play {
  margin-left: 0;
}

.audio-play-btn:hover {
  background: #f2e2f8;
  border-color: #ba88d2;
}

.audio-seek-slider {
  flex: 1;
  accent-color: #9e64b4;
  height: 4px;
  cursor: pointer;
}

.audio-time-label {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #8c7697;
  min-width: 72px;
  text-align: right;
}

.music-sequence-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #f7eefa;
  border: 1px solid #dec3ec;
  margin-top: 6px;
}

.btn-sequence-play {
  padding: 9px 18px;
  border-radius: 20px;
  background: #8b4fa1;
  color: #ffffff;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-sequence-play:hover {
  background: #793f8e;
  transform: translateY(-1px);
}

.btn-case-reset {
  padding: 8px 14px;
  border-radius: 18px;
  border: 1px solid #d9c1e7;
  background: #ffffff;
  color: #7b598b;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-case-reset:hover {
  background: #f7effb;
}

.case-live-status {
  font-size: 12.5px;
  color: #825f93;
  margin-left: auto;
  font-weight: 450;
}

.music-video-pane {
  display: flex;
  flex-direction: column;
}

.music-video-pane .case-media-shell {
  aspect-ratio: 1 / 1;
  width: 100%;
}

/* ==========================================================================
   CASE 02: Short-video Director Agent
   ========================================================================== */
.director-stage-layout {
  display: grid;
  grid-template-columns: 260px 1fr 290px;
  gap: 28px;
  align-items: start;
}

.director-input-card {
  display: flex;
  flex-direction: column;
}

.input-image-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e1cdeb;
  background: #140c1c;
  position: relative;
  cursor: pointer;
  padding: 0;
  display: block;
}

.input-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-image-thumb:hover img {
  transform: scale(1.04);
}

.input-image-zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(23, 15, 32, 0.75);
  color: #ffffff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.director-brief-card {
  padding: 10px 4px;
}

.director-quote {
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.35;
  letter-spacing: -0.03em;
  color: #3f224f;
  margin: 12px 0 24px;
  font-style: italic;
  font-family: serif, var(--font-body, system-ui);
}

.director-direction-block {
  border-top: 1px solid #ebddf2;
  padding-top: 18px;
  margin-top: 18px;
}

.director-direction-block h5 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a6aa8;
  margin: 0 0 8px;
}

.director-direction-block p {
  font-size: 15px;
  line-height: 1.65;
  color: #654a72;
  margin: 0 0 16px;
}

.director-video-pane {
  display: flex;
  flex-direction: column;
}

.director-video-pane .case-media-shell {
  aspect-ratio: 3 / 4;
  width: 100%;
}

/* ==========================================================================
   CASE 03: AI for Science
   ========================================================================== */
.science-stage-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 36px;
  align-items: start;
}

.science-steps-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.science-step-card {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #ebdff2;
  background: rgba(255, 255, 255, 0.7);
}

.science-step-num {
  font-size: 13px;
  font-weight: 600;
  color: #a47bb4;
}

.science-step-card h5 {
  font-size: 16px;
  font-weight: 550;
  color: #40234d;
  margin: 0 0 4px;
}

.science-step-card p {
  font-size: 13.5px;
  line-height: 1.5;
  color: #7b6287;
  margin: 0;
}

.science-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.science-tag-chip {
  font-size: 11px;
  color: #8c579f;
  background: #f5ebf9;
  border: 1px solid #dfc7eb;
  padding: 4px 10px;
  border-radius: 14px;
}

.science-video-pane {
  display: flex;
  flex-direction: column;
}

.science-clip-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.science-tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #dfcbe8;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.science-tab-btn img {
  width: 46px;
  height: 28px;
  object-fit: cover;
  border-radius: 5px;
  opacity: 0.7;
}

.science-tab-btn span {
  font-size: 12.5px;
  color: #765a84;
  font-weight: 500;
}

.science-tab-btn[aria-selected="true"] {
  border-color: #ba88d2;
  background: #f4e6fa;
  box-shadow: 0 0 0 2px rgba(186, 136, 210, 0.25);
}

.science-tab-btn[aria-selected="true"] img {
  opacity: 1;
}

.science-tab-btn[aria-selected="true"] span {
  color: #452656;
  font-weight: 600;
}

.science-video-pane .case-media-shell {
  aspect-ratio: 16 / 9;
  width: 100%;
}

/* ==========================================================================
   CASE 04: Image to Touch
   ========================================================================== */
.touch-stage-layout {
  display: grid;
  grid-template-columns: 240px 1fr 340px;
  gap: 28px;
  align-items: start;
}

.touch-input-card {
  display: flex;
  flex-direction: column;
}

.touch-input-card .input-image-thumb img {
  object-position: center top;
  transform-origin: center top;
}

.touch-brief-card {
  padding: 10px 4px;
}

.touch-brief-card h4 {
  font-size: 24px;
  font-weight: 550;
  letter-spacing: -0.025em;
  color: #40234f;
  margin: 10px 0 16px;
  line-height: 1.3;
}

.touch-brief-card p {
  font-size: 15px;
  line-height: 1.65;
  color: #6d527b;
  margin: 0 0 20px;
}

.touch-chips-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.touch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 16px;
  background: #f7edfa;
  border: 1px solid #dec3ec;
  color: #7b4a92;
  font-weight: 500;
}

.touch-guide-hint {
  font-size: 13px !important;
  color: #927b9c !important;
  font-style: italic;
}

.touch-frame-pane {
  display: flex;
  flex-direction: column;
}

.touch-frame-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.touch-frame-header .case-step-label {
  margin-bottom: 0;
}

.touch-ext-link {
  font-size: 12px;
  color: #9a6aa8;
  text-decoration: none;
  font-weight: 500;
}

.touch-ext-link:hover {
  text-decoration: underline;
}

@media (min-width: 961px) {
  .touch-frame-header {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
  }

  .touch-frame-header .case-step-label {
    white-space: nowrap;
    font-size: 11px;
    letter-spacing: 0.035em;
    line-height: 1.65;
  }

  .touch-ext-link {
    flex: none;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.65;
  }
}

.touch-iframe-shell {
  width: 100%;
  height: 420px;
  position: relative;
  background: #140c1c;
  border: 1px solid #e1cdeb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(20, 12, 28, 0.18);
}

.touch-iframe-shell iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: transparent;
}

.touch-cover-loading {
  position: absolute;
  inset: 0;
  background: #140c1c;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.3s;
}

.touch-cover-loading img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.3;
}

.touch-spinner-box {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 24px;
  background: rgba(30, 18, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f0e1f7;
  font-size: 12.5px;
}

.touch-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c384db;
  animation: pulseDot 1s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}

.touch-iframe-shell.is-loaded .touch-cover-loading {
  opacity: 0;
  pointer-events: none;
}

/* --- Image Zoom Modal --- */
.case-zoom-dialog {
  padding: 0;
  border: 1px solid #e1cdeb;
  border-radius: 16px;
  background: rgba(18, 11, 26, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.case-zoom-dialog::backdrop {
  background: rgba(14, 8, 20, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.case-zoom-content {
  position: relative;
  padding: 24px;
  display: grid;
  place-items: center;
}

.case-zoom-content img {
  max-width: 82vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.case-zoom-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 5;
}

.case-zoom-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* --- Case Footer Actions --- */
.case-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  border-top: 1px solid #e6d8ee;
  margin-top: 8px;
}

.case-footer-bar p {
  font-size: 14px;
  color: #846991;
  margin: 0;
}

.case-footer-links {
  display: flex;
  gap: 18px;
}

/* --- Homepage Applications Section Case Teaser Cards --- */
.applications-case-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 36px;
}

.app-case-card {
  display: flex;
  flex-direction: column;
  padding: 20px 22px 22px;
  border-radius: 18px;
  border: 1px solid #e2d2ec;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.85), rgba(248, 241, 252, 0.7));
  box-shadow: 0 4px 18px rgba(162, 115, 181, 0.08);
  text-align: left;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.28s,
              box-shadow 0.28s;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.app-case-card:hover {
  transform: translateY(-4px);
  border-color: #b783d2;
  box-shadow: 0 12px 30px rgba(162, 115, 181, 0.18);
}

.app-case-num {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #9d70ae;
  margin-bottom: 8px;
}

.app-case-card h3 {
  font-size: 20px;
  font-weight: 550;
  letter-spacing: -0.025em;
  color: #40234d;
  margin: 0 0 8px;
  line-height: 1.25;
}

.app-case-card p {
  font-size: 13.5px;
  line-height: 1.55;
  color: #7b6287;
  margin: 0 0 18px;
}

.app-case-action {
  margin-top: auto;
  font-size: 13px;
  font-weight: 500;
  color: #8c4fa3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.applications-footer-action {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 960px) {
  .case-selector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .music-stage-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .music-video-pane .case-media-shell {
    max-width: 480px;
    margin: 0 auto;
  }
  .director-stage-layout {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .director-video-pane {
    grid-column: 1 / -1;
    max-width: 380px;
    margin: 0 auto;
    width: 100%;
  }
  .science-stage-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .touch-stage-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .applications-case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .case-selector-grid {
    grid-template-columns: 1fr;
  }
  .case-showcase-stage {
    padding: 20px 16px;
  }
  .music-stage-layout > *,
  .director-stage-layout > *,
  .science-stage-layout > *,
  .touch-stage-layout > * {
    min-width: 0;
  }
  .case-badge-heading,
  .case-media-meta,
  .music-sequence-bar,
  .touch-chips-row {
    flex-wrap: wrap;
  }
  .audio-track-controls {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 12px;
  }
  .audio-seek-slider {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }
  .audio-time-label {
    min-width: 0;
  }
  .case-live-status {
    flex-basis: 100%;
    margin-left: 0;
  }
  .director-stage-layout {
    grid-template-columns: 1fr;
  }
  .science-clip-tabs {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .applications-case-grid {
    grid-template-columns: 1fr;
  }
  .case-footer-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
