/* Full project chapters share the portfolio canvas, typography, and rail. */
.horizontal-layout .project-chapter {
  padding: 8px max(var(--gutter), calc((100vw - 1320px) / 2)) 24px;
  background: transparent;
  color: var(--ink);
  --ink: #1b222b;
  --muted: #445161;
  --line: #27313f40;
  --paper: #f8f7f3;
  font-family: var(--body);
  scroll-behavior: smooth;
}
.project-chapter > section { max-width: 1320px; margin-inline: auto; }
.project-chapter .eyebrow { font-size: .6875rem; letter-spacing: .06em; }
.project-chapter a { text-underline-offset: 5px; }
.project-chapter :is(#c-constellation-title, #p-pet-title) {
  font: 900 clamp(3.8rem, 7.4vw, 7.5rem)/.97 var(--display);
  letter-spacing: -.075em;
  margin-block: 18px 24px;
}
.constellation-chapter .constellation-hero { position: relative; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; min-height: 0; padding-block: 0 20px; gap: clamp(16px, 2vw, 28px); }
.constellation-chapter .intro-copy { min-width: 0; container-type: inline-size; }
.constellation-chapter #c-constellation-title { font-size: clamp(2rem, 14.4cqw, 5.5rem); margin-bottom: 8px; }
.constellation-chapter .palette-sculpture { width: 100%; max-width: 500px; justify-self: start; margin: 0; }
.constellation-chapter .palette-stage { height: clamp(380px, 38vw, 450px); }
/* Let the wheel use a large display while retaining room for its cue and rail. */
@media (min-width: 1200px) and (min-height: 700px) {
  .horizontal-layout .constellation-chapter { padding-inline: max(var(--gutter), calc((100vw - 1600px) / 2)); }
  .constellation-chapter > section { max-width: 1600px; }
  .constellation-chapter .palette-sculpture { width: min(100%, calc(100dvh - 200px)); max-width: 760px; justify-self: center; }
  .constellation-chapter .palette-stage { height: auto; aspect-ratio: 1.15; }
}
@media (min-width: 1440px) and (min-height: 800px) {
  .constellation-chapter .intro-discovery, .constellation-chapter .palette-peek { height: 250px; }
  .constellation-chapter .palette-peek { width: min(560px, 100%); }
  .constellation-chapter .palette-mini { width: min(100%, calc(184px * var(--mini-ratio) + 12px)); }
  .constellation-chapter .palette-mini-image img { max-height: 184px; }
}
.constellation-chapter .intro-copy > .lead { font-size: clamp(1.2rem, 2vw, 1.65rem); line-height: 1.35; max-width: none; text-align: left; }
.constellation-chapter .intro-links { justify-content: flex-start; gap: 8px 24px; margin: 0 0 18px; }
.constellation-chapter .explore-link { margin: 0; min-height: 40px; padding-block: 8px; line-height: 1.35; }
.constellation-chapter .intro-discovery { margin-top: 12px; }
.constellation-chapter .intro-copy > p:not(.eyebrow):not(.lead) { max-width: 35ch; line-height: 1.65; }
.constellation-chapter .explorer-section { padding-block: 24px 16px; border-top: 1px solid var(--line); }
.horizontal-layout .constellation-chapter { padding-bottom: 12px; }
.constellation-chapter .project-story { margin-top: 24px; padding-block: 28px 8px; }
.constellation-chapter .story-method p { padding-bottom: 0; }
.constellation-chapter .explorer-section,
.constellation-chapter .project-story { transition: filter .45s ease, opacity .45s ease; }
.constellation-chapter.is-spotlit .explorer-section,
.constellation-chapter.is-spotlit .project-story { filter: blur(10px); opacity: .16; transition: none; }
.constellation-chapter .spotlight-context { display: grid; grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .65s cubic-bezier(.22,1,.36,1), opacity .5s ease; }
.constellation-chapter .spotlight-context-inner { min-height: 0; overflow: hidden; }
.constellation-chapter.is-spotlit .spotlight-context { grid-template-rows: 0fr; opacity: 0; visibility: hidden; }
.constellation-chapter.spotlight-settled .spotlight-context,
.constellation-chapter.motion-paused .spotlight-context { transition: none; }
.constellation-chapter.is-spotlit .intro-copy > .lead { position: relative; z-index: 1; }
.constellation-chapter .spotlight-exit { position: absolute; top: -8px; right: 0; z-index: 3; display: inline-flex; align-items: center; gap: 7px; padding: 0; background: transparent; font-size: .75rem; }
.constellation-chapter .spotlight-exit::after { content: ''; position: absolute; bottom: 8px; left: 0; right: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .2s; }
.constellation-chapter .spotlight-exit:hover::after,
.constellation-chapter .spotlight-exit:focus-visible::after { transform: scaleX(1); }
.constellation-chapter .spotlight-exit[hidden] { display: none; }
.constellation-spotlight > .site-header { filter: blur(4px); opacity: .35; transition: none; }
.constellation-spotlight > .site-header:focus-within { filter: none; opacity: 1; }
.site-header { transition: filter .45s ease, opacity .45s ease; }
.constellation-chapter.motion-paused .drifting,
.constellation-chapter.motion-hidden .drifting { animation-play-state: paused; }
.pet-chapter .device-hero { grid-template-columns: 1fr; align-items: start; min-height: 0; gap: 12px; padding-block: 8px 24px; }
.pet-chapter .device-hero > .intro-copy { display: grid; grid-template-columns: .8fr 1.2fr; column-gap: 5%; }
.pet-chapter .device-hero .eyebrow { grid-column: 1 / -1; }
.pet-chapter #p-pet-title { grid-column: 1; grid-row: 2; margin-block: 18px 12px; }
.pet-chapter .device-hero .lead { grid-column: 1; grid-row: 3; }
.pet-chapter .device-hero .intro-copy > p:not(.eyebrow):not(.lead) { grid-column: 2; grid-row: 2; align-self: center; margin-top: 0; max-width: 49ch; }
.pet-chapter .device-hero .pet-intro-links { grid-column: 2; grid-row: 3; margin-top: 0; }
.pet-chapter .device-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 32px; left: 0; height: auto; padding: 28px 16px 16px; }
.pet-chapter .device-print { position: relative; inset: auto; width: 100%; max-width: none; margin: 0; }
.pet-chapter .print-early { transform: rotate(-2deg); }
.pet-chapter .print-current { transform: rotate(2deg); margin-top: 44px; }
.pet-chapter .device-gallery .paper { animation-name: pet-study-drift; }
@keyframes pet-study-drift { 0%, 100% { translate: -2px 2px; rotate: -.3deg; } 50% { translate: 2px -3px; rotate: .3deg; } }
.pet-chapter .intro-copy > p:not(.eyebrow):not(.lead) { max-width: 36ch; font-size: 1rem; line-height: 1.7; margin-top: 18px; }
.pet-intro-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 24px; font-size: .8125rem; }
.pet-intro-links a { display: inline-flex; align-items: center; min-height: 44px; border-bottom: 1px solid var(--line); }
.pet-chapter .interaction { background: transparent; color: var(--ink); border-block: 1px solid var(--line); padding: 28px 0; }
.pet-chapter .interaction li { border-color: var(--line); }
.pet-chapter .interaction p, .pet-chapter .interaction li > span { color: var(--muted); }
.pet-chapter .os-section { padding-block: 42px; }
.pet-chapter #p-os-preview { width: min(100%, 960px); margin-inline: auto; }
.pet-chapter .build { padding-block: 36px 48px; }
.pet-chapter .v2-study { border-top: 1px solid var(--line); padding-block: 28px 8px; text-align: center; }
.v2-heading { display: grid; gap: 10px; justify-items: center; }
.pet-chapter .v2-heading h2 { font-size: clamp(2.2rem, 3.5vw, 3.25rem); letter-spacing: -.055em; line-height: 1.07; }
.pet-chapter .v2-heading > p:last-child { max-width: 65ch; font-size: 1rem; line-height: 1.6; color: var(--muted); }
.v2-decisions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 28px; max-width: 1120px; margin: 24px auto 0; }
.v2-decisions article { display: grid; grid-template-rows: subgrid; grid-row: span 3; border-top: 1px solid var(--line); padding-top: 16px; justify-items: center; }
.decision-number { display: block; font-size: .625rem; letter-spacing: .065em; }
.pet-chapter .v2-decisions h3 { font-size: clamp(1.25rem, 1.8vw, 1.6rem); font-weight: 400; letter-spacing: -.04em; line-height: 1.25; text-wrap: balance; }
.v2-decisions p { max-width: 31ch; font-size: .9375rem; line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.pet-chapter.motion-paused .paper,
.pet-chapter.motion-hidden .paper { animation-play-state: paused; }
.project-chapter[inert] *, .project-chapter[inert] *::before, .project-chapter[inert] *::after { animation-play-state: paused !important; }
.horizontal-layout .work-section { grid-template-rows: auto minmax(0, 1fr); }
.hero-shell { position: relative; isolation: isolate; overflow: clip; background: #c9d1db; }
.hero-shell::before {
  content: '';
  position: absolute;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse calc(80% + var(--chapter-depth, 0) * 12%) calc(85% - var(--chapter-depth, 0) * 12%) at calc(90% - var(--chapter-progress, 0) * 35%) calc(18% + var(--chapter-progress, 0) * 25%), #99b4d5 0%, transparent 65%),
    radial-gradient(ellipse at calc(10% + var(--chapter-progress, 0) * 40%) calc(85% - var(--chapter-depth, 0) * 20%), #dcc4bb 0%, transparent 60%), #c9d1db;
  animation: chapter-ambient-drift 18s ease-in-out infinite alternate;
}
@keyframes chapter-ambient-drift { from { transform: translate3d(-2%, -1%, 0); } to { transform: translate3d(2%, 1%, 0); } }
.hero-shell.canvas-paused::before { animation-play-state: paused; }
@media (max-width: 850px) {
  .site-header nav { gap: 15px; font-size: .75rem; }
  .v2-decisions { gap: 22px; }
}
@media (max-width: 700px) {
  .horizontal-layout .site-header { gap: 12px; min-height: 80px; padding-block: 12px; }
  .site-header nav { display: grid; grid-template-columns: max-content max-content; gap: 0 16px; align-content: center; justify-items: end; text-align: right; max-width: none; font-size: .75rem; }
  .site-header nav a { min-height: 20px; line-height: 1.15; }
  .site-header nav a::after { bottom: 0; }
  .horizontal-layout .project-chapter { padding: 8px var(--gutter) 20px; }
  .horizontal-layout .constellation-chapter { padding-bottom: 12px; }
  .project-chapter :is(#c-constellation-title, #p-pet-title) { font-size: clamp(3rem, 12vw, 4.5rem); }
  .pet-chapter .device-hero { grid-template-columns: 1fr; padding-top: 0; }
  .pet-chapter .device-hero > .intro-copy { display: block; }
  .pet-chapter .device-hero .intro-copy > p:not(.eyebrow):not(.lead) { margin-top: 18px; }
  .pet-chapter .device-hero .pet-intro-links { margin-top: 20px; }
  .pet-chapter .device-gallery { grid-template-columns: 1fr; gap: 32px; width: min(100%, 440px); margin: 0 auto; padding: 24px 12px 12px; }
  .pet-chapter .print-current { margin-top: 0; }
  .pet-chapter .hello-steps { grid-template-columns: 1fr; gap: 18px; }
  .v2-heading, .v2-decisions { grid-template-columns: 1fr; }
  .v2-decisions { gap: 22px; margin-top: 24px; }
  .v2-decisions article { grid-template-rows: auto; grid-row: auto; gap: 10px; }
  .pet-chapter .v2-heading > p:last-child { font-size: .9375rem; }
  .section-navigation button { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-shell::before { animation: none; }
  .horizontal-layout .project-chapter { scroll-behavior: auto; }
  .constellation-chapter .spotlight-context, .constellation-chapter .explorer-section,
  .constellation-chapter .project-story, .site-header { transition: none; }
}

/* Navigation may jump directly to any chapter; touch still snaps to a page. */
.horizontal-layout .section-track > * { scroll-snap-stop: normal; }

/* A bounded square stage keeps the animated rim inside its own section. */
.horizontal-layout .constellation-chapter { container-type: size; padding-top: 12px; overflow-anchor: none; }
.constellation-chapter .constellation-hero { min-height: 0; align-items: center; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); padding-block: 40px 28px; }
.constellation-chapter #c-constellation-title { font-size: clamp(2.75rem, 14.4cqw, 5.5rem); margin-block: 16px 20px; }
.constellation-chapter .intro-links { margin-bottom: 24px; }
.constellation-chapter .intro-discovery { --peek-photo-height: clamp(112px, 30cqh, 240px); height: calc(var(--peek-photo-height) + 64px); margin-top: 20px; }
.constellation-chapter .palette-peek { position: relative; width: 100%; height: 100%; padding: 12px 8px; }
.constellation-chapter .palette-peek-photos { gap: clamp(16px, 2vw, 28px); }
.constellation-chapter .palette-mini { width: min(100%, calc(var(--peek-photo-height) * var(--mini-ratio) + 12px)); }
.constellation-chapter .palette-mini-image img { max-height: var(--peek-photo-height); }
.constellation-chapter .palette-sculpture { width: min(100%, 620px, max(240px, calc(100cqh - 76px))); max-width: none; height: auto; margin: 0 auto; justify-self: center; }
.constellation-chapter .palette-stage { width: 100%; height: auto; aspect-ratio: 1; }
.constellation-chapter #c-palette-orbit { --palette-scale: 1.06; width: calc(100% - 48px); height: calc(100% - 48px); margin: 48px 24px 0; }
.constellation-chapter .palette-hint { font-size: .875rem; }
.constellation-chapter .palette-hint > span { right: auto; }
.constellation-chapter .palette-selection { width: calc(var(--palette-hole) * .86); min-height: 0; padding: 0; gap: 3px; line-height: 1.1; }
.constellation-chapter .selected-color-index { font-size: clamp(7px, calc(var(--palette-hole) * .1), 10px); }
.constellation-chapter #c-selected-color-hex { font-size: clamp(11px, calc(var(--palette-hole) * .18), 20px); letter-spacing: 0; }
.constellation-chapter .selected-color-relation { font-size: clamp(8px, calc(var(--palette-hole) * .11), 12px); line-height: 1.15; }
.constellation-chapter .intro-copy > .lead { margin: 0; }
.constellation-chapter .spotlight-exit { top: 0; }

@media (max-width: 700px), (pointer: coarse) and (max-width: 1100px) and (orientation: portrait) {
  .horizontal-layout .site-header { min-height: 92px; padding-block: 20px 16px; }
  .horizontal-layout .constellation-chapter { padding-top: 8px; }
  .constellation-chapter .constellation-hero { height: auto; min-height: 0; grid-template-columns: 1fr; gap: 8px; padding-block: 40px 20px; }
  .constellation-chapter #c-constellation-title { font-size: clamp(2.75rem, 13.5cqw, 5.5rem); margin-block: 10px 14px; }
  .constellation-chapter .spotlight-context .eyebrow { margin: 0; }
  .constellation-chapter .intro-links { gap: 8px 20px; margin: 0 0 12px; }
  .constellation-chapter .explore-link { min-height: 36px; padding-block: 6px; }
  .constellation-chapter .intro-copy > .lead { margin: 0; line-height: 1.35; font-size: clamp(1rem, 3.8vw, 1.4rem); }
  .constellation-chapter .intro-discovery { --peek-photo-height: clamp(64px, 22cqh, 170px); height: calc(var(--peek-photo-height) + 48px); margin-top: 12px; }
  .constellation-chapter .palette-peek { padding: 10px 6px; }
  .constellation-chapter .palette-peek-photos { gap: 16px; }
  .constellation-chapter .palette-mini-caption { padding-block: 5px; }
  .constellation-chapter .palette-sculpture { width: clamp(156px, calc(78cqh - 148px), 360px); max-width: 90%; }
  .constellation-chapter #c-palette-orbit { --mobile-palette-cue: 1; }
  .constellation-chapter .palette-hint { font-size: .75rem; }
}

/* Landscape phones need breathing room too; short viewports can scroll. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1100px), (pointer: coarse) and (max-width: 1100px) and (orientation: landscape) {
  .horizontal-layout .site-header { min-height: 76px; padding-block: 18px 14px; }
  .horizontal-layout .constellation-chapter { padding-top: 8px; }
  .constellation-chapter .constellation-hero { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; padding-block: 36px 20px; }
  .constellation-chapter #c-constellation-title { font-size: clamp(2.1rem, 4.8vw, 3.6rem); margin-block: 0 18px; }
  .constellation-chapter #c-constellation-title br, .constellation-chapter .spotlight-context .eyebrow { display: none; }
  .constellation-chapter .intro-copy > .lead { font-size: clamp(1rem, 1.8vw, 1.25rem); }
  .constellation-chapter .intro-links { gap: 8px 20px; margin-bottom: 16px; }
  .constellation-chapter .explore-link { min-height: 36px; padding-block: 6px; font-size: .8125rem; }
  .constellation-chapter .intro-discovery { --peek-photo-height: clamp(64px, calc(100cqh - 166px), 160px); height: calc(var(--peek-photo-height) + 48px); margin-top: 12px; }
  .constellation-chapter .palette-sculpture { width: min(100%, 360px, max(156px, calc(100cqh - 64px))); }
  .constellation-chapter #c-palette-orbit { --mobile-palette-cue: 1; }
}

/* Keep the complete color invitation above the rail in short mobile views. */
@media (max-width: 700px), (pointer: coarse) and (max-width: 1100px) and (orientation: portrait) {
  .horizontal-layout .constellation-chapter.is-spotlit { padding-top: 8px; }
  .constellation-chapter.is-spotlit .constellation-hero {
    height: 100cqh; min-height: 0; padding-block: 32px 12px;
    grid-template-rows: auto minmax(0, 1fr); gap: 8px; align-content: stretch;
  }
  .constellation-chapter.is-spotlit .intro-discovery {
    --peek-photo-height: clamp(48px, 20cqh, 160px);
    height: calc(var(--peek-photo-height) + 48px); margin-top: 12px;
  }
  .constellation-chapter.is-spotlit .palette-sculpture {
    container-type: size; align-self: stretch; width: 100%; max-width: none;
  }
  .constellation-chapter.is-spotlit .palette-stage {
    width: min(90%, 100cqh, 340px); height: auto; aspect-ratio: 1; margin-inline: auto;
  }
}
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1100px), (pointer: coarse) and (max-width: 1100px) and (orientation: landscape) {
  .horizontal-layout .constellation-chapter.is-spotlit { padding-top: 8px; }
  .constellation-chapter.is-spotlit .constellation-hero {
    height: 100cqh; min-height: 0; padding-block: 28px 12px;
    grid-template-rows: minmax(0, 1fr); gap: 24px;
  }
  .constellation-chapter.is-spotlit .intro-discovery {
    --peek-photo-height: clamp(48px, calc(100cqh - 134px), 160px);
    height: calc(var(--peek-photo-height) + 48px); margin-top: 10px;
  }
  .constellation-chapter.is-spotlit .palette-sculpture {
    container-type: size; align-self: stretch; width: 100%; max-width: none;
  }
  .constellation-chapter.is-spotlit .palette-stage {
    width: min(100%, 100cqh, 360px); height: auto; aspect-ratio: 1; margin-inline: auto;
  }
}

@media (orientation: portrait) and (max-width: 700px) and (max-height: 500px) {
  .constellation-chapter.is-spotlit .constellation-hero { padding-block: 24px 8px; gap: 4px; }
  .constellation-chapter.is-spotlit .intro-discovery {
    --peek-photo-height: clamp(28px, 12cqh, 48px);
    height: calc(var(--peek-photo-height) + 40px); margin-top: 8px;
  }
}

/* Both project introductions share the same title → links → invitation rhythm. */
.project-chapter :is(.pet-intro-copy, .spotlight-context-inner) > :is(#p-pet-title, #c-constellation-title) { margin-block: 16px 20px; }
.project-chapter .project-intro-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px 24px; margin: 0 0 24px; }
.project-chapter :is(.pet-intro-copy, .spotlight-context-inner) .project-intro-actions > a { display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--muted); color: var(--ink); font-size: .8125rem; line-height: 1.35; text-decoration: none; }
.pet-chapter .pet-intro-copy > .lead { margin: 0; }
@media (max-width: 700px), (pointer: coarse) and (max-width: 1100px) and (orientation: portrait) {
  .project-chapter :is(.pet-intro-copy, .spotlight-context-inner) > :is(#p-pet-title, #c-constellation-title) { margin-block: 10px 14px; }
  .project-chapter .project-intro-actions { gap: 8px 20px; margin-bottom: 16px; }
}
