/* ============================================================
   FoxDim portfolio — CASE STUDY pages
   Built on FoxDim tokens. Dark canvas · single orange accent.
   Scroll-driven container hero, editorial scenario layouts,
   interactive hotspots, animated results, gamified explorer.
   ============================================================ */

/* deeper canvas for case pages */
body.case { background: var(--bg-0); }

/* ---------------------------------------------------------------- reading progress */
.read-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), #ffd9c4);
  z-index: 200; box-shadow: 0 0 12px rgba(var(--accent-rgb), .6);
  transition: width .08s linear;
}

/* ---------------------------------------------------------------- case hero */
.case-hero { position: relative; padding: 150px 0 0; overflow: hidden; isolation: isolate; }
.case-hero .beams { position: absolute; inset: -20% -10%; z-index: 0; }
.case-hero .glow {
  position: absolute; top: -10%; left: 50%; transform: translateX(-50%);
  width: 1100px; height: 600px; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), .14), transparent 65%);
  filter: blur(20px);
}
.case-hero .wrap { position: relative; z-index: 3; }

.back-link {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 44px;
  font-size: 14px; font-weight: var(--w-light); letter-spacing: .03em; color: var(--fg-3);
  transition: gap var(--dur-fast), color var(--dur-fast);
}
.back-link svg { width: 18px; height: 18px; transition: transform var(--dur-fast) var(--ease-brand); }
.back-link:hover { color: var(--accent); gap: 16px; }
.back-link:hover svg { transform: translateX(-4px); }

.ch-head { max-width: 980px; }
.ch-eyebrow { margin-bottom: 26px; }
/* Project logo shown INSTEAD of the text title — its height matches the big
   case title (clamp 3.4rem→7.5rem) so a logo and a wordmark title read at the
   same scale. width:auto keeps the logo's aspect; tall wordmarks are capped. */
.ch-logo {
  height: clamp(3.2rem, 7.4vw, 6.8rem); width: auto;
  max-width: min(100%, 780px); margin: 0; display: block;
}
.ch-title {
  margin: 0; font-size: clamp(3.4rem, 8vw, 7.5rem); line-height: .92;
  font-weight: var(--w-bold); letter-spacing: -.03em; color: var(--white);
}
.ch-title .lt { display: inline-block; opacity: 0; transform: translateY(40px) rotate(6deg); }
/* visually-hidden title kept for SEO/screen-readers when a logo replaces it */
.ch-title.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.ch-tagline {
  margin: 30px 0 0; max-width: 60ch; font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  line-height: 1.5; font-weight: var(--w-light); color: var(--fg-2);
}

/* meta strip */
.ch-meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin: 64px 0 0; background: var(--line-1);
  border: 1px solid var(--line-1); border-radius: var(--r-lg); overflow: hidden;
}
.ch-meta .m { background: var(--bg-1); padding: 26px 28px; }
.ch-meta .ml { font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-weight: var(--w-extralight); margin-bottom: 12px; }
.ch-meta .mv { font-size: 16px; font-weight: var(--w-light); color: var(--fg-1); line-height: 1.45; }

/* ---------------------------------------------------------------- container-scroll hero card */
.cs-stage { position: relative; height: 200vh; margin-top: 70px; }
/* PHONE hero: no 200vh scroll-pin. Normal-flow centered phone whose screen
   scrolls internally and chains to the page when it reaches the end. */
.cs-stage.phone { height: auto; margin-top: 30px; }
.cs-stage.phone .cs-sticky { position: static; height: auto; min-height: 0; padding: 5rem 0 6rem; overflow: visible; }
.cs-sticky { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cs-perspective { perspective: 1200px; width: 100%; max-width: 1180px; padding: 0 var(--space-page); }
.cs-kicker { text-align: center; margin-bottom: 30px; will-change: transform; }
.cs-kicker .k1 { font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--fg-4); font-weight: var(--w-extralight); }
.cs-kicker .k2 { margin: 12px 0 0; font-size: clamp(1.8rem, 4vw, 3rem); font-weight: var(--w-extralight); color: var(--fg-1); letter-spacing: -.01em; }
/* DESKTOP mockup: a monitor bezel whose height ADAPTS to the uploaded image —
   no fixed aspect-ratio, image renders at width:100% height:auto, so it is
   never cropped. The optional browser bar is a real strip ABOVE the image. */
