/*
 * case-study.css
 * Styles for individual case study pages
 * Layout mirrors the homepage: sticky TOC sidebar + article card, same dark tokens.
 */

:root {
  /* Editorial Theme Variables mapped to Case Study */
  --cs-accent: var(--text-primary);
  --cs-bg: var(--bg-base);
  --cs-surface: var(--bg-surface);
  --cs-surface-2: var(--bg-surface);
  --cs-border: var(--border-color);
  --cs-text: var(--text-primary);
  --cs-text-muted: var(--text-muted);
  --cs-white: var(--text-primary);

  /* Legacy variables used by case studies mapped to editorial theme */
  --smoky-black: var(--bg-base);
  --eerie-black-2: var(--bg-surface);
  --jet: var(--border-color);
  --shadow-1: none;
  --shadow-2: none;
  --orange-yellow-crayola: var(--text-primary);
  --white-2: var(--text-primary);
  --border-gradient-onyx: transparent;
  --bg-gradient-jet: var(--bg-surface);
}

/* ─── Base ─────────────────────────────────────────────────────── */
.cs-body {
  background: var(--smoky-black);
  color: var(--cs-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  font-weight: 300;
  min-height: 100vh;
}

/* ─── Root container — mirrors homepage <main> ─────────────────── */
.cs-root {
  max-width: 1200px;
  margin-inline: auto;
  padding: 100px 15px 30px; /* Adjusted as per user request */
}

@media (min-width: 580px) {
  .cs-root {
    padding: 120px 30px 40px;
  }
}

@media (min-width: 1250px) {
  .cs-root {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    padding: 160px 30px 50px;
  }
}

/* ─── TOC Sidebar — mirrors homepage rail design ───────────────── */
.cs-sidenav {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin-bottom: 25px;
}

@media (min-width: 1250px) {
  .cs-sidenav {
    position: sticky;
    top: 120px; /* Higher top to gain more space */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    flex-shrink: 0;
    width: 250px;
    margin-bottom: 0;
    padding: 0 0 0 2rem;
    border-left: 1px solid var(--border-color); /* The Rail */
  }

  .cs-sidenav::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
  }
}

/* Mobile toggle header */
.cs-sidenav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

@media (min-width: 1250px) {
  .cs-sidenav-header {
    display: none; /* Hide toggle on desktop, use the rail */
  }
}

.cs-sidenav-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.cs-sidenav-toggle {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.cs-sidenav.open .cs-sidenav-toggle {
    transform: rotate(180deg);
}

/* TOC list */
.cs-toc {
  padding: 0;
  margin: 0;
  list-style: none;
}

@media (max-width: 1249px) {
    .cs-toc {
        display: none;
    }
    
    .cs-sidenav.open .cs-toc {
        display: block;
        margin-top: 1.5rem;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
    }
}

.cs-toc li {
  margin-bottom: 2px;
}

.cs-toc-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.5rem 0; /* Reduced from 0.8rem to prevent clipping */
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.3s ease;
  line-height: 1.3;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cs-toc-link:hover {
  color: var(--text-primary);
  transform: translateX(5px);
}

.cs-toc-link.active {
  color: var(--text-primary);
  font-weight: 600;
}

@media (min-width: 1250px) {
  .cs-toc-link.active::before {
    content: "";
    position: absolute;
    left: -2.25rem; /* Centered on the rail */
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--text-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  }
}

.cs-toc-num {
  display: none; /* Hide numbers to match homepage minimalist labels */
}

/* ─── Main article card — mirrors article / .main-content ──────── */
.cs-main {
  background: var(--eerie-black-2);
  border: 1px solid var(--jet);
  border-radius: 20px;
  box-shadow: var(--shadow-1);
  padding: 24px;
  width: 100%;
}

@media (min-width: 580px) {
  .cs-main {
    padding: 30px;
  }
}

@media (min-width: 1250px) {
  .cs-main {
    flex: 1;
    min-width: 0;
    padding: 40px 44px;
  }
}

/* ─── Back button (mobile / top of article card) ──────────────── */
.cs-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--orange-yellow-crayola);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid hsla(45, 100%, 72%, 0.3);
  border-radius: 8px;
  transition: background 0.25s, border-color 0.25s;
}

