/* =========================================================
   PORTFOLIO PAGE (portfolio.html)
   ========================================================= */

/* ---------- HERO ---------- */

.work-hero {
  padding-block: 6rem 5rem;
  text-align: center;
}

.work-hero .container { position: relative; z-index: 1; }

.work-hero h1 {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  animation: heroIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.work-hero-sub {
  color: var(--text-muted);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  max-width: 52ch;
  margin-inline: auto;
  margin-bottom: 2.5rem;
  animation: heroIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1rem;
  color: var(--white);
  animation: heroIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}
.scroll-cue svg { width: 18px; height: 18px; animation: bobDown 2s ease-in-out infinite; }
.scroll-cue:hover { color: var(--accent-pink); }

@keyframes bobDown {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(5px); }
}

.last-updated {
  margin-top: 2.5rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-faint);
}

@media (prefers-reduced-motion: reduce) {
  .work-hero h1, .work-hero-sub, .scroll-cue { animation: none; }
  .scroll-cue svg { animation: none; }
}

/* ---------- WORK INTRO + CATEGORY DROPDOWN ---------- */

.work-intro {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 2rem;
}

.work-intro .section-heading { font-size: clamp(1.9rem, 3.6vw, 2.9rem); }

.work-intro-copy {
  color: var(--text-muted);
  max-width: 56ch;
  margin: 0;
}

.category-select { position: relative; flex-shrink: 0; }

.category-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.category-toggle:hover { border-color: var(--accent-pink); }
.category-toggle svg {
  width: 17px;
  height: 17px;
  transition: transform 0.25s ease;
}
.category-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.category-toggle[aria-expanded="true"] { border-color: var(--accent-pink); }

.category-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  min-width: 200px;
  padding: 0.45rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: rgba(10, 15, 30, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  z-index: 60;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.category-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }

.category-menu li {
  padding: 0.72rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.16s ease;
}
.category-menu li:hover,
.category-menu li:focus-visible { background: var(--accent-red); }
.category-menu li[aria-selected="true"] { background: var(--accent-red); font-weight: 600; }

/* ---------- WORK GRID ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem 1.25rem;
}

.work-item { transition: opacity 0.3s ease, transform 0.3s ease; }
.work-item.is-hidden { display: none; }

.work-link { display: block; }

.work-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent-red);
  display: grid;
  place-items: center;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}
.work-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { font-size: 0.82rem; color: rgba(255, 255, 255, 0.7); }

.work-item:hover .work-thumb {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 44px rgba(197, 3, 55, 0.45);
}

/* Play affordance */
.work-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(10, 15, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.work-item:hover .work-thumb::after { opacity: 1; transform: scale(1); }

.work-foot {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding-top: 0.9rem;
}

.work-channel {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.work-title {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.35;
  margin: 0;
  color: var(--white);
}

.work-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.work-arrow svg { width: 14px; height: 14px; stroke-linecap: round; stroke-linejoin: round; }
.work-item:hover .work-arrow {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
  transform: translate(2px, -2px);
}

.work-empty {
  display: none;
  text-align: center;
  color: var(--text-faint);
  padding-block: 3rem;
}
.work-empty.is-visible { display: block; }

/* ---------- CASE STUDIES ---------- */

.case-section .section-subheading { margin-bottom: 3.5rem; }

.case-list { display: flex; flex-direction: column; gap: 2rem; }

.case-card {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 3rem;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.028);
  transition: border-color 0.25s ease;
}
.case-card:hover { border-color: rgba(255, 46, 99, 0.4); }

.case-avatar {
  display: block;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 1.1rem;
}

.case-name { font-size: 1.4rem; margin-bottom: 0.2rem; }
.case-subs { font-size: 0.92rem; color: var(--text-muted); margin-bottom: 1.75rem; }

.case-quote {
  margin: 1.75rem 0 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.55;
  color: var(--white);
}
.case-quote::before { content: '\201C'; }
.case-quote::after  { content: '\201D'; }

.case-detail h4 {
  font-size: 1.2rem;
  margin-bottom: 0.9rem;
}
.case-detail > p { color: var(--text-muted); font-size: 0.98rem; }

.case-results {
  margin: 1.25rem 0 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.case-results li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.96rem;
  color: var(--text-muted);
}
.case-results li::before {
  content: '';
  flex-shrink: 0;
  margin-top: 0.45rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-pink);
}

/* Mini carousel of clips */
.case-carousel { position: relative; }

.case-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-right: 3rem;
}
.case-track::-webkit-scrollbar { display: none; }

.case-clip {
  margin: 0;
  flex: 0 0 calc(50% - 0.5rem);
  scroll-snap-align: start;
}
.clip-thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: var(--accent-red);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.6rem;
  overflow: hidden;
  transition: transform 0.25s ease;
}
.clip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.case-clip:hover .clip-thumb { transform: translateY(-3px); }

.case-clip figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.case-next {
  position: absolute;
  top: 28%;
  right: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(8px);
  color: var(--white);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.case-next:hover {
  background: var(--accent-red);
  border-color: transparent;
  transform: translateX(2px);
}
.case-next svg { width: 18px; height: 18px; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1100px) {
  .work-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 880px) {
  .work-hero { padding-block: 3.5rem 3rem; }
  .work-grid { grid-template-columns: repeat(2, 1fr); gap: 1.25rem 1rem; }
  .work-intro { grid-template-columns: 1fr; align-items: start; }
  .category-select { justify-self: stretch; }
  .category-toggle { width: 100%; justify-content: space-between; }
  .category-menu { left: 0; right: 0; }

  .case-card { grid-template-columns: 1fr; gap: 2rem; padding: 1.75rem; }
  .case-clip { flex: 0 0 75%; }
}

@media (max-width: 520px) {
  .work-grid { grid-template-columns: 1fr; }
}

/* ---------- LOAD MORE ---------- */

.load-more-wrap {
  text-align: center;
  margin-top: 3rem;
}

.load-more {
  padding: 0.85rem 2rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.load-more:hover {
  background: var(--accent-red);
  border-color: transparent;
  transform: translateY(-2px);
}
.load-more[hidden] { display: none; }

.load-more-hint {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--text-faint);
}

/* Hidden until Load More is pressed */
.work-item.is-extra { display: none; }
.work-item.is-extra.is-shown { display: block; }

/* ---------- WORK CARD BADGES ---------- */

.work-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.stat-pill {
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 46, 99, 0.35);
  background: rgba(197, 3, 55, 0.16);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--white);
  white-space: nowrap;
}

