/* ═══ OUR WORK STYLESHEET ═══ */

/* Layout & Grid */
.work-section {
  padding: 120px 0;
  min-height: 80vh;
}

.work-header {
  margin-bottom: 64px;
  text-align: center;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

/* Project Card */
.pcard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s var(--ease-out), transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
  cursor: pointer;
}

.pcard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(800px circle at var(--x, 0) var(--y, 0), rgba(91, 63, 238, 0.08), transparent 40%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 1;
}

.pcard:hover::before {
  opacity: 1;
}

.pcard:hover {
  border-color: var(--border-hl);
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 32px var(--accent-glow);
}

.pcard__tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 16px;
}

.pcard__title {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 12px;
  /* Support long titles gracefully */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcard__desc {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 24px;
  flex: 1;
}

.pcard__tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.pcard__chip {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: border-color 0.2s, color 0.2s;
}

.pcard:hover .pcard__chip {
  border-color: rgba(255, 255, 255, 0.12);
}

.pcard__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: auto;
  z-index: 2;
}

.pcard__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
  width: 100%;
}

.pcard__btn--primary {
  background: var(--accent);
  color: #fff;
}

.pcard__btn--primary:hover {
  background: var(--accent-2);
}

.pcard__btn--outline {
  border: 1px solid var(--border);
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.01);
}

.pcard__btn--outline:hover {
  border-color: var(--border-hl);
  color: var(--text);
  background: rgba(91, 63, 238, 0.05);
}

/* Detail View Layouts */
.detail-view {
  display: none;
  padding: 100px 0 120px;
  animation: fadeIn 0.4s var(--ease-out);
}

.detail-view.active {
  display: block;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.breadcrumb a {
  color: var(--accent-2);
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb__sep {
  opacity: 0.5;
}

/* Case Study Section Styles */
.cs-hero {
  margin-bottom: 64px;
}

.cs-hero__title {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.cs-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  align-items: start;
}

/* Case Study Sidebar */
.cs-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.cs-toc {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

.cs-toc__link {
  font-size: 0.85rem;
  color: var(--text-2);
  transition: color 0.25s, padding-left 0.25s;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-toc__link:hover {
  color: var(--text);
}

.cs-toc__link.active {
  color: var(--accent-2);
  font-weight: 600;
  padding-left: 4px;
}

.cs-meta-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.cs-meta-title {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.cs-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Case Study Content Body */
.cs-content {
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.75;
}

.cs-section {
  margin-bottom: 64px;
  scroll-margin-top: 100px;
}

.cs-section h2 {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cs-section h3 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 36px;
  margin-bottom: 16px;
}

.cs-section p {
  margin-bottom: 20px;
}

.cs-section ul {
  margin-bottom: 24px;
  padding-left: 20px;
  list-style: none;
}

.cs-section li {
  position: relative;
  margin-bottom: 12px;
  padding-left: 16px;
}

.cs-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Metrics Dashboard Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.metric-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.00) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.3s;
}

.metric-card:hover {
  border-color: var(--border-hl);
}

.metric-card__val {
  font-family: var(--display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 30%, var(--text-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metric-card__lbl {
  font-size: 0.8rem;
  color: var(--text-3);
  font-family: var(--sans);
  line-height: 1.4;
}

/* Architecture Viewer */
.arch-viewer {
  background: #030305;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  height: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arch-viewer__canvas {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: grab;
  background-size: 20px 20px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
}

.arch-viewer__canvas:active {
  cursor: grabbing;
}

.arch-viewer__img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
  user-select: none;
  pointer-events: none;
}

.arch-viewer__toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 18, 0.85);
  border: 1px solid var(--border-hl);
  border-radius: 999px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

.arch-viewer__btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.arch-viewer__btn:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.arch-viewer__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}

/* Product UI Iframe Preview Frame */
.preview-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #030305;
}

.preview-toolbar {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-viewport-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.preview-vp-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.preview-vp-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--border-hl);
}

.preview-vp-btn:hover:not(.active) {
  border-color: var(--border-hl);
  color: var(--text);
}

.preview-frame-wrap {
  flex: 1;
  background: #111116;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}

.preview-iframe {
  background: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  transition: width 0.4s var(--ease-out), height 0.4s var(--ease-out);
  width: 100%;
  height: 100%;
}

.preview-iframe.desktop {
  width: 100%;
  height: 100%;
}

.preview-iframe.tablet {
  width: 768px;
  height: 1024px;
  max-height: 100%;
}

.preview-iframe.mobile {
  width: 375px;
  height: 667px;
  max-height: 100%;
}

/* Animation utilities */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Overrides */
@media (max-width: 1024px) {
  .work-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cs-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .cs-sidebar {
    position: relative;
    top: 0;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .cs-sidebar > * {
    flex: 1;
    min-width: 240px;
  }
}

@media (max-width: 768px) {
  .work-grid {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .arch-viewer {
    height: 400px;
  }
  .preview-toolbar {
    flex-direction: column;
    gap: 12px;
  }
}
