/* ═══════════════════════════════════════
   CASE STUDY PAGE
═══════════════════════════════════════ */

/* Wipe-arrival: hide body until JS positions bars, matching bar darkest colour */
html.wipe-arriving            { background: #1d2142; }
html.wipe-arriving body       { visibility: hidden; }

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cs-panel-w: 30%;
  --cs-nav-h: 100px;
  --cs-brand: #181818;
  --cs-text: #ffffff;
  --ease-brand: cubic-bezier(0.4, 0, 0.2, 1);
}

html, body.cs-body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f2f1ed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fixed black border frame — matches main site */
body.cs-body::before {
  content: '';
  position: fixed;
  inset: 0;
  border: 12px solid #000;
  pointer-events: none;
  z-index: 99998;
}

a { text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* ─── Nav ─────────────────────────────── */
.cs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--cs-nav-h);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 5vw, 80px);
  border-bottom: 3px solid #000;
  background: var(--cs-brand);
  transition: background 0.55s var(--ease-brand);
}

.cs-nav__logo img {
  height: 82px;
  width: auto;
  display: block;
  transition: opacity 0.2s;
}
.cs-nav__logo:hover img { opacity: 0.7; }

.cs-nav__links {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  margin-right: 2rem;
}

.cs-nav__links a {
  color: #000;
  font-size: 1.17rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

/* Split-flap flip */
.cs-nav .nav-flip {
  display: inline-block;
  position: relative;
  perspective: 500px;
}
.cs-nav .nav-flip__front,
.cs-nav .nav-flip__back {
  display: block;
  padding: 3px 9px;
  border-radius: 3px;
  backface-visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top center;
}
.cs-nav .nav-flip__front { color: #000; transform: rotateX(0deg); }
.cs-nav .nav-flip__back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #fff;
  transform: rotateX(90deg);
}
.cs-nav__links a:hover .nav-flip__front { transform: rotateX(-90deg); }
.cs-nav__links a:hover .nav-flip__back  { transform: rotateX(0deg); }

/* "Let's talk" button — matches main site btn-outline */
.cs-nav__cta {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 1.25rem;
  font-family: 'Lilita One', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid #000;
  border-radius: 999px;
  color: #000;
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.cs-nav__cta:hover {
  background: #000;
  color: #fff;
}

/* Burger button */
.cs-nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.cs-nav__burger span {
  display: block;
  width: 22px;
  height: 1px;
  background: #000;
}

/* Mobile nav */
@media (max-width: 900px) {
  .cs-nav__links {
    display: none;
    position: fixed;
    inset: var(--cs-nav-h) 0 0 0;
    background: var(--cs-brand);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    z-index: 99;
    transition: background 0.55s var(--ease-brand);
  }
  .cs-nav__links.open { display: flex; }
  .cs-nav__links a { font-size: 1.1rem; }
  .cs-nav__cta { display: none; }
  .cs-nav__burger { display: flex; }
}

@media (max-width: 480px) {
  .cs-nav__links {
    display: flex;
    position: static;
    inset: auto;
    flex: 1;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    background: none;
    gap: 0.75rem;
    z-index: auto;
  }
  .cs-nav__links li:first-child { display: none; }
  .cs-nav__links a {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
  }
  .cs-nav__burger { display: none; }
  .cs-nav__cta { display: none; }
}

/* ─── Layout ──────────────────────────── */
.cs-layout {
  display: flex;
  height: 100vh;
  padding-top: var(--cs-nav-h);
}

/* ─── Left Panel ──────────────────────── */
.cs-panel {
  position: fixed;
  top: var(--cs-nav-h);
  left: 0;
  width: var(--cs-panel-w);
  height: calc(100vh - var(--cs-nav-h));
  display: flex;
  flex-direction: column;
  background: var(--cs-brand);
  color: var(--cs-text);
  transition: background 0.55s var(--ease-brand);
  z-index: 100;
  user-select: none;
}

/* Dark upper strip — holds the big abbreviation */
.cs-panel__upper {
  flex: 0 0 auto;
  min-height: 5%;
  background: rgb(0, 0, 0);
  padding: 3rem 3rem 2.5rem;
  display: flex;
  align-items: flex-end;
}

.cs-panel__abbr {
  font-family: 'Passion One', sans-serif;
  font-size: clamp(4.5rem, 11vw, 9rem);
  line-height: 0.88;
  letter-spacing: -0.02em;
  color: #fff;
  transition: opacity 0.2s;
}

/* Brand-color lower area — client info */
.cs-panel__lower {
  flex: 1;
  padding: 2.5rem 3rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1.25rem;
}

.cs-panel__label {
  font-size: 0.rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.5;
}

.cs-panel__title {
  font-family: 'Passion One', sans-serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  transition: opacity 0.2s;
}

.cs-panel__desc {
  flex: 1;
  font-size: 1rem;
  line-height: 1.7;
  opacity: 0.8;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.cs-panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  transition: opacity 0.2s;
}

.cs-panel__tags span {
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.38rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 100px;
}

.cs-panel__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.88rem 1.75rem;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  width: fit-content;
  transition: background 0.2s, border-color 0.2s;
}

.cs-panel__btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #fff;
}

