/* ==========================================================================
   Case study pages (Pocket Budget)
   Builds on styles.css. Desktop follows the Figma frame (1326 wide:
   200px chapter sidebar + content column with an 830px measure).
   Tablet and mobile extend the same brand system.
     mobile  < 720px   no chapter nav (menu keeps Work / About / Contact)
     tablet  720–1079  no chapter nav
     desktop ≥ 1080    sticky chapter sidebar
   ========================================================================== */

.case {
  --cs-ink: #475569;       /* headings + body */
  --cs-ink-strong: #0f172a;
  --cs-muted: rgba(15, 23, 42, 0.7);
  --cs-accent: #01652c;    /* per-project accent (Pocket Budget green) */
  --cs-badge-weight: 600;
  --cs-alert: #dc0000;
  --cs-rule: rgba(15, 23, 42, 0.12);
  --cs-shadow: drop-shadow(0 12px 32px rgba(15, 23, 42, 0.08));
  --font-display: "Crimson Pro", Georgia, "Times New Roman", serif;
  --font-number: "Frank Ruhl Libre", Georgia, serif;
}

/* ---------- Page shell ---------- */
.page--case {
  --bg-angle: 96.87deg;
  align-items: stretch;
  padding: 32px 0 0;
}

.case-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
/* Below desktop the wrapper is transparent to layout (the sidebar is hidden there) */
.case-main { display: contents; }
.case-main > .navbar { order: 1; }
.toc { order: 2; }
.cs { order: 3; }

/* Nav pill on case studies: white rim + muted ink (per Figma) */
.page--case .nav__toggle,
.page--case .nav__list { border-color: #fff; }
.page--case .nav__link { color: var(--cs-muted); }
.page--case .nav__link:hover { color: var(--cs-ink-strong); }

/* ---------- Chapter navigation (toc) ---------- */
.toc { display: none; }
.toc__list { display: flex; }
.toc__link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cs-ink);
  font-weight: 500;
  font-size: 14px;
  line-height: normal;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s var(--ease);
}
.toc__link::before {
  content: "";
  display: none;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: var(--cs-accent);
}
.toc__link:hover { color: var(--cs-ink-strong); }
.toc__link.is-active { color: var(--cs-accent); font-weight: 700; }
.toc__link.is-active::before { display: block; }

/* ---------- Content column ---------- */
.cs {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--cs-ink);
}

.cs em { font-style: italic; color: var(--cs-accent); }
.cs strong { font-weight: 600; }

.cs-hero {
  width: 100%;
  max-width: 926px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px 16px 48px;
}
.cs-hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -2px;
  color: var(--cs-ink);
}

/* Metadata panel */
.cs-meta {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  line-height: normal;
}
.cs-meta__item { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cs-meta dt {
  color: var(--cs-ink);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.cs-meta dd {
  margin: 0;
  color: var(--cs-ink);
  font-weight: 700;
  font-size: 15px;
}

/* Intro: "What is…" + "My role" */
.cs-intro {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 24px 0 8px;
  color: var(--cs-ink);
}
.cs-intro__col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.cs-intro__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.1;
}
.cs-intro__text { font-size: 16px; line-height: 1.6; text-wrap: pretty; }

/* Sections */
.cs-section {
  width: 100%;
  max-width: 926px;
  display: flex;
  flex-direction: column;
  gap: 72px;
  padding: 56px 20px;
  border-top: 1px solid var(--cs-rule);
  border-bottom: 1px solid var(--cs-rule);
  scroll-margin-top: 16px;
}
.cs-section--last { border: 0; padding-bottom: 88px; }

.cs-block { display: flex; flex-direction: column; gap: 20px; }
.cs-block--50, .cs-stack--50 { gap: 32px; }
.cs-stack { display: flex; flex-direction: column; }
.cs-stack--60 { gap: 36px; }
.cs-stack--100 { gap: 48px; }

.cs-badge {
  color: var(--cs-muted);
  font-weight: var(--cs-badge-weight);
  font-size: 12px;
  line-height: 19.5px;
  letter-spacing: 0.91px;
  text-transform: uppercase;
}

.cs-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.15;
  color: var(--cs-ink);
  text-align: center;
  text-wrap: balance;
}
.cs-heading em { font-weight: 600; }
.nowrap { white-space: nowrap; }

.cs-body {
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  text-wrap: pretty;
}
.cs-story p + p { margin-top: 1.3em; }
.cs-story__quote { font-weight: 600; }
.cs-story__alert { font-weight: 600; font-style: italic; color: var(--cs-alert); }

