/* ============================================================
   THE INTERFACES — real client products showcase
   Shares the design language of the rest of the home
   (css/hero.css vars): dark ground, cyan accent, glass, mono
   labels, engineering grid, thin borders, restrained glow.

   Editorial, not a dashboard: one large interface preview is the
   protagonist, project information sits beside it as quiet
   editorial text. Whitespace and hierarchy carry the section —
   information is not boxed unless it needs to be.

   Layout:
     01 header      — eyebrow + title + one line of intro
     02 stage       — .ui-preview (65–70%) + .ui-info (30–35%)
     03 selector    — 4 compact project cards

   States driven by js/interfaces.js:
     .revealed on .interfaces  → staggered entrance (once)
     .in-view  on .interfaces  → any looping animation may run
     .is-swapping on .ui-stage → cross-fade during project switch

   The preview is STATIC this phase. .ui-preview-viewport is a
   clean mount point: a later phase adds per-project hero sliders,
   hotspots and auto slides inside it without markup changes here.
   ============================================================ */

.interfaces {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 110px 32px 140px;
  overflow-x: clip;
}

.interfaces::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% 30%, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 30%, black 20%, transparent 100%);
  pointer-events: none;
}

.interfaces-inner { position: relative; }

/* looping animations freeze while the section is off-screen */
.interfaces:not(.in-view) .ui-loop {
  animation-play-state: paused !important;
}

/* ---------- 01 · header ---------- */

.ui-head { max-width: 760px; }

.ui-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--cyan);
}

.ui-eyebrow .eyebrow-sep { color: var(--dim); }
.ui-eyebrow .eyebrow-dim { color: var(--muted); letter-spacing: 0.14em; }

.ui-title {
  margin-top: 24px;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.14;
  color: var(--text);
}

.ui-title-grad {
  background: linear-gradient(90deg, #7dd3fc, #38bdf8, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ui-sub {
  margin-top: 20px;
  max-width: 540px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
}

/* entrance — same rhythm as the sections above */
.ui-head,
.ui-stage,
.ui-projects {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.interfaces.revealed .ui-head     { opacity: 1; transform: none; }
.interfaces.revealed .ui-stage    { opacity: 1; transform: none; transition-delay: 0.16s; }
.interfaces.revealed .ui-projects { opacity: 1; transform: none; transition-delay: 0.32s; }

/* ---------- 02 · main project stage ---------- */

.ui-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(0, 1fr);
  gap: 52px;
  align-items: start;
  margin-top: 64px;
}

/* project switch · subtle cross-fade on the two stage columns.
   sits on inner elements so it never fights the section entrance. */
.ui-preview,
.ui-info > * {
  transition: opacity 0.26s ease, transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.ui-stage.is-swapping .ui-preview,
.ui-stage.is-swapping .ui-info > * {
  opacity: 0;
  transform: translateY(6px);
}

/* ---------- 03 · the preview ---------- */

.ui-preview {
  position: relative;
  margin: 0;
}

/* restrained pool of light, not a drop shadow */
.ui-preview::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -26px;
  height: 46px;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, rgba(56, 189, 248, 0.14), transparent 70%);
  pointer-events: none;
}

.ui-preview-frame {
  border: 1px solid rgba(125, 180, 255, 0.16);
  border-radius: 14px;
  background: linear-gradient(170deg, #121824, #0c1119);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 24px 60px rgba(0, 0, 0, 0.42);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.ui-preview:hover .ui-preview-frame {
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 24px 60px rgba(0, 0, 0, 0.42),
    0 0 30px rgba(56, 189, 248, 0.08);
}

/* very restrained browser chrome */
.ui-preview-chrome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(125, 180, 255, 0.1);
  background: rgba(140, 180, 255, 0.015);
}

.ui-preview-dots {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

.ui-preview-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(125, 180, 255, 0.2);
}

.ui-preview-url {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--dim);
  padding: 3px 12px;
  border-radius: 100px;
  background: rgba(125, 180, 255, 0.05);
  border: 1px solid rgba(125, 180, 255, 0.08);
}

