/* ── PAGE HEADER ── */
.page-header {
  padding-top: 140px;
  padding-bottom: 64px;
  padding-left: 80px;
  padding-right: 80px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -1.5px;
  color: var(--ink);
  margin-bottom: 16px;
}

.page-header p {
  font-size: 17px;
  color: var(--muted);
  max-width: 520px;
  line-height: 1.75;
}

.portfolio-pdf-link {
  display: inline-flex;
  margin-top: 28px;
  padding-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--earth);
  border-bottom: 1px solid var(--earth);
  text-decoration: none;
}

.portfolio-pdf-link:hover { color: var(--ink); border-color: var(--ink); }

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 80px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 65px;
  background: rgba(250,250,247,0.95);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.toolbar-count {
  font-size: 13px;
  color: var(--muted);
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--linen);
  padding: 4px;
  border-radius: var(--radius);
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.view-btn:hover { color: var(--ink); }
.view-btn.active { background: var(--warm-white); color: var(--ink); }

/* ── PROJECTS CONTAINER ── */
.projects-container {
  padding: 48px 80px 80px;
  min-height: 60vh;
}

/* ── GRID VIEW ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.25s;
}

.project-card:hover {
  border-color: var(--earth);
  transform: translateY(-4px);
}

.project-card-img {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--linen);
}

.project-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .project-card-img img { transform: scale(1.04); }

.project-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--stone-light);
}

.project-card-placeholder span {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-card-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card-body h3 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 8px;
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.project-card-meta span {
  font-size: 12px;
  color: var(--stone-light);
  letter-spacing: 0.04em;
}

.project-card-meta span + span::before {
  content: '·';
  margin-right: 12px;
}

.project-card-body p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 20px;
}

.project-card-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--earth);
  letter-spacing: 0.04em;
}

/* ── LIST VIEW ── */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-row {
  display: grid;
  grid-template-columns: 160px 1fr auto 40px;
  align-items: center;
  gap: 32px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.project-row:hover {
  border-color: var(--earth);
  background: var(--linen);
}

.project-row-img {
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--linen);
  flex-shrink: 0;
}

.project-row-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-row-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--stone-light);
}

.project-row-body h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 8px;
}

.project-row-body p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.project-row-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  min-width: 120px;
}

.project-row-meta span {
  font-size: 13px;
  color: var(--stone-light);
}

.project-row-arrow {
  color: var(--stone-light);
  transition: color 0.2s, transform 0.2s;
}

.project-row:hover .project-row-arrow {
  color: var(--earth);
  transform: translateX(4px);
}

/* ── EMPTY STATE ── */
.projects-empty {
  text-align: center;
  padding: 100px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.projects-empty p {
  font-size: 16px;
  color: var(--muted);
}

/* ── HIDDEN ── */
.hidden { display: none !important; }

/* ── DETAIL BACK ── */
.detail-back {
  padding: 100px 80px 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.back-link:hover { color: var(--ink); }

/* ── DETAIL HEADER ── */
.detail-header {
  padding: 32px 80px 40px;
  border-bottom: 1px solid var(--border);
}

.detail-header h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.08;
  letter-spacing: -1px;
  color: var(--ink);
  margin-bottom: 16px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.detail-meta-item svg { color: var(--earth); }

/* ── DETAIL MAIN ── */
.detail-main {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 48px;
  padding: 48px 80px;
  align-items: start;
}

/* ── DETAIL COVER ── */
.detail-visuals { min-width: 0; }

.project-carousel {
  position: relative;
}

.project-carousel-viewport {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  background: var(--linen);
}

.project-carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease;
}

.project-carousel-slide.active {
  opacity: 1;
  visibility: visible;
}

.project-carousel-slide:focus-visible {
  outline: 2px solid var(--earth);
  outline-offset: -4px;
}

.project-carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-carousel-arrow {
  position: absolute;
  top: calc(50% - 26px);
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  color: #fff;
  background: rgba(20,19,17,0.62);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.project-carousel-arrow:hover,
.project-carousel-arrow:focus-visible {
  background: rgba(20,19,17,0.88);
  transform: scale(1.05);
  outline: none;
}

.project-carousel-prev { left: 14px; }
.project-carousel-next { right: 14px; }

.project-carousel-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.project-carousel-counter {
  flex-shrink: 0;
  color: var(--earth);
  letter-spacing: 0.08em;
}

.detail-cover {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--linen);
}

.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--linen);
}

.detail-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--stone-light);
}