.cs-card {
  position: relative; margin: 0 auto; width: 100%; max-width: 1100px;
  border-radius: 24px; padding: 14px;
  background: linear-gradient(145deg, #1c1c1c, #0a0a0a);
  border: 1px solid var(--line-3); will-change: transform;
  box-shadow: 0 0 #0000004d, 0 9px 20px #0000004a, 0 37px 37px #00000042, 0 84px 50px #00000026, 0 149px 60px #0000000a;
}
.cs-screen {
  position: relative; width: 100%; overflow: hidden;
  border-radius: 14px; background: #000;
  display: flex; flex-direction: column;
}
.cs-screen img { width: 100%; height: auto; display: block; }
.cs-screen .browser-bar {
  position: relative; height: 34px; flex: none; z-index: 2;
  background: rgba(10,10,10,.9);
  display: flex; align-items: center; gap: 7px; padding: 0 14px;
  border-bottom: 1px solid var(--line-1);
}
.cs-screen .browser-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--line-3); }

/* APP mockup: a phone bezel. Tall app screens scroll vertically inside it
   instead of being cropped. */
.cs-card.phone {
  max-width: 360px; border-radius: 46px; padding: 13px;
  background: linear-gradient(160deg, #1d1d1d, #070707);
}
.cs-card.phone .cs-screen {
  border-radius: 34px; max-height: 74vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cs-card.phone .cs-screen::-webkit-scrollbar { width: 0; height: 0; }
.cs-card.phone .cs-screen img { width: 100%; height: auto; }

/* ---------------------------------------------------------------- generic case sections */
.case-section { padding: 7rem 0; position: relative; }
.case-section.tight { padding: 4.5rem 0; }
.sec-eyebrow { margin-bottom: 22px; }
.sec-title {
  margin: 0; font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-weight: var(--w-extralight);
  line-height: 1.04; letter-spacing: -.02em; color: var(--white);
}
.sec-lead {
  margin: 28px 0 0; max-width: 64ch; font-size: var(--t-body); line-height: 1.75;
  font-weight: var(--w-light); color: var(--fg-2);
}
.sec-lead + .sec-lead { margin-top: 1.4rem; }
.sec-lead b { color: var(--accent); font-weight: var(--w-medium); }

/* overview: lead text + pull quote */
.overview-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 80px; align-items: start; }
.pull {
  border-left: 2px solid var(--accent); padding: 6px 0 6px 28px;
  font-size: 1.5rem; line-height: 1.4; font-weight: var(--w-light); color: var(--fg-1);
}
.pull b { color: var(--accent); font-weight: var(--w-regular); }

/* ---------------------------------------------------------------- problem ↔ solution */
.ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 3.5rem; }
.ps-col { background: var(--surface-1); border: 1px solid var(--line-1); border-radius: var(--r-xl); padding: 40px; }
.ps-col.fix { background: linear-gradient(145deg, rgba(var(--accent-rgb),.06), rgba(var(--accent-rgb),.01)); border-color: var(--accent-line); }
.ps-col h4 { margin: 0 0 24px; font-size: 13px; text-transform: uppercase; letter-spacing: .14em; font-weight: var(--w-regular); display: inline-flex; align-items: center; gap: 12px; }
.ps-col.bad h4 { color: var(--fg-3); }
.ps-col.fix h4 { color: var(--accent); }
.ps-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.ps-col li { display: flex; gap: 16px; font-size: 16px; line-height: 1.55; font-weight: var(--w-light); color: var(--fg-2); }
.ps-col li .mk { flex: none; width: 22px; height: 22px; margin-top: 1px; display: flex; align-items: center; justify-content: center; }
.ps-col.bad li .mk { color: var(--fg-4); }
.ps-col.fix li .mk { color: var(--accent); }
.ps-col li .mk svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- scenarios (editorial) */
.scenario { display: grid; grid-template-columns: 1fr 1fr; gap: 70px; align-items: center; margin-top: 8rem; }
.scenario:first-of-type { margin-top: 4rem; }
.scenario.flip .sc-media { order: 2; }
.sc-text .sc-n {
  font-size: 15px; font-weight: var(--w-bold); color: var(--accent);
  letter-spacing: .08em; display: inline-flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.sc-text .sc-n::before { content: ""; width: 30px; height: 1px; background: var(--accent); }
.sc-text h3 { margin: 0 0 18px; font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: var(--w-light); line-height: 1.12; color: var(--white); letter-spacing: -.01em; }
.sc-text p { margin: 0; font-size: 17px; line-height: 1.7; font-weight: var(--w-light); color: var(--fg-2); max-width: 52ch; }
.sc-text .sc-bullets { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.sc-text .sc-bullets li { display: flex; gap: 13px; font-size: 15px; color: var(--fg-3); font-weight: var(--w-light); line-height: 1.5; }
.sc-text .sc-bullets li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 8px; border-radius: 50%; background: var(--accent); }

/* media frame + hotspots */
.sc-media { position: relative; }
/* overflow VISIBLE so a hotspot tooltip can extend past the image edge without
   being cut off (req: the title a hotspot opens must not be clipped). The image
   itself stays clipped to rounded corners by the inner .media-clip wrapper. */
.media-frame {
  position: relative; border-radius: var(--r-lg); overflow: visible;
  border: 1px solid var(--line-2); background: #000;
  box-shadow: var(--shadow-card);
}
.media-clip { position: relative; border-radius: inherit; overflow: hidden; display: block; }
.media-frame img { width: 100%; height: auto; display: block; }
.media-frame.contain { background: linear-gradient(145deg, #141414, #060606); padding: 5%; }
.media-frame.contain .media-clip { border-radius: var(--r-sm); }
.media-frame.phone { background: linear-gradient(160deg, #161616, #070707); padding: 4% 22%; }
.media-frame.phone .media-clip { border-radius: var(--r-md); }
.media-frame .caption {
  position: absolute; left: 14px; bottom: 14px; z-index: 4;
  font-size: 12px; letter-spacing: .03em; color: var(--fg-2); font-weight: var(--w-light);
  background: rgba(0,0,0,.78); backdrop-filter: blur(8px);
  border: 1px solid var(--line-white); padding: 7px 14px; border-radius: var(--r-pill);
}

/* hotspots */
.hotspot {
  position: absolute; z-index: 6; width: 34px; height: 34px;
  transform: translate(-50%, -50%); cursor: pointer;
  /* reset default <button> chrome — no square box, border or fill */
  -webkit-appearance: none; appearance: none;
  background: none; border: 0; padding: 0; margin: 0; outline: none;
}
/* the "+" marker has a TRANSPARENT (tinted-glass) fill — no white background —
   so the screenshot shows through it. Just an orange ring + orange "+". */
.hotspot .dot {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(var(--accent-rgb), .16);
  border: 2px solid var(--accent);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), .5);
  transition: transform var(--dur-fast) var(--ease-brand), background var(--dur-fast);
}
.hotspot .dot::before { content: "+"; color: var(--accent); font-size: 22px; font-weight: 600; line-height: 1; }
.hotspot .pulse {
  position: absolute; inset: 0; border-radius: 50%; background: var(--accent);
  animation: hsPulse 2.4s var(--ease-brand) infinite; z-index: -1;
}
@keyframes hsPulse { 0% { transform: scale(1); opacity: .55; } 70%,100% { transform: scale(2.6); opacity: 0; } }
.hotspot:hover .dot { transform: scale(1.18); background: rgba(var(--accent-rgb), .3); }
.hotspot.found .dot { background: var(--accent); border-color: var(--accent); }
.hotspot.found .dot::before { content: ""; }
.hotspot.found .dot::after {
  content: ""; width: 12px; height: 7px; border-left: 2px solid var(--bg-0); border-bottom: 2px solid var(--bg-0);
  transform: rotate(-45deg) translate(1px,-2px);
}
.hotspot.found .pulse { display: none; }
.hotspot .tip {
  position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%) translateY(8px);
  width: 248px; padding: 16px 18px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--accent-line);
  box-shadow: var(--shadow-card); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-brand), transform var(--dur-fast) var(--ease-brand);
}
.hotspot.open .tip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.hotspot .tip h5 { margin: 0 0 7px; font-size: 14px; font-weight: var(--w-medium); color: var(--accent); }
.hotspot .tip p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--fg-2); font-weight: var(--w-light); }
.hotspot .tip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: var(--surface-2); }
.hint-explore {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 22px;
  font-size: 13px; color: var(--fg-4); font-weight: var(--w-light); letter-spacing: .02em;
}
.hint-explore svg { width: 16px; height: 16px; color: var(--accent); }

