/* ─── Tokens ─── */
:root {
  --bg: #EFF7FF;
  --surface: #FFFFFF;
  --surface-hover: #E6EFF8;
  --border: #D0DAE4;
  --text: #3A2A3A;
  --text-muted: #6E5A6E;
  --accent: #82204A;
  --accent-dim: #6B1A3D;
  --accent-light: rgba(130, 32, 74, 0.08);
  --heading: #231123;
  --teal: #558C8C;
  --gold: #E8DB7D;
  --max-width: 820px;
}

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

/* ─── Base ─── */
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--accent-dim); }

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* Portrait app screenshots — capped narrower so they don't dominate
   the column. To add another portrait image, append its filename to
   the selector list below. */
.case-study-body img[src*="detail-view-loading"],
.case-study-body img[src*="progress-bar"],
.case-study-body img[src*="ready-to-import"] {
  max-width: 440px;
}

/* ─── Layout ─── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}


/* ─── Nav ─── */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--heading);
}

/* ─── Dropdown ─── */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.nav-dropdown-caret {
  transition: transform 0.15s;
  opacity: 0.6;
}

.nav-dropdown:hover .nav-dropdown-caret,
.nav-dropdown:focus-within .nav-dropdown-caret {
  transform: rotate(-180deg);
  opacity: 1;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 200px;
  margin-top: 4px;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(35, 17, 35, 0.06);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 10;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu li {
  margin: 0;
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a[aria-current="page"] {
  background: var(--surface-hover);
  color: var(--heading);
}

/* Mobile: show as inline expandable list, not absolute */
@media (max-width: 600px) {
  .nav-dropdown-menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    margin-top: 8px;
    display: none;
  }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu {
    transform: none;
  }
  .nav-dropdown-caret { display: none; }
}

/* ─── Hero ─── */
.hero {
  margin-bottom: 64px;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 720px;
  line-height: 1.6;
}

/* ─── Work list ─── */
.work-list h2 {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.work-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 12px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.work-card:hover {
  border-color: var(--accent-dim);
  background: var(--surface-hover);
}

.work-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.work-card p {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
}

.work-card-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ─── Case study ─── */
.case-study-header {
  margin-bottom: 48px;
}

/* Case study lives in the same 720px column as every other page.
   The TOC sidebar floats outside that column on wide viewports
   (≥1100px), and falls back to in-flow at narrower sizes. */
.case-study {
  /* No max-width override — inherits main's 720px */
}

.case-study-layout {
  /* Below 1100px: stack TOC above body. At ≥1100px the TOC is
     position:fixed (see media query below), so layout block is fine. */
  display: block;
}

.case-study-nav {
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 32px;
  padding: 16px;
  background: var(--surface);
  border-radius: 8px;
}

@media (min-width: 1200px) {
  /* Wide-desktop: TOC floats in the page margin to the left of main.
     main column stays at 720px so header and body align.
     Math: main is 720px centered → its left edge is at 50vw - 360px.
     TOC is 200px wide with 32px gap → its left edge sits at
     50vw - 360px - 232px. Below 1200px the math leaves <8px of inner
     padding, so we fall back to in-flow above the body. */
  .case-study-nav {
    position: fixed;
    top: 100px;
    left: calc(50vw - 360px - 232px);
    width: 200px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
  }
}

.case-study-nav-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.case-study-toc {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--border);
}

.case-study-toc li {
  margin: 0;
  padding: 0;
}

.case-study-toc a {
  display: block;
  padding: 6px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.case-study-toc a:hover {
  color: var(--text);
}

.case-study-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.case-study-toc .toc-h3 a {
  padding-left: 24px;
  font-size: 0.8rem;
}


.case-study-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.case-study-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.case-study-meta {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.case-study-meta div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.case-study-meta dt {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.case-study-meta dd {
  font-size: 0.88rem;
  color: var(--text);
}

/* ─── Case study body (markdown) ─── */
.case-study-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--heading);
  margin-top: 48px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.case-study-body h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--teal);
  margin-top: 32px;
  margin-bottom: 8px;
}

.case-study-body p {
  margin-bottom: 16px;
  line-height: 1.65;
}

.case-study-body em {
  color: var(--text-muted);
}

.case-study-body strong {
  font-weight: 600;
  color: var(--heading);
}

.case-study-body ul,
.case-study-body ol {
  margin-bottom: 16px;
  padding-left: 20px;
}

.case-study-body li {
  margin-bottom: 6px;
  line-height: 1.55;
}

.case-study-body img {
  margin: 24px auto;
  border: 1px solid var(--border);
}

.case-study-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84em;
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.case-study-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── About ─── */
.about h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.about h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--heading);
  margin-top: 40px;
  margin-bottom: 12px;
}

.about p {
  margin-bottom: 16px;
  line-height: 1.65;
}

.about ul {
  list-style: none;
  padding: 0;
  margin-bottom: 16px;
}

.about li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.5;
}

.about li:last-child {
  border-bottom: none;
}

.about li strong {
  color: var(--accent);
}

/* ─── Footer ─── */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--heading);
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.7rem; }
  .case-study-header h1 { font-size: 1.6rem; }
  .case-study-meta { flex-direction: column; gap: 16px; }
  main { padding: 0 16px 60px; }
  .site-header { padding: 24px 16px 36px; }
  .site-footer { padding: 24px 16px; }
  /* Tighter spacing in nav so name + dropdown + avatar all fit */
  .nav-links { gap: 16px; }
  /* Footer links stack rather than crowd */
  .footer-links {
    flex-wrap: wrap;
    gap: 12px 20px;
  }
}

@media (max-width: 480px) {
  /* Smaller avatars on phones — the desktop sizes feel heavy here */
  .about-hero-avatar { width: 110px; height: 110px; }
  .nav-avatar { width: 28px; height: 28px; }
  /* Cap large case-study images so they don't dominate the screen */
  .case-study-body img { max-width: 100%; height: auto; }
}

/* ─── Avatar placements ─── */
.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-left: 8px;
}

.hero-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 24px;
}

.about-hero-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 24px;
}

/* ─── Case study CTA ─── */
.case-study-cta {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.case-study-cta p {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.5;
}

.case-study-cta-email {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
}
