/**
 * Custom Portfolio — Silicon Valley Case Study Modal
 */

/* ── Base Resets ──────────────────────────────────── */
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* ── Modal Overlay ────────────────────────────────── */
.portfolio-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
}
.portfolio-modal[aria-hidden="false"] {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Backdrop */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 6, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ── Modal Shell ──────────────────────────────────── */
.modal-content-wrapper {
  position: relative;
  width: 100%;
  max-width: 920px;
  max-height: 92vh;
  background: #0c0c0f;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateY(28px) scale(0.97);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  color: #e8e8e8;
}
.portfolio-modal[aria-hidden="false"] .modal-content-wrapper {
  transform: translateY(0) scale(1);
}

/* ── Close Button ─────────────────────────────────── */
.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.modal-close-btn:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.08);
}

/* ── Hero Image ──────────────────────────────────── */
.modal-hero-image {
  width: 100%;
  height: 300px;
  overflow: hidden;
  background: #09090c;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.modal-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, opacity 0.4s ease;
  opacity: 0; /* Hidden by default, JS will show it */
}
.portfolio-modal[aria-hidden="false"] .modal-hero-image img { transform: scale(1.02); }

/* ── Meta Strip ──────────────────────────────────── */
.modal-meta-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 36px 0;
  flex-wrap: wrap;
}
.modal-meta-left { flex: 1 1 60%; }
.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.4px;
  margin: 0 0 4px;
  line-height: 1.2;
}
.modal-intro {
  font-size: 13.5px;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.5;
}
.modal-role-tag {
  display: inline-block;
  font-size: 10px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 3px 10px;
}
.modal-meta-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.modal-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  letter-spacing: 0.2px;
}
.modal-btn:hover { opacity: 0.8; transform: translateY(-1px); }
.modal-btn-primary  { background: #fff; color: #000; }
.modal-btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #bbb;
}

/* ── Tech & Links ────────────────────────────────── */
.modal-tech-and-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 36px 0;
}
.modal-tech-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}
.tech-pill {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 4px 11px;
  border-radius: 4px;
  font-size: 10.5px;
  color: #fff;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* ── Divider ─────────────────────────────────────── */
.modal-divider {
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: 28px 36px;
}

/* ── Body ────────────────────────────────────────── */
.modal-body {
  padding: 0 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Hook Card ───────────────────────────────────── */
.cs-hook-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 14px;
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ── Stats Grid ──────────────────────────────────── */
.cs-stats-wrap { margin-bottom: 28px; }
.cs-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.cs-stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 12.5px;
  color: #bbb;
  line-height: 1.4;
}

/* ── Sub-section Heading ─────────────────────────── */
.cs-sub-section { margin-bottom: 24px; }
.cs-sub-heading {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 12px;
  letter-spacing: 0;
}

/* ── Key Decisions ───────────────────────────────── */
.cs-decisions-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cs-decision-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.2s;
}
.cs-decision-card:hover { border-color: rgba(255,255,255,0.14); }
.cs-decision-card strong {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
  display: block;
  margin-bottom: 4px;
}
.cs-decision-card p {
  font-size: 12.5px;
  color: #777;
  margin: 0;
  line-height: 1.55;
}

/* ── System / Challenges ─────────────────────────── */
.cs-system-text {
  font-size: 12.5px;
  color: #777;
  line-height: 1.6;
  margin: 0;
}
.cs-challenges-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cs-challenges-list li {
  font-size: 12.5px;
  color: #777;
  padding-left: 16px;
  position: relative;
  line-height: 1.55;
}
.cs-challenges-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: #444;
}

/* ── Gallery ─────────────────────────────────────── */
.cs-gallery-wrap { margin-top: 4px; }
.modal-gallery-grid {
  display: grid;
  gap: 10px;
}
.modal-gallery-grid img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: #111;
}

/* ── Product Thinking Button ─────────────────────── */
.cs-thinking-row {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.modal-thinking-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #888;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.modal-thinking-btn:hover {
  background: rgba(255,255,255,0.05);
  color: #ccc;
  border-color: rgba(255,255,255,0.2);
}

/* ── Product Thinking Modal ───────────────────────── */
.thinking-panel {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s;
  background: rgba(4, 4, 6, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.thinking-panel.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.thinking-panel-inner {
  width: 100%;
  max-width: 500px;
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 32px 32px 40px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 32px 64px rgba(0,0,0,0.8);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.thinking-panel.open .thinking-panel-inner {
  transform: scale(1) translateY(0);
}
.thinking-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.thinking-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}
.thinking-close-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #888;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}
.thinking-item {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.thinking-item:last-child { border-bottom: none; }
.thinking-item strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #eee;
  margin-bottom: 4px;
}
.thinking-item p {
  font-size: 13px;
  color: #777;
  line-height: 1.6;
}
.thinking-panel-footer {
  margin-top: 24px;
  padding-top: 10px;
}
.w-full-btn {
  width: 100%;
  text-align: center;
  cursor: pointer;
}

/* ── Showcase Card Hover ─────────────────────────── */
.showcase-item {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
}
.showcase-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.showcase-item:hover::after { opacity: 1; }
.showcase-image-wrapper img {
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.showcase-item:hover .showcase-image-wrapper img { transform: scale(1.04); }
.showcase-item.w-inline-block:hover { text-decoration: none; }

/* Body lock */
body.modal-open { overflow: hidden; }

/* ── Responsive ──────────────────────────────────── */
@media screen and (max-width: 900px) {
  .modal-content-wrapper { max-width: 100%; border-radius: 16px; }
}
@media screen and (max-width: 640px) {
  .modal-meta-strip, .modal-tech-and-links, .modal-body { padding-left: 20px; padding-right: 20px; }
  .modal-divider { margin-left: 20px; margin-right: 20px; }
  .modal-meta-right { width: 100%; }
  .cs-stats-grid { grid-template-columns: 1fr 1fr; }
  .thinking-panel { padding: 24px 20px 40px; }
}

/* ── Gallery Expand UI ───────────────────────────── */
.gallery-img-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}
.gallery-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.3s ease;
}
.gallery-img-wrap:hover img {
  transform: scale(1.02);
}
.gallery-expand-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(4px);
}
.gallery-img-wrap:hover .gallery-expand-icon {
  opacity: 1;
  transform: scale(1);
}

/* ── Full View Modal (Lightbox) ──────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999999;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.lightbox-overlay.active img {
  transform: scale(1);
}
.lightbox-close {
  position: absolute;
  top: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, transform 0.2s;
}
.lightbox-close:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}
