/* ============================================================
   3D COVERFLOW — project showcase
   Vanilla port of the 3-d-coverflow-carousel component.
   Inherits the site palette (--ink, --brass*, --p-*) and type
   (--display, --mono) so it follows whichever theme is active.
   ============================================================ */

.cf {
  --cf-w:  clamp(240px, 62vw, 330px);
  --cf-h:  calc(var(--cf-w) * 1.5);
  --cf-x1: calc(var(--cf-w) * 0.865);
  --cf-x2: calc(var(--cf-w) * 1.545);
  --cf-ease: cubic-bezier(0.25, 1, 0.5, 1);
  --cf-glow: color-mix(in srgb, var(--brass-lt) 30%, transparent);
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 3vw, 2.5rem) 0 clamp(3rem, 5vw, 4.5rem);
  color: var(--p-light);
  user-select: none;
  -webkit-user-select: none;
}

/* Blurred ambience of the active project behind the stage */
.cf-ambience { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.cf-ambience img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.22) blur(32px);
  transform: scale(1.15);
  opacity: 0;
  transition: opacity 1s ease;
}
.cf-ambience img.is-on { opacity: 1; }
.cf-ambience::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at center,
    color-mix(in srgb, var(--ink) 30%, transparent) 0%,
    color-mix(in srgb, var(--ink) 92%, transparent) 100%);
}

/* Stage */
.cf-stage {
  position: relative;
  z-index: 1;
  height: calc(var(--cf-h) + 2.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
}
.cf-track {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  list-style: none; margin: 0; padding: 0;
}

/* Cards */
.cf-card {
  position: absolute;
  width: var(--cf-w);
  height: var(--cf-h);
  border-radius: 18px;
  overflow: hidden;
  background: var(--ink-2);
  border: 1px solid rgba(255,255,255,0.12);
  transform-origin: center center;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  cursor: pointer;
  will-change: transform;
  transition:
    transform 0.8s var(--cf-ease),
    opacity 0.8s var(--cf-ease),
    filter 0.8s var(--cf-ease),
    box-shadow 0.8s var(--cf-ease);
}
.cf-card > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.cf-card::after {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.1) 25%, rgba(0,0,0,0.68) 60%, rgba(0,0,0,0.96) 100%);
  pointer-events: none;
}

/* Coverflow positions */
.cf-card.is-center {
  transform: translateX(0) scale(1) rotateY(0deg);
  opacity: 1; z-index: 30;
  filter: brightness(1);
  cursor: default;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9), 0 0 35px var(--cf-glow);
}
.cf-card.is-r1 { transform: translateX(var(--cf-x1)) scale(0.84) rotateY(-24deg); opacity: 0.65; z-index: 20; filter: brightness(0.75); }
.cf-card.is-r2 { transform: translateX(var(--cf-x2)) scale(0.68) rotateY(-38deg); opacity: 0.38; z-index: 10; filter: brightness(0.55) blur(1px); }
.cf-card.is-l1 { transform: translateX(calc(var(--cf-x1) * -1)) scale(0.84) rotateY(24deg); opacity: 0.65; z-index: 20; filter: brightness(0.75); }
.cf-card.is-l2 { transform: translateX(calc(var(--cf-x2) * -1)) scale(0.68) rotateY(38deg); opacity: 0.38; z-index: 10; filter: brightness(0.55) blur(1px); }
.cf-card.is-hidden { transform: translateX(0) scale(0.4) rotateY(0deg); opacity: 0; z-index: 0; filter: brightness(0.4) blur(2px); pointer-events: none; }

