@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=IBM+Plex+Sans:wght@400;500&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --bg: #F0F3F6;
  --ink: #16171B;
  --muted: #5B5D66;
  --accent: #2B44FF;
  --line: #DCE2E8;
  --card: #FFFFFF;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-y: scroll; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.6;
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.5em;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5em;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Header */
header.site {
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}
header.site .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
header.site .name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem; }
nav.main { display: flex; gap: 24px; font-size: 0.95rem; }
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.is-active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

@media (max-width: 960px) {
  .nav-toggle { display: flex; }
  nav.main {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
  }
  nav.main.open { display: flex; }
  nav.main a {
    padding: 14px 4px;
    font-size: 1.15rem;
    border-top: 1px solid var(--line);
  }
  nav.main a:first-child { border-top: none; }
}

/* Hero */
.hero { min-height: 70vh; display: flex; align-items: center; padding: 60px 0; }
.hero .wrap { width: 100%; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 34ch; }
.hero p { color: var(--muted); max-width: 65ch; font-size: 1.1rem; }

.section-title { font-size: 1.5rem; margin: 0; }

/* Tag filter */
.tag-filter { padding: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-btn {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.tag-btn:hover { border-color: var(--accent); color: var(--ink); }
.tag-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-count { margin: 16px 0 0; color: var(--muted); font-size: 0.85rem; }

/* Project grid */
.projects { padding: 24px 0 60px; display: grid; gap: 24px; grid-template-columns: repeat(2, 1fr); }
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.project-thumb { width: 100%; aspect-ratio: 1 / 1; background: var(--line); display: block; object-fit: cover; }
.project-info { min-width: 0; padding: 20px; }
.project-card h3 { font-size: 1.7rem; margin-bottom: 4px; }
.project-card .date { color: var(--muted); font-size: 0.9rem; margin: 0 0 10px; }
.project-card .tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.project-card .tags li:not(:last-child)::after { content: ","; }

@media (max-width: 600px) {
  .projects { grid-template-columns: 1fr; }
}

/* Generic page content */
/* Main content on every page except home is narrowed to 70% of the home page width, independent of the header/footer wrap */
.page { padding-top: 60px; padding-bottom: 80px; max-width: 756px; }
.page h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.case-header { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.case-header h1 { margin: 0; }
.case-header .eyebrow { margin: 0; }
.case-header .meta { margin: 0; color: var(--muted); }
.page h2 { margin-top: 48px; font-size: 1.5rem; }
.page h3 { margin-top: 32px; font-size: 1.15rem; }
.page ul { padding-left: 1.2em; }
.page li { margin-bottom: 0.4em; }
.page blockquote {
  margin: 32px 0;
  padding-left: 20px;
  border-left: 3px solid var(--accent);
  font-style: italic;
}
.page blockquote p { margin: 0 0 8px; }
.page blockquote cite { display: block; font-style: normal; color: var(--muted); font-size: 0.85rem; }

/* Expand/collapse panels ("As a ___" sections) */
.panel {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px 32px;
  margin: 24px 0;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.panel:hover, .panel:focus-visible { border-color: var(--accent); }
.panel:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.panel-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.panel-header h2 { margin: 0; flex: 1; }
.panel-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--accent);
}
.panel-icon svg { width: 100%; height: 100%; display: block; }
.panel-arrow {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted);
}
.panel-arrow svg { width: 100%; height: 100%; display: block; }
.panel.expanded .panel-arrow { transform: rotate(180deg); }
.panel-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}
.panel.expanded .panel-content { grid-template-rows: 1fr; }
.panel-content-inner { overflow: hidden; min-height: 0; }
.panel-content-inner blockquote:first-child,
.panel-content-inner p:first-child { margin-top: 20px; }
.panel-content-inner p:last-child { margin-bottom: 0; }

/* Highlights card */
.highlights-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.highlights-card li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.highlights-card li:hover { border-color: var(--accent); transform: translateY(-2px); }
.highlights-card li {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.highlights-card li:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.highlight-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 12px;
  flex: 0 0 auto;
  color: var(--highlight-color, var(--accent));
}
.highlight-icon svg { width: 100%; height: 100%; display: block; }

