.detail-main {
  width: min(1160px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 2rem 0 4.5rem;
}
.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 2rem;
  align-items: start;
}

.detail-copy,
.detail-visual,
.stack-strip,
.article-shell,
.not-found-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2rem;
  box-shadow: 0 20px 60px rgba(23, 78, 166, 0.08);
}

.detail-copy {
  padding: 2rem;
}

.back-link {
  display: inline-flex;
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.detail-kicker {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.detail-title {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3.6rem);
  line-height: 1.05;
}

.detail-lead {
  margin: 1.15rem 0 0;
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.8;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1.6rem;
}

.meta-card {
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
}

.meta-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-value {
  color: var(--text-primary);
  font-size: 0.96rem;
  line-height: 1.5;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.8rem;
}

.detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.detail-button.primary {
  background: #4285f4;
  border: 1px solid #4285f4;
  color: #fff;
}

.detail-button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
}

.detail-visual {
  padding: 1.2rem;
}

.detail-visual svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 1.5rem;
}

.detail-visual figcaption {
  margin-top: 0.9rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.stack-strip {
  margin-top: 1.5rem;
  padding: 1.4rem 1.5rem;
}

.stack-label {
  display: block;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 800;
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.stack-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: color-mix(in srgb, #4285f4 12%, white);
  color: #174ea6;
  font-size: 0.88rem;
  font-weight: 700;
}

.article-shell {
  margin-top: 1.5rem;
  padding: 2rem;
}

.article-section + .article-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.article-section h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  line-height: 1.2;
}

.article-section p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.9;
}

.article-section p + p {
  margin-top: 1rem;
}

.article-points {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-secondary);
}

.article-points li + li {
  margin-top: 0.7rem;
}

.not-found-shell {
  padding: 2rem;
  text-align: left;
}

@media (max-width: 960px) {
  .detail-main {
    width: calc(100vw - 32px);
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .detail-copy,
  .detail-visual,
  .stack-strip,
  .article-shell,
  .not-found-shell {
    border-radius: 1.5rem;
  }

  .detail-copy,
  .article-shell,
  .not-found-shell {
    padding: 1.35rem;
  }

  .stack-strip,
  .detail-visual {
    padding: 1rem;
  }

  .detail-title {
    font-size: 2rem;
  }

  .detail-actions {
    flex-direction: column;
  }

  .detail-button {
    width: 100%;
  }
}

/* Project gallery and lightbox */
.project-gallery {
  width: 100%;
}

.project-gallery-main {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid #dadce0;
  border-radius: 16px;
  background: #f8f9fa;
}

.project-gallery-slide {
  position: absolute;
  inset: 0;
  display: grid;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #f8f9fa;
  cursor: zoom-in;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.project-gallery-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.project-gallery-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project-gallery-slide:hover img {
  transform: scale(1.025);
}

.project-gallery-zoom-hint {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.68);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.project-gallery-slide:hover .project-gallery-zoom-hint,
.project-gallery-slide:focus-visible .project-gallery-zoom-hint {
  opacity: 1;
  transform: translateY(0);
}

.project-gallery-nav,
.project-lightbox-nav {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(32, 33, 36, 0.68);
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.project-gallery-nav:hover,
.project-lightbox-nav:hover {
  background: #4285f4;
  transform: scale(1.06);
}

.project-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
}

.project-gallery-nav:hover {
  transform: translateY(-50%) scale(1.06);
}

.project-gallery-prev {
  left: 1rem;
}

.project-gallery-next {
  right: 1rem;
}

.project-gallery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
}

.project-gallery-thumbs {
  display: flex;
  gap: 0.5rem;
  max-width: calc(100% - 4rem);
  overflow-x: auto;
  padding: 0.15rem 0.15rem 0.4rem;
  scrollbar-width: thin;
}

.project-gallery-thumb {
  flex: 0 0 4.5rem;
  height: 3.25rem;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f8f9fa;
  cursor: pointer;
  opacity: 0.62;
  transition: border-color 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.project-gallery-thumb:hover,
.project-gallery-thumb.is-active {
  border-color: #4285f4;
  opacity: 1;
  transform: translateY(-2px);
}

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

.project-gallery-counter {
  flex: 0 0 auto;
  color: #80868b;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
}

.project-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.project-lightbox.is-open {
  display: flex;
}

.project-lightbox-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(16, 18, 22, 0.86);
  cursor: default;
}

.project-lightbox-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1100px, 100%);
  height: min(850px, 94vh);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  background: #202124;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.35);
}

.project-lightbox-header,
.project-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  color: #fff;
}

.project-lightbox-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.project-lightbox-eyebrow {
  color: #8ab4f8;
  font-family: 'Nunito', sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.project-lightbox-title {
  margin-top: 0.15rem;
  font-family: 'Nunito', sans-serif;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  font-weight: 800;
  line-height: 1.25;
}

.project-lightbox-close {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.project-lightbox-close:hover {
  background: #ea4335;
  transform: rotate(90deg);
}

.project-lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 2rem 4.5rem;
  background: #101114;
}

#project-lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 160ms ease;
  user-select: none;
}

.project-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
}

.project-lightbox-nav:hover {
  transform: translateY(-50%) scale(1.06);
}

.project-lightbox-prev {
  left: 1.25rem;
}

.project-lightbox-next {
  right: 1.25rem;
}

.project-lightbox-toolbar {
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Nunito', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
}

.project-lightbox-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.project-lightbox-zoom-controls button {
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 180ms ease;
}

.project-lightbox-zoom-controls button:hover {
  background: #4285f4;
}

.project-lightbox-zoom-controls span {
  min-width: 3.4rem;
  text-align: center;
}

.project-lightbox-help {
  color: rgba(255, 255, 255, 0.42);
  font-weight: 600;
}

@media (max-width: 640px) {
  .project-gallery-main {
    aspect-ratio: 4 / 3;
    border-radius: 12px;
  }

  .project-gallery-zoom-hint {
    display: none;
  }

  .project-lightbox {
    padding: 0;
  }

  .project-lightbox-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .project-lightbox-stage {
    padding: 1rem 3.5rem;
  }

  .project-lightbox-help {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-gallery-slide,
  .project-gallery-slide img,
  .project-gallery-thumb,
  #project-lightbox-image,
  .project-gallery-nav,
  .project-lightbox-nav {
    transition-duration: 0.01ms !important;
  }
}
