/* The same three hero spheres become the first-line markers for real content. */
.sphere-journey {
  position: fixed;
  inset: 0;
  z-index: 12;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(var(--header-height, 76px) 0 0 0);
}

.sphere-journey .moving-token circle {
  stroke: var(--token-outline);
  stroke-width: 3;
  filter: drop-shadow(0 3px 5px var(--token-shadow));
}

.journey-enabled .fusion-mark > span { visibility: hidden; }
.journey-enabled .stream-bridge { height: 32px; }
.journey-enabled .stream-bridge::before,
.journey-enabled .stream-bridge::after,
.journey-enabled .stream-bridge span,
.journey-enabled .project-number,
.journey-enabled .flow-node::after,
.journey-enabled .contact-core::before { display: none; }

.section-shell.chapter-section {
  --page-hold: 0px;
  --sphere-size: 24px;
  --sphere-gap: 15px;
  position: relative;
  width: min(1040px, calc(100vw - 48px));
  padding-block: 88px;
}

.chapter-section.is-page-sticky { padding-bottom: calc(88px + var(--page-hold)); }
.chapter-section.is-page-sticky .chapter-content { position: sticky; top: 76px; }
.chapter-content {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding-left: calc(var(--sphere-size) + var(--sphere-gap));
  justify-self: stretch;
}

.chapter-section .section-intro {
  display: block;
  padding-top: 0;
  border-top: 0;
}

.chapter-section .section-index {
  width: max-content;
  margin-bottom: 18px;
}

.chapter-section .section-heading h2,
.chapter-section .contact-copy h2 {
  max-width: 760px;
  font-size: clamp(40px, 4.3vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.048em;
}

.chapter-section .section-heading p,
.chapter-section .contact-copy p {
  max-width: 680px;
  margin-top: 20px;
  font-size: 16px;
  line-height: 1.75;
}

.sphere-title {
  position: relative;
  display: block;
  min-width: 0;
}

.sphere-title-copy,
.sphere-title > span:last-child { min-width: 0; }

.sphere-slot {
  position: absolute;
  top: 0.14em;
  right: calc(100% + var(--sphere-gap));
  display: block;
  width: var(--sphere-size);
  height: var(--sphere-size);
  border: 0;
  background: transparent;
}

.chapter-section .project-ledger,
.chapter-section .notes-layout { margin-top: 40px; }

.chapter-section .project-entry,
.chapter-section .project-entry.featured {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.54fr) 38px;
  gap: 28px;
  min-height: 0;
  padding: 28px 0;
}

.chapter-section .project-copy h3,
.chapter-section .project-entry:not(.featured) .project-copy h3 {
  margin-top: 10px;
  font-size: clamp(24px, 2.7vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.chapter-section .project-copy p { margin-top: 14px; font-size: 15px; }
.chapter-section .project-summary { gap: 10px; }

.chapter-section .notes-layout { display: block; }
.chapter-section .note-list { border-top: 1px solid var(--hairline-strong); }

.chapter-section .note-row {
  grid-template-columns: minmax(0, 1fr) 106px auto;
  gap: 20px;
  align-items: start;
  padding: 25px 0;
}

.chapter-section .note-title {
  font-size: clamp(21px, 2.2vw, 26px);
  line-height: 1.28;
}

.chapter-section .note-row:hover .note-title,
.chapter-section .note-row:focus-visible .note-title { transform: none; }

.chapter-section .note-date,
.chapter-section .note-kind { padding-top: 7px; }

.writing-archive {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 22px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.writing-archive a:hover,
.writing-archive a:focus-visible { color: var(--ink); }

.chapter-section.contact-section {
  min-height: calc(100svh - var(--header-height, 76px));
  display: flex;
  flex-direction: column;
  padding-block: 88px 48px;
}

.chapter-section .contact-core {
  display: block;
  padding: 0 0 44px;
  border-top: 0;
}

.chapter-section .contact-links { max-width: none; margin-top: 40px; }
.contact-title-line { align-items: center; }
.contact-title-line .sphere-slot { margin-top: 0; }
.chapter-section .contact-link { padding-block: 18px; }
.chapter-section .contact-link:first-child strong { font-size: 15px; }

/* v2 content layouts: three editorial projects, three note rows, six contact endpoints. */
.projects-section .chapter-content { padding-left: 0; }
.chapter-section .project-ledger {
  display: block;
  border-top: 1px solid var(--hairline-strong);
}
.chapter-section .project-entry,
.chapter-section .project-entry.featured {
  position: relative;
  display: block;
  min-width: 0;
  padding: 28px 34px 28px calc(var(--sphere-size) + var(--sphere-gap));
  border-bottom: 1px solid var(--hairline);
}
.chapter-section .project-title-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}
.chapter-section .project-title-link:focus-visible {
  border-radius: 2px;
  outline: 3px solid var(--math);
  outline-offset: 3px;
}
.chapter-section .project-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}
.chapter-section .project-arrow {
  position: absolute;
  top: 28px;
  right: 0;
  color: var(--muted);
  text-decoration: none;
}
.writing-archive {
  min-height: 44px;
  align-items: center;
}
.writing-archive a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}
.chapter-section .note-row {
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto) 32px;
  align-items: center;
}
.chapter-section .sphere-title-copy {
  display: grid;
  gap: 5px;
}
.chapter-section .sphere-title-copy > span,
.chapter-section .note-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}
.chapter-section .note-kind { text-align: right; }
.chapter-section .contact-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  column-gap: 24px;
  border-top: 1px solid var(--hairline-strong);
}
.contact-section .chapter-content { padding-left: 0; }
.chapter-section .contact-item {
  position: relative;
  min-width: 0;
  min-height: 96px;
  padding: 18px 0 18px calc(var(--sphere-size) + var(--sphere-gap));
  border-bottom: 1px solid var(--hairline);
}
.chapter-section .contact-action {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: inherit;
  text-decoration: none;
}
.chapter-section .contact-item strong {
  display: block;
  min-width: 0;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.chapter-section .contact-action strong { margin-top: 0; }
.chapter-section .contact-title-line { min-height: 20px; }
.chapter-section .contact-phone { cursor: default; }
.chapter-section .note-title-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}
.chapter-section .note-title-link:focus-visible,
.chapter-section .contact-action:focus-visible {
  border-radius: 2px;
  outline: 3px solid var(--math);
  outline-offset: 3px;
}
.chapter-section .contact-action:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--math);
}

