/* ===========================
   PROJECT DETAIL PAGES — /projects/<slug>/
   Layout only. Tokens, navbar, buttons, .tags, reveals and the
   view-transition names all come from styles.css, which loads first.
   =========================== */

.project-page main {
  padding-top: calc(var(--nav-height) + 36px);
}

/* --- Back link --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 0;
  margin-bottom: 36px;
}

.back-link svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

@media (hover: hover) and (pointer: fine) {
  .back-link:hover svg {
    transform: translateX(-3px);
  }
}

/* --- Header --- */
.project-header {
  margin-bottom: 48px;
}

.project-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.project-eyebrow .sep {
  color: var(--faint);
}

.project-eyebrow .cat {
  color: var(--muted);
}

.project-title {
  font-size: clamp(3rem, 1.5rem + 5.6vw, 6rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin-bottom: 24px;
  /* Hug the text: keeps the morph from the homepage card title undistorted. */
  width: fit-content;
}

.project-lede {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
  line-height: 1.5;
  color: var(--muted);
  max-width: 52ch;
  margin-bottom: 40px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.meta-grid>div {
  padding: 18px 20px;
  border-left: 1px solid var(--border);
}

.meta-grid>div:first-child {
  padding-left: 0;
  border-left: 0;
}

.meta-grid dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}

.meta-grid dd {
  font-size: 0.97rem;
  line-height: 1.45;
  color: var(--text);
}

.status-live,
.status-proto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-live::before,
.status-proto::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-live::before {
  background: var(--accent-2);
  box-shadow: 0 0 0 3px var(--mint-soft);
}

.status-proto::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.project-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn .icon-fill {
  fill: currentColor;
}

/* --- Hero image --- */
.project-hero {
  margin: 0 0 clamp(64px, 9vw, 112px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
  box-shadow: var(--shadow-card);
}

.project-hero img {
  width: 100%;
  height: auto;
}

/* --- Body: sticky TOC + prose --- */
.project-body {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--nav-height) + 32px);
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
}

.toc ol {
  list-style: none;
  border-left: 1px solid var(--border);
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0 7px 16px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--faint);
}

@media (hover: hover) and (pointer: fine) {
  .toc a:hover {
    color: var(--text);
    border-left-color: var(--accent);
  }
}

/* Zero-JS "you are here" for the last-clicked TOC entry. Section ids are
   the same on every project page, so these rules are shared. */
.project-body:has(#overview:target) .toc a[href="#overview"],
.project-body:has(#problem:target) .toc a[href="#problem"],
.project-body:has(#approach:target) .toc a[href="#approach"],
.project-body:has(#features:target) .toc a[href="#features"],
.project-body:has(#learned:target) .toc a[href="#learned"],
.project-body:has(#next:target) .toc a[href="#next"],
.project-page:has(#gallery:target) .toc a[href="#gallery"] {
  color: var(--text);
  border-left-color: var(--accent);
}

.prose {
  counter-reset: sec;
  min-width: 0;
}

.prose-section {
  counter-increment: sec;
  padding-bottom: 56px;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--border);
}

.prose-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.prose h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
  font-weight: 700;
  margin-bottom: 20px;
}

.prose h2::before {
  content: counter(sec, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.prose p {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
  max-width: 68ch;
  margin-bottom: 18px;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.points {
  list-style: none;
  display: grid;
  gap: 16px;
  max-width: 68ch;
}

.points li {
  position: relative;
  padding-left: 30px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  list-style: none;
}

.feature {
  padding: 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.feature-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-2);
  margin-bottom: 12px;
}

.feature h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.prose .feature p {
  font-size: 0.94rem;
  line-height: 1.6;
}

/* --- Gallery --- */
.gallery {
  margin-top: clamp(80px, 10vw, 128px);
}

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

.shot--wide {
  grid-column: 1 / -1;
}

.shot-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
}

.shot-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ratio-16x9 {
  aspect-ratio: 16 / 9;
}

.ratio-16x10 {
  aspect-ratio: 16 / 10;
}

.ratio-4x3 {
  aspect-ratio: 4 / 3;
}

.ratio-21x9 {
  aspect-ratio: 21 / 9;
}

.shot figcaption {
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--faint);
  margin-top: 12px;
}

.shot figcaption .n {
  color: var(--accent);
  flex-shrink: 0;
}

/* Placeholder frame until the real screenshot lands at the named path. */
.is-placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, var(--accent-soft) 14px 15px),
    var(--surface);
}

.ph-icon {
  width: 28px;
  height: 28px;
  color: var(--faint);
  margin-bottom: 4px;
}

.ph-file {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  word-break: break-all;
}

.ph-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--faint);
}

/* --- Prev / next --- */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: clamp(80px, 10vw, 128px) 0 clamp(64px, 8vw, 96px);
}

.pager-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 12px 20px 12px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 400;
  transition: transform 0.35s var(--ease-out), border-color var(--transition-fast);
}

.pager-card--next {
  grid-template-columns: minmax(0, 1fr) 112px;
  padding: 12px 12px 12px 20px;
  text-align: right;
}

.pager-card--next .pager-thumb {
  order: 2;
}

.pager-thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-2);
}

/* "Back to all projects": same card shape, an arrow tile in place of a thumb. */
.pager-icon {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--accent);
}

.pager-icon svg {
  width: 28px;
  height: 28px;
  transition: transform 0.35s var(--ease-out);
}

.pager-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pager-dir {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}

.pager-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

@media (hover: hover) and (pointer: fine) {
  .pager-card:hover {
    color: var(--text);
    border-color: var(--accent);
    transform: translateY(-3px);
  }

  .pager-card--back:hover .pager-icon svg {
    transform: translateX(-4px);
  }
}

@media (hover: none) {
  .pager-card:active {
    transform: scale(0.985);
    transition-duration: 0.08s;
  }
}

/* --- Responsive --- */
@media (max-width: 960px) {
  .project-body {
    grid-template-columns: 1fr;
  }

  .toc {
    display: none;
  }
}

@media (max-width: 760px) {
  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-grid>div:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .meta-grid>div:nth-child(n+3) {
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  .project-page main {
    padding-top: calc(var(--nav-height) + 20px);
  }

  .back-link {
    margin-bottom: 24px;
  }

  .feature-grid,
  .gallery-grid,
  .pager {
    grid-template-columns: 1fr;
  }

  .shot--wide {
    grid-column: auto;
  }

  .pager-card,
  .pager-card--next {
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 10px 16px 10px 10px;
    text-align: left;
  }

  .pager-card--next .pager-thumb {
    order: 0;
  }

  .prose-section {
    padding-bottom: 44px;
    margin-bottom: 44px;
  }
}

/* Crop helper for thumbnails whose subject sits on the left edge. */
.pos-left {
  object-position: 0% 50%;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--text);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}
