/* ============================================================
   wemark — Projects ENHANCEMENT layer
   Cinematic case-study interactions, built on styles.css +
   pages.css + projects.css tokens. Warm-editorial, restrained.
   ============================================================ */

/* ---------- scroll progress ---------- */
.cs-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--burgundy); z-index: 200; pointer-events: none;
  transition: width .08s linear;
}

/* ---------- cinematic hero ---------- */
.cs-hero {
  position: relative; margin-top: 100px;
  height: calc(100svh - 100px); min-height: 600px;
  overflow: hidden; display: flex; align-items: flex-end;
  background: var(--walnut-deep); isolation: isolate;
}
.cs-hero__media { position: absolute; inset: 0; z-index: 0; will-change: transform; }
.cs-hero__media image-slot { display: block; width: 100%; height: 100%; transform: scale(1.18); transform-origin: center; }
.cs-hero__veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to top, rgba(20,10,5,0.88) 0%, rgba(20,10,5,0.5) 32%, rgba(20,10,5,0.06) 62%, rgba(20,10,5,0.28) 100%),
    linear-gradient(105deg, rgba(20,10,5,0.5) 0%, rgba(20,10,5,0) 55%);
}
.cs-hero__inner {
  position: relative; z-index: 2; width: 100%;
  padding-bottom: clamp(2.8rem, 7vh, 6rem); color: var(--cream);
}
.cs-hero__crumb {
  display: flex; gap: .6rem; align-items: center; margin-bottom: 1.5rem;
  font-size: .76rem; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(247,239,221,.72);
}
.cs-hero__crumb a { color: inherit; border-bottom: 1px solid rgba(247,239,221,.4); transition: border-color .2s; }
.cs-hero__crumb a:hover { border-color: rgba(247,239,221,.9); }
.cs-hero__title {
  font-family: var(--display); font-weight: 500; text-transform: lowercase;
  font-size: clamp(3.6rem, 12vw, 9.5rem); line-height: .84; letter-spacing: -0.025em;
  color: var(--cream); text-shadow: 0 2px 40px rgba(0,0,0,0.3);
}
.cs-hero__title--logo { line-height: 1; }
.cs-hero__title--logo img {
  display: block; width: clamp(280px, 38vw, 520px); height: auto;
  filter: drop-shadow(0 2px 30px rgba(0,0,0,0.35));
}
.cs-hero__title-sub {
  display: block; font-family: var(--sans); font-weight: 300; text-transform: uppercase;
  font-size: clamp(.85rem, 2.2vw, 1.6rem); letter-spacing: .46em;
  color: rgba(247,239,221,.82); margin-top: 1.2rem; padding-left: .35em;
}
.cs-hero__lead {
  max-width: 42ch; margin-top: 1.8rem;
  font-size: clamp(1.05rem, 1.5vw, 1.3rem); line-height: 1.55;
  color: rgba(247,239,221,.9);
}
.cs-hero__tags { list-style: none; display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2.1rem; }
.cs-hero__tags li {
  font-size: .78rem; letter-spacing: .01em; color: var(--cream);
  border: 1px solid rgba(247,239,221,.34); border-radius: 100px;
  padding: .45rem .95rem; backdrop-filter: blur(6px);
  background: rgba(247,239,221,.04);
}
.cs-hero__cue {
  position: absolute; bottom: clamp(1.4rem,4vh,2.4rem); right: clamp(1.5rem,5vw,6rem); z-index: 2;
  writing-mode: vertical-rl; display: flex; align-items: center; gap: .9rem;
  font-size: .68rem; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(247,239,221,.7);
}
.cs-hero__cue::after { content: ""; width: 1px; height: 46px; background: linear-gradient(rgba(247,239,221,.7), transparent); animation: cuePulse 2.2s ease-in-out infinite; }
@keyframes cuePulse { 0%,100% { transform: scaleY(.4); transform-origin: top; opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }

/* hero entrance — visible by default; only hidden once JS marks .preanim,
   then revealed on .ready. Guarantees content shows if JS/paint never runs. */
@media (prefers-reduced-motion: no-preference) {
  .cs-hero__crumb, .cs-hero__title, .cs-hero__title-sub, .cs-hero__lead, .cs-hero__tags {
    transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
  }
  .cs-hero.preanim .cs-hero__crumb, .cs-hero.preanim .cs-hero__title,
  .cs-hero.preanim .cs-hero__title-sub, .cs-hero.preanim .cs-hero__lead,
  .cs-hero.preanim .cs-hero__tags { opacity: 0; transform: translateY(26px); }
  .cs-hero.ready .cs-hero__crumb { transition-delay: .05s; }
  .cs-hero.ready .cs-hero__title { transition-delay: .14s; }
  .cs-hero.ready .cs-hero__title-sub { transition-delay: .26s; }
  .cs-hero.ready .cs-hero__lead { transition-delay: .36s; }
  .cs-hero.ready .cs-hero__tags { transition-delay: .46s; }
  .cs-hero.ready .cs-hero__crumb, .cs-hero.ready .cs-hero__title,
  .cs-hero.ready .cs-hero__title-sub, .cs-hero.ready .cs-hero__lead,
  .cs-hero.ready .cs-hero__tags { opacity: 1; transform: none; }
}

/* ---------- chapter rail ---------- */
.cs-rail {
  position: fixed; left: clamp(1rem, 2.2vw, 2.4rem); top: 50%; transform: translateY(-50%);
  z-index: 90; display: none; flex-direction: column; gap: .2rem;
}
.cs-rail__item {
  display: flex; align-items: center; gap: .8rem; padding: .5rem 0;
  background: none; border: none; cursor: pointer; text-align: left;
  color: var(--camel); opacity: .55; transition: opacity .3s, color .3s;
  font-family: var(--sans);
}
.cs-rail__item:hover { opacity: 1; }
.cs-rail__dash { width: 18px; height: 1.5px; background: currentColor; transition: width .3s, background .3s; flex: none; }
.cs-rail__num { font-family: var(--display); font-size: .9rem; width: 1.4em; }
.cs-rail__label {
  font-size: .74rem; letter-spacing: .04em; white-space: nowrap;
  max-width: 0; overflow: hidden; opacity: 0; transition: max-width .35s ease, opacity .3s;
}
.cs-rail__item:hover .cs-rail__label,
.cs-rail__item.active .cs-rail__label { max-width: 200px; opacity: 1; }
.cs-rail__item.active { opacity: 1; color: var(--burgundy); }
.cs-rail__item.active .cs-rail__dash { width: 30px; background: var(--burgundy); }
@media (min-width: 1240px) { .cs-rail { display: flex; } }

/* ---------- interactive colour swatches ---------- */
.swatch { position: relative; }
.swatch__chip {
  cursor: pointer; transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s;
  position: relative;
}
.swatch__chip::after {
  content: "Copy"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--sans); font-size: .72rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: #fff; background: rgba(0,0,0,0.28);
  opacity: 0; transition: opacity .25s; border-radius: inherit;
}
.swatch__chip:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -16px rgba(47,27,17,0.5); }
.swatch__chip:hover::after { opacity: 1; }
.swatch__chip.copied::after { content: "Copied ✓"; opacity: 1; background: rgba(31,58,61,0.55); }

