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

/* ── Variables ── */
:root {
  --bg: #f4f2ed;
  --surface: #fdfcfa;
  --surface-2: #eceae4;
  --ink: #1c1b18;
  --ink-2: #5a5850;
  --ink-3: #9a9890;
  --border: rgba(28,27,24,0.1);
  --border-strong: rgba(28,27,24,0.2);
  --accent: #c95f2a;
  --accent-light: #fdf0e8;
  --accent-border: rgba(201,95,42,0.22);
  --serif: 'Cabinet Grotesk', system-ui, sans-serif;
  --sans: 'General Sans', system-ui, sans-serif;
  --mono: 'General Sans', system-ui, sans-serif;
  --r: 10px;
  --r-lg: 16px;
}

/* ── Base ── */
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
.page { max-width: 860px; margin: 0 auto; padding: 0 2rem 6rem; }

/* ── Nav ── */
nav:not(.toc) {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  margin-bottom: 2.25rem;
  position: sticky;
  top: 0;
  background: transparent;
  z-index: 10;
}
/* Full-bleed background so the bar spans the viewport, not just the column */
nav:not(.toc)::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border-strong);
  z-index: -1;
}
.nav-name { font-family: var(--serif); font-size: 18px; text-decoration: none; color: var(--ink); }
.nav-links { display: flex; gap: 1.75rem; }
.nav-links a { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }

/* ── Footer ── */
footer {
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 0.5px solid var(--border-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-name { font-family: var(--serif); font-size: 15px; color: var(--ink-2); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
  font-size: 13px;
  font-family: var(--mono);
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 0.5px solid var(--border-strong);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.footer-links a:hover { color: var(--accent); border-color: var(--accent-border); }

/* ── Section label ── */
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 2rem;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.btn-secondary:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-1px); }

/* ── Browser frame mockup ── */
.browser-frame {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(28,27,24,0.1);
  border: 1px solid var(--border);
  background: #fff;
}
.browser-frame::before {
  content: '';
  display: block;
  height: 32px;
  background: #e8e6e1;
  background-image:
    radial-gradient(circle at 12px 16px, #fc5f57 4px, transparent 4px),
    radial-gradient(circle at 26px 16px, #fdbc2c 4px, transparent 4px),
    radial-gradient(circle at 40px 16px, #29c940 4px, transparent 4px);
}
.browser-frame img,
.browser-frame video {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.active { background: #e8f5e9; color: #2e7d32; }
.status-badge.early-access { background: var(--accent-light); color: var(--accent); }
.status-badge.in-progress { background: #f3f0ff; color: #5b21b6; }

/* ── Fade-up animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { opacity: 0; }
.fade-up.in-view { animation: fadeUp 0.6s cubic-bezier(0.22,1,0.36,1) both; }



/* ── Back link (project pages) ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-3);
  text-decoration: none;
  margin-top: -0.75rem;
  margin-bottom: 1rem;
  transition: color 0.2s ease;
}
.back-link:hover { color: var(--accent); }
.back-link::before { content: '←'; }

/* ── Case study hero title row ── */
.case-hero-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}
.case-hero-title-row h1 { margin-bottom: 0; }
.case-hero-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .case-hero-title-row { flex-wrap: wrap; }
  .case-hero-badges { padding-top: 0; }
}

/* ── Categorical pills ── */
.case-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2rem;
}
.case-pill {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  padding: 3px 8px;
  border-radius: 4px;
}

/* ── Case study hero image ── */
.case-hero-img {
  margin: 0 0 2.5rem;
}
.case-hero-img .browser-frame {
  box-shadow: 0 24px 64px rgba(28,27,24,0.12);
}

/* ── Jump-link sidebar (case study section nav) ── */
.toc {
  position: fixed;
  top: 50%;
  left: calc(50% - 430px - 18px);
  transform: translate(-100%, -50%);
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: 128px;
  z-index: 5;
}
.toc a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  text-decoration: none;
  text-align: right;
  padding-right: 12px;
  border-right: 1.5px solid var(--border);
  line-height: 1.35;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.toc a:hover { color: var(--ink-2); }
.toc a.active { color: var(--accent); border-color: var(--accent); }
@media (max-width: 1140px) { .toc { display: none; } }

/* anchored sections clear the sticky nav on jump */
.case-section, .pipeline-diagram { scroll-margin-top: 96px; }

/* ── Two-column hero (text left, image right) ── */
.case-hero-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 2.5rem;
}
.case-hero-layout .case-hero,
.case-hero-layout .case-hero-img { min-width: 0; }
.case-hero-layout .case-hero { margin-bottom: 0; }
.case-hero-layout .case-hero p { font-size: 15px; }
.case-hero-layout .case-hero-img { margin: 0; }
@media (max-width: 720px) {
  .case-hero-layout { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ── Responsive ── */
@media (max-width: 580px) {
  .page { padding: 0 1rem 4rem; }
  nav { margin-bottom: 2.5rem; }
}

/* ── More projects (case study footer) ── */
.more-projects {
  margin-top: 5rem;
  padding-top: 2.5rem;
  border-top: 0.5px solid var(--border-strong);
}
.more-projects .section-label { margin-bottom: 1.25rem; }
.more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.more-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.more-card:hover { border-color: var(--accent-border); transform: translateY(-2px); }
.more-card-name { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.more-card-desc { font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.more-card-tag {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
@media (max-width: 640px) { .more-grid { grid-template-columns: 1fr; } }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
