/* =========================================================
   DEMO CATALOG + DETAIL PAGES
========================================================= */

/* ---------- Hero intro (shared) ---------- */
.demos-hero {
  padding: 120px 0 28px;
  position: relative;
}
.demos-hero .wrap { text-align: center; }
.demos-hero .label { color: var(--orange); }
.demos-hero h1 {
  font-family: var(--font-h); font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin-bottom: 14px;
}
.demos-hero p.lede {
  color: var(--ink-light); max-width: 640px; margin: 0 auto;
  font-size: 1.05rem; line-height: 1.65;
}

/* ---------- Filter bar ---------- */
.demos-filters {
  padding: 8px 0 32px;
}
.demos-filters .filter-row {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: center; margin-bottom: 12px;
}
.demos-filters .filter-label {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-lighter); margin-right: 6px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1.5px solid var(--line);
  background: var(--white); border-radius: 50px;
  font-size: 0.85rem; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: all 0.2s var(--ease);
  min-height: 36px;
}
.filter-chip:hover { border-color: var(--green); color: var(--green); }
.filter-chip.active {
  background: var(--green); color: var(--white); border-color: var(--green);
}
.filter-chip .count {
  font-size: 0.7rem; opacity: 0.7; font-weight: 500;
}
.filter-chip.active .count { opacity: 0.9; }

.demos-search {
  max-width: 480px; margin: 6px auto 0;
  position: relative;
}
.demos-search input {
  width: 100%; padding: 13px 18px 13px 44px;
  border: 1.5px solid var(--line); border-radius: 50px;
  font-family: var(--font-b); font-size: 0.95rem;
  background: var(--white); color: var(--ink);
  transition: border-color 0.2s;
}
.demos-search input:focus { outline: none; border-color: var(--green); }
.demos-search svg {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-lighter);
}

.demos-count {
  text-align: center; color: var(--ink-lighter);
  font-size: 0.85rem; margin-top: 14px;
}

/* ---------- Grid of demo cards ---------- */
.demos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px; padding: 24px 0 72px;
}
.demo-card {
  display: flex; flex-direction: column;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  text-decoration: none; color: inherit;
}
.demo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(26,26,46,.09);
  border-color: var(--green-light);
}
.demo-card-media {
  position: relative; aspect-ratio: 16/10;
  background: var(--cream-dark); overflow: hidden;
}
.demo-card-media video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.demo-card-media .media-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 50%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}
.demo-card-media .play-pill {
  position: absolute; bottom: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.95); color: var(--ink);
  padding: 6px 12px; border-radius: 50px;
  font-size: 0.75rem; font-weight: 700;
}
.demo-card-media .play-pill svg { width: 12px; height: 12px; color: var(--green); }

.demo-card-body {
  padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px;
  flex: 1;
}
.demo-card-sector {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--orange);
}
.demo-card h3 {
  font-family: var(--font-h); font-weight: 400; font-size: 1.2rem;
  line-height: 1.3; color: var(--ink); margin: 0;
}
.demo-card p {
  font-size: 0.88rem; color: var(--ink-light); line-height: 1.55;
  flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.demo-card-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px;
}
.demo-card-tag {
  font-size: 0.7rem; font-weight: 600;
  padding: 3px 9px; border-radius: 50px;
  background: var(--green-light); color: var(--green);
}

.demos-empty {
  text-align: center; padding: 64px 20px;
  color: var(--ink-lighter);
}
.demos-empty h3 { font-family: var(--font-h); font-weight: 400; margin-bottom: 8px; }

/* =========================================================
   DETAIL PAGE
========================================================= */
.demo-detail-hero {
  padding: 110px 0 32px; background: var(--white);
  border-bottom: 1px solid var(--line);
}
.demo-detail-hero .wrap {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center;
}
.demo-detail-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--ink-lighter); font-weight: 600;
  margin-bottom: 14px;
}
.demo-detail-back:hover { color: var(--green); }
.demo-detail-back svg { width: 14px; height: 14px; }

.demo-detail-hero .tags-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.demo-detail-hero .tag-category {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--orange);
  background: var(--orange-light); padding: 4px 10px; border-radius: 50px;
}
.demo-detail-hero .tag-work {
  font-size: 0.72rem; font-weight: 600;
  color: var(--green); background: var(--green-light);
  padding: 4px 10px; border-radius: 50px;
}
.demo-detail-hero h1 {
  font-family: var(--font-h); font-weight: 400;
  font-size: clamp(1.9rem, 3.5vw, 2.6rem); line-height: 1.15; margin-bottom: 8px;
}
.demo-detail-hero .sector {
  font-size: 0.92rem; color: var(--ink-lighter); margin-bottom: 22px;
}
.demo-detail-hero .cta-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px;
}

