/* ============================================================================
   case-study.css — Shared module library for project case-study pages
   ----------------------------------------------------------------------------
   Built on top of the existing Webflow design tokens (Inter Tight, the
   --black-85 / --black-40 / --black-15 grayscale, .container, ._1-1-grid).
   Goal: every new module here should feel "aus einem Guss" with the rest of
   the site. New, page-specific modules live here so jonashapp.webflow.css is
   not touched. Interactions for these modules live in src/js/case-study.js.

   Module index:
     1.  Tokens & helpers
     2.  Persona greeting banner          .cs-persona
     3.  Section heading / eyebrow         .cs-eyebrow / .cs-section
     4.  Tag chips                         .cs-tags
     5.  Metric / stat cards               .cs-stats
     6.  Info & process cards              .cs-cards / .cs-step
     7.  Pull quote                        .cs-quote
     8.  Image section (full-width)        .cs-image
     9.  Placeholder block                 .cs-ph
     10. Carousel                          .cs-carousel
     11. Phone mockup                      .cs-phone
     12. Lightbox / pop-up modal           .cs-modal
     13. Technical architecture diagram    .cs-arch
   ========================================================================== */

/* ── 1. Tokens & helpers ─────────────────────────────────────────────────── */
:root {
  /* Accent can be overridden per page or by the persona layer (case-study.js) */
  --cs-accent: #0a66c2;
  --cs-ink: rgba(0, 0, 0, .85);
  --cs-muted: rgba(0, 0, 0, .4);
  --cs-hair: rgba(0, 0, 0, .15);
  --cs-surface: #f6f7f9;
  --cs-radius: 16px;
  --cs-radius-sm: 10px;
  --cs-gap: 32px;
  --cs-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cs-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cs-eyebrow {
  font-family: 'Inter Tight', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cs-ink);
  margin: 0;
}

.cs-lead {
  font-family: 'Inter Tight', sans-serif;
  font-size: 22px;
  line-height: 150%;
  color: var(--cs-muted);
  max-width: 60ch;
}

/* ── 2. Persona greeting banner ──────────────────────────────────────────── */
/* Personalised by case-study.js from localStorage (mirrors feature/personalisation).
   Hidden by default; .cs-persona--on is added only when a persona is present. */
.cs-persona {
  display: none;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--cs-hair);
  border-left: 3px solid var(--cs-accent);
  border-radius: var(--cs-radius-sm);
  background: var(--cs-surface);
  animation: cs-fade-up var(--dur-slow, 500ms) var(--cs-ease) both;
}
.cs-persona--on { display: flex; }
.cs-persona-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cs-accent);
}
.cs-persona-text {
  font-family: 'Inter Tight', sans-serif;
  font-size: 16px;
  line-height: 140%;
  color: var(--cs-ink);
  margin: 0;
}
.cs-persona-text b { font-weight: 500; }

/* ── 3. Tag chips ────────────────────────────────────────────────────────── */
.cs-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.cs-tag {
  font-family: 'Inter Tight', sans-serif;
  font-size: 13px;
  line-height: 1;
  color: var(--cs-ink);
  padding: 8px 14px;
  border: 1px solid var(--cs-hair);
  border-radius: 100px;
  background: #fff;
}

/* ── 5. Metric / stat cards ──────────────────────────────────────────────── */
.cs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--cs-gap);
}
.cs-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 24px;
  border: 1px solid var(--cs-hair);
  border-radius: var(--cs-radius);
  background: #fff;
}
.cs-stat-value {
  font-family: 'Inter Tight', sans-serif;
  font-size: 52px;
  font-weight: 500;
  line-height: 1;
  color: var(--cs-ink);
}
.cs-stat-label {
  font-family: 'Inter Tight', sans-serif;
  font-size: 15px;
  line-height: 135%;
  color: var(--cs-muted);
}

/* ── 6. Info & process cards ─────────────────────────────────────────────── */
.cs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--cs-gap);
}
.cs-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--cs-hair);
  border-radius: var(--cs-radius);
  background: #fff;
  transition: transform var(--dur-base, 250ms) var(--cs-ease),
              box-shadow var(--dur-base, 250ms) var(--cs-ease);
}
.cs-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(150, 163, 181, .18);
}
.cs-card-index {
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--cs-accent);
  letter-spacing: .05em;
}
.cs-card-title {
  font-family: 'Inter Tight', sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 130%;
  color: var(--cs-ink);
  margin: 0;
}
.cs-card-text {
  font-family: 'Inter Tight', sans-serif;
  font-size: 16px;
  line-height: 150%;
  color: var(--cs-muted);
  margin: 0;
}

