html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #111;
  color: #fff;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

:root {
  --bg: #f3f3f1;
  --fg: #111;
  --soft: rgba(17, 17, 17, 0.55);
  --line: rgba(17, 17, 17, 0.08);
  --overlay: rgba(0, 0, 0, 0.92);
  --overlay-fg: #fff;
}

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

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
}

body.lightbox-open {
  overflow: hidden;
}

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

button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

img,
video {
  display: block;
}

/* ─── Header ─── */
.detail-header {
  position: fixed;
  top: 40px;
  left: 40px;
  right: 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 10;
}

.detail-header::before {
  content: "";
  position: absolute;
  top: -40px;
  bottom: -36px;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: #f5f5f5;
  z-index: -1;
}

.detail-logo img {
  width: 120px;
  display: block;
}

.detail-nav a {
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}

/* ─── Page Layout ─── */
.detail-page {
  flex: 1 0 auto;
  padding: 110px 28px 28px;
  display: grid;
  grid-template-rows: auto auto;
  row-gap: 22px;
}

.detail-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.detail-category {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-meta h1 {
  font-size: clamp(36px, 5vw, 72px);
  line-height: 0.94;
  letter-spacing: -0.05em;
  font-weight: 400;
}

/* ─── Masonry Grid ───────────────────────────────────────────── */
.media-collage {
  --cols: 4;
  --gap: 10px;
  --unit: 4px;
  --max-h: 480px;

  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: var(--unit);
  gap: var(--gap);
  align-content: start;
  padding-bottom: 28px;
}

/* ─── Media Card ─── */
.media-card {
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
}

.media-card img,
.media-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.45s ease;
}

.media-card:hover img,
.media-card:hover video {
  transform: scale(1.03);
}

/* ─── Badge ─── */
.media-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  line-height: 1;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  z-index: 2;
  pointer-events: none;
}

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.lightbox-close {
  position: absolute;
  top: 32px;
  right: 32px;
  z-index: 210;
  color: var(--overlay-fg);
  font-size: 14px;
  line-height: 1;
}

.lightbox-inner {
  width: 100%;
  height: 100%;
  padding: 80px 32px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media {
  max-width: min(1280px, 92vw);
  max-height: 84vh;
}

.lightbox-image {
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-video {
  width: auto;
  height: auto;
  background: #000;
}

/* ─── Footer ─── */
.projects-footer {
  margin-top: auto;
  padding: 80px 40px 88px;
  background: var(--bg);
  color: rgba(0, 0, 0, 0.68);
}

.projects-footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
}

.projects-footer-contact {
  font-size: 13px;
  line-height: 1.55;
}

.projects-footer-contact a {
  text-decoration: none;
}

.projects-footer-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.projects-footer-links a {
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.12em;
  color: rgba(0, 0, 0, 0.68);
  text-decoration: none;
}

.projects-footer-line {
  margin-top: 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.projects-footer-bottom {
  padding-top: 36px;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(0, 0, 0, 0.68);
}

.footer-bottom-left,
.footer-bottom-right {
  display: block;
}

.footer-bottom-right {
  margin-top: 8px;
}

.projects-footer-bottom a {
  color: inherit;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.projects-footer-bottom a:hover {
  opacity: 1;
}

/* ─── Responsive ─── */
@media (max-width: 1200px) {
  .detail-page {
    padding: 108px 22px 22px;
  }

  .media-collage {
    --cols: 3;
  }
}

@media (max-width: 900px) {
  .detail-header {
    top: 20px;
    left: 20px;
    right: 20px;
  }

  .detail-header::before {
    top: -20px;
    bottom: -20px;
  }

  .detail-page {
    padding: 100px 20px 20px;
    row-gap: 18px;
  }

  .detail-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .detail-meta h1 {
    font-size: clamp(32px, 10vw, 56px);
  }

  .media-collage {
    --cols: 2;
    --max-h: 360px;
  }

  .lightbox-close {
    top: 24px;
    right: 24px;
  }

  .lightbox-inner {
    padding: 72px 20px 20px;
  }

  .lightbox-media {
    max-width: 100%;
    max-height: 82vh;
  }

  .projects-footer {
    padding: 80px 20px 64px;
  }

  .projects-footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .projects-footer-links {
    gap: 18px 22px;
  }

  .projects-footer-line {
    margin-top: 28px;
  }

  .projects-footer-bottom {
    padding-top: 28px;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .detail-header {
    top: 20px;
    left: 20px;
    right: 20px;
  }

  .detail-header::before {
    top: -20px;
    bottom: -20px;
  }

  .detail-logo img {
    width: 112px;
  }

  .detail-page {
    padding: 92px 16px 16px;
  }

  .detail-nav a,
  .lightbox-close {
    font-size: 13px;
  }

  .media-collage {
    --cols: 2;
    --gap: 6px;
    --max-h: 280px;
  }

  .media-badge {
    left: 10px;
    bottom: 10px;
    font-size: 10px;
    padding: 7px 9px;
  }

  .projects-footer-contact {
    font-size: 12px;
  }

  .projects-footer-links a {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .projects-footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .footer-bottom-left {
    text-align: left;
  }

  .footer-bottom-right {
    margin-top: 0;
    text-align: right;
  }
}