* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  color: #fff;
  background: linear-gradient(180deg, #7fb8ec 0%, #5fa6e0 45%, #3f8ad6 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
body { padding-top: 60px; }
a { color: inherit; }

.project-shell,
.container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.project-shell { padding: clamp(64px, 8vw, 112px) 0 96px; }
.project-shell > :not(.project-clouds) {
  position: relative;
  z-index: 1;
}
.page-head,
.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(18px, 2.4vw, 26px);
  align-items: start;
  justify-items: center;
  text-align: center;
  max-width: 860px;
  margin: 0 auto 44px;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
  margin-bottom: 16px;
}
.project-title,
.page-title {
  font-family: 'Instrument Serif', 'Times New Roman', serif;
  font-size: clamp(48px, 9vw, 112px);
  line-height: 0.9;
  font-weight: 400;
  margin: 0;
  text-shadow: 0 6px 28px rgba(24,70,120,0.22);
}
.page-title em { font-style: italic; }
.project-lede,
.page-lede {
  margin: 0 auto;
  max-width: 620px;
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.7;
  color: rgba(255,255,255,0.9);
}
.head-rule {
  grid-column: 1 / -1;
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.22);
  margin-top: 4px;
}
/* Retired: the count / category line under page headers. */
.head-count { display: none !important; }

.projects-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px clamp(40px, 6vw, 88px);
  align-items: start;
}
.work-item {
  opacity: 0;
  transform: translateY(56px);
  transition: opacity 700ms cubic-bezier(.2,.7,.2,1), transform 700ms cubic-bezier(.2,.7,.2,1);
}
.work-item.in-view { opacity: 1; transform: translateY(0); }
.work-item:nth-child(even) { margin-top: clamp(56px, 9vw, 140px); transition-delay: 90ms; }
.work-link { display: block; text-decoration: none; color: inherit; }
.work-frame {
  display: block;
  position: relative;
  background: rgba(255,255,255,0.96);
  padding: clamp(8px, 1vw, 12px);
  border-radius: 4px;
  box-shadow: 0 30px 70px -28px rgba(10,30,60,0.5), 0 2px 0 rgba(255,255,255,0.4) inset;
  transform: rotate(var(--tilt, -1.4deg));
  transition: transform 420ms cubic-bezier(.2,.7,.2,1), box-shadow 420ms ease;
}
.work-item:hover .work-frame {
  transform: rotate(0deg) translateY(-8px);
  box-shadow: 0 42px 90px -30px rgba(10,30,60,0.6);
}
.work-img {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--a, #294d72) 0%, var(--b, #7fb8ec) 100%);
}
.work-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: brightness(1.06) saturate(1.06);
  transition: transform 700ms cubic-bezier(.2,.7,.2,1);
}
.work-item:hover .work-img img { transform: scale(1.05); }
.work-code,
.work-tag { display: none; }
.work-cap { display: block; padding: 20px 6px 0; }
.work-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-shadow: 0 2px 14px rgba(0,0,0,0.14);
}
.work-title .arrow { transition: transform 240ms ease; }
.work-item:hover .work-title .arrow { transform: translateX(6px); }
.work-tags {
  margin: 8px 0 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
}
@media (prefers-reduced-motion: reduce) {
  .work-item { opacity: 1; transform: none; transition: none; }
  .work-item:nth-child(even) { transition-delay: 0ms; }
}
.work-desc {
  margin: 12px 0 0;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.65;
  color: rgba(255,255,255,0.9);
  max-width: 520px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  font-size: 11.5px;
  font-weight: 500;
  color: #2a4055;
  background: rgba(63,138,214,0.10);
  border: 1px solid rgba(63,138,214,0.22);
  padding: 4px 10px;
  border-radius: 999px;
}
.work-cap .chips { margin-top: 14px; }
.work-cap .chip {
  color: #fff;
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.30);
}