.detail-cover-placeholder span {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── DETAIL DESCRIPTION ── */
.detail-description {
  font-size: 17px;
  color: var(--muted);
  line-height: 1.85;
}

.detail-description p { margin-bottom: 16px; }

.detail-lead {
  font-family: var(--font-display);
  font-size: clamp(21px, 2.1vw, 28px);
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 0 !important;
}

.detail-story {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 64px;
  padding: 0 80px 80px;
}

.project-story-section + .project-story-section {
  margin-top: 0;
  padding-left: 32px;
  border-left: 1px solid var(--border-dark);
}

.project-story-section h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 24px;
}

.project-story-grid {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border-dark);
}

.project-story-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.project-story-item h3 {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--earth);
}

.project-story-item p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0;
}

/* ── GALLERY ── */
.detail-gallery {
  padding: 32px 0 0;
}

.gallery-header {
  margin-bottom: 20px;
}

.gallery-header h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: var(--linen);
  border: 0;
  padding: 0;
  font: inherit;
}

.gallery-item:focus-visible {
  outline: 2px solid var(--earth);
  outline-offset: 3px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img { transform: scale(1.04); }

.gallery-item-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(28,28,26,0.75), transparent);
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-item:hover .gallery-item-caption { opacity: 1; }

/* ── LIGHTBOX ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20,20,18,0.95);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

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

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-caption {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-top: 12px;
  text-align: center;
}

.lightbox-counter {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 8px;
  letter-spacing: 0.08em;
}

.lightbox-close {
  position: absolute;
  top: 24px; right: 24px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.2); }

/* ── PROJECT NAV ── */
.project-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border);
}

.project-nav-prev,
.project-nav-next {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 40px 80px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.project-nav-prev { border-right: 1px solid var(--border); }
.project-nav-next { align-items: flex-end; text-align: right; }

.project-nav-prev:hover,
.project-nav-next:hover { background: var(--linen); }

.project-nav-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--earth);
  transition: gap 0.2s;
}

.project-nav-prev:hover .project-nav-label { gap: 10px; }
.project-nav-next:hover .project-nav-label { gap: 10px; }

.project-nav-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.5vw, 30px);
  color: var(--ink);
  line-height: 1.1;
}

/* ── DETAIL CTA ── */
.detail-cta {
  background: var(--linen);
  padding: 100px 80px;
  text-align: center;
}

.detail-cta-inner {
  max-width: 560px;
  margin: 0 auto;
}

.detail-cta h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin-bottom: 16px;
}

.detail-cta h2 em { font-style: italic; color: var(--earth); }

.detail-cta p {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 36px;
  line-height: 1.7;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .page-header { padding: 120px 40px 48px; }
  .toolbar { padding: 16px 40px; top: 61px; }
  .projects-container { padding: 40px 40px 60px; }
  .projects-grid { grid-template-columns: 1fr 1fr; }
  .project-row { grid-template-columns: 120px 1fr 40px; }
  .project-row-meta { display: none; }
  .detail-back { padding: 100px 40px 0; }
  .detail-header { padding: 24px 40px 32px; }
  .detail-main { grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr); padding: 40px 40px; gap: 32px; }
  .detail-story { gap: 40px; padding: 0 40px 60px; }
  .detail-cover { position: static; }
  .detail-gallery { padding: 28px 0 0; }
  .gallery-grid { grid-template-columns: 1fr 1fr; }
  .detail-cta { padding: 80px 40px; }
}

@media (max-width: 640px) {
  .page-header { padding: 100px 24px 40px; }
  .toolbar { padding: 16px 24px; }
  .projects-container { padding: 32px 24px 48px; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-row { grid-template-columns: 120px 1fr 32px; gap: 12px; }
  .detail-back { padding: 80px 24px 0; }
  .detail-header { padding: 20px 24px 24px; }
  .detail-main { grid-template-columns: 1fr; padding: 32px 24px; }
  .detail-story { grid-template-columns: 1fr; gap: 0; padding: 0 24px 48px; }
  .detail-cover { position: static; aspect-ratio: 4/3; }
  .detail-gallery { padding: 24px 0 0; }
  .gallery-grid { grid-template-columns: 1fr; }
  .project-nav { grid-template-columns: 1fr; }
  .project-nav-prev { border-right: none; border-bottom: 1px solid var(--border); padding: 28px 24px; }
  .project-nav-next { align-items: flex-start; text-align: left; padding: 28px 24px; }
  .project-story-item { grid-template-columns: 1fr; gap: 8px; }
  .detail-lead { margin-bottom: 0 !important; }
  .project-story-section + .project-story-section {
    margin-top: 44px;
    padding-left: 0;
    border-left: 0;
  }
  .detail-cta { padding: 60px 24px; }
}