/* ── 7. Pull quote ───────────────────────────────────────────────────────── */
.cs-quote {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 48px 0;
  border-top: 1px solid var(--cs-hair);
  border-bottom: 1px solid var(--cs-hair);
}
.cs-quote-mark {
  font-family: 'Inter Tight', sans-serif;
  font-size: 64px;
  line-height: .6;
  color: var(--cs-accent);
}
.cs-quote-text {
  font-family: 'Inter Tight', sans-serif;
  font-size: clamp(24px, 3.4vw, 38px);
  font-weight: 400;
  line-height: 135%;
  color: var(--cs-ink);
  margin: 0;
  max-width: 24ch;
}
.cs-quote-cite {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Inter Tight', sans-serif;
  font-size: 15px;
  color: var(--cs-muted);
}
.cs-quote-cite b { color: var(--cs-ink); font-weight: 500; }
.cs-quote-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cs-surface);
  border: 1px solid var(--cs-hair);
}

/* ── 8. Image section ────────────────────────────────────────────────────── */
.cs-image {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cs-image-frame {
  border-radius: var(--cs-radius);
  overflow: hidden;
  border: 1px solid var(--cs-hair);
  background: var(--cs-surface);
}
.cs-image-frame img { display: block; width: 100%; height: auto; }
.cs-caption {
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  color: var(--cs-muted);
  margin: 0;
}

/* ── 9. Placeholder block ────────────────────────────────────────────────── */
/* Lightweight CSS placeholder so pages render with no missing images.
   Replace with a real <img> when filling the page. */
.cs-ph {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  background:
    repeating-linear-gradient(45deg,
      rgba(0,0,0,.018) 0 14px,
      rgba(0,0,0,.04) 14px 28px);
  color: var(--cs-muted);
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  letter-spacing: .04em;
}
.cs-ph[data-ratio="4-3"]  { aspect-ratio: 4 / 3; }
.cs-ph[data-ratio="1-1"]  { aspect-ratio: 1 / 1; }
.cs-ph[data-ratio="3-4"]  { aspect-ratio: 3 / 4; }
.cs-ph[data-ratio="21-9"] { aspect-ratio: 21 / 9; }

/* ── 10. Carousel ────────────────────────────────────────────────────────── */
.cs-carousel { display: flex; flex-direction: column; gap: 16px; }
.cs-carousel-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cs-carousel-track::-webkit-scrollbar { display: none; }
.cs-slide {
  scroll-snap-align: start;
  flex: 0 0 clamp(260px, 60%, 520px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cs-slide .cs-image-frame { width: 100%; }
.cs-carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.cs-carousel-dots { display: flex; gap: 8px; }
.cs-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--cs-hair);
  cursor: pointer;
  transition: background var(--dur-fast, 150ms) var(--cs-ease),
              transform var(--dur-fast, 150ms) var(--cs-ease);
}
.cs-dot.is-active { background: var(--cs-accent); transform: scale(1.25); }
.cs-carousel-arrows { display: flex; gap: 8px; }
.cs-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--cs-hair);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--cs-ink);
  transition: background var(--dur-fast, 150ms) var(--cs-ease),
              color var(--dur-fast, 150ms) var(--cs-ease);
}
.cs-arrow:hover { background: var(--cs-ink); color: #fff; }
.cs-arrow:disabled { opacity: .35; cursor: default; background: #fff; color: var(--cs-ink); }

/* ── 11. Phone mockup ────────────────────────────────────────────────────── */
.cs-phones {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-end;
  justify-content: center;
}
.cs-phone {
  flex: 0 0 auto;
  width: 260px;
  max-width: 70vw;
  aspect-ratio: 9 / 19;
  padding: 12px;
  border-radius: 40px;
  background: #111;
  box-shadow: 0 24px 60px rgba(17, 24, 39, .25);
  position: relative;
}
.cs-phone::before { /* notch */
  content: "";
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 38%;
  height: 22px;
  border-radius: 0 0 14px 14px;
  background: #111;
  z-index: 2;
}
.cs-phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 30px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.cs-phone-screen img { width: 100%; height: 100%; object-fit: cover; }
.cs-phone--tilt-l { transform: rotate(-5deg); }
.cs-phone--tilt-r { transform: rotate(5deg); }

/* ── 12. Lightbox / pop-up modal ─────────────────────────────────────────── */
.cs-zoomable { cursor: zoom-in; }
.cs-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vw;
  background: rgba(10, 10, 12, .8);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base, 250ms) var(--cs-ease),
              visibility var(--dur-base, 250ms) var(--cs-ease);
}
.cs-modal.is-open { opacity: 1; visibility: visible; }
.cs-modal-body {
  max-width: 1100px;
  max-height: 86vh;
  width: 100%;
  background: #fff;
  border-radius: var(--cs-radius);
  overflow: auto;
  transform: scale(.96);
  transition: transform var(--dur-base, 250ms) var(--cs-ease);
}
.cs-modal.is-open .cs-modal-body { transform: scale(1); }
.cs-modal-body img { display: block; width: 100%; height: auto; }
.cs-modal-pad { padding: 32px; }
.cs-modal-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #111;
  font-size: 22px;
  cursor: pointer;
}

