/* ============================================================
   N1 HEALTHCARE CASE STUDY — STYLES
   Aesthetic: Matches dhrumilkherde.com (dark, lavender accents)
   Project accent: N1 teal #0D7377
   ============================================================ */

/* ---------- IMPORTS ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- CUSTOM PROPERTIES ---------- */
:root {
  /* Background layers */
  --bg-base: #0D0D0D;
  --bg-surface: rgba(198, 202, 236, 0.04);
  --bg-surface-hover: rgba(198, 202, 236, 0.07);
  --bg-elevated: rgba(198, 202, 236, 0.06);

  /* Text */
  --text-primary: rgba(225, 228, 250, 0.92);
  --text-secondary: rgba(198, 202, 236, 0.6);
  --text-muted: rgba(198, 202, 236, 0.35);
  --text-heading: rgb(217, 220, 242);

  /* Accent — N1 Teal */
  --accent: #0D7377;
  --accent-light: #14969B;
  --accent-glow: rgba(13, 115, 119, 0.15);
  --accent-text: #5BCDD1;

  /* Borders */
  --border: rgba(198, 202, 236, 0.08);
  --border-accent: rgba(13, 115, 119, 0.3);

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.15);
  --shadow-glow: 0 0 40px rgba(13, 115, 119, 0.08);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;

  /* Layout */
  --max-width: 820px;
  --header-height: 60px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-text); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-light); }

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4 {
  color: var(--text-heading);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin-bottom: var(--space-lg); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.35rem); margin-bottom: var(--space-md); }
h4 { font-size: 1rem; font-weight: 500; color: var(--text-secondary); margin-bottom: var(--space-sm); }
p { margin-bottom: var(--space-md); color: var(--text-secondary); }
strong { color: var(--text-primary); font-weight: 600; }

/* ---------- BACK LINK ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: var(--space-md) 0;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text-primary); }
.back-link svg { width: 16px; height: 16px; }

/* ---------- LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ---------- HERO ---------- */
.hero {
  padding: var(--space-4xl) 0 var(--space-3xl);
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.hero-content { position: relative; z-index: 1; }
.hero-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-lg);
}
.hero-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.hero h1 { margin-bottom: var(--space-md); }
.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

/* ---------- META ROW ---------- */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.meta-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ---------- STAT PILLS ---------- */
.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.25s ease;
}
.stat-pill:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-accent);
  color: var(--text-primary);
}
.stat-pill .stat-number {
  color: var(--accent-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- TOGGLE ---------- */
.toggle-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-3xl);
}
.toggle-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toggle-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.toggle-tab {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-sans);
}
.toggle-tab:hover { color: var(--text-secondary); }
.toggle-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(13, 115, 119, 0.3);
}
.toggle-section-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  display: none;
}

/* ---------- SECTIONS ---------- */
.case-section {
  margin-bottom: var(--space-4xl);
}
.section-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-sm);
  display: block;
}
.section-divider {
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin-bottom: var(--space-xl);
  border-radius: 1px;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all 0.3s ease;
}
.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}
.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
}

/* Feature cards (in platform features section) */
.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all 0.3s ease;
}
.feature-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.feature-card .feature-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 18px;
}
.feature-card h4 {
  color: var(--text-heading);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.feature-card p {
  font-size: 14px;
  margin-bottom: 0;
  line-height: 1.5;
}

/* ---------- IMAGE PLACEHOLDERS ---------- */
.img-placeholder {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  text-align: center;
  background: var(--bg-surface);
  min-height: 280px;
  margin: var(--space-xl) 0;
  transition: border-color 0.2s;
}
.img-placeholder:hover { border-color: var(--border-accent); }
.img-placeholder .ph-icon {
  font-size: 32px;
  opacity: 0.4;
  margin-bottom: var(--space-xs);
}
.img-placeholder .ph-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.img-placeholder .ph-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.5;
}
.img-placeholder.img-wide { min-height: 360px; }
.img-placeholder.img-hero { min-height: 440px; }

/* Actual images once added */
.case-image {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-xl) 0;
  border: 1px solid var(--border);
}
.case-image img {
  width: 100%;
  height: auto;
}
.case-image figcaption {
  padding: var(--space-sm) var(--space-md);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
}