@media (min-width: 1024px) {
  .projects-section .section-heading { padding-left: calc(var(--sphere-size) * 2 + var(--sphere-gap)); }
  .projects-section .section-heading h2 { text-wrap: balance; }
  .projects-section .section-heading h2,
  .projects-section .section-heading p { max-width: 240px; }
  .chapter-section .project-ledger {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 24px;
  }
  .chapter-section .project-entry,
  .chapter-section .project-entry.featured {
    padding-right: 24px;
    border-bottom: 1px solid var(--hairline);
  }
  .chapter-section .project-entry + .project-entry {
    border-left: 1px solid var(--hairline);
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .chapter-section .project-summary {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.journey-enabled .site-footer { margin-top: 12px; padding-top: 24px; }
.chapter-section.contact-section .site-footer { margin-top: auto; }

@media (max-width: 899px) {
  .section-shell.chapter-section {
    width: min(100% - 32px, 720px);
    padding-block: 72px;
  }

  .chapter-section.is-page-sticky { padding-bottom: 72px; }
  .chapter-section.is-page-sticky .chapter-content { position: static; }
  .chapter-section .project-entry,
  .chapter-section .project-entry.featured { grid-template-columns: minmax(0, 1fr) 34px; gap: 18px; }
  .chapter-section .project-summary { grid-column: 1 / -1; }
  .chapter-section .note-row { grid-template-columns: minmax(0, 1fr) auto; }
  .chapter-section .note-date { grid-column: 1; }
  .chapter-section .note-kind { grid-column: 2; }
  .chapter-section .contact-core { grid-template-columns: 1fr; gap: 40px; }
  .chapter-section .contact-links { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
  .chapter-section.contact-section { min-height: 0; display: block; }
}

@media (max-width: 1023px) {
  .projects-section .section-heading { padding-left: calc(var(--sphere-size) + var(--sphere-gap)); }
}

@media (max-width: 520px) {
  .section-shell.chapter-section {
    --sphere-size: 20px;
    --sphere-gap: 15px;
    width: calc(100% - 28px);
    padding-block: 64px;
  }
  .chapter-section .section-heading h2,
  .chapter-section .contact-copy h2 { font-size: clamp(32px, 10vw, 38px); }
  .chapter-section .section-heading p,
  .chapter-section .contact-copy p { font-size: 15px; }
  .chapter-section .section-heading p { width: calc(100% - 32px); }
  .chapter-section .project-entry,
  .chapter-section .project-entry.featured { grid-template-columns: minmax(0, 1fr) 30px; gap: 12px; padding: 24px 30px 24px calc(var(--sphere-size) + var(--sphere-gap)); }
  .chapter-section .project-copy h3,
  .chapter-section .project-entry:not(.featured) .project-copy h3 { font-size: clamp(21px, 6.8vw, 25px); }
  .chapter-section .note-row { grid-template-columns: 1fr; gap: 8px; }
  .chapter-section .note-date,
  .chapter-section .note-kind { grid-column: 1; padding-top: 0; }
  .chapter-section .note-kind { padding-left: 0; text-align: left; }
  .chapter-section .contact-links { grid-template-columns: 1fr; }
  .chapter-section.contact-section { padding-block: 64px 42px; }
  .chapter-section .contact-link strong { overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  .sphere-journey { display: none; }
  .journey-enabled .fusion-mark > span { visibility: visible; }
  .chapter-section.is-page-sticky { padding-bottom: 88px; }
  .chapter-section.is-page-sticky .chapter-content { position: static; }
  .sphere-slot {
    border-radius: 50%;
    background: var(--math);
  }
  .sphere-slot[data-sphere-id^="stats"] { background: var(--stats); }
  .sphere-slot[data-sphere-id^="cs"] { background: var(--cs); }
  .sphere-slot[data-sphere-id^="project"] { background: var(--math); }
  .sphere-slot[data-sphere-id^="analytics"] { background: var(--stats); }
  .sphere-slot[data-sphere-id^="brainstorming"] { background: var(--cs); }
  .sphere-slot[data-sphere-id^="contact-stats"] { background: var(--stats); }
  .sphere-slot[data-sphere-id^="contact-cs"] { background: var(--cs); }
}

/* Readable static fallback until the journey controller has initialized. */
html:not(.journey-enabled) { scroll-behavior: auto !important; }
html:not(.journey-enabled) .moving-token { display: none; }
html:not(.journey-enabled) .static-tokens { display: block; }
html:not(.journey-enabled) .sphere-slot {
  border-radius: 50%;
  background: var(--math);
}
html:not(.journey-enabled) .sphere-slot[data-sphere-id^="stats"] { background: var(--stats); }
html:not(.journey-enabled) .sphere-slot[data-sphere-id^="cs"] { background: var(--cs); }
html:not(.journey-enabled) .scroll-story { height: auto; }
html:not(.journey-enabled) .hero {
  position: relative;
  height: auto;
  min-height: 0;
  display: block;
  padding-top: var(--header-height, 76px);
}
html:not(.journey-enabled) .hero .system {
  height: calc(100svh - var(--header-height, 76px));
  min-height: 560px;
  margin-inline: auto;
}
html:not(.journey-enabled) .focus-panel {
  position: relative;
  inset: auto;
  min-height: calc(100svh - var(--header-height, 76px));
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto;
}
html:not(.journey-enabled) .story-panel .fusion-mark { opacity: 1; }

@media (max-width: 760px) {
  html:not(.journey-enabled) .hero .system { min-height: 600px; }
}

/* Approved D03/R01/D04/D07/D08 integration. */
.story-panel .project-type-row > .card-type-orb.sphere-slot {
  position: relative;
  inset: auto;
  right: auto;
  top: auto;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html.journey-enabled:not(.article-transition-active) .story-panel .sphere-slot {
    background: transparent;
    box-shadow: none;
  }
}

.story-panel .contact-sphere-dock .sphere-slot {
  position: relative;
  inset: auto;
  right: auto;
  top: auto;
  width: 16px;
  height: 16px;
}

.story-panel .project-entry,
.story-panel .project-entry.featured {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100%;
  padding: 0;
}

.story-panel .project-card-link {
  flex: 1 1 auto;
  width: 100%;
  padding: 54px 52px 50px;
}

.story-panel .project-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.story-panel .project-summary {
  margin-top: auto;
  padding-top: 28px;
}

.story-panel .project-arrow { top: 24px; right: 24px; }

.story-panel .note-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px max-content 20px;
  gap: 16px;
  align-items: center;
}

.story-panel [data-content-figure="writing"] .note-index-figure {
  width: 44px;
  height: 40px;
}

.story-panel .note-empty {
  white-space: nowrap;
}

.story-panel .note-kind {
  grid-column: 4;
  padding: 0;
  text-align: right;
}

html:not(.journey-enabled) .sphere-slot[data-sphere-id^="project"],
html.article-transition-active .sphere-slot[data-sphere-id^="project"] { background: var(--math); }
html:not(.journey-enabled) .sphere-slot[data-sphere-id^="analytics"],
html.article-transition-active .sphere-slot[data-sphere-id^="analytics"] { background: var(--stats); }
html:not(.journey-enabled) .sphere-slot[data-sphere-id^="brainstorming"],
html.article-transition-active .sphere-slot[data-sphere-id^="brainstorming"] { background: var(--cs); }
html:not(.journey-enabled) .sphere-slot[data-sphere-id^="contact-stats"],
html.article-transition-active .sphere-slot[data-sphere-id^="contact-stats"] { background: var(--stats); }
html:not(.journey-enabled) .sphere-slot[data-sphere-id^="contact-cs"],
html.article-transition-active .sphere-slot[data-sphere-id^="contact-cs"] { background: var(--cs); }

html.article-transition-active .sphere-journey { visibility: hidden; }
html.article-transition-active .sphere-slot {
  border-radius: 50%;
  background: var(--math);
}

html.article-transition-active .story-panel .card-type-orb {
  animation: none !important;
  transform: none !important;
}

.sphere-journey .moving-token circle {
  transform-box: fill-box;
  transform-origin: center;
}

.sphere-journey .moving-token.is-idling[data-sphere-index="0"] circle {
  animation: sphere-idle-a 3.6s cubic-bezier(.35, 0, .2, 1) 1 both;
}

.sphere-journey .moving-token.is-idling[data-sphere-index="1"] circle {
  animation: sphere-idle-b 3.6s cubic-bezier(.35, 0, .2, 1) 1 both;
}

.sphere-journey .moving-token.is-idling[data-sphere-index="2"] circle {
  animation: sphere-idle-c 3.6s cubic-bezier(.35, 0, .2, 1) 1 both;
}

.sphere-journey .moving-token.is-hovered circle,
.story-panel :is(a, button):hover .card-type-orb,
.story-panel :is(a, button):focus-visible .card-type-orb {
  animation: sphere-hover-once 900ms cubic-bezier(.2, .75, .2, 1) 1 both;
}

@keyframes sphere-idle-a {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1px, -2px); }
  58% { transform: translate(1px, 1.5px); }
  82% { transform: translate(-.5px, -.75px); }
}

@keyframes sphere-idle-b {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(.2px, 1px); }
  58% { transform: translate(-1px, -.5px); }
  82% { transform: translate(.8px, .25px); }
}

@keyframes sphere-idle-c {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(.8px, 1px); }
  58% { transform: translate(0, -1px); }
  82% { transform: translate(-.3px, .5px); }
}