/* Video embed */
.demo-video-wrap {
  position: relative; width: 100%; aspect-ratio: 16/10;
  border-radius: 14px; overflow: hidden;
  background: var(--ink);
  box-shadow: 0 16px 48px rgba(26,26,46,.15);
}
.demo-video-wrap video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Problem + flow blocks */
.demo-detail-story {
  padding: 56px 0;
  background: var(--cream);
}
.demo-story-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
}
.story-block {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px 30px;
}
.story-block .label-small {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; margin-bottom: 10px;
  display: inline-flex; align-items: center; gap: 6px;
}
.story-block .label-small svg { width: 14px; height: 14px; }
.story-block.problem .label-small { color: #DC2626; }
.story-block.flow .label-small { color: var(--green); }
.story-block h2 {
  font-family: var(--font-h); font-weight: 400;
  font-size: 1.35rem; line-height: 1.3; margin-bottom: 12px;
}
.story-block p {
  color: var(--ink-light); line-height: 1.7; font-size: 0.98rem;
}

/* Applications (where else) */
.demo-applications {
  padding: 56px 0; background: var(--white);
}
.demo-applications .wrap { max-width: 880px; }
.demo-applications h2 {
  text-align: center; font-family: var(--font-h); font-weight: 400;
  font-size: clamp(1.5rem, 2.8vw, 2rem); margin-bottom: 8px;
}
.demo-applications .lede {
  text-align: center; color: var(--ink-light);
  margin-bottom: 32px; font-size: 0.98rem;
}
.demo-applications-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.application-item {
  background: var(--green-lighter); border: 1px solid var(--green-light);
  border-radius: 12px; padding: 18px 20px;
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 0.92rem; color: var(--ink); line-height: 1.5;
  font-weight: 500;
}
.application-item .bullet {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; margin-top: 1px;
}

/* Related demos carousel */
.demo-related {
  padding: 56px 0 80px; background: var(--cream);
  border-top: 1px solid var(--line);
}
.demo-related h2 {
  font-family: var(--font-h); font-weight: 400;
  font-size: clamp(1.5rem, 2.8vw, 2rem); margin-bottom: 22px;
  text-align: center;
}
.related-scroller {
  position: relative;
}
.related-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 300px);
  gap: 18px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding: 8px 4px 16px;
  scrollbar-width: thin;
}
.related-track::-webkit-scrollbar { height: 6px; }
.related-track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
.related-track .demo-card { scroll-snap-align: start; }

.related-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--white); border: 1px solid var(--line);
  display: none; align-items: center; justify-content: center;
  cursor: pointer; z-index: 5;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
  transition: all 0.2s;
}
.related-arrow:hover { border-color: var(--green); color: var(--green); }
.related-arrow svg { width: 18px; height: 18px; }
.related-arrow.prev { left: -8px; }
.related-arrow.next { right: -8px; }
@media (min-width: 768px) {
  .related-arrow { display: flex; }
}

/* Final CTA (detail page) */
.demo-final-cta {
  padding: 56px 24px;
  background: var(--green); color: var(--white);
  text-align: center;
}
.demo-final-cta h2 {
  font-family: var(--font-h); font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 10px; color: var(--white);
}
.demo-final-cta p {
  color: rgba(255,255,255,0.85); margin-bottom: 22px;
  max-width: 560px; margin-left: auto; margin-right: auto;
}
.demo-final-cta .btn {
  background: var(--white); color: var(--green);
  padding: 15px 30px;
}
.demo-final-cta .btn:hover { background: var(--cream); transform: translateY(-1px); }

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 900px) {
  .demo-detail-hero .wrap { grid-template-columns: 1fr; gap: 28px; }
  .demo-story-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .demos-grid { grid-template-columns: 1fr; }
  .demos-filters .filter-row { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
  .demos-filters .filter-row::-webkit-scrollbar { display: none; }
  .filter-chip { flex-shrink: 0; }
  .demo-detail-hero { padding-top: 90px; }
}

/* Loading placeholder */
.demo-loading {
  padding: 140px 20px; text-align: center; color: var(--ink-lighter);
}
