/* ============================================================
   THE CASES — AI projects showcase
   Continues the story: Problem → Workflow → Method → Products.
   Shares the design language of the hero (css/hero.css vars):
   same background, grid, glass, mono labels, cyan glow.
   One showcase at a time; js/showcase.js drives:
   - .revealed on .showcase        → staggered entrance
   - .is-active on a .sc-slide     → visible project
   - .pos-left on a .sc-slide      → enter/exit from the left side
   ============================================================ */

.showcase {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 110px 32px 140px;
  /* parked slides sit at translateX(±34px); keep that out of the
     scrollable overflow without creating a scroll container */
  overflow-x: clip;
}

/* faint engineering grid, same treatment as the cycle stage */
.showcase::before {
  content: '';
  position: absolute;
  inset: 40px 0 40px;
  background:
    linear-gradient(rgba(125, 180, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 180, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, black 20%, transparent 100%);
  pointer-events: none;
}

.showcase-inner { position: relative; }

/* ---------- header ---------- */

.sc-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--cyan);
}

.sc-eyebrow .eyebrow-dim { color: var(--muted); letter-spacing: 0.14em; }

.sc-title {
  margin-top: 22px;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--text);
}

.sc-title-grad {
  background: linear-gradient(90deg, #7dd3fc, #38bdf8, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sc-sub {
  margin-top: 18px;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
}

/* entrance: header pieces rise in sequence, like the cycle */
.sc-eyebrow,
.sc-title,
.sc-sub,
.sc-stage {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.showcase.revealed .sc-eyebrow { opacity: 1; transform: none; }
.showcase.revealed .sc-title   { opacity: 1; transform: none; transition-delay: 0.12s; }
.showcase.revealed .sc-sub     { opacity: 1; transform: none; transition-delay: 0.24s; }
.showcase.revealed .sc-stage   { opacity: 1; transform: none; transition-delay: 0.36s; }

/* ---------- stage: stacked slides, one visible ---------- */

.sc-stage { margin-top: 64px; }

.sc-slides { display: grid; }

.sc-slide {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: 55fr 45fr;
  gap: 24px;
  align-items: stretch;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(34px);
  transition:
    opacity 0.45s ease,
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.6s;
}

/* the slide sits (enters/exits) on the left instead of the right */
.sc-slide.pos-left { transform: translateX(-34px); }

.sc-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  z-index: 1;
  transition:
    opacity 0.5s ease 0.08s,
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.08s,
    visibility 0s;
}

/* ---------- left: the live monitor ---------- */

.sc-monitor {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.sc-monitor:hover {
  border-color: rgba(56, 189, 248, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 44px rgba(56, 189, 248, 0.1);
}

.sc-mon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(125, 180, 255, 0.08);
}

.sc-mon-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc-mon-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 5px 11px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sc-mon-chip.is-sim {
  color: var(--muted);
  background: rgba(125, 180, 255, 0.05);
  border-color: var(--border);
}

.sc-mon-stage {
  position: relative;
  flex: 1;
  min-height: 380px;
  overflow: hidden;
}

/* faint engineering grid inside the monitor, same as the hero stage */
.sc-mon-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(rgba(125, 180, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 180, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 85% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 85% at 50% 50%, black 30%, transparent 100%);
  pointer-events: none;
}

.sc-mon-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid rgba(125, 180, 255, 0.08);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dim);
}

.sc-mon-foot b { color: var(--muted); font-weight: 500; }

/* ---------- monitor visuals ---------- */

.sc-vis { position: absolute; inset: 0; }

/* · 01 — photo evaluation: live enhanced frame under a scan pass */
.sc-vis-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: scPan 16s ease-in-out infinite alternate;
}

@keyframes scPan {
  from { transform: scale(1); }
  to   { transform: scale(1.07) translateX(-1.5%); }
}

.sc-vis-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 12, 20, 0.82), transparent 46%);
  pointer-events: none;
}