.cs-back-btn:hover {
  background: hsla(45, 100%, 72%, 0.08);
  border-color: var(--orange-yellow-crayola);
}

.cs-back-btn ion-icon {
  font-size: 16px;
}


/* ─── Hero ─────────────────────────────────────────────────────── */
.cs-hero {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--jet);
}

.cs-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.cs-tag {
  display: inline-block;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  color: var(--orange-yellow-crayola);
  background: hsla(45, 100%, 72%, 0.1);
  border: 1px solid hsla(45, 100%, 72%, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cs-read-time {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.cs-title {
  font-family: var(--font-primary);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.cs-accent {
  color: var(--text-primary);
  opacity: 0.6;
}

.cs-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 800px;
}

/* ─── Section ──────────────────────────────────────────────────── */
.cs-section {
  margin-bottom: 80px;
  scroll-margin-top: 100px;
}

.cs-section-title {
  font-family: var(--font-primary);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.cs-num {
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ─── Card ─────────────────────────────────────────────────────── */
.cs-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 30px;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.cs-card::before {
  display: none;
}

.cs-highlight-card {
  position: relative;
  padding-left: 24px;
}

.cs-highlight-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--orange-yellow-crayola);
  border-radius: 3px 0 0 3px;
}

.cs-highlight-icon {
  font-size: 22px;
  color: var(--orange-yellow-crayola);
  display: block;
  margin-bottom: 10px;
}

/* ─── Card label ────────────────────────────────────────────────── */
.cs-card-label {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--orange-yellow-crayola);
  margin-bottom: 8px;
}

/* ─── Row / Col grid ────────────────────────────────────────────── */
.cs-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 600px) {
  .cs-row {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

.cs-col p {
  font-size: 14px;
  color: var(--cs-text);
}

/* ─── List ──────────────────────────────────────────────────────── */
.cs-list {
  padding-left: 18px;
  color: var(--cs-text);
  font-size: 14px;
}

.cs-list li {
  list-style: disc;
  margin-bottom: 6px;
}

/* ─── Personas ──────────────────────────────────────────────────── */
.cs-persona-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 4px;
}

@media (min-width: 768px) {
  .cs-persona-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.cs-persona {
  background: hsl(240, 2%, 13%);
  border: 1px solid var(--jet);
  border-radius: 10px;
  padding: 14px;
}

.cs-persona ion-icon {
  font-size: 20px;
  color: var(--orange-yellow-crayola);
  margin-bottom: 8px;
}

.cs-persona h4 {
  color: var(--white-2);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.cs-persona p {
  font-size: 12px;
  color: var(--cs-text);
}

.cs-pain {
  color: var(--cs-text-muted) !important;
}

/* ─── Table ─────────────────────────────────────────────────────── */
.cs-table-wrap {
  overflow-x: auto;
  margin-top: 10px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.cs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.cs-table th,
.cs-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.cs-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.cs-table td {
  color: var(--text-primary);
}

.cs-table tr:last-child td {
  border-bottom: none;
}

/* ─── JTBD Quote ────────────────────────────────────────────────── */
.cs-jtbd {
  font-size: 14px;
  font-style: italic;
  color: var(--white-2);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 20px;
}

/* ─── Stats ─────────────────────────────────────────────────────── */
.cs-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--orange-yellow-crayola);
  margin-bottom: 10px;
}

.cs-stat-row {
  display: flex;
  gap: 24px;
}

@media (max-width: 768px) {
    .cs-stat-row {
        flex-direction: column;
        gap: 32px;
    }
}

.cs-stat {
  flex: 1;
  min-width: 140px;
  background: hsl(240, 2%, 13%);
  border: 1px solid var(--jet);
  border-radius: 10px;
  padding: 14px;
}

.cs-stat-num {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: var(--orange-yellow-crayola);
  margin-bottom: 6px;
  line-height: 1;
}

.cs-stat-desc {
  display: block;
  font-size: 12px;
  color: var(--cs-text-muted);
  line-height: 1.5;
}

/* ─── Positioning quote ─────────────────────────────────────────── */
.cs-positioning {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  background: hsl(240, 2%, 13%);
  border-left: 3px solid var(--orange-yellow-crayola);
  border-radius: 0 8px 8px 0;
  padding: 14px;
}

.cs-positioning ion-icon {
  color: var(--orange-yellow-crayola);
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 3px;
}

.cs-positioning p {
  font-style: italic;
  color: var(--white-2);
  font-size: 13px;
}

/* ─── Roadmap Timeline ──────────────────────────────────────────── */
.cs-timeline {
  display: flex;
  flex-direction: column;
  padding-left: 8px;
  margin-top: 14px;
}

.cs-tl-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0 10px 18px;
  position: relative;
}

.cs-tl-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 17px;
  width: 12px;
  height: 12px;
  background: var(--orange-yellow-crayola);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--eerie-black-2);
}