/* the animation surface — a single screenshot, or the NQUADRO
   slider (.ui-slides). Fixed aspect + overflow:hidden means a slide
   change never shifts layout. */
.ui-preview-viewport {
  position: relative;
  aspect-ratio: 1440 / 1024;
  background: #06090f;
  overflow: hidden;
}

.ui-preview-viewport img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.ui-preview-viewport::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(125, 180, 255, 0.08);
  pointer-events: none;
  z-index: 3;
}

/* ---------- NQUADRO hero slider ----------
   Three final hero states, crossfaded with a barely perceptible
   scale. The UI stays the protagonist — this must not read as a
   carousel. Nodes are built once and reused every transition. */
.ui-slides {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ui-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.01);
  transition:
    opacity 820ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 820ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.ui-slide.is-active {
  opacity: 1;
  transform: scale(1);
  z-index: 2;
}

/* keep JS `hidden` authoritative over `.ui-preview-viewport img { display:block }` */
.ui-preview-viewport img[hidden],
.ui-slides[hidden] { display: none; }

.ui-preview-foot {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ui-preview-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--dim);
  transition: color 0.35s ease;
}

.ui-preview:hover .ui-preview-label { color: var(--cyan); }

/* preview-level indicator — deliberately separate from the slider
   dots that live *inside* the NQUADRO screenshots */
.ui-slider-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.ui-slider-dots[hidden] { display: none; }

.ui-sdot {
  width: 16px;
  height: 3px;
  padding: 0;
  border: 0;
  border-radius: 100px;
  background: rgba(125, 180, 255, 0.18);
  cursor: pointer;
  transition: background 0.4s ease, width 0.4s ease, box-shadow 0.4s ease;
}

.ui-sdot.is-active {
  width: 26px;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
}

.ui-sdot:hover:not(.is-active) { background: rgba(125, 180, 255, 0.32); }

.ui-sdot:focus-visible {
  outline: 1px solid rgba(56, 189, 248, 0.6);
  outline-offset: 3px;
}

/* ---------- 04 · project information ---------- */

.ui-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 4px;
}

.ui-info-index {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

.ui-info-index-total { color: var(--dim); }

.ui-info-type {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--cyan);
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.06);
}

.ui-info-name {
  margin-top: 18px;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.1;
  color: var(--text);
}

.ui-info-cat {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  line-height: 1.6;
}

.ui-info-headline {
  margin-top: 22px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
}

.ui-info-desc {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}

/* process / scope · compact chips, quiet, never a diagram */
.ui-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(125, 180, 255, 0.09);
  width: 100%;
}

.ui-scope-step {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid rgba(125, 180, 255, 0.12);
  background: rgba(140, 180, 255, 0.015);
  white-space: nowrap;
}

.ui-scope-arrow {
  color: rgba(56, 189, 248, 0.5);
  font-size: 11px;
  line-height: 1;
}

/* project facts · secondary, factual, no KPI styling */
.ui-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 20px;
  width: 100%;
}

.ui-fact {
  position: relative;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.ui-fact + .ui-fact::before {
  content: '·';
  position: absolute;
  left: -11px;
  color: rgba(125, 180, 255, 0.28);
}

.ui-scope[hidden],
.ui-facts[hidden] { display: none; }

/* case-study CTA · same interaction language as .sc-btn */
.ui-cta-wrap { margin-top: 30px; }

.ui-cta {
  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 rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.08);
  color: var(--cyan);
  text-decoration: none;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.1);
  transition: all 0.25s;
}

a.ui-cta: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);
}

a.ui-cta svg { transition: transform 0.25s; }
a.ui-cta:hover svg { transform: translateX(3px); }

a.ui-cta:focus-visible {
  outline: 1px solid rgba(56, 189, 248, 0.6);
  outline-offset: 3px;
}

/* destination not built yet — visible, but inert */
.ui-cta.is-pending {
  cursor: default;
  color: var(--muted);
  border-color: var(--border);
  background: rgba(140, 180, 255, 0.02);
  box-shadow: none;
}

.ui-cta-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;
}

/* ---------- 05 · project selector ---------- */