/* ---------------------------------------------------------------- gallery strip */
.gallery { display: grid; gap: 22px; margin-top: 3rem; }
.gallery.g2 { grid-template-columns: 1fr 1fr; }
.gallery.g3 { grid-template-columns: repeat(3, 1fr); }
.gallery .media-frame img { width: 100%; }

/* ---------------------------------------------------------------- palette / design-system strip */
.ds-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-top: 3rem; }
.sw { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-1); background: var(--surface-1); }
.sw .chip { height: 96px; }
.sw .meta { padding: 14px 16px; }
.sw .meta .hx { font-size: 14px; font-weight: var(--w-medium); color: var(--fg-1); letter-spacing: .02em; }
.sw .meta .nm { font-size: 12px; color: var(--fg-4); margin-top: 3px; }

/* ---------------------------------------------------------------- results */
.case-section.results { background: var(--bg-1); border-top: 1px solid var(--line-1); border-bottom: 1px solid var(--line-1); }
.results-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; margin-top: 3.5rem; }
.metric {
  background: linear-gradient(145deg, rgba(var(--accent-rgb),.07), rgba(var(--accent-rgb),.01));
  border: 1px solid var(--accent-line); border-radius: var(--r-lg); padding: 36px 30px; text-align: left;
  transition: transform var(--dur-fast) var(--ease-brand), box-shadow var(--dur-fast) var(--ease-brand);
}
.metric:hover { transform: translateY(-6px); box-shadow: var(--shadow-card); }
.metric .mnum { font-size: clamp(2.6rem, 4.4vw, 3.6rem); font-weight: var(--w-bold); color: var(--accent); line-height: 1; letter-spacing: -.02em; }
.metric .mnum .pre, .metric .mnum .suf { font-weight: var(--w-light); color: var(--fg-2); }
.metric .mlbl { margin-top: 16px; font-size: 14px; line-height: 1.5; color: var(--fg-3); font-weight: var(--w-light); }
.result-note { margin: 3.2rem auto 0; max-width: 70ch; text-align: center; font-size: 1.15rem; line-height: 1.7; font-weight: var(--w-light); color: var(--fg-3); }