.cs-tl-q {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--orange-yellow-crayola);
  background: hsla(45, 100%, 72%, 0.1);
  border: 1px solid hsla(45, 100%, 72%, 0.25);
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: 1px;
  margin-top: 2px;
}

.cs-tl-item p {
  font-size: 13px;
  color: var(--cs-text);
  margin: 0;
}

/* ─── Stakeholder / KPI Grid ────────────────────────────────────── */
.cs-stakeholder-grid,
.cs-kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {

  .cs-stakeholder-grid,
  .cs-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cs-stakeholder,
.cs-kpi {
  text-align: center;
  background: hsl(240, 2%, 13%);
  border: 1px solid var(--jet);
  border-radius: 10px;
  padding: 16px 12px;
}

.cs-stakeholder ion-icon,
.cs-kpi ion-icon {
  font-size: 22px;
  color: var(--orange-yellow-crayola);
  margin-bottom: 8px;
}

.cs-stakeholder h4,
.cs-kpi h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--white-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cs-stakeholder p,
.cs-kpi p {
  font-size: 12px;
  color: var(--cs-text);
}

/* ─── Accent text ────────────────────────────────────────────────── */
.cs-accent-text {
  color: var(--orange-yellow-crayola);
}

/* ─── Appendix Accordion ────────────────────────────────────────── */
.cs-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cs-accordion-item {
  background: hsl(240, 2%, 13%);
  border: 1px solid var(--jet);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.25s;
  scroll-margin-top: 120px;
}

.cs-accordion-item.active {
  border-color: hsla(45, 100%, 72%, 0.4);
}

.cs-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  color: var(--white-2);
}

.cs-accordion-header-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cs-accordion-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: hsla(45, 100%, 72%, 0.08);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  color: var(--orange-yellow-crayola);
}

.cs-accordion-info {
  flex: 1;
}

.cs-accordion-info h4 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.cs-accordion-info p {
  font-size: 12px;
  color: var(--cs-text-muted);
}

.cs-accordion-chevron {
  font-size: 18px;
  color: var(--cs-text-muted);
  transition: transform 0.3s;
}

.cs-accordion-item.active .cs-accordion-chevron {
  transform: rotate(180deg);
}

.cs-accordion-item.active .cs-accordion-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cs-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.cs-accordion-item.active .cs-accordion-content {
  max-height: 3000px;
}

.cs-accordion-content>.cs-card {
  padding: 24px 20px 32px !important;
}

.cs-appendix-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--orange-yellow-crayola);
  border: 1px solid hsla(45, 100%, 72%, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
  margin-top: 15px;
}

.cs-appendix-link:hover {
  background: hsla(45, 100%, 72%, 0.08);
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.cs-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--jet);
}

/* ─── Responsive Safeguards ──────────────────────────────────────── */
.cs-main img,
.cs-main video {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  margin-top: 20px;
  margin-bottom: 20px;
}