.cs-panel__btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Footer — arrow navigation */
.cs-panel__foot {
  flex: 0 0 auto;
  padding: 1.75rem 3rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cs-panel__arrow {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.cs-panel__arrow:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.65);
  transform: scale(1.06);
}

.cs-panel__arrow:active { transform: scale(0.97); }

.cs-panel__arrow svg {
  width: 17px;
  height: 17px;
}

.cs-panel__counter {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  opacity: 0.4;
}

/* ─── Right scrollable area ───────────── */
.cs-main {
  margin-left: var(--cs-panel-w);
  flex: 1;
  height: calc(100vh - var(--cs-nav-h));
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  background: #f2f1ed;
  scroll-behavior: auto;
}

/* Content grid — user fills these with real media */
.cs-content {
  padding: 2.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.cs-media {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #e2dfd8;
}

/* Default aspect — 3:2 */
.cs-media::after {
  content: '';
  display: block;
  padding-top: 66.67%;
}

.cs-media--wide {
  grid-column: 1 / -1;
}

.cs-media--wide::after { padding-top: 44%; }

.cs-media--tall::after { padding-top: 125%; }

/* Placeholder label */
.cs-media::before {
  content: attr(data-slot);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.18);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  z-index: 1;
}

.cs-media img,
.cs-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
}

/* ─── Right-side wipe overlay ─────────── */
.cs-wipe {
  position: sticky;
  top: 0;
  height: 0;
  overflow: visible;
  z-index: 200;
}

.cs-wipe__inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100vh - var(--cs-nav-h));
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.cs-wipe__bar {
  flex: 1;
  transform: translateX(101%);
  will-change: transform;
}

/* ─── Responsive ──────────────────────── */
@media (max-width: 900px) {
  :root {
    --cs-panel-w: 45%;
  }
}

@media (max-width: 640px) {
  .cs-layout {
    flex-direction: column;
  }

  .cs-panel {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    height: auto;
  }

  .cs-main {
    margin-left: 0;
    height: auto;
    overflow-y: visible;
  }

  html, body.cs-body {
    overflow: auto;
  }
}

/* ─── Full-screen nav-wipe overlay ───── */
.page-wipe {
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.page-wipe__bar {
  flex: 1;
  transform: translateX(101%);
  will-change: transform;
}

/* ─── Gold mode ───────────────────────── */
body.cs-gold .cs-main,
body.cs-gold { background: #f5e0a0; }

body.cs-gold .cs-media { background: #e8cc80; }

/* Gold bar pill — mirrors main site */
.cs-gold-bar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 18px;
  background: #000;
  border-radius: 999px 999px 0 0;
  cursor: pointer;
  user-select: none;
}

.cs-gold-bar__label {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #fff;
  text-transform: uppercase;
}

.cs-gold-bar__toggle {
  position: relative;
  width: 40px;
  height: 22px;
  background: #333;
  border-radius: 999px;
  transition: background 0.25s;
  flex-shrink: 0;
}

.cs-gold-bar__toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #888;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s;
}

.cs-gold-bar.active .cs-gold-bar__toggle { background: #ffab00; }
.cs-gold-bar.active .cs-gold-bar__toggle::after {
  transform: translateX(18px);
  background: #fff;
}
