:root {
  --bg: #ffffff;
  --surface: #f7f9fb;
  --surface-strong: #eef3f7;
  --text: #172028;
  --muted: #6c7883;
  --line: #d7e0e7;
  --line-strong: #9fb0bd;
  --cyan: #22b8d7;
  --lemon: #f5d94a;
  --coral: #ff6f61;
  --green: #47b978;
  --shadow: 0 22px 80px rgba(23, 32, 40, 0.12);
  --max: 1180px;
  --gutter: clamp(18px, 4vw, 54px);
  font-family: Inter, "Aptos", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(215, 224, 231, 0.45) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(0deg, rgba(215, 224, 231, 0.34) 1px, transparent 1px) 0 0 / 72px 72px,
    var(--bg);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.site-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.site-grid::before,
.site-grid::after {
  content: "";
  position: absolute;
  border: 1px solid var(--line);
  opacity: 0.64;
}

.site-grid::before {
  top: 96px;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 34px;
}

.site-grid::after {
  top: 24px;
  right: calc(var(--gutter) * 0.72);
  width: 18vw;
  height: 72vh;
  border-color: rgba(34, 184, 215, 0.32);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 76px;
  padding: 0 var(--gutter);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand,
.nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav {
  gap: clamp(14px, 2.2vw, 32px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav a {
  position: relative;
  padding: 10px 0;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 1px;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.nav a:hover::after,
.nav a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

main {
  position: relative;
}

.section-line {
  position: relative;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.section-line::before {
  content: "";
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: 0;
  height: 1px;
  background: var(--line);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.58fr);
  align-items: center;
  gap: clamp(28px, 5.4vw, 76px);
  min-height: calc(100vh - 76px);
  padding-top: 48px;
  padding-bottom: 64px;
}

.hero::after {
  content: "";
  position: absolute;
  left: var(--gutter);
  bottom: 42px;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, var(--coral), transparent);
}

.hero-copy {
  position: relative;
  min-width: 0;
  max-width: 700px;
}

.hero-copy::before {
  content: "";
  position: absolute;
  left: -22px;
  top: -26px;
  width: 82px;
  height: 82px;
  border-left: 1px solid var(--cyan);
  border-top: 1px solid var(--cyan);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 660px;
  font-size: clamp(54px, 7.6vw, 112px);
  line-height: 0.9;
  font-weight: 760;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 435px;
  margin-top: 28px;
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.7;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-top: 34px;
  padding: 0 16px 0 18px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--text);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 800;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.text-button svg,
.prev-button svg,
.next-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.text-button:hover,
.text-button:focus-visible {
  color: var(--bg);
  background: var(--text);
  transform: translateY(-2px);
}

.media-frame {
  position: relative;
  overflow: hidden;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  cursor: zoom-in;
}

.media-frame::before,
.gallery-tile::before,
.lightbox-figure::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.52);
  mix-blend-mode: screen;
}

.media-frame img,
.gallery-tile img {
  filter: grayscale(1) brightness(1.03) contrast(0.95);
  transition: filter 260ms ease, transform 360ms ease;
}

.media-frame:hover img,
.media-frame:focus-visible img,
.gallery-tile:hover img,
.gallery-tile:focus-visible img {
  filter: grayscale(0) brightness(1) contrast(1);
  transform: scale(1.035);
}

.hero-media {
  min-width: 0;
  width: min(100%, 440px);
  justify-self: end;
  aspect-ratio: 0.76;
  box-shadow: var(--shadow);
}

@media (min-width: 1280px) {
  .hero-media {
    width: min(100%, 500px);
  }
}

.measure {
  position: absolute;
  z-index: 4;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
}

.x-axis {
  left: 18px;
  bottom: 18px;
  padding: 6px 8px;
}

.y-axis {
  right: 18px;
  top: 18px;
  writing-mode: vertical-rl;
  padding: 8px 6px;
}

.projects,
.process,
.index-panel {
  padding-top: 92px;
  padding-bottom: 96px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(260px, 0.55fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 34px;
}

.section-heading h2 {
  font-size: clamp(34px, 5.2vw, 72px);
  line-height: 0.94;
  font-weight: 760;
  letter-spacing: 0;
}

.section-heading p {
  max-width: 430px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 96px;
  gap: 14px;
}

.gallery-tile {
  position: relative;
  grid-column: span 2;
  grid-row: span 2;
  overflow: hidden;
  min-height: 0;
  padding: 0;
  color: var(--bg);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  cursor: zoom-in;
  text-align: left;
}

.gallery-tile.is-wide {
  grid-column: span 3;
}

.gallery-tile.is-tall {
  grid-row: span 3;
}

.gallery-tile.is-large {
  grid-column: span 3;
  grid-row: span 3;
}

.gallery-tile:nth-child(2)::after,
.gallery-tile:hover::after,
.gallery-tile:focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border: 2px solid var(--cyan);
}

.gallery-tile:nth-child(2) img {
  filter: grayscale(0) brightness(1) contrast(1);
}

.gallery-tile span {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: inline-flex;
  width: max-content;
  max-width: calc(100% - 24px);
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(215, 224, 231, 0.82);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.process-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.process-step {
  min-height: 250px;
  padding: 24px;
  background: rgba(247, 249, 251, 0.72);
}

.process-step + .process-step {
  border-left: 1px solid var(--line);
}

.process-step h3 {
  margin-top: 24px;
  font-size: 20px;
  font-weight: 800;
}

.process-step p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.diagram {
  position: relative;
  height: 112px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(159, 176, 189, 0.34) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, rgba(159, 176, 189, 0.25) 1px, transparent 1px) 0 0 / 24px 24px,
    #fff;
}

.diagram::before,
.diagram::after {
  content: "";
  position: absolute;
  border: 1px solid currentColor;
}

.diagram-plan {
  color: var(--cyan);
}

.diagram-plan::before {
  left: 22px;
  top: 20px;
  width: 82px;
  height: 52px;
}

.diagram-plan::after {
  right: 34px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-left-color: var(--lemon);
  border-bottom-color: var(--lemon);
}

.diagram-frame {
  color: var(--coral);
}

.diagram-frame::before {
  left: 32px;
  top: 22px;
  width: 88px;
  height: 58px;
  transform: skewX(-14deg);
}

.diagram-frame::after {
  right: 26px;
  top: 32px;
  width: 54px;
  height: 42px;
  border-color: var(--green);
}

.diagram-field {
  color: var(--green);
}

.diagram-field::before {
  left: 24px;
  top: 50px;
  width: 72%;
  height: 1px;
  border-width: 1px 0 0;
}

.diagram-field::after {
  left: 48px;
  top: 22px;
  width: 72px;
  height: 72px;
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(245, 217, 74, 0.28), rgba(34, 184, 215, 0.1));
}

.image-index {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  margin: 0;
  list-style: none;
  border: 1px solid var(--line-strong);
  background: var(--line);
}

.image-index li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
}