/* Media — shadows follow the image alpha, like Figma's drop shadow on image fills */
.cs-media,
.cs-phone,
.cs-feature__visual {
  margin: 0;
  overflow: hidden;
  filter: var(--cs-shadow);
}
.cs-media {
  width: 100%;
  aspect-ratio: 830 / 466;
  border-radius: 18px;
}
.cs-media--chat { aspect-ratio: 830 / 300; }
.cs-media img,
.cs-phone img,
.cs-feature__visual img,
.cs-feature__visual video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Phone + copy rows */
.cs-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
.cs-phone {
  flex: none;
  width: min(240px, 68%);
  aspect-ratio: 291 / 600;
  border-radius: 40px;
}
.cs-row__text { order: -1; } /* copy sits between heading and phone when stacked */
.cs-row__text,
.cs-feature__copy {
  text-align: center; /* mobile only; left-aligned beside the phone from tablet up */
  font-size: 16px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Research quotes */
.cs-quotes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}
.cs-quotes__list {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
}
.cs-quote { margin: 0; display: flex; flex-direction: column; }
.cs-quote__icon { width: 22px; height: 22px; margin-bottom: 12px; }
.cs-quote__text {
  margin: 0;
  font-weight: 500;
  font-style: italic;
  font-size: 18px;
  line-height: 1.35;
}
.cs-quote__cite { align-self: flex-end; font-size: 16px; line-height: normal; }
.cs-quotes__art { width: 180px; height: auto; }

/* Final design features */
.cs-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.cs-feature__text {
  order: -1; /* number + copy lead on mobile so both features read the same way */
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}
.cs-feature__visual {
  flex: none;
  width: min(260px, 72%);
  aspect-ratio: 320 / 653;
  border-radius: 40px;
}
.cs-feature__num {
  font-family: var(--font-number);
  font-weight: 700;
  font-size: 96px;
  line-height: 0.7;
  letter-spacing: -3px;
  color: var(--cs-accent);
  opacity: 0.35;
  white-space: nowrap;
  text-align: center; /* mobile only; left-aligned from tablet up */
}
@supports (text-box: trim-both cap alphabetic) {
  .cs-feature__num { line-height: normal; text-box: trim-both cap alphabetic; }
}

/* ---------- WorldMark / Travel Discovery theme + components ---------- */
.case--worldmark {
  --cs-accent: #ca4d2b;
  --cs-badge-weight: 500;
}

.cs-badge--sm { font-size: 11px; }

/* Laptop mock-ups: shown whole (contain) inside an 830x600 stage on larger screens */
.cs-laptop {
  margin: 0;
  width: 100%;
  filter: var(--cs-shadow);
}
.cs-laptop img { width: 100%; height: 100%; object-fit: contain; }

/* Testimonial */
.cs-testimonial { margin: 0; text-align: center; }
.cs-testimonial__mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 36px;
  line-height: normal;
  color: var(--cs-accent);
}
.cs-testimonial__quote {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 22px;
  line-height: 1.25;
  color: var(--cs-ink);
  text-wrap: pretty;
}
.cs-testimonial__quote strong {
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
}
.cs-section--plain { border: 0; }
.cs-section--quote { padding-bottom: 28px; }

/* Photo card (e.g. "Final day of internship") */
.cs-section--photo { align-items: center; }
.cs-photo-card {
  margin: 0;
  width: 100%;
  max-width: 646px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px 20px 24px;
  border-radius: 20px;
  background: #ecd3cd;
  filter: drop-shadow(0 12px 16px rgba(15, 23, 42, 0.08));
}
.cs-photo-card picture { display: block; width: 100%; }
.cs-photo-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 935 / 638;
  object-fit: cover;
  border-radius: 12px;
}
.cs-photo-card figcaption { width: 100%; }

/* ---------- Footer ---------- */
.page--case .footer { margin-inline: auto; }

/* ==========================================================================
   Tablet
   ========================================================================== */
