/* ============================================================
   VISION CRAFTERS — featured case: shared frames, reel videos,
   homepage section (.vcf), works-archive card (.vcw), and the
   case-study scroll reel (.vcr). Tokens come from main.css.
   Videos are lazy: js/vc.js sets src and plays only in view.
   ============================================================ */

/* ---------- browser + phone frames ---------- */

.vc-frame {
  position: relative;
  border: 1px solid var(--line);
  background: var(--midnight);
  overflow: hidden;
  transition: border-color 0.4s;
}
.vc-frame:hover { border-color: var(--line-hot); }
.vc-frame__bar {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--gray);
}
.vc-frame__bar i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(242, 242, 242, 0.22); }
.vc-frame__bar i:first-child { background: var(--cyan); border-color: var(--cyan); }
.vc-frame__url { margin-left: 0.6rem; color: var(--cyan); }
.vc-frame__live { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--gray); }
.vc-frame__live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.vc-frame__screen { position: relative; aspect-ratio: 16 / 9; background: #05070b; overflow: hidden; }
.vc-frame__screen video, .vc-frame__screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

.vc-phone {
  position: relative;
  border: 1px solid var(--line-hot);
  border-radius: 2.1rem;
  padding: 7px;
  background: #020305;
  box-shadow: 0 0 0 1px rgba(242, 242, 242, 0.04), 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(43, 140, 255, 0.12);
}
.vc-phone__screen { position: relative; aspect-ratio: 390 / 844; border-radius: 1.6rem; overflow: hidden; background: #05070b; }
.vc-phone__screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.vc-phone::before { /* speaker slot */
  content: ""; position: absolute; top: 13px; left: 50%; width: 22%; height: 4px; transform: translateX(-50%);
  border-radius: 4px; background: rgba(0, 0, 0, 0.7); z-index: 2;
}

.vc-stage__vid { opacity: 0; transition: opacity 0.5s var(--ease-out); pointer-events: none; }
.vc-stage__vid.is-on { opacity: 1; pointer-events: auto; z-index: 1; }

/* ---------- HOMEPAGE: featured section ---------- */

.vcf { --vcf-glow: rgba(43, 140, 255, 0.16); isolation: isolate; }
.vcf::before { /* soft glow behind the stage */
  content: ""; position: absolute; z-index: -1; inset: 18% 0 auto;
  height: 60%;
  background: radial-gradient(60% 60% at 50% 40%, var(--vcf-glow), transparent 70%);
  pointer-events: none;
}
.vcf .section__head { max-width: 1100px; }

.vcf__stage {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(200px, 21vw, 300px);
  gap: clamp(1.25rem, 2.6vw, 2.5rem); align-items: center;
}
.vcf__tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.vc-tab {
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gray); background: transparent; cursor: pointer;
  border: 1px solid var(--line); padding: 0.55rem 0.9rem;
  display: inline-flex; gap: 0.6rem; align-items: baseline;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.vc-tab b { color: var(--electric); font-weight: 700; }
.vc-tab:hover { color: var(--white); border-color: var(--line-hot); }
.vc-tab.is-on { color: var(--charcoal); background: var(--cyan); border-color: var(--cyan); }
.vc-tab.is-on b { color: var(--charcoal); }
.vc-tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.vcf__cap { color: var(--gray); font-size: 0.95rem; max-width: 62ch; margin-top: 0.9rem; min-height: 3em; }
.vcf__cap strong { color: var(--white); font-weight: 600; }

.vcf__phone-label {
  font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gray); text-align: center; margin-top: 0.9rem;
}
.vcf__phone-label b { color: var(--cyan); font-weight: 500; }

.vcf__tiles {
  list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.75rem); margin-top: clamp(2.5rem, 5vw, 4rem);
}
.vcf__tile .vc-frame__screen { aspect-ratio: 16 / 10; }
.vcf__tile-meta { display: grid; gap: 0.35rem; padding-top: 0.9rem; }
.vcf__tile-meta .mono { color: var(--electric); font-size: 0.625rem; letter-spacing: 0.12em; }
.vcf__tile-meta h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.01em; }
.vcf__tile-meta p { color: var(--gray); font-size: 0.92rem; }

.vcf__facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line); background: var(--midnight);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.vcf__facts > div { padding: 1.2rem 1.4rem; border-right: 1px solid var(--line); display: grid; gap: 0.35rem; }
.vcf__facts > div:last-child { border-right: none; }
.vcf__facts dt { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gray); }
.vcf__facts dd { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.1rem, 2vw, 1.6rem); text-transform: uppercase; line-height: 1.1; }
.vcf__facts dd small { display: block; margin-top: 0.3rem; font-family: var(--font-body); font-size: 0.8rem; font-weight: 400; text-transform: none; color: var(--gray); }

.vcf__cta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: clamp(2rem, 4vw, 3rem); }