/* ── 13. Technical architecture diagram ──────────────────────────────────── */
.cs-arch {
  border: 1px solid var(--cs-hair);
  border-radius: var(--cs-radius);
  background:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,.06) 1px, transparent 0);
  background-size: 22px 22px;
  background-color: var(--cs-surface);
  padding: 40px clamp(20px, 4vw, 56px);
}
.cs-arch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
}
.cs-arch-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.cs-arch-node {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
  max-width: 220px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--cs-hair);
  border-radius: var(--cs-radius-sm);
  box-shadow: 0 4px 18px rgba(150, 163, 181, .1);
}
.cs-arch-node.is-accent { border-color: var(--cs-accent); border-width: 1.5px; }
.cs-arch-node-kicker {
  font-family: 'Inter Tight', sans-serif;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cs-accent);
}
.cs-arch-node-title {
  font-family: 'Inter Tight', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--cs-ink);
}
.cs-arch-node-sub {
  font-family: 'Inter Tight', sans-serif;
  font-size: 13px;
  line-height: 135%;
  color: var(--cs-muted);
}
.cs-arch-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cs-muted);
  font-size: 20px;
  min-width: 28px;
}
.cs-arch-connector--v { transform: rotate(90deg); }
.cs-arch-caption {
  margin-top: 20px;
  text-align: center;
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  color: var(--cs-muted);
}

/* ── 15. Live app / site embed (iframe) ──────────────────────────────────── */
/* Desktop keeps a landscape aspect-ratio preview. On phones that same ratio
   collapses to a sliver (≈53% of a ~360px width ≈ 190px tall), squashing the
   embedded page so its own responsive layout can't render or scroll. Below
   the mobile breakpoint we switch to a fixed, generously tall box instead so
   the iframe gets a real viewport to work with. */
.cs-embed-frame {
  position: relative;
  width: 100%;
  padding-top: 53.125%;
}
.cs-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

@media screen and (max-width: 767px) {
  .cs-embed-frame {
    padding-top: 0;
    height: 75vh;
    min-height: 420px;
    max-height: 640px;
  }
}

/* ── Entrance animation (respects reduced motion) ────────────────────────── */
@keyframes cs-fade-up {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
.cs-reveal { opacity: 0; }
.cs-reveal.cs-in { animation: cs-fade-up 600ms var(--cs-ease) both; }

@media (prefers-reduced-motion: reduce) {
  .cs-reveal, .cs-reveal.cs-in, .cs-persona, .cs-card { animation: none; transition: none; }
  .cs-reveal { opacity: 1; }
  .cs-carousel-track { scroll-behavior: auto; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media screen and (max-width: 767px) {
  .cs-quote-text { font-size: 24px; }
  .cs-stat-value { font-size: 40px; }
  .cs-arch-row { flex-direction: column; align-items: center; }
  .cs-arch-connector { transform: rotate(90deg); }
  .cs-slide { flex-basis: 82%; }
}

/* ── 14. AI Summary (personalization) ────────────────────────────────────── */
/* Collapsible AI summary rendered under .cs-tags by case-study.js when the
   visitor has personalized the portfolio (data cached in localStorage). */
.jh-cs-summary {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--cs-hair);
}

.jh-cs-summary .jh-case-summary-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter Tight', sans-serif;
  color: var(--cs-ink);
}

.jh-cs-summary .jh-case-summary-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #111;
}

.jh-cs-summary .jh-personal-spark {
  flex: none;
  color: currentColor;
}

.jh-cs-summary .jh-case-summary-chevron {
  flex: none;
  color: var(--cs-muted);
  transition: transform 250ms var(--cs-ease);
}

.jh-cs-summary.is-open .jh-case-summary-chevron {
  transform: rotate(180deg);
}

.jh-cs-summary .jh-case-summary-toggle:hover {
  color: var(--cs-accent);
}

/* Animated expand/collapse via grid-template-rows (no height measuring) */
.jh-cs-summary .jh-case-summary-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 250ms var(--cs-ease);
}

.jh-cs-summary.is-open .jh-case-summary-body {
  grid-template-rows: 1fr;
}

.jh-cs-summary .jh-case-summary-text {
  overflow: hidden;
  min-height: 0;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--cs-muted);
}

.jh-cs-summary.is-open .jh-case-summary-text {
  padding-top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .jh-cs-summary .jh-case-summary-chevron,
  .jh-cs-summary .jh-case-summary-body {
    transition: none;
  }
}
