:root {
  --ink: #0e0e0e;
  --ink-muted: #555;
  --paper: #f5f5f5;
  --accent: #1a1aff;
  --rule: hsl(0, 0%, 85.1%);
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--paper); color: var(--ink);
  font-family: 'DM Sans', sans-serif; font-weight: 400;
  line-height: 1.7; -webkit-font-smoothing: antialiased;
}

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 1.25rem 3rem;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white); border-bottom: 1px solid var(--rule);
}
.nav-name {
  font-family: 'Source Serif 4', serif; font-weight: 700;
  font-size: 1.45rem; letter-spacing: 0.04em;
  text-decoration: none; color: var(--ink);
}
.nav-links { display: flex; gap: 2rem; }
.nav-links a {
  font-size: 0.85rem; color: var(--ink-muted);
  text-decoration: none; letter-spacing: 0.03em; transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a.active { text-decoration: underline; text-underline-offset: 4px; }

/* LAYOUT */
.wide  { max-width: 1100px; margin: 0 auto; padding: 0 3rem; }
.read  { max-width: 720px;  margin: 0 auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; }
.two-col.center { align-items: center; }

/* SPACING */
.py-lg { padding: 5rem 0; }
.py-md { padding: 4rem 0; }
.pb-md { padding-bottom: 4rem; }
.pb-sm { padding-bottom: 2rem; }
.mt-xs { margin-top: 1.5rem; }
.mt-sm { margin-top: 2rem; }
.mt-md { margin-top: 4rem; }
.mt-lg { margin-top: 5rem; }
.mb-sm { margin-bottom: 2rem; }
.mb-md { margin-bottom: 4rem; }

/* TYPOGRAPHY */
h1 { font-family: 'Source Serif 4', serif; font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; margin-bottom: 2rem; }
h2 { font-family: 'Source Serif 4', serif; font-size: 1.9rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 1.25rem; }
h2.on-dark { color: var(--white); }
p { font-size: 0.95rem; line-height: 1.85; color: var(--ink-muted); margin-bottom: 1.25rem; }
p:last-child { margin-bottom: 0; }
p.on-dark { color: rgba(255,255,255,0.65); }
p.lead { font-size: 1.05rem; }
strong { color: var(--ink); font-weight: 500; }
.meta { font-size: 0.8rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.5rem; }
.label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.label-muted { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.4); margin-bottom: 1rem; }
.hook, blockquote { font-family: 'Source Serif 4', serif; font-size: 1.5rem; font-style: italic; line-height: 1.5; border-left: 3px solid var(--accent); padding-left: 1.75rem; color: var(--ink); margin: 2.5rem 0; }
hr { border: none; border-top: 1px solid var(--rule); }
hr.read { max-width: 720px; margin: 0 auto; }

/* PAGE HEADER (case-studies + resume) */
.page-header { padding-top: 7rem; padding-bottom: 3rem; background: var(--white); border-bottom: 1px solid var(--rule); }
.page-header h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: 0.75rem; }
.page-header p { font-size: 0.95rem; color: var(--ink-muted); }

/* IMAGES */
.img-wrap { width: 100%; border-radius: 16px; overflow: hidden; background: var(--white); border: 1px solid var(--rule); }
.img-wrap img { width: 100%; display: block; }
.img-ph { width: 100%; border-radius: 16px; background: var(--white); border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: #aaa; }
.img-caption { font-size: 0.8rem; color: var(--ink-muted); text-align: center; margin-top: 0.75rem; }

/* DARK BAND */
.dark { background: var(--ink); }
.outcome-hed { font-family: 'Source Serif 4', serif; font-size: clamp(1.6rem, 3.5vw, 2.5rem); font-weight: 700; line-height: 1.25; color: var(--white); margin-bottom: 1.25rem; }
.outcome-body { font-size: 1rem; color: rgba(255,255,255,0.6); line-height: 1.8; margin-bottom: 1rem; }

/* METRICS (shared across madhive case studies) */
.metrics-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.m-card { background: rgba(255,255,255,0.05); color: var(--white); border-radius: 16px; padding: 1.75rem 1.5rem; text-align: center; border: 1px solid rgba(255,255,255,0.12); }
.m-card.soft { background: var(--white); color: var(--ink); border: 1px solid var(--rule); }
.m-val { font-family: 'Source Serif 4', serif; font-size: 2.8rem; font-weight: 900; line-height: 1; display: block; margin-bottom: 0.4rem; }
.m-lbl { font-size: 0.78rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }
.m-card.soft .m-lbl { color: var(--ink-muted); opacity: 1; }

/* MAIN FOOTER */
footer {
  border-top: 1px solid var(--rule);
  padding: 3.5rem 0;
  background: var(--white);
}
.footer-inner { display: grid; grid-template-columns: 1fr auto auto; gap: 4rem; align-items: start; }
.footer-name { font-family: 'Source Serif 4', serif; font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.footer-links { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a { font-size: 0.875rem; color: var(--ink-muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--ink); }

/* CASE STUDY BACK/NEXT FOOTER */
footer.cs-footer { border-top: 1px solid var(--rule); padding: 3rem 0; display: flex; justify-content: space-between; align-items: center; max-width: 720px; margin: 0 auto; background: transparent; }
footer.cs-footer a { font-size: 0.85rem; color: var(--ink-muted); text-decoration: none; }
footer.cs-footer a:hover { color: var(--ink); }

/* ANIMATIONS */
.fade-in { opacity: 0; transform: translateY(20px); animation: fadeUp 0.7s ease forwards; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
.fade-in:nth-child(1) { animation-delay: 0.05s; }
.fade-in:nth-child(2) { animation-delay: 0.18s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.42s; }

/* RESPONSIVE */
@media (max-width: 900px) {
  nav { padding: 1rem 1.5rem; }
  .wide { padding: 0 1.5rem; }
  .two-col { grid-template-columns: 1fr; gap: 2rem; }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 768px) {
  .read { padding: 0; }
  .py-lg { padding: 3.5rem 0; }
  .py-md { padding: 3rem 0; }
  .hook, blockquote { font-size: 1.2rem; }
  footer.cs-footer { flex-direction: column; gap: 1rem; }
}