/* ---------- PROCESS FLOW ---------- */
.process-flow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
  align-items: stretch;
}
.process-step {
  flex: 1;
  min-width: 140px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  position: relative;
}
.process-step .step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}
.process-step h4 {
  font-size: 14px;
  color: var(--text-heading);
  font-weight: 600;
  margin-bottom: 4px;
}
.process-step p {
  font-size: 12px;
  margin-bottom: 0;
  line-height: 1.4;
}
.process-arrow {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 18px;
  flex-shrink: 0;
}

/* ---------- COMPARISON BLOCK ---------- */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}
.comparison-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}
.comparison-col.before { border-top: 2px solid rgba(239, 68, 68, 0.5); }
.comparison-col.after { border-top: 2px solid var(--accent); }
.comparison-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}
.comparison-col.before h4 { color: rgba(239, 68, 68, 0.7); }
.comparison-col.after h4 { color: var(--accent-text); }
.comparison-col ul {
  list-style: none;
  padding: 0;
}
.comparison-col li {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}
.comparison-col li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- INLINE CODE / TAGS ---------- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: var(--accent-glow);
  color: var(--accent-text);
  border: 1px solid var(--border-accent);
}

/* ---------- LISTS ---------- */
.case-list {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0;
}
.case-list li {
  position: relative;
  padding: var(--space-sm) 0 var(--space-sm) var(--space-lg);
  font-size: 15px;
  color: var(--text-secondary);
}
.case-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- CALLOUT ---------- */
.callout {
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  font-size: 15px;
  line-height: 1.6;
}
.callout .callout-icon {
  font-size: 20px;
  margin-bottom: var(--space-sm);
  display: block;
}
.callout p { color: var(--text-primary); margin-bottom: 0; }
.callout strong { color: var(--accent-text); }

/* ---------- METRICS GRID ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
}
.metric-number {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 4px;
}
.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- TIMELINE ---------- */
.timeline {
  position: relative;
  padding-left: var(--space-xl);
  margin: var(--space-xl) 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: var(--space-xl);
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-xl) + 2px);
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-base);
}
.timeline-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.timeline-item h4 {
  color: var(--text-heading);
  font-weight: 600;
  margin-bottom: 4px;
}
.timeline-item p {
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- FOOTER ---------- */
.case-footer {
  padding: var(--space-3xl) 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.case-footer p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- SCROLL REVEAL ANIMATIONS ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.06s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.12s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.18s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.24s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.30s; }
.reveal-stagger.visible > *:nth-child(7) { transition-delay: 0.36s; }
.reveal-stagger.visible > *:nth-child(8) { transition-delay: 0.42s; }
.reveal-stagger.visible > *:nth-child(9) { transition-delay: 0.48s; }
.reveal-stagger.visible > *:nth-child(10) { transition-delay: 0.54s; }
.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- DETAIL/OVERVIEW TOGGLE CONTENT ---------- */
.detail-only { display: none; }
body.mode-detail .detail-only { display: block; }
body.mode-detail .overview-only { display: none; }

/* Smooth collapse/expand */
.toggle-content {
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.4s ease;
}

/* ---------- TABLE ---------- */
.case-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 14px;
}
.case-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.case-table td {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.case-table td:first-child {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}
.case-table tr:last-child td { border-bottom: none; }

/* ---------- QUOTE ---------- */
.case-quote {
  border-left: 3px solid var(--accent);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xl) 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-heading);
  font-style: italic;
  line-height: 1.5;
}
.case-quote cite {
  display: block;
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  :root { --max-width: 100%; }
  .container { padding: 0 var(--space-md); }
  .hero { padding: var(--space-3xl) 0 var(--space-2xl); }
  .meta-row { gap: var(--space-md); }
  .card-grid, .card-grid-3, .comparison { grid-template-columns: 1fr; }
  .process-flow { flex-direction: column; }
  .process-arrow { transform: rotate(90deg); justify-content: center; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .toggle-section-title { display: none; }
  .stat-pills { gap: 6px; }
  .stat-pill { font-size: 12px; padding: 5px 10px; }
  h1 { font-size: 1.8rem; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
  .metric-card { padding: var(--space-md) var(--space-sm); }
  .toggle-tabs { width: 100%; }
  .toggle-tab { flex: 1; text-align: center; }
  .toggle-inner { flex-direction: column; gap: var(--space-sm); }
}