/* ---------- gallery: hover zoom + caption + zoomable cursor ---------- */
.cs-gallery .cs-slot { position: relative; }
.cs-gallery .cs-slot image-slot { transition: transform .9s cubic-bezier(.2,.7,.2,1); }
.cs-gallery .cs-slot[data-zoom] { cursor: zoom-in; }
.cs-gallery .cs-slot[data-zoom] image-slot { pointer-events: none; }
.cs-gallery .cs-slot[data-zoom]:hover image-slot { transform: scale(1.05); }
.cs-cap-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; pointer-events: none;
  padding: 1.4rem 1.2rem .9rem; color: var(--cream);
  font-size: .82rem; letter-spacing: .02em;
  background: linear-gradient(to top, rgba(20,10,5,0.7), rgba(20,10,5,0));
  opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s;
}
.cs-gallery .cs-slot:hover .cs-cap-overlay { opacity: 1; transform: none; }

/* ---------- browser frame: float + sheen ---------- */
.browser { transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s; }
.browser:hover { transform: translateY(-6px); box-shadow: 0 44px 80px -36px rgba(47,27,17,0.55); }

/* ---------- pulse module: live ring ---------- */
.pmod { position: relative; overflow: hidden; transition: transform .4s, border-color .4s, box-shadow .4s; }
.pmod:hover { transform: translateY(-5px); border-color: var(--line); box-shadow: 0 24px 44px -28px rgba(47,27,17,0.4); }
.pmod__live::before {
  position: relative;
  box-shadow: 0 0 0 0 rgba(124,45,42,0.5); animation: livePulse 2.2s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(124,45,42,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(124,45,42,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,45,42,0); }
}