.sc-scan {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 64px;
  background: linear-gradient(to bottom, transparent, rgba(56, 189, 248, 0.1), transparent);
  border-bottom: 1px solid rgba(56, 189, 248, 0.45);
  animation: scScan 4.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scScan {
  0% { top: -18%; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { top: 104%; opacity: 0; }
}

.sc-vis-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--cyan);
  background: rgba(8, 12, 20, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 9px;
  border-radius: 100px;
}

.sc-corner {
  position: absolute;
  z-index: 3;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(56, 189, 248, 0.75);
}
.sc-corner.c1 { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-radius: 5px 0 0 0; }
.sc-corner.c2 { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-radius: 0 5px 0 0; }
.sc-corner.c3 { bottom: 10px; left: 10px; border-right: 0; border-top: 0; border-radius: 0 0 0 5px; }
.sc-corner.c4 { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-radius: 0 0 5px 0; }

.sc-readout {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sc-read {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.sc-read .rk { width: 74px; flex-shrink: 0; }
.sc-read b { color: var(--cyan); font-weight: 600; }

.sc-read .rt {
  flex: 1;
  height: 4px;
  border-radius: 100px;
  background: rgba(125, 180, 255, 0.12);
  overflow: hidden;
}

.sc-read .rt i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-2));
  box-shadow: 0 0 10px var(--cyan-glow);
}

.sc-slide.is-active .sc-read .rt i {
  animation: scGrow 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards;
}

@keyframes scGrow { to { width: var(--w); } }

/* · 02 — travel map engine: route plotting between stops */
.sc-vis-map {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.sc-vis-map svg { width: 100%; max-height: 100%; overflow: visible; }

.sc-vis-map img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sc-route-base {
  fill: none;
  stroke: rgba(125, 180, 255, 0.22);
  stroke-width: 1.5;
  stroke-dasharray: 5 7;
}

.sc-route-flow {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
  stroke-dasharray: 46 900;
  opacity: 0.85;
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.7));
  animation: scRoute 5.4s linear infinite;
}

@keyframes scRoute {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -946; }
}

.sc-pin-dot {
  fill: var(--cyan);
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.7));
}

.sc-pin-ring {
  fill: none;
  stroke: rgba(56, 189, 248, 0.5);
  stroke-width: 1.2;
  transform-box: fill-box;
  transform-origin: center;
  animation: scPinPulse 2.6s ease-out infinite;
}

.sc-pin:nth-of-type(2) .sc-pin-ring { animation-delay: 0.6s; }
.sc-pin:nth-of-type(3) .sc-pin-ring { animation-delay: 1.2s; }
.sc-pin:nth-of-type(4) .sc-pin-ring { animation-delay: 1.8s; }

@keyframes scPinPulse {
  0%   { transform: scale(0.4); opacity: 1; }
  70%  { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

.sc-pin text {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  fill: var(--muted);
}

/* · 03 — placeholder: reserved slot for a future project, in development.
   A quiet, inactive system frame — no data, no metrics, no animation. */
.sc-vis-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
}

.sc-ph-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(125, 180, 255, 0.22);
  pointer-events: none;
}
.sc-ph-corner.c1 { top: 24px; left: 24px; border-right: 0; border-bottom: 0; }
.sc-ph-corner.c2 { top: 24px; right: 24px; border-left: 0; border-bottom: 0; }
.sc-ph-corner.c3 { bottom: 24px; left: 24px; border-right: 0; border-top: 0; }
.sc-ph-corner.c4 { bottom: 24px; right: 24px; border-left: 0; border-top: 0; }

.sc-ph-year {
  position: relative;
  z-index: 2;
  font-family: var(--mono);
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.sc-ph-note {
  position: relative;
  z-index: 2;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--dim);
  text-align: center;
}

/* ---------- right: project information ---------- */

.sc-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 12px 8px 12px 16px;
}

.sc-index {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--cyan);
}

.sc-status {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 4px 10px;
  border-radius: 100px;
  color: #34d399;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.sc-status.is-dev {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.07);
  border-color: rgba(251, 191, 36, 0.28);
}

.sc-name {
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text);
}

.sc-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 460px;
}

.sc-desc b { color: var(--text); font-weight: 600; }

/* metrics — system cards, not statistics */
.sc-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.sc-metric {
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(140, 180, 255, 0.03), rgba(140, 180, 255, 0.008));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.sc-metric:hover {
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 20px rgba(56, 189, 248, 0.07);
}