.ui-projects {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 72px;
}

.ui-prj {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 10px 10px 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(140, 180, 255, 0.02), rgba(140, 180, 255, 0.004));
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.ui-prj-thumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 9px;
  overflow: hidden;
  background: #06090f;
  box-shadow: inset 0 0 0 1px rgba(125, 180, 255, 0.1);
}

.ui-prj-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0.55;
  filter: saturate(0.7) brightness(0.68);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.ui-prj-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px;
}

.ui-prj-num {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s;
}

.ui-prj b {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
  transition: color 0.25s;
}

.ui-prj-cat {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--dim);
  transition: color 0.25s;
}

/* the presented project */
.ui-prj.active {
  border-color: rgba(56, 189, 248, 0.45);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.07), rgba(140, 180, 255, 0.01));
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.1);
}

.ui-prj.active .ui-prj-thumb { box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35); }
.ui-prj.active .ui-prj-thumb img { opacity: 1; filter: none; }
.ui-prj.active .ui-prj-num { color: var(--cyan); }
.ui-prj.active b { color: var(--text); }
.ui-prj.active .ui-prj-cat { color: var(--muted); }

.ui-prj:not(.active):hover {
  border-color: rgba(56, 189, 248, 0.26);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.04), rgba(140, 180, 255, 0.01));
}

.ui-prj:not(.active):hover .ui-prj-thumb img {
  opacity: 0.8;
  filter: saturate(0.9) brightness(0.88);
}

.ui-prj:not(.active):hover b { color: var(--text); }

.ui-prj:focus-visible {
  outline: 1px solid rgba(56, 189, 248, 0.6);
  outline-offset: 2px;
}

/* locked slot — future project, not unlocked yet.
   Same card box as the others; reduced contrast, not selectable. */
.ui-prj--locked {
  cursor: not-allowed;
  opacity: 0.62;
  transition: border-color 0.25s, opacity 0.25s;
}

.ui-prj-lockart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background:
    linear-gradient(rgba(125, 180, 255, 0.045) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, rgba(125, 180, 255, 0.045) 1px, transparent 1px) 0 0 / 16px 16px,
    radial-gradient(ellipse at 50% 42%, rgba(56, 189, 248, 0.06), transparent 62%),
    #05080d;
}

.ui-prj-lock {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(125, 180, 255, 0.16);
  background: rgba(6, 10, 16, 0.8);
  color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.06);
  transition: box-shadow 0.3s, color 0.3s, border-color 0.3s;
}

.ui-prj-lock-label,
.ui-prj-lock-date {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  line-height: 1;
  color: var(--dim);
}

.ui-prj-lock-label { color: var(--muted); margin-top: 2px; }

.ui-prj.ui-prj--locked:hover {
  opacity: 0.72;
  border-color: rgba(125, 180, 255, 0.2);
  background: linear-gradient(160deg, rgba(140, 180, 255, 0.02), rgba(140, 180, 255, 0.004));
}

.ui-prj.ui-prj--locked:hover b { color: var(--muted); }

.ui-prj--locked:hover .ui-prj-lock {
  color: rgba(56, 189, 248, 0.8);
  border-color: rgba(56, 189, 248, 0.24);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.12);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1080px) {
  .interfaces { padding: 80px 16px 96px; }

  .ui-stage {
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 48px;
  }

  .ui-info { max-width: 640px; }
}

@media (max-width: 780px) {
  .ui-projects { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .ui-stage { gap: 34px; }
  .ui-preview::after { bottom: -18px; }
  .ui-info-headline { font-size: 16px; }
  .ui-projects { gap: 10px; margin-top: 48px; }
  .ui-prj { padding: 8px 8px 11px; gap: 10px; }
}

/* ============ REDUCED MOTION ============ */

@media (prefers-reduced-motion: reduce) {
  .ui-head, .ui-stage, .ui-projects,
  .ui-preview, .ui-info > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* slider keeps a plain crossfade — no scale, no long ease */
  .ui-slide {
    transform: none !important;
    transition: opacity 260ms linear !important;
  }

  .ui-sdot { transition: none !important; }
}
