/* ============================================
   Ian Cameron — case-study.css
   Shared styles for all case study pages
   ============================================ */

/* Page transitions */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
html.page-transitioning body {
  animation: pageFadeIn 0.35s ease 0.3s both;
}
html.page-transition-out body {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  line-height: 1.7;
  color: #1a1a1a;
  background-color: #fafaf8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: chocolate;
}

/* --- Tokens --- */
:root {
  --color-bg: #fafaf8;
  --color-surface: #ffffff;
  --color-text-primary: #1a1a1a;
  --color-text-secondary: #555550;
  --color-text-muted: #757570;
  --color-border: rgba(26, 26, 26, 0.12);
  --color-border-strong: rgba(26, 26, 26, 0.2);

  --font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --max-width: 780px;
  --radius-sm: 4px;
  --radius-md: 10px;
}

/* --- Fixed nav --- */
.cs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
  height: 56px;
  background: rgba(250, 250, 248, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.cs-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cs-nav-back:hover { color: var(--color-text-primary); }

.cs-nav-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.cs-nav-arrows {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.cs-nav-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cs-nav-arrow:hover { color: var(--color-text-primary); }
.cs-nav-arrow--next { flex-direction: row; }

/* --- Main offset for fixed nav --- */
main { padding-top: 56px; }

/* --- Cover --- */
.cs-cover {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) clamp(1.5rem, 5vw, 2rem) 0;
}

.cs-cover-inner {
  margin-bottom: 3rem;
}

.cs-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-bottom: 1.25rem;
}

.cs-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}

.cs-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  line-height: 1.75;
  color: var(--color-text-secondary);
  font-weight: 300;
  max-width: 580px;
}

/* Cover imagery */
.cs-cover-image {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(to bottom, #eeede9, #e8e7e2);
  padding: 3rem 0 0;
  overflow: hidden;
}

.cs-cover-image-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  height: 360px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5rem;
}

.cs-floater {
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.cs-floater-hybrid {
  width: 38%;
  align-self: flex-end;
  margin-bottom: 68px;
  animation: csFloat1 6s ease-in-out infinite;
}

.cs-phone-stack {
  position: relative;
  width: 26%;
  flex-shrink: 0;
}

.cs-phone {
  width: 100%;
  display: block;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  animation: csFloat2 7s ease-in-out infinite 0.3s;
}

.cs-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: csConfetti 3s ease-in-out infinite;
  pointer-events: none;
}

.cs-floater-video {
  width: 28%;
  align-self: center;
  animation: csFloat3 5.5s ease-in-out infinite 0.7s;
}

@keyframes csFloat1 {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-8px) rotate(-1deg); }
}
@keyframes csFloat2 {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}
@keyframes csFloat3 {
  0%, 100% { transform: translateY(0px) rotate(1.5deg); }
  50%       { transform: translateY(-6px) rotate(1.5deg); }
}
@keyframes csConfetti {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50%       { transform: scale(1.04) rotate(0.5deg); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-floater, .cs-phone, .cs-confetti { animation: none; }
}

/* --- Overview strip --- */
.cs-overview {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-top: 4rem;
}

.cs-overview-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem clamp(1.5rem, 5vw, 2rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.cs-overview-item {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.cs-overview-label {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 400;
}

.cs-overview-value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

/* --- Content sections --- */
.cs-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 4.5rem) clamp(1.5rem, 5vw, 2rem);
  border-bottom: 1px solid var(--color-border);
}

.cs-section-inner {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 3rem;
  align-items: start;
}

.cs-section-inner img {
  width: 100%;
  margin: 1.125rem 0;
}

.cs-section-label {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 400;
  padding-top: 6px;
}

.cs-section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  font-weight: 400;
  line-height: 1.25;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

.cs-section-body p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
  font-weight: 300;
  margin-bottom: 1.125rem;
}

.cs-section-body p:last-child { margin-bottom: 0; }

/* --- Callout cards --- */
.cs-callouts {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.cs-callout {
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.cs-callout-number {
  display: block;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.cs-callout h3 {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.cs-callout p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  font-weight: 300;
  margin: 0 !important;
}

/* --- Pull quote --- */
.cs-pullquote {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.cs-pullquote-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 5vw, 2rem);
}

.cs-pullquote blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.25rem, 3vw, 1.625rem);
  line-height: 1.5;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

/* --- Image break --- */
.cs-image-break {
  background: #eeede9;
  padding: 3rem 0;
  overflow: hidden;
}

.cs-image-break-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 2rem);
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.cs-figure {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.cs-figure img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  object-fit: cover;
  object-position: top center;
  aspect-ratio: 1.5;
  display: block;
}

.cs-figure figcaption {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

/* --- Video embed --- */
.cs-video-wrap {
  background: var(--color-bg);
  padding: clamp(2.5rem, 6vw, 4rem) 0;
  border-bottom: 1px solid var(--color-border);
}

.cs-video-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 5vw, 2rem);
}

.cs-video-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.cs-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  background: #000;
}

.cs-video-caption {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

/* --- Results --- */
.cs-results {
  background: var(--color-text-primary);
}

.cs-results-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) clamp(1.5rem, 5vw, 2rem);
}

.cs-results .cs-section-label {
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 1.5rem;
  display: block;
}

.cs-results-heading {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 400;
  line-height: 1.2;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin-bottom: 3rem;
  max-width: 540px;
}

.cs-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.cs-stat {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cs-stat-number {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 400;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.cs-stat-label {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
  line-height: 1.4;
}

/* --- Footer --- */
.cs-footer {
  background: var(--color-text-primary);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cs-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem clamp(1.5rem, 5vw, 2rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.cs-footer-back,
.cs-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cs-footer-back:hover,
.cs-footer-link:hover { color: #ffffff; }

.cs-footer-nav {
  display: flex;
  gap: 2rem;
}

.cs-footer-link--next { flex-direction: row; }

/* --- Focus styles --- */
a:focus-visible {
  outline: 2px solid var(--color-text-primary);
  outline-offset: 3px;
  border-radius: 2px;
}

.cs-results a:focus-visible,
.cs-footer a:focus-visible {
  outline-color: #ffffff;
}

/* --- Responsive --- */
@media (max-width: 680px) {
  .cs-nav-title { display: none; }

  .cs-nav-arrow span { display: none; }

  .cs-section-inner {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .cs-overview-inner {
    grid-template-columns: repeat(2, 1fr);
  }

  .cs-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .cs-cover-image-inner {
    height: 280px;
    gap: 1rem;
  }

  .cs-image-break-inner {
    gap: 0.75rem;
  }

  .cs-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .cs-cover-image-inner {
    height: 220px;
  }

  .cs-floater-hybrid { display: none; }
}