@keyframes sphere-hover-once {
  0% { transform: scale(1); opacity: 1; }
  20% { transform: scale(1.12); opacity: 1; }
  58% { transform: scale(1.12); opacity: .78; }
  100% { transform: scale(1.12); opacity: 1; }
}

html.reveal-ready .story-panel .reveal-item.is-reveal-pending:not(.is-visible) {
  opacity: .55;
  transform: translateY(10px);
}

html.reveal-ready .story-panel .reveal-item.is-visible,
html.reveal-ready .story-panel .reveal-item:focus-within,
html.reveal-ready .story-panel :target.reveal-item {
  opacity: 1;
  transform: none;
}

@media (min-width: 761px) {
  .story-panel .project-ledger {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .story-panel .project-ledger {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    border-top: 0;
  }

  .story-panel .project-entry,
  .story-panel .project-entry.featured {
    min-height: 0;
    padding: 0;
    border: 1px solid var(--hairline);
  }

  .story-panel .project-card-link { padding: 44px 24px; }

  .story-panel .project-entry .project-summary {
    grid-column: auto;
    margin-top: 0;
    padding-top: 24px;
  }

  .story-panel .project-arrow { top: 17px; right: 17px; }

  .story-panel .note-row {
    grid-template-columns: minmax(0, 1fr) 26px 20px;
    grid-template-rows: auto auto;
    gap: 10px;
  }

  .story-panel [data-content-figure="writing"] .note-index-figure {
    grid-column: 2;
    grid-row: 1;
    width: 26px;
    height: 28px;
  }

  .story-panel .note-empty {
    grid-column: 1;
    grid-row: 2;
    white-space: normal;
  }

  .story-panel .note-kind {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sphere-journey .moving-token,
  .sphere-journey .moving-token circle,
  .story-panel .card-type-orb {
    animation: none !important;
    transform: none !important;
  }

  html.reveal-ready .story-panel .reveal-item.is-reveal-pending {
    opacity: 1;
    transform: none;
  }
}
