/* Streamlined featured project pages */
.project-page {
  min-height: 100vh;
  padding-top: var(--header-height);
  background: var(--page);
}

.project-detail-shell {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
}

.project-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 28px 0 22px;
  color: var(--muted);
  font-family: "Manrope", Inter, ui-sans-serif, sans-serif;
  font-size: 0.86rem;
  font-weight: 650;
  transition: color 150ms ease, transform 150ms ease;
}

.project-back:hover {
  color: var(--text);
  transform: translateX(-2px);
}

.project-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  margin-bottom: 26px;
}

.project-detail-title {
  font-family: "Manrope", Inter, ui-sans-serif, sans-serif;
  font-size: clamp(3rem, 5.6vw, 4.9rem);
  font-weight: 780;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.project-meta {
  margin-top: 12px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.project-detail-summary {
  max-width: 720px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.project-link-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.project-external-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 15px;
  color: var(--button-text);
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: 999px;
  font-family: "Manrope", Inter, ui-sans-serif, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  transition: transform 150ms ease, opacity 150ms ease;
}

.project-external-link:hover {
  transform: translateY(-1px);
  opacity: 0.88;
}

.project-hero-image {
  width: 100%;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid color-mix(in srgb, var(--text) 15%, transparent);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(25, 23, 19, 0.055);
}

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

.project-detail-content {
  width: min(820px, 100%);
  padding: 44px 0 76px;
}

.project-copy-section + .project-copy-section {
  margin-top: 38px;
}

.project-copy-section h2 {
  margin-bottom: 12px;
  font-family: "Manrope", Inter, ui-sans-serif, sans-serif;
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  font-weight: 740;
  letter-spacing: -0.04em;
}

.project-copy-section p {
  max-width: 780px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.project-work-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-work-list li {
  padding: 8px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 650;
}

.project-page-footer {
  border-top: 1px solid var(--line);
}

.project-page-footer .footer-inner {
  width: min(1080px, calc(100% - 48px));
}

html[data-theme="dark"] .project-hero-image {
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
}

@media (max-width: 800px) {
  .project-detail-head {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .project-link-group {
    justify-content: flex-start;
  }

  .project-detail-content {
    padding-top: 36px;
  }
}

@media (max-width: 700px) {
  .project-detail-shell,
  .project-page-footer .footer-inner {
    width: min(100% - 30px, 1080px);
  }

  .project-back {
    margin: 22px 0 18px;
  }

  .project-detail-title {
    font-size: clamp(2.7rem, 14vw, 4rem);
  }

  .project-hero-image {
    aspect-ratio: 4 / 3;
    border-radius: 15px;
  }

  .project-detail-content {
    padding: 32px 0 58px;
  }

  .project-copy-section + .project-copy-section {
    margin-top: 32px;
  }
}


/* --- V20: streamlined project case-study modules --- */

.project-secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 15px;
  color: var(--text);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  border-radius: 999px;
  font-family: "Manrope", Inter, ui-sans-serif, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  transition: transform 150ms ease, border-color 150ms ease;
}

.project-secondary-link:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--text) 50%, transparent);
}

.project-story {
  width: min(960px, 100%);
  padding: 48px 0 82px;
}

.project-story .project-copy-section {
  width: 100%;
}

.project-story .project-copy-section + .project-copy-section {
  margin-top: 64px;
}

.project-section-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.72rem !important;
  font-weight: 760;
  letter-spacing: 0.13em;
  line-height: 1.2 !important;
  text-transform: uppercase;
}

.project-story .project-copy-section h2 {
  margin-bottom: 16px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.project-overview > p:last-child {
  max-width: 810px;
}

.project-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.project-section-heading h2 {
  margin-bottom: 0 !important;
}

.gallery-note {
  max-width: 260px;
  color: var(--muted);
  font-size: 0.78rem !important;
  line-height: 1.5 !important;
  text-align: right;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.highlight-item {
  min-width: 0;
  padding: 26px 24px 28px 0;
  border-bottom: 1px solid var(--line);
}

.highlight-item:nth-child(odd) {
  padding-right: 34px;
  border-right: 1px solid var(--line);
}

.highlight-item:nth-child(even) {
  padding-left: 34px;
}

.highlight-number {
  display: block;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.12em;
}

.highlight-item h3 {
  margin-bottom: 9px;
  font-size: 1.12rem;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.highlight-item p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

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

.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.gallery-item-wide {
  aspect-ratio: 16 / 9;
}

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

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

.gallery-item figcaption {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gallery-item.image-missing::before {
  content: "Add image";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
}

.project-tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-tool-list li {
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 680;
}

@media (max-width: 760px) {
  .project-story {
    padding: 38px 0 62px;
  }

  .project-story .project-copy-section + .project-copy-section {
    margin-top: 48px;
  }

  .project-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
  }

  .gallery-note {
    max-width: none;
    text-align: left;
  }

  .highlight-grid {
    grid-template-columns: 1fr;
  }

  .highlight-item,
  .highlight-item:nth-child(odd),
  .highlight-item:nth-child(even) {
    padding: 22px 0 24px;
    border-right: 0;
  }

  .highlight-number {
    margin-bottom: 14px;
  }

  .project-gallery {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .gallery-item,
  .gallery-item-wide {
    aspect-ratio: 16 / 10;
  }
}


/* --- V21: SpellFister content + gallery polish --- */

/* Keep all gallery tiles the same size. */
.project-gallery {
  align-items: stretch;
}

.gallery-item,
.gallery-item-wide {
  aspect-ratio: 16 / 10;
}

.project-resources-section > h2 {
  margin-bottom: 22px !important;
}

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

.project-resource-card {
  position: relative;
  min-height: 178px;
  padding: 22px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

a.project-resource-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--text) 25%, var(--line));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.07);
}

html[data-theme="dark"] a.project-resource-card:hover {
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.20);
}