.case-study {
  display: grid;
  gap: 34px;
}
.case-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(24px, 5vw, 64px);
  padding: 34px;
  border-radius: 5px;
  background: rgba(255,255,255,0.92);
  color: #1c2a3a;
  box-shadow: 0 26px 70px -32px rgba(18,58,100,0.55);
}
.case-overview h2,
.case-section h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(30px, 4vw, 50px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.02;
  margin: 0 0 18px;
}
.case-overview p,
.case-section p {
  color: #46566a;
  line-height: 1.7;
  margin: 0 0 18px;
}
.case-meta {
  display: grid;
  gap: 14px;
  margin: 0;
}
.case-meta div {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(28,42,58,0.12);
}
.case-meta dt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #5b6a7d;
  margin: 0 0 6px;
}
.case-meta dd { margin: 0; }
.case-gallery {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 4vw, 44px);
}
.case-slot {
  min-height: 0;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  background: rgba(255,255,255,0.26);
  box-shadow: 0 22px 64px -34px rgba(8,24,48,0.74);
}
.case-slot.has-image {
  padding: 0;
  background: transparent;
}
.case-slot.has-image::before { display: none; }
.case-slot.has-image img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.case-slot.has-video {
  background: rgba(12,20,30,0.42);
  aspect-ratio: 16 / 9;
}
.case-slot.has-video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.case-videos {
  display: grid;
  gap: clamp(16px, 2vw, 26px);
}
.case-videos-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.case-video {
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(16,24,32,0.84);
  box-shadow: 0 24px 72px -34px rgba(16,24,32,0.72);
}
.case-video-vertical {
  aspect-ratio: 9 / 16;
  width: 100%;
  max-width: 400px;
  margin-inline: auto;
}
.case-video video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.case-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.case-slot.large,
.case-slot.wide {
  min-height: 0;
}
.case-slot::before {
  display: none;
}
.case-slot span {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.94);
  background: rgba(0,0,0,0.26);
  padding: 6px 9px;
  border-radius: 2px;
}
.case-section {
  padding: 34px;
  border-radius: 5px;
  background: rgba(255,255,255,0.9);
  color: #1c2a3a;
}
.back-link {
  display: inline-flex;
  color: #1c2a3a;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  text-decoration: none;
}
.footer-line {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 26px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.82);
}
.footer-line a { text-decoration: none; }
.footer-line a:hover { text-decoration: underline; }