/* Highlight color — shared by icon color and confetti */
.highlights-card li { --highlight-color: #F7B32B; }

@media (max-width: 700px) {
  .highlights-card ul { grid-template-columns: 1fr; }
}

/* Confetti burst */
.confetti-piece {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 1px;
  animation: confetti-burst 700ms ease-out forwards;
}
@keyframes confetti-burst {
  0% { transform: translate(var(--x0), var(--y0)) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--x1), var(--y1)) rotate(var(--r)); opacity: 0; }
}

/* Case study cross-links */
.more-case-studies { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.more-case-studies p {
  margin: 0 0 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.related-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.related-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-thumb { flex: 0 0 80px; width: 80px; height: 80px; aspect-ratio: 1 / 1; background: var(--line); border-radius: 4px; object-fit: cover; display: block; }
.related-info { min-width: 0; }
.related-info h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.05rem; margin: 0 0 4px; }
.related-info .date {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 6px;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.6;
  letter-spacing: normal;
  text-transform: none;
}
.related-info .tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  line-height: 1.3;
}
.related-info .tags li:not(:last-child)::after { content: ","; }

/* Gallery */
.gallery-grid {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.gallery-item { margin: 0; }
.gallery-item figcaption { font-family: 'Space Grotesk', sans-serif; font-weight: 500; margin-bottom: 12px; }
.gallery-thumb { width: 100%; aspect-ratio: 16 / 9; background: var(--line); border-radius: 4px; }
.gallery-item .case-image,
.gallery-item .case-carousel,
.gallery-item .case-image-row,
.gallery-item .gallery-video { margin-top: 0; }
.gallery-video { width: 100%; border-radius: 4px; display: block; }

/* Back to top / Back to all projects */
.back-to-top { max-width: 1080px; margin: 0 auto; padding: 0 24px 40px; text-align: center; }
.back-to-top.back-to-projects { text-align: left; }
body.subpage .back-to-top { max-width: 756px; }
.back-to-top a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.back-to-top a:hover { border-color: var(--accent); color: var(--accent); }
.placeholder {
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 24px;
  color: var(--muted);
  font-style: italic;
  margin-top: 24px;
}
.resume-embed {
  width: 100%;
  height: 85vh;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-top: 12px;
}
.case-image {
  width: 100%;
  border-radius: 4px;
  margin-top: 24px;
  display: block;
  cursor: zoom-in;
}
.case-image--outlined { outline: 1px solid #9a9a9a; outline-offset: -1px; }
.case-image-row {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}
.case-image-row .case-image { margin-top: 0; }
.case-image-row .case-figure { flex: 1; margin: 0; }
.case-figure { margin: 24px 0 0; }
.case-figure .case-image { margin-top: 0; }
.case-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
}
@media (max-width: 700px) {
  .case-image-row { flex-direction: column; }
}

/* Case study image carousel */
.case-carousel { margin-top: 24px; position: relative; }
.case-carousel-viewport { overflow: hidden; border-radius: 4px; }
.case-carousel-track { display: flex; height: 100%; transition: transform 0.3s ease; }
.case-carousel-track .case-image { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; margin-top: 0; }
.case-carousel--peek .case-carousel-track .case-image { flex: 0 0 auto; width: auto; height: 100%; object-fit: initial; margin-right: 16px; }
.case-carousel-track .case-image.case-image--fit-height { flex: 0 0 auto; width: auto; height: 100%; object-fit: initial; }
.case-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.case-carousel-arrow:hover { border-color: var(--accent); color: var(--accent); }
.case-carousel-prev { left: 12px; }
.case-carousel-next { right: 12px; }
.case-carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.case-carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
}
.case-carousel-dot.active { background: var(--accent); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(22, 23, 27, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 1000;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 100%; max-height: 100%; border-radius: 4px; cursor: default; }
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

footer.site {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
footer.site .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

@media (max-width: 600px) {
  .hero { min-height: 60vh; padding: 40px 0; }
}