.resource-kicker {
  display: block;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-resource-card h3,
.devlog-copy h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.project-resource-card p,
.devlog-copy p {
  max-width: 40ch;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.resource-arrow {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--muted);
  font-size: 1rem;
}

.resource-status {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.resource-coming-soon {
  opacity: 0.82;
}

.devlog-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 0;
  margin-top: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.devlog-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--text) 25%, var(--line));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.07);
}

html[data-theme="dark"] .devlog-card:hover {
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.20);
}

.devlog-thumbnail {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  background: var(--surface-soft);
}

.devlog-thumbnail img {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  transition: transform 300ms ease;
}

.devlog-card:hover .devlog-thumbnail img {
  transform: scale(1.018);
}

.devlog-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  font-size: 0.9rem;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.devlog-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
}

.devlog-copy .resource-kicker {
  margin-bottom: 18px;
}

.devlog-watch {
  display: inline-block;
  margin-top: 20px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 720;
}

@media (max-width: 760px) {
  .project-resource-grid,
  .devlog-card {
    grid-template-columns: 1fr;
  }

  .project-resource-card {
    min-height: 158px;
    padding: 20px;
  }

  .devlog-thumbnail,
  .devlog-thumbnail img {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .devlog-copy {
    padding: 20px;
  }

  .gallery-item,
  .gallery-item-wide {
    aspect-ratio: 16 / 10;
  }
}


/* --- V22: center case-study content beneath the full-width hero --- */
.project-story {
  margin-inline: auto;
}


/* =========================================================
   V36 — Three.js project page
   ========================================================= */

.threejs-page .project-story {
  margin-inline: auto;
}

.threejs-hero-stage,
.threejs-model-tile,
.threejs-orbit-stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--text) 8%, transparent), transparent 50%),
    var(--surface);
  border: 1px solid var(--line);
}

.threejs-hero-stage {
  width: 100%;
  aspect-ratio: 16 / 7;
  margin-top: 30px;
  border-radius: 22px;
}