@media (min-width: 720px) {
  .page--case { padding-top: 48px; }

  .cs-hero { padding: 24px 48px 60px; gap: 28px; }
  .cs-hero__title { font-size: 64px; letter-spacing: -3px; }

  .cs-meta { padding: 28px; gap: 24px; }
  .cs-meta dt { font-size: 14px; }
  .cs-meta dd { font-size: 16px; }

  .cs-intro { flex-direction: row; gap: 40px; padding: 40px 0 0; }
  .cs-intro__col { gap: 18px; }
  .cs-intro__title { font-size: 34px; }
  .cs-intro__text { font-size: 17px; }

  .cs-section { padding: 80px 48px; gap: 112px; }
  .cs-section--last { padding-bottom: 140px; }
  .cs-block { gap: 26px; }
  .cs-block--50, .cs-stack--50 { gap: 42px; }
  .cs-stack--60 { gap: 50px; }
  .cs-stack--100 { gap: 72px; }

  .cs-badge { font-size: 13px; }
  .cs-badge--sm { font-size: 12px; }
  .cs-laptop { aspect-ratio: 830 / 600; }
  .cs-testimonial__mark { font-size: 44px; }
  .cs-testimonial__quote { font-size: 27px; }
  .cs-section--quote { padding-bottom: 40px; }
  .cs-photo-card { gap: 28px; padding: 32px 32px 40px; border-radius: 24px; }
  .cs-photo-card img { border-radius: 16px; }
  .cs-heading { font-size: 42px; line-height: normal; }
  .cs-body { font-size: 18px; line-height: 1.45; }

  .cs-media { border-radius: 24px; }

  .cs-row { flex-direction: row; justify-content: space-between; gap: 40px; }
  .cs-phone { width: 220px; border-radius: 38px; }
  .cs-row__text { order: 0; flex: 0 1 480px; font-size: 18px; line-height: 1.45; }
  .cs-row__text,
  .cs-feature__copy,
  .cs-feature__num { text-align: left; }

  .cs-quotes { flex-direction: row; justify-content: space-between; gap: 40px; }
  .cs-quotes__list { flex: 0 1 400px; gap: 64px; }
  .cs-quote__icon { width: 26px; height: 26px; margin-bottom: 15px; }
  .cs-quote__text { font-size: 20px; line-height: normal; }
  .cs-quote__cite { font-size: 18px; }
  .cs-quotes__art { width: 230px; flex: none; }

  .cs-feature { flex-direction: row; justify-content: center; gap: 40px; }
  .cs-feature__text { order: 0; flex: 0 1 480px; gap: 48px; }
  .cs-feature__visual { width: 250px; border-radius: 42px; }
  .cs-feature__num { font-size: 140px; letter-spacing: -4px; }
  .cs-feature__copy { font-size: 18px; line-height: 1.45; }
}

/* ==========================================================================
   Desktop — Figma frame
   ========================================================================== */
@media (min-width: 1080px) {
  .page--case { padding-top: 0; }

  .case-layout {
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
  }
  .toc, .case-main > .navbar, .cs { order: 0; }

  /* Sidebar */
  .toc {
    display: block;
    flex: none;
    align-self: stretch;
    width: 200px;
    min-height: 1024px;
    padding-bottom: 60px;
  }
  .toc__inner { position: sticky; top: 0; padding: 88px 20px 0; }
  .toc__list { flex-direction: column; gap: 2px; }
  .toc__link { padding: 8px 8px 8px 18px; }
  .toc__link.is-active { padding-left: 0; }

  /* Content column: 1126 wide at the 1326 frame, 100px gutters */
  .case-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(24px, calc(100vw - 1226px), 100px);
    isolation: isolate;
  }
  .page--case .navbar {
    width: 100%;
    max-width: 911px;
    padding: 0 48px;
  }

  .cs-hero { padding: 0 48px 60px; gap: 30px; }
  .cs-hero__title { font-size: 80px; line-height: 80px; letter-spacing: -4px; }

  .cs-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 32px; gap: 24px; }
  .cs-meta__item:last-child { white-space: nowrap; }

  /* 926 wide in Figma: spans the hero's full width, with its own 40px gutters */
  .cs-intro { margin-inline: -48px; gap: 60px; padding: 60px 40px; border-radius: 16px; }
  .cs-intro__col { gap: 20px; }
  .cs-intro__title { font-size: 40px; }
  .cs-intro__text { font-size: 18px; }

  .cs-section { padding: 100px 48px; gap: 150px; }
  .cs-section--last { padding: 100px 48px 200px; }
  .cs-block { gap: 30px; }
  .cs-block--50, .cs-stack--50 { gap: 50px; }
  .cs-stack--60 { gap: 60px; }

  .cs-heading { font-size: 52px; text-wrap: wrap; } /* natural wrapping, so line breaks match Figma */
  .cs-testimonial__mark { font-size: 52px; }
  .cs-testimonial__quote { font-size: 32px; line-height: normal; text-wrap: wrap; }
  .cs-stack--100 { gap: 100px; }
  .cs-section--quote { padding-bottom: 50px; }
  .cs-photo-card { gap: 32px; padding: 40px 40px 48px; }
  .cs-heading--tight { line-height: 62px; }
  .cs-body { font-size: 20px; line-height: normal; }

  .cs-row { gap: 40px; }
  .cs-phone { width: 291px; border-radius: 50px; }
  .cs-row__text { font-size: 20px; line-height: normal; }

  .cs-quotes__list { flex-basis: 400px; height: 350px; justify-content: center; gap: 100px; }
  .cs-quote__text { font-size: 22px; }
  .cs-quote__cite { font-size: 20px; }
  .cs-quotes__art { width: 300px; }

  .cs-feature { gap: 30px; min-height: 653px; }
  .cs-feature__visual { flex: 0 1 320px; width: auto; min-width: 240px; border-radius: 50px; }
  .cs-feature__text { flex: 0 1 480px; gap: 80px; }
  .cs-feature__num { font-size: 200px; letter-spacing: -6px; }
  .cs-feature__copy { font-size: 20px; line-height: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .toc__link { transition: none; }
}