/* count-up underline draw on stats */
.cs-stat { position: relative; }
.cs-stat__v { display: inline-block; }

/* ---------- lightbox ---------- */
.cs-lightbox {
  position: fixed; inset: 0; z-index: 300; display: none;
  align-items: center; justify-content: center; padding: clamp(1rem,4vw,4rem);
  background: rgba(18,9,4,0.92); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .3s;
}
.cs-lightbox.open { display: flex; opacity: 1; }
.cs-lightbox img {
  max-width: 100%; max-height: 100%; border-radius: 8px;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,0.7);
  transform: scale(.96); transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.cs-lightbox.open img { transform: scale(1); }
.cs-lightbox__close {
  position: absolute; top: clamp(1rem,3vw,2rem); right: clamp(1rem,3vw,2rem);
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(247,239,221,.3);
  background: rgba(247,239,221,.06); color: var(--cream); cursor: pointer;
  display: grid; place-items: center; font-size: 1.2rem; transition: background .2s, transform .2s;
}
.cs-lightbox__close:hover { background: rgba(247,239,221,.16); transform: rotate(90deg); }

/* ---------- toast ---------- */
.cs-toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translate(-50%, 20px); z-index: 310;
  background: var(--walnut); color: var(--cream); padding: .7rem 1.3rem; border-radius: 100px;
  font-size: .85rem; letter-spacing: .02em; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; box-shadow: 0 18px 40px -18px rgba(0,0,0,0.5);
}
.cs-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- richer reveal (stagger children) ---------- */
@media (prefers-reduced-motion: no-preference) {
  [data-stagger] > * { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
  [data-stagger].in > * { opacity: 1; transform: none; }
  [data-stagger].in > *:nth-child(1) { transition-delay: .04s; }
  [data-stagger].in > *:nth-child(2) { transition-delay: .1s; }
  [data-stagger].in > *:nth-child(3) { transition-delay: .16s; }
  [data-stagger].in > *:nth-child(4) { transition-delay: .22s; }
  [data-stagger].in > *:nth-child(5) { transition-delay: .28s; }
  [data-stagger].in > *:nth-child(6) { transition-delay: .34s; }
}

/* responsive */
@media (max-width: 700px) {
  .cs-hero { height: calc(100svh - 100px); min-height: 520px; }
  .cs-hero__cue { display: none; }
}

/* ============================================================
   LIVE MOCKUPS — scaled iframes inside device frames
   ============================================================ */
.mock { position: relative; width: 100%; height: 100%; overflow: hidden; background: #fff; }
.mock iframe { position: absolute; top: 0; left: 0; border: 0; display: block; transform-origin: top left; }
.mock__live {
  position: absolute; top: 10px; right: 10px; z-index: 4; pointer-events: none;
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--sans); font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: rgba(31,28,24,.62); backdrop-filter: blur(6px);
  padding: .34rem .6rem; border-radius: 100px;
}
.mock__live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #6fcf97; box-shadow: 0 0 0 0 rgba(111,207,151,.6); animation: livePulse 2s ease-out infinite; }

/* digital: browser + single phone accent */
.devices .phone { max-width: 248px; justify-self: center; width: 100%; }
.devices > div { min-width: 0; }
.device-cap { margin-top: .9rem; font-size: .82rem; color: var(--camel); }

/* ---- live device mockups: equal height + pulse-consistent phone bezel ---- */
.devices { align-items: center; --dev-h: clamp(440px, 42vw, 580px); }
/* desktop browser fills the shared height */
.devices .browser { display: flex; flex-direction: column; height: var(--dev-h); }
.devices .browser__screen { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; }
/* phone column centers the bezel */
.devices > div:last-child { text-align: center; }
/* iPhone bezel — matches the pulse page, height-matched to the browser */
.devices .ps-phone {
  display: inline-flex; flex-direction: column; vertical-align: bottom;
  position: relative; padding: 9px;
  background: linear-gradient(145deg, #4a3a2c 0%, #2a1d13 46%, #170f08 100%);
  border-radius: 44px;
  box-shadow:
    0 40px 70px -32px rgba(47,27,17,0.6),
    0 12px 26px -12px rgba(0,0,0,0.5),
    inset 0 0 0 2px rgba(255,255,255,0.07),
    inset 0 0 0 7px rgba(0,0,0,0.32);
}
.devices .ps-phone__screen {
  position: relative; border-radius: 36px; overflow: hidden; background: #fff;
  height: calc(var(--dev-h) - 18px);
  width: calc((var(--dev-h) - 18px) * 9 / 19.5);
}
.devices .ps-phone__island {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 84px; height: 24px; background: #000; border-radius: 999px; z-index: 6;
}
.devices .ps-phone__btn { position: absolute; background: #2a1d13; border-radius: 2px; }
.devices .ps-phone__btn--pwr { right: -2px; top: 30%; width: 3px; height: 15%; border-radius: 0 3px 3px 0; background: linear-gradient(90deg, #2a1d13, #4a3a2c); }
.devices .ps-phone__btn--vu { left: -2px; top: 21%; width: 3px; height: 8%; border-radius: 3px 0 0 3px; background: linear-gradient(270deg, #2a1d13, #4a3a2c); }
.devices .ps-phone__btn--vd { left: -2px; top: 31%; width: 3px; height: 8%; border-radius: 3px 0 0 3px; background: linear-gradient(270deg, #2a1d13, #4a3a2c); }

/* pulse: loop demo split */
.loop-demo {
  display: grid; grid-template-columns: 300px 1fr;
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
  margin-top: clamp(2.2rem, 4.5vw, 3.5rem);
}
.loop-demo .phone { max-width: 300px; width: 100%; }
.loop-demo__copy h3 {
  font-family: var(--display); font-weight: 500; color: var(--walnut);
  font-size: clamp(1.6rem, 2.8vw, 2.3rem); line-height: 1.08; letter-spacing: -0.01em;
  margin-bottom: 1.1rem; max-width: 16ch;
}
.loop-demo__copy > p { color: var(--cocoa); font-size: 1.06rem; line-height: 1.65; max-width: 42ch; margin-bottom: 1.6rem; }
.loop-flow { list-style: none; display: grid; gap: .9rem; margin: 0 0 1.6rem; }
.loop-flow li { display: flex; gap: .85rem; align-items: flex-start; color: var(--walnut); font-size: .98rem; line-height: 1.5; }
.loop-flow .lf-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; font-size: .85rem; color: #fff; margin-top: 1px; }
.loop-flow .lf-ic--good { background: #3CB371; }
.loop-flow .lf-ic--flag { background: var(--camel); }
.loop-demo__hint { font-family: var(--sans); font-size: .82rem; color: var(--camel); display: inline-flex; align-items: center; gap: .5rem; }
.loop-demo__hint::before { content: "👆"; }

@media (max-width: 860px) {
  .loop-demo { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .loop-demo__copy h3, .loop-demo__copy > p { max-width: none; }
  .loop-flow li { text-align: left; }
}
@media (max-width: 700px) {
  .devices .phone { max-width: 220px; }
}

/* ============================================================
   PHOTOGRAPHY — static editorial mosaic (all 4 visible)
   ============================================================ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: "a a a" "b c d";
  gap: clamp(10px, 1.3vw, 18px);
}
.pg-item {
  position: relative; margin: 0; overflow: hidden;
  border-radius: 16px; background: var(--linen-soft);
}
.pg-item--a { grid-area: a; aspect-ratio: 16 / 9; }
.pg-item--b { grid-area: b; aspect-ratio: 3 / 4; }
.pg-item--c { grid-area: c; aspect-ratio: 3 / 4; }
.pg-item--d { grid-area: d; aspect-ratio: 3 / 4; }
.pg-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-item image-slot { display: block; width: 100%; height: 100%; }

.photo-note {
  margin-top: clamp(1.4rem, 3vw, 2.2rem); display: flex; align-items: center; gap: 1.2rem;
  flex-wrap: wrap; color: var(--cocoa); font-size: .96rem;
}
.photo-note .pn-tags { display: flex; gap: .5rem; flex-wrap: wrap; }
.photo-note .pn-tag { font-size: .78rem; color: var(--cocoa); border: 1px solid var(--line); border-radius: 100px; padding: .4rem .9rem; }

@media (max-width: 860px) {
  .photo-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "a a" "b c" "d d";
  }
  .pg-item--a, .pg-item--d { aspect-ratio: 16 / 9; }
  .pg-item--b, .pg-item--c { aspect-ratio: 1 / 1; }
}
@media (max-width: 520px) {
  .photo-grid { grid-template-columns: 1fr; grid-template-areas: "a" "b" "c" "d"; }
  .pg-item--a, .pg-item--b, .pg-item--c, .pg-item--d { aspect-ratio: 16 / 10; }
}

/* ============================================================
   INSTAGRAM PROFILE MOCKUP — launch grid as a real IG profile
   ============================================================ */
.ig-mock {
  max-width: 680px; margin: 0 auto;
  background: var(--white); border: 1px solid var(--line-soft);
  border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 64px -38px rgba(47,27,17,0.42);
}
.ig-mock__head {
  display: flex; align-items: center; gap: clamp(1.4rem, 4vw, 2.6rem);
  padding: clamp(1.5rem, 3.5vw, 2.2rem);
}
.ig-mock__avatar {
  flex: none; width: clamp(78px, 16vw, 104px); aspect-ratio: 1;
  border-radius: 50%; padding: 3px; background: var(--cream);
  box-shadow: 0 0 0 2px var(--line-soft), inset 0 0 0 3px var(--white);
}
.ig-mock__avatar image-slot { display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.ig-mock__meta { min-width: 0; flex: 1; }
.ig-mock__top { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.05rem; }
.ig-mock__handle { font-family: var(--display); font-size: clamp(1.15rem, 2.4vw, 1.5rem); color: var(--walnut); font-weight: 500; letter-spacing: -0.01em; }
.ig-mock__btn {
  font-family: var(--sans); font-size: .82rem; font-weight: 500;
  padding: .42rem .95rem; border-radius: 9px; color: var(--walnut);
  background: var(--linen-soft); border: 1px solid var(--line-soft); white-space: nowrap;
}
.ig-mock__btn--primary { background: var(--walnut); color: var(--cream); border-color: var(--walnut); }
.ig-mock__stats { list-style: none; display: flex; gap: clamp(1.1rem, 3vw, 2.1rem); margin: 0 0 1rem; padding: 0; }
.ig-mock__stats li { font-family: var(--sans); font-size: .92rem; color: var(--cocoa); }
.ig-mock__stats b { color: var(--walnut); font-weight: 600; }
.ig-mock__bio { display: flex; flex-direction: column; gap: .12rem; font-family: var(--sans); font-size: .92rem; line-height: 1.5; color: var(--cocoa); }
.ig-mock__bio strong { color: var(--walnut); font-weight: 600; }
.ig-mock__link { color: var(--camel); font-weight: 500; }
.ig-mock__tabs {
  display: flex; justify-content: center; gap: clamp(2rem, 6vw, 3.6rem);
  border-top: 1px solid var(--line-soft);
  font-family: var(--sans); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--camel);
}
.ig-mock__tabs span { padding: .95rem 0; border-top: 1px solid transparent; margin-top: -1px; }
.ig-mock__tabs .is-on { color: var(--walnut); border-top-color: var(--walnut); }
.ig-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; background: var(--line-soft); }
.ig-cell { position: relative; margin: 0; aspect-ratio: 1; overflow: hidden; background: var(--linen-soft); }
.ig-cell image-slot { display: block; width: 100%; height: 100%; }
.ig-cell__ov {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 1.8rem; color: #fff; background: rgba(47,27,17,0.32);
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.ig-cell:hover .ig-cell__ov { opacity: 1; }
@media (max-width: 560px) {
  .ig-mock__head { flex-direction: column; text-align: center; gap: 1.1rem; }
  .ig-mock__top, .ig-mock__stats { justify-content: center; }
  .ig-mock__bio { align-items: center; }
}
