:root {
  --background: #0e0d0d;
  --foreground: #f2f2f2;
  --text-secondary: #949494;
  --text-label: #909090;
  --accent: #8fe327;
  --line: #282828;
  --line-strong: #3c3c3c;
}
html[data-theme="light"] {
  --background: #f1f0ec;
  --foreground: #171717;
  --text-secondary: #68665f;
  --text-label: #63615a;
  --accent: #5b920f;
  --line: #d7d5cf;
  --line-strong: #b9b7b0;
}

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

html {
  background: var(--background);
  color: var(--foreground);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Bricolage Grotesque', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

a {
  color: inherit;
}

.case-top {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.2s;
}

.brand:hover {
  color: var(--accent);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  color: var(--accent);
}

.icon {
  width: 16px;
  height: 16px;
  display: block;
}

html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }

.case-main {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 0;
}

.back-link {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 56px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

.back-top {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s;
}

.back-top:hover {
  color: var(--accent);
}

.case-sub {
  font-weight: 300;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.case-title {
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.case-description {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 60ch;
  margin-bottom: 32px;
}

.case-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.case-link {
  display: inline-block;
  padding: 11px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  color: var(--foreground);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.case-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

.case-tag {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.case-hero-image {
  width: 100%;
  aspect-ratio: 504 / 297;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.case-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 640px) {
  .gallery {
    grid-template-columns: 1fr 1fr;
  }
}

.gallery-item {
  aspect-ratio: 504 / 297;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.case-thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.case-thumb {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.case-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.case-body {
  margin-top: 72px;
}

.case-section {
  margin-bottom: 56px;
}

.case-h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-label);
  margin-bottom: 20px;
}

.case-p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 70ch;
}

.case-p + .case-p {
  margin-top: 16px;
}

.case-p strong {
  color: var(--foreground);
  font-weight: 600;
}

.case-footer {
  width: 100%;
  max-width: 860px;
  margin: 40px auto 0;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--line);
}

.proj-head {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-label);
  margin-bottom: 20px;
}

.proj-lede {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 48px;
  max-width: 55ch;
}

.proj-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.proj-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.proj-row:last-child {
  border-bottom: 1px solid var(--line);
}

.proj-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  transition: color 0.2s;
}

.proj-row:hover .proj-name {
  color: var(--accent);
}

.proj-desc {
  display: block;
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
}

.proj-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-label);
  text-align: right;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .proj-row {
    flex-direction: column;
    gap: 6px;
  }
  .proj-meta {
    text-align: left;
  }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lb-stage {
  margin: 0;
  max-width: min(90vw, 1200px);
  max-height: 82vh;
}

.lb-stage img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  border-radius: 6px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.lb-close,
.lb-prev,
.lb-next {
  position: fixed;
  z-index: 1001;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

.lb-close {
  top: 20px;
  right: 20px;
}

.lb-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lb-count {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 640px) {
  .lb-prev {
    left: 10px;
  }
  .lb-next {
    right: 10px;
  }
}

@media (max-width: 767px) {
  .case-top {
    padding: 20px 16px 0;
  }
  .case-main {
    padding: 32px 16px 0;
  }
  .back-link {
    margin-bottom: 40px;
  }
  .case-body {
    margin-top: 56px;
  }
}

/* ---- Case study: traction metrics ---------------------------------- */
.case-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-bottom: 28px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

@media (min-width: 640px) {
  .case-metrics {
    grid-template-columns: repeat(4, 1fr);
  }
}

.metric {
  background: var(--background);
  padding: 20px 18px;
}

.metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  line-height: 1.1;
}

.metric-value .accent {
  color: var(--accent);
}

.metric-label {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}