.sc-metric-k {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--cyan);
}

.sc-metric-v {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text);
  font-weight: 500;
}

/* metrics fade in with a stagger whenever a slide becomes active */
.sc-metric {
  opacity: 0;
  transform: translateY(10px);
}

.showcase.revealed .sc-slide.is-active .sc-metric {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.3s, box-shadow 0.3s;
}

.showcase.revealed .sc-slide.is-active .sc-metric:nth-of-type(1) { transition-delay: 0.18s, 0.18s, 0s, 0s; }
.showcase.revealed .sc-slide.is-active .sc-metric:nth-of-type(2) { transition-delay: 0.26s, 0.26s, 0s, 0s; }
.showcase.revealed .sc-slide.is-active .sc-metric:nth-of-type(3) { transition-delay: 0.34s, 0.34s, 0s, 0s; }
.showcase.revealed .sc-slide.is-active .sc-metric:nth-of-type(4) { transition-delay: 0.42s, 0.42s, 0s, 0s; }

/* ---------- actions ---------- */

.sc-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.sc-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  padding: 12px 22px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: rgba(140, 180, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s;
}

.sc-btn:hover {
  color: var(--cyan);
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.05);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

.sc-btn-primary {
  color: var(--cyan);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.1);
}

.sc-btn-primary:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.22);
}

.sc-btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.sc-btn .sc-soon {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--dim);
  border: 1px solid rgba(125, 180, 255, 0.15);
  padding: 2px 7px;
  border-radius: 100px;
}

/* actions rise in after the metrics */
.sc-actions {
  opacity: 0;
  transform: translateY(10px);
}

.showcase.revealed .sc-slide.is-active .sc-actions {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease 0.5s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.5s;
}

/* ---------- project selector ---------- */

.sc-selector {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 48px;
  flex-wrap: wrap;
}

.sc-tab {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  padding: 12px 22px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: rgba(140, 180, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.25s;
}

.sc-tab .sc-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(125, 180, 255, 0.25);
  flex-shrink: 0;
}

.sc-tab .sc-soon {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--dim);
  border: 1px solid rgba(125, 180, 255, 0.15);
  padding: 2px 7px;
  border-radius: 100px;
}

.sc-tab:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.sc-tab.active {
  color: var(--cyan);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.07);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.12);
}

.sc-tab.active .sc-tab-dot {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  animation: livePulse 2s ease-in-out infinite;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1080px) {
  .showcase { padding: 80px 16px 96px; }

  .sc-stage { margin-top: 44px; }

  /* stack: monitor → description → metrics → CTA → selector */
  .sc-slide {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sc-info { padding: 0 4px; gap: 14px; }
  .sc-desc { max-width: none; }

  .sc-mon-stage { min-height: 300px; }

  .sc-selector {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 36px;
  }

  .sc-tab {
    width: 100%;
    padding: 15px 18px;
    border-radius: 14px;
    font-size: 11px;
    letter-spacing: 0.12em;
  }
}

@media (max-width: 640px) {
  .sc-mon-head { padding: 12px 14px; }
  .sc-mon-title { font-size: 10px; letter-spacing: 0.14em; }
  .sc-mon-stage { min-height: 240px; }
  .sc-mon-foot { padding: 10px 14px; letter-spacing: 0.14em; }

  .sc-readout { left: 14px; right: 14px; bottom: 12px; }
  .sc-read .rk { width: 62px; }

  .sc-metrics { gap: 8px; }
  .sc-metric { padding: 11px 12px; }

  .sc-actions { flex-direction: column; align-items: stretch; }
  .sc-btn { justify-content: center; }
}

/* ============ REDUCED MOTION ============ */

@media (prefers-reduced-motion: reduce) {
  .sc-vis-photo img, .sc-scan, .sc-route-flow, .sc-pin-ring {
    animation: none !important;
  }

  .sc-read .rt i { width: var(--w); animation: none !important; }

  .sc-eyebrow, .sc-title, .sc-sub, .sc-stage,
  .sc-slide, .sc-metric, .sc-actions {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .sc-slide:not(.is-active) { opacity: 0 !important; }
}