.image-index span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 30px var(--gutter) 38px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 760;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  --lightbox-edge-gap: clamp(18px, 4vw, 48px);
  padding: 0 var(--lightbox-edge-gap);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

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

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(215, 224, 231, 0.45) 1px, transparent 1px) 0 0 / 64px 64px,
    rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  cursor: zoom-out;
}

.lightbox-panel {
  position: relative;
  width: min(980px, calc(100vw - 330px));
  margin-top: var(--lightbox-edge-gap);
  padding-bottom: var(--lightbox-edge-gap);
}

.lightbox.is-portrait {
  place-items: start center;
}

.lightbox.is-portrait .lightbox-panel {
  align-self: start;
  max-height: none;
}

.lightbox-figure {
  position: relative;
  overflow: visible;
  display: block;
  min-height: 0;
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--text);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.lightbox.is-portrait .lightbox-figure {
  display: block;
  overflow: visible;
}

.lightbox-figure img {
  width: 100%;
  height: auto;
  min-height: 0;
  object-fit: contain;
  background: var(--surface);
}

.lightbox.is-portrait .lightbox-figure img {
  width: 100%;
  height: auto;
  max-height: none;
}

.lightbox-figure figcaption {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) minmax(180px, auto);
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.lightbox-figure h2 {
  overflow: hidden;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-figure p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.lightbox-figure .count {
  color: var(--cyan);
}

.icon-button,
.nav-button,
.next-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--text);
  border-radius: 4px;
  cursor: pointer;
}

.close-button {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 5;
  width: 42px;
  height: 42px;
}

.nav-button {
  position: fixed;
  top: 50%;
  z-index: 7;
  min-height: 48px;
  justify-content: space-between;
  padding: 0 14px 0 16px;
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
  box-shadow: 0 16px 42px rgba(23, 32, 40, 0.08);
}

.prev-button {
  left: clamp(18px, 3vw, 42px);
}

.next-button {
  right: clamp(18px, 3vw, 42px);
}

.icon-button:hover,
.icon-button:focus-visible,
.nav-button:hover,
.nav-button:focus-visible,
.next-button:hover,
.next-button:focus-visible {
  color: var(--bg);
  background: var(--text);
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

@media (max-width: 900px) {
  .site-header {
    height: auto;
    min-height: 72px;
    align-items: flex-start;
    flex-direction: column;
    padding-top: 18px;
    padding-bottom: 16px;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 58px;
  }

  .hero-media {
    justify-self: stretch;
    width: 100%;
    aspect-ratio: 1.18;
  }

  .section-heading,
  .lightbox-figure figcaption {
    grid-template-columns: 1fr;
  }

  .lightbox-panel {
    width: 100%;
    max-width: 100%;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 118px;
  }

  .gallery-tile,
  .gallery-tile.is-wide,
  .gallery-tile.is-tall,
  .gallery-tile.is-large {
    grid-column: span 1;
    grid-row: span 2;
  }

  .process-strip,
  .image-index {
    grid-template-columns: 1fr;
  }

  .process-step + .process-step {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

}

@media (max-width: 560px) {
  :root {
    --gutter: 16px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 10px;
    font-size: 11px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(42px, 14.6vw, 64px);
  }

  .projects,
  .process,
  .index-panel {
    padding-top: 70px;
    padding-bottom: 74px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 104px;
  }

  .site-footer {
    flex-direction: column;
  }

  .lightbox {
    --lightbox-edge-gap: 14px;
    padding: 0 var(--lightbox-edge-gap);
  }

  .lightbox-panel {
    padding-bottom: calc(var(--lightbox-edge-gap) + 64px);
  }

  .nav-button {
    top: auto;
    bottom: 14px;
    transform: none;
  }

  .prev-button {
    left: 14px;
  }

  .next-button {
    right: 14px;
  }

  .close-button {
    top: 8px;
    right: 8px;
  }
}