/* ---------- WORKS ARCHIVE: featured card ---------- */

.vcw {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  border: 1px solid var(--line-hot); background: var(--midnight);
  margin-bottom: clamp(1.25rem, 2.2vw, 2rem); overflow: clip;
  transition: border-color 0.4s;
}
.vcw:hover { border-color: var(--cyan); }
.vcw__media { position: relative; aspect-ratio: 16 / 9.2; background: #05070b; overflow: hidden; }
.vcw__media video, .vcw__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vcw__body { padding: clamp(1.5rem, 3vw, 2.5rem); display: flex; flex-direction: column; gap: 1rem; justify-content: center; }
.vcw__flag {
  align-self: flex-start; font-family: var(--font-mono); font-size: 0.625rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--charcoal); background: var(--cyan); padding: 0.3rem 0.6rem;
}
.vcw__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 1; letter-spacing: -0.02em; text-transform: uppercase; }
.vcw__cat { color: var(--electric); font-size: 0.6875rem; letter-spacing: 0.1em; }
.vcw__desc { color: var(--gray); max-width: 46ch; }
.vcw__meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.06em; color: var(--gray); }
.vcw__meta b { color: var(--white); font-weight: 500; margin-right: 0.4rem; text-transform: uppercase; }
.vcw__cta { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan); }

/* ---------- CASE STUDY: scroll reel chapters ---------- */

.vcr { display: grid; gap: clamp(3.5rem, 8vw, 7rem); }
.vcr__item { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(1.25rem, 3vw, 3rem); align-items: center; }
.vcr__item > .vcr__media { grid-column: 1 / span 8; }
.vcr__item > .vcr__copy  { grid-column: 9 / span 4; }
.vcr__item--flip > .vcr__media { grid-column: 5 / span 8; grid-row: 1; }
.vcr__item--flip > .vcr__copy  { grid-column: 1 / span 4; grid-row: 1; }
.vcr__item--phone > .vcr__media { grid-column: 2 / span 3; }
.vcr__item--phone > .vcr__copy  { grid-column: 6 / span 6; }
.vcr__copy { display: grid; gap: 0.9rem; align-content: center; }
.vcr__act { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--electric); }
.vcr__act b { color: var(--cyan); font-weight: 700; }
.vcr__copy h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 2.6vw, 2.2rem); line-height: 1.05; letter-spacing: -0.01em; text-transform: uppercase; }
.vcr__copy p { color: var(--gray); font-size: 0.98rem; }
.vcr__copy code { font-family: var(--font-mono); font-size: 0.85em; color: var(--cyan); background: rgba(79, 209, 255, 0.08); padding: 0.1em 0.35em; }
.vcr__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.vcr__tags span { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray); border: 1px solid var(--line); padding: 0.3rem 0.6rem; }

/* case-study hero player */
.cs-hero__media .vc-frame { border: none; }
.cs-hero__media .vc-frame__screen { aspect-ratio: 16 / 9; }

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .vcf__stage { grid-template-columns: 1fr; }
  .vcf__phone { width: min(260px, 62vw); margin-inline: auto; }
  .vcf__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vcf__facts > div:nth-child(2) { border-right: none; }
  .vcf__facts > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .vcw { grid-template-columns: 1fr; }
  .vcr__item, .vcr__item--flip, .vcr__item--phone { grid-template-columns: minmax(0, 1fr); }
  .vcr__item > .vcr__media, .vcr__item--flip > .vcr__media, .vcr__item--phone > .vcr__media,
  .vcr__item > .vcr__copy, .vcr__item--flip > .vcr__copy, .vcr__item--phone > .vcr__copy { grid-column: 1; grid-row: auto; }
  .vcr__item--phone > .vcr__media { width: min(260px, 62vw); margin-inline: auto; }
}
@media (max-width: 680px) {
  .vcf__tiles { grid-template-columns: 1fr; }
  .vc-tab { padding: 0.5rem 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .vc-stage__vid { transition: none; }
}

/* ---------- WORKS ARCHIVE: looping clip inside a regular card ---------- */
.card__media > video.vc-reel {
  width: 100%; height: 100%; object-fit: cover; object-position: top; display: block;
  filter: saturate(0.9) contrast(1.02); transition: filter 0.6s;
}
.card:hover .card__media > video.vc-reel { filter: saturate(1.05); }

/* long live URLs (e.g. *.vercel.app) must not push the tag off the browser bar */
.vc-frame__url { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-frame__live { flex: none; white-space: nowrap; }

.vcr__media, .vcr__copy { min-width: 0; }   /* a long URL in the frame bar must never stretch the grid */

/* an odd final card in the works archive (13, 17, ...) would sit alone in a 7-column slot; let it span the row */
.work__grid > .card:nth-child(4n + 1):last-child { grid-column: 1 / -1; }
.work__grid > .card:nth-child(4n + 1):last-child .card__media { aspect-ratio: 21 / 6; }