/* The multiplier badge — the "this outperformed" number */
.stat-pill--boost {
  border-color: transparent;
  background: var(--accent-red);
}

/* ---------- A / B VARIANT TOGGLE ---------- */

.work-variants {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.variant-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.variant-btn:hover { border-color: var(--accent-pink); color: var(--white); }
.variant-btn.is-active {
  background: var(--accent-red);
  border-color: transparent;
  color: var(--white);
}

/* ---------- CASE CARD GLOWS ---------- */
/* Each card gets its own coloured halo, as in the reference */

.case-card {
  position: relative;
}
.case-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--glow, var(--accent-red)), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.9;
}
.case-card--a { --glow: #C50337; box-shadow: 0 0 42px rgba(197, 3, 55, 0.22); }
.case-card--b { --glow: #FF2E63; box-shadow: 0 0 42px rgba(255, 46, 99, 0.20); }
.case-card--c { --glow: #021C4F; box-shadow: 0 0 42px rgba(2, 28, 79, 0.42); }

/* ---------- CLIP META ---------- */

.clip-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 0.3rem 0 0.45rem;
}
.case-clip .stat-pill { font-size: 0.72rem; padding: 0.2rem 0.6rem; }

@media (max-width: 880px) {
  .work-intro { justify-content: stretch; }
  .category-select { width: 100%; }
}


/* ---------- VERTICAL CLIP GRID ---------- */

.work-grid--vertical {
  grid-template-columns: repeat(4, 1fr);
  gap: 1.75rem 1.25rem;
}

.work-thumb--vertical {
  aspect-ratio: 9 / 16;   /* TikTok / Reels are vertical */
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.work-thumb--vertical img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

/* Empty state — reads as a deliberate card, not a broken image.
   Hidden as soon as a thumbnail loads. */
.work-thumb--vertical {
  background:
    linear-gradient(160deg, rgba(2, 28, 79, 0.55) 0%, rgba(197, 3, 55, 0.85) 100%);
}

.work-thumb--vertical .thumb-ph {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem 0.9rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(180deg, transparent, rgba(10, 15, 30, 0.75));
  z-index: 2;
}

/* Once a real thumbnail is in, drop the placeholder text and the tint */
.work-thumb--vertical.has-thumb { background: var(--surface); }
.work-thumb--vertical.has-thumb .thumb-ph { display: none; }

/* Scrim so the play button stays legible over any thumbnail */
.work-thumb--vertical::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(10, 15, 30, 0.35), transparent 65%);
  z-index: 2;
  pointer-events: none;
}

/* Play button */
.play-badge {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 15, 30, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--white);
  z-index: 3;
  transition: transform 0.25s ease, background 0.25s ease;
}
.play-badge svg { width: 22px; height: 22px; margin-left: 3px; }
.work-item:hover .play-badge { transform: scale(1.1); background: var(--accent-red); }

.platform-badge {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: rgba(10, 15, 30, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--white);
  z-index: 3;
}

.work-grid--vertical .work-foot {
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
}

/* The old hover play circle would double up with .play-badge */
.work-thumb--vertical::after { display: none; }

/* Inline playback — once clicked, the thumbnail/badges are replaced by
   a real iframe player sized to fill the same tile. */
.work-thumb iframe,
.work-thumb video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  object-fit: cover;
  background: #000;
}
.work-thumb.is-playing { cursor: default; }
.work-thumb.is-playing:hover { transform: none; box-shadow: none; }
.work-thumb--vertical.is-playing::before { display: none; }

/* Close button — top-right corner, shown only once a clip is playing */
.thumb-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 4;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 15, 30, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--white);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.thumb-close:hover { background: var(--accent-red); transform: scale(1.08); }
.thumb-close svg { width: 16px; height: 16px; }

/* ---------- LIGHTBOX ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 2rem 1.5rem;
  background: rgba(10, 15, 30, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: lightboxIn 0.28s ease both;
}
.lightbox[hidden] { display: none; }

@keyframes lightboxIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-inner {
  width: min(380px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lightbox-frame {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  min-height: 300px;
  display: grid;
  place-items: center;
}
.lightbox-frame iframe { width: 100%; border: 0; display: block; }
.lightbox-frame blockquote { margin: 0; width: 100%; }

.lightbox-title {
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.lightbox-close:hover { background: var(--accent-red); transform: rotate(90deg); }
.lightbox-close svg { width: 20px; height: 20px; stroke-linecap: round; }

.lightbox-loading {
  font-size: 0.9rem;
  color: var(--text-faint);
  padding: 3rem 1rem;
}

@media (max-width: 1100px) {
  .work-grid--vertical { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 780px) {
  .work-grid--vertical { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .work-grid--vertical { grid-template-columns: 1fr; max-width: 320px; margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox { animation: none; }
}
.case-avatar.case-logo {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  padding: 4px;
}
.last-updated { font-family: var(--font-handwritten); font-style: normal; }