/* ---------------------------------------------------------------- next-case CTA */
.next-case { position: relative; padding: 7rem 0; text-align: center; overflow: hidden; }
.next-case .eyebrow { justify-content: center; margin-bottom: 26px; }
.next-case .nc-name { font-size: clamp(2.6rem, 6vw, 5rem); font-weight: var(--w-extralight); letter-spacing: -.02em; color: var(--white); margin: 0; }
.next-case a.nc-link { display: inline-flex; flex-direction: column; align-items: center; gap: 18px; }
.next-case .nc-go { display: inline-flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 15px; color: var(--accent); font-weight: var(--w-light); }
.next-case .nc-go svg { width: 20px; height: 20px; transition: transform var(--dur-fast) var(--ease-brand); }
.next-case a:hover .nc-go svg { transform: translateX(6px); }

/* ---------------------------------------------------------------- gamified explorer widget */
.explorer {
  position: fixed; right: 26px; bottom: 26px; z-index: 150;
  display: flex; align-items: center; gap: 14px;
  background: rgba(17,17,17,.86); backdrop-filter: blur(14px);
  border: 1px solid var(--line-2); border-radius: var(--r-cta);
  padding: 10px 20px 10px 12px; box-shadow: var(--shadow-card);
  transform: translateY(140%); opacity: 0;
  transition: transform .6s var(--ease-brand), opacity .6s, border-color var(--dur-fast);
}
.explorer.show { transform: none; opacity: 1; }
.explorer.complete { border-color: var(--accent); }
.exp-ring { position: relative; width: 46px; height: 46px; flex: none; }
.exp-ring svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.exp-ring .track { stroke: var(--line-2); }
.exp-ring .prog { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease-brand); }
.exp-ring .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: var(--w-semibold); color: var(--fg-1); }
.exp-text { line-height: 1.25; }
.exp-text .t1 { font-size: 13px; font-weight: var(--w-medium); color: var(--fg-1); }
.exp-text .t2 { font-size: 11px; color: var(--fg-4); margin-top: 2px; }
.explorer.complete .exp-text .t1 { color: var(--accent); }

/* achievement toast */
.achv {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 160%);
  z-index: 250; display: flex; align-items: center; gap: 18px;
  background: linear-gradient(145deg, #1a1a1a, #0c0c0c);
  border: 1px solid var(--accent); border-radius: var(--r-xl);
  padding: 20px 30px 20px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 40px rgba(var(--accent-rgb),.2);
  opacity: 0; transition: transform .7s var(--ease-brand), opacity .5s;
}
.achv.show { transform: translate(-50%, 0); opacity: 1; }
.achv .badge {
  width: 56px; height: 56px; flex: none; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.achv .badge svg { width: 28px; height: 28px; }
.achv .txt .a1 { font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--accent); font-weight: var(--w-regular); }
.achv .txt .a2 { font-size: 17px; font-weight: var(--w-medium); color: var(--fg-1); margin-top: 4px; }
.achv .txt .a3 { font-size: 13px; color: var(--fg-3); font-weight: var(--w-light); margin-top: 4px; }

/* confetti */
.confetti { position: fixed; inset: 0; z-index: 240; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 9px; opacity: 0; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .ch-meta { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; gap: 40px; }
  .ps-grid { grid-template-columns: 1fr; }
  .scenario { grid-template-columns: 1fr; gap: 36px; margin-top: 5rem; }
  .scenario.flip .sc-media { order: 0; }
  .gallery.g2, .gallery.g3 { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .cs-stage { height: 150vh; }
}
@media (max-width: 560px) {
  .ch-meta { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .explorer { right: 14px; bottom: 14px; padding: 8px 16px 8px 10px; }
  .case-section { padding: 5rem 0; }
}

/* reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .hotspot .pulse { animation: none; }
  .ch-title .lt { opacity: 1; transform: none; }
}