/* ---- Flexible case-study gallery blocks ---- */
.case-gallery figure { margin: 0; }
.case-layout-full { display: flex; flex-direction: column; gap: clamp(22px, 4vw, 44px); }
.case-layout-2up { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2vw, 26px); align-items: start; }
.case-layout-3up { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 22px); align-items: start; }
.case-layout-masonry { columns: 2; column-gap: clamp(16px, 2vw, 26px); }
.case-layout-masonry .case-slot { break-inside: avoid; margin: 0 0 clamp(16px, 2vw, 26px); }
.block-caption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.82);
  margin: 10px 0 0;
}
.case-text-block {
  padding: clamp(24px, 4vw, 40px);
  border-radius: 5px;
  background: rgba(255,255,255,0.92);
  color: #1c2a3a;
  box-shadow: 0 26px 70px -32px rgba(18,58,100,0.55);
}
.case-text-block h2 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0 0 16px;
}
.case-text-block p { color: #46566a; line-height: 1.75; margin: 0 0 16px; font-size: clamp(15px, 1.6vw, 17px); }
.case-text-block p:last-child { margin-bottom: 0; }
.case-text-block .block-caption { color: #5b6a7d; }

/* ---- Projects listing grid layouts ---- */
.projects-page-grid.grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px clamp(22px, 3vw, 44px); }
.projects-page-grid.grid-three .work-item:nth-child(even) { margin-top: 0; transition-delay: 0ms; }
.projects-page-grid.grid-masonry { display: block; columns: 2; column-gap: clamp(40px, 6vw, 88px); }
.projects-page-grid.grid-masonry .work-item { break-inside: avoid; margin: 0 0 clamp(40px, 6vw, 72px); }
.projects-page-grid.grid-masonry .work-item:nth-child(even) { margin-top: 0; transition-delay: 0ms; }

/* ---- Blog ---- */
.blog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); align-items: start; }
.blog-card-link { display: block; text-decoration: none; color: inherit; }
.blog-card-cover {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 5px;
  background: linear-gradient(135deg, #294d72 0%, #7fb8ec 100%);
  box-shadow: 0 30px 70px -28px rgba(10,30,60,0.5);
}
.blog-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 700ms cubic-bezier(.2,.7,.2,1); }
.blog-card:hover .blog-card-cover img { transform: scale(1.05); }
.blog-card-cover-empty { background: linear-gradient(135deg, rgba(255,255,255,0.32), rgba(255,255,255,0.12)); }
.blog-card-body { display: block; padding: 18px 4px 0; }
.blog-card-meta {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  margin-bottom: 10px;
}
.blog-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.14;
  color: #fff;
  margin: 0;
  text-shadow: 0 2px 14px rgba(0,0,0,0.14);
}
.blog-excerpt { margin: 10px 0 0; font-size: 14.5px; line-height: 1.65; color: rgba(255,255,255,0.9); }
.blog-card .chips { margin-top: 14px; }
.blog-card .chip { color: #fff; background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.30); }
.blog-readmore {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
}
.blog-readmore span { transition: transform 240ms ease; }
.blog-card:hover .blog-readmore span { transform: translateX(6px); }
.blog-empty { color: rgba(255,255,255,0.85); }
.blog-article { display: grid; gap: clamp(24px, 4vw, 40px); max-width: 900px; margin: 0 auto; }
.blog-post-hero { max-width: 760px; }
.blog-post-hero .project-title { font-size: clamp(36px, 6vw, 72px); line-height: 1.03; }
.blog-post-tags { margin-top: 18px; }
.blog-post-tags .chip { color: #fff; background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); }
.blog-hero-cover { border-radius: 6px; overflow: hidden; box-shadow: 0 30px 80px -34px rgba(8,24,48,0.7); }
.blog-hero-cover img { width: 100%; height: auto; display: block; }
.blog-body { display: grid; gap: clamp(20px, 3vw, 34px); }
.blog-back { margin-top: 8px; color: #fff; }

@media (max-width: 860px) {
  body { padding-top: 54px; }
  .page-head,
  .project-hero,
  .projects-page-grid,
  .case-overview {
    grid-template-columns: 1fr;
  }
  .project-shell,
  .container { width: min(100% - 28px, 1180px); }
  .work-item:nth-child(even) { margin-top: 0; }
  .case-layout-2up,
  .case-videos-two,
  .case-layout-3up { grid-template-columns: 1fr; }
  .case-layout-masonry { columns: 1; }
  .projects-page-grid.grid-masonry { columns: 1; }
  .blog-grid { grid-template-columns: 1fr; }
  .case-slot.large,
  .case-slot.wide { min-height: 0; }
  .case-overview,
  .case-section { padding: 22px; }
  .footer-line { flex-direction: column; }
  .work-frame { transform: rotate(calc(var(--tilt, -1.4deg) * 0.3)); }
}

/* ---- Interactive table of contents (project + blog) ---- */
.case-layout { display: block; }
.case-toc { display: none; }
.case-section[id],
.case-text-block[id],
.case-overview[id],
.blog-body .case-text-block[id] { scroll-margin-top: 90px; }
@media (min-width: 1080px) {
  .case-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: clamp(34px, 4vw, 68px);
    align-items: start;
  }
  .case-toc {
    display: block;
    position: sticky;
    top: 92px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }
  .case-main { min-width: 0; }
}
.case-toc-title {
  margin: 0 0 18px;
  font: 500 11px/1 'JetBrains Mono', 'Space Grotesk', monospace;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.case-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.case-toc a {
  display: block;
  padding: 8px 0 8px 16px;
  border-left: 2px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.62);
  font: 400 14px/1.35 'Inter', sans-serif;
  text-decoration: none;
  text-wrap: pretty;
  transition: color 200ms ease, border-color 200ms ease, padding-left 200ms ease;
}
.case-toc a:hover { color: #fff; padding-left: 20px; }
.case-toc a.active { color: #fff; border-left-color: #fff; font-weight: 500; }
@media (prefers-reduced-motion: reduce) {
  .case-toc a { transition: color 200ms ease; }
  .case-toc a:hover { padding-left: 16px; }
}