.threejs-hero-stage canvas,
.threejs-model-tile canvas,
.threejs-orbit-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.threejs-stage-loading,
.threejs-stage-hint,
.threejs-model-index {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.threejs-stage-loading {
  top: 50%;
  left: 50%;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease;
}

.threejs-model-stage.is-loaded .threejs-stage-loading,
.threejs-orbit-stage.is-loaded .threejs-stage-loading {
  opacity: 0;
}

.threejs-stage-hint {
  right: 16px;
  bottom: 14px;
  padding: 6px 9px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.threejs-experiment {
  scroll-margin-top: 110px;
}

.threejs-experiment-copy {
  max-width: 360px;
  color: var(--muted);
  font-size: 0.86rem !important;
  line-height: 1.6 !important;
  text-align: right;
}

.threejs-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.threejs-model-tile {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
}

.threejs-model-index {
  top: 13px;
  left: 14px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 760;
  letter-spacing: 0.1em;
}

.threejs-orbit-stage {
  width: 100%;
  aspect-ratio: 16 / 8;
  border-radius: 18px;
  cursor: grab;
}

.threejs-orbit-stage:active {
  cursor: grabbing;
}

.threejs-next-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.threejs-next-card {
  padding: 24px 28px 26px 0;
  border-bottom: 1px solid var(--line);
}

.threejs-next-card + .threejs-next-card {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.threejs-next-card > span {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.1em;
}

.threejs-next-card h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.threejs-next-card p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

@media (max-width: 820px) {
  .threejs-hero-stage {
    aspect-ratio: 16 / 9;
  }

  .threejs-experiment-copy {
    max-width: none;
    text-align: left;
  }

  .threejs-model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .threejs-orbit-stage {
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 520px) {
  .threejs-model-grid,
  .threejs-next-grid {
    grid-template-columns: 1fr;
  }

  .threejs-next-card,
  .threejs-next-card + .threejs-next-card {
    padding: 20px 0 22px;
    border-left: 0;
  }

  .threejs-hero-stage,
  .threejs-orbit-stage {
    border-radius: 15px;
  }

  .threejs-stage-hint {
    right: 10px;
    bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .threejs-stage-hint {
    display: none;
  }
}


/* =========================================================
   V37 — Three.js internal experiment tabs
   ========================================================= */

.threejs-browser-section {
  scroll-margin-top: 110px;
}

.threejs-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 24px 0 34px;
  padding: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.threejs-tab {
  min-height: 38px;
  padding: 0 15px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 720;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.threejs-tab:hover {
  color: var(--text);
}

.threejs-tab.is-active {
  background: var(--text);
  color: var(--page);
}

.threejs-tab-panel[hidden] {
  display: none !important;
}

.threejs-tab-panel {
  min-height: 420px;
}

.threejs-tile-hint {
  position: absolute;
  right: 12px;
  bottom: 11px;
  z-index: 2;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.threejs-model-tile:hover .threejs-tile-hint {
  opacity: 0.8;
}

.threejs-model-tile {
  cursor: grab;
}

.threejs-model-tile:active {
  cursor: grabbing;
}

@media (max-width: 600px) {
  .threejs-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .threejs-tab {
    width: 100%;
  }

  .threejs-tile-hint {
    opacity: 0.72;
  }
}


/* =========================================================
   V39 — Three.js experiment hierarchy
   ========================================================= */

.threejs-model-experiment {
  padding-top: 10px;
}

.threejs-feature-heading {
  margin-bottom: 28px;
}

.threejs-model-experiment .threejs-model-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.threejs-model-experiment .threejs-model-tile {
  aspect-ratio: 1 / 1;
}

.threejs-orbit-experiment {
  margin-top: 26px;
  padding-top: 62px;
  border-top: 1px solid var(--line);
}

.threejs-orbit-experiment .threejs-orbit-stage {
  max-width: 840px;
  aspect-ratio: 16 / 7.5;
  margin-inline: auto;
}

.threejs-experiment + .threejs-experiment {
  scroll-margin-top: 110px;
}

/* Old tab UI is intentionally retired in V39. */
.threejs-tabs,
.threejs-tab,
.threejs-tab-panel {
  all: unset;
}

@media (max-width: 820px) {
  .threejs-model-experiment .threejs-model-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .threejs-orbit-experiment {
    padding-top: 48px;
  }

  .threejs-orbit-experiment .threejs-orbit-stage {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 520px) {
  .threejs-model-experiment .threejs-model-grid {
    grid-template-columns: 1fr;
  }

  .threejs-orbit-experiment {
    padding-top: 38px;
  }
}


/* =========================================================
   V40 — Three.js page cleanup
   ========================================================= */

/* Align all Three.js page content to the same 1080px shell as the title. */
.threejs-page .project-story {
  width: 100%;
  margin-inline: 0;
  padding-top: 34px;
}

/* Less dead space between title block and first experiment. */
.threejs-page .project-detail-head {
  margin-bottom: 0;
}

.threejs-page .project-detail-summary {
  max-width: 660px;
  margin-top: 14px;
}

/* Experiment headings should read as one coherent left-aligned block. */
.threejs-page .project-section-heading {
  display: block;
  margin-bottom: 26px;
}

.threejs-page .project-section-heading h2 {
  max-width: 760px;
  margin-bottom: 12px !important;
  font-size: clamp(2rem, 3.2vw, 2.85rem);
}

.threejs-page .threejs-experiment-copy {
  max-width: 760px;
  margin: 0;
  font-size: 0.94rem !important;
  line-height: 1.65 !important;
  text-align: left;
}

/* Keep Experiment 01 visually dominant without making the heading awkward. */
.threejs-model-experiment {
  padding-top: 0;
}

.threejs-model-experiment .threejs-model-grid {
  margin-top: 8px;
}

/* Experiment 02 stays clearly separated but aligns to the same left edge. */
.threejs-orbit-experiment {
  margin-top: 54px;
  padding-top: 54px;
}

.threejs-orbit-experiment .threejs-orbit-stage {
  max-width: 900px;
  margin-inline: 0;
}

/* Slightly tighten the lower sections so the page feels intentional. */
.threejs-page .project-story .project-copy-section + .project-copy-section {
  margin-top: 56px;
}

@media (max-width: 820px) {
  .threejs-page .project-story {
    width: 100%;
    padding-top: 28px;
  }

  .threejs-page .project-section-heading h2 {
    max-width: none;
  }

  .threejs-orbit-experiment {
    margin-top: 44px;
    padding-top: 44px;
  }
}


/* =========================================================
   V43 — Orbiting Gallery width
   ========================================================= */

.threejs-orbit-experiment .threejs-orbit-stage {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}