/* Card copy — only readable on the centre card */
.cf-card-body {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: center;
  padding: 1.25rem 1.125rem 1.375rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
.cf-card.is-center .cf-card-body { opacity: 1; transform: none; pointer-events: auto; }

.cf-tag {
  align-self: flex-end;
  font-family: var(--mono);
  font-size: 0.5938rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}
.cf-card-text {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  margin-top: auto;
  padding-bottom: 4px;
}
.cf-card-text h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.375rem, 2vw, 1.75rem);
  line-height: 1.1;
  color: #fff;
  margin: 0;
  text-shadow: 0 3px 12px rgba(0,0,0,0.95);
}
.cf-card-text h3 small {
  display: block;
  font-size: 0.5em;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.7);
  margin-top: 0.25rem;
}
.cf-sub {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 3px 10px rgba(0,0,0,0.9);
}
.cf-rule {
  display: block;
  width: 34px; height: 2px;
  border-radius: 2px;
  background: var(--brass-lt);
  box-shadow: 0 0 8px color-mix(in srgb, var(--brass-lt) 70%, transparent);
  margin: 6px auto 4px;
}
.cf-card-text p {
  font-size: 0.8125rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.4;
  color: rgba(255,255,255,0.9);
  max-width: 280px;
  margin: 0 0 12px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
.cf-cta {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1.125rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--brass-lt) 0%, var(--brass-2) 100%);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), 0 0 15px var(--cf-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cf-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.5), 0 0 18px var(--cf-glow); }
.cf-cta svg { width: 12px; height: 12px; }

/* Arrows */
.cf-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 40;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.cf-arrow:hover { background: rgba(0,0,0,0.78); border-color: var(--brass-lt); }
.cf-arrow svg { width: 20px; height: 20px; }
.cf-prev { left: var(--pad); }
.cf-next { right: var(--pad); }

/* Dots */
.cf-dots {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  margin-top: 1.5rem;
}
.cf-dot {
  width: 8px; height: 8px;
  padding: 0; border: 0;
  border-radius: 9999px;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.cf-dot.is-active { width: 28px; background: var(--brass-lt); box-shadow: 0 0 10px color-mix(in srgb, var(--brass-lt) 70%, transparent); }

.cf-live {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* Detail panel synced to the active project */
.cf-details {
  position: relative; z-index: 1;
  display: grid;
  max-width: 1480px;
  margin: clamp(2.5rem, 5vw, 4rem) auto 0;
  padding: 0 var(--pad);
}
.cf-detail {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
  padding-top: clamp(1.75rem, 3vw, 2.5rem);
  border-top: 1px solid var(--line-lt);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), visibility 0s 0.6s;
}
.cf-detail.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.cf-detail .case-tag { color: var(--brass-lt); }
.cf-detail h3 { font-size: clamp(1.75rem, 3.2vw, 2.75rem); margin: 1rem 0 1.125rem; }
.cf-detail h3 small { font-size: 0.5em; color: var(--p-soft); font-family: var(--mono); letter-spacing: 0.08em; }
.cf-detail-copy > p:not(.case-tag) { font-weight: 300; font-size: 0.9688rem; line-height: 1.85; color: var(--p-mid); max-width: 36em; }
.cf-detail .case-meta { margin-top: 0; padding-top: 0; border-top: 0; flex-wrap: wrap; }
.cf-detail .case-meta strong { color: var(--p-light); }
.cf-detail .case-meta span { color: var(--p-soft); }
.cf-detail .case-scope span { color: var(--p-mid); border-color: var(--line-lt); }

/* No-JS fallback: plain grid of cards, all copy visible */
.cf:not(.is-ready) .cf-ambience,
.cf:not(.is-ready) .cf-arrow,
.cf:not(.is-ready) .cf-dots { display: none; }
.cf:not(.is-ready) .cf-stage { display: block; height: auto; perspective: none; }
.cf:not(.is-ready) .cf-track {
  position: static;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 0 var(--pad);
}
.cf:not(.is-ready) .cf-card { position: relative; width: auto; cursor: default; }
.cf:not(.is-ready) .cf-card-body { opacity: 1; transform: none; pointer-events: auto; }
.cf:not(.is-ready) .cf-details { display: block; }
.cf:not(.is-ready) .cf-detail { opacity: 1; visibility: visible; transform: none; margin-top: 2rem; }

@media (max-width: 900px) {
  .cf-detail { grid-template-columns: 1fr; gap: 1.75rem; }
  .cf-arrow { width: 40px; height: 40px; }
}
@media (max-width: 620px) {
  .cf-prev { left: 0.625rem; }
  .cf-next { right: 0.625rem; }
  .cf-card-text p { display: none; }
}

/* Pagination dots: 8px visual, 28px touch target */
.cf-dot { position: relative; }
.cf-dot::before { content: ""; position: absolute; inset: -10px; }
