/* Feature chapters use distinct colors for the two work stories. */
.work-chapter {
  --chapter-ink: #f1f8ef;
  --chapter-muted: #c1d3c9;
  --chapter-accent: #c8f0aa;
  --chapter-line: #56736b;
  --chapter-panel: #173330;
  position: relative;
  padding: clamp(4rem, 8vw, 8rem) clamp(1.25rem, 6vw, 6rem);
  scroll-margin-top: 90px;
  color: var(--chapter-ink);
  background: radial-gradient(ellipse at 84% 5%, #2e594d 0, transparent 63%), #102823;
}

.work-chapter--l2 {
  --chapter-ink: #fff3fa;
  --chapter-muted: #e1cbdc;
  --chapter-accent: #ffbfda;
  --chapter-line: #87627f;
  --chapter-panel: #382338;
  background: radial-gradient(ellipse at 77% 0%, #60415e 0, transparent 64%), #2b1c2c;
}

.work-chapter__inner {
  max-width: 1260px;
  margin-inline: auto;
}

.work-chapter__spread {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: center;
}

.work-chapter__intro h2 {
  margin-block: 0.2em;
  font: 400 clamp(3rem, 6.5vw, 7rem)/0.94 Georgia, Cambria, serif;
  letter-spacing: -0.065em;
  text-wrap: balance;
}

.work-chapter__intro p:not(.work-chapter__project) {
  max-width: 40ch;
  color: var(--chapter-muted);
}

.work-chapter__project,
.chapter-console__label,
.chapter-console__time {
  color: var(--chapter-accent);
  font: 500 0.73rem/1.5 ui-monospace, Consolas, monospace;
  letter-spacing: 0.05em;
}

.work-chapter__link {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  margin-top: 1rem;
  color: var(--chapter-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.work-chapter__link:hover { text-decoration-thickness: 2px; }

.work-chapter .signoff {
  margin-top: clamp(2rem, 5vw, 4rem);
  scroll-margin-top: 90px;
}

.work-chapter__visual {
  min-width: 0;
  margin: 0;
}

.work-chapter__visual figcaption {
  margin-top: 0.8rem;
  color: var(--chapter-muted);
  font-size: 0.76rem;
}

.chapter-console {
  overflow: hidden;
  border: 1px solid var(--chapter-line);
  border-radius: 0.85rem;
  background: var(--chapter-panel);
  box-shadow: 0 22px 60px #11171355;
  font-size: 0.875rem;
}

.chapter-console__header,
.chapter-console__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: clamp(0.85rem, 2.4vw, 1.45rem);
}

.chapter-console__header {
  background: #0003;
}

.chapter-console__title {
  font-size: clamp(1.05rem, 2.2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.28;
  text-wrap: balance;
}

.chapter-console__rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-console__row {
  border-top: 1px solid var(--chapter-line);
}

.chapter-console__row strong,
.chapter-console__detail { display: block; }

.chapter-console__detail {
  margin-top: 0.14rem;
  color: var(--chapter-muted);
  line-height: 1.4;
}

.chapter-status {
  flex: none;
  padding: 0.3rem 0.52rem;
  border: 1px solid currentColor;
  border-radius: 0.3rem;
  font: 500 0.72rem/1.2 ui-monospace, Consolas, monospace;
  white-space: nowrap;
}

.chapter-status--blocked { color: #ffbfab; }
.chapter-status--done { color: #c8f0aa; }
.chapter-status--waiting { color: #ffdd9b; }

.chapter-console__timeline .chapter-console__row {
  justify-content: flex-start;
  align-items: baseline;
}

.chapter-console__time {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.chapter-console__foot {
  margin: 0;
  padding: clamp(0.85rem, 2.4vw, 1.45rem);
  border-top: 1px solid var(--chapter-line);
  color: var(--chapter-muted);
  line-height: 1.55;
}

.chapter-console__foot strong {
  margin-inline-end: 0.35em;
  color: var(--chapter-ink);
}

@media (max-width: 780px) {
  .work-chapter__spread { grid-template-columns: minmax(0, 1fr); }
  .work-chapter__intro h2 { max-width: 12ch; }
}

/* The panels stay readable and in order where view timelines are unavailable. */
@supports (animation-timeline: view()) {
  @media (min-width: 781px) and (prefers-reduced-motion: no-preference) {
    .work-chapter__visual {
      animation: chapter-arrive linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 85%;
    }

    @keyframes chapter-arrive {
      from { opacity: 0.68; transform: translateY(48px) scale(0.97); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
  }
}

.work-chapter--sap .chapter-console {
  border-radius: 0.15rem;
  border-top: 3px double var(--chapter-accent);
}

.work-chapter--sap .chapter-status {
  border-radius: 0.1rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.routing-exercise { scroll-margin-top: 90px; }

.routing-thread {
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--chapter-line);
  border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
  background: var(--chapter-panel);
}

.routing-thread header { padding-bottom: 1rem; }

.routing-thread dl {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}

.routing-thread dl div {
  max-width: 85%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--chapter-line);
  border-radius: 0.7rem 0.7rem 0.7rem 0.1rem;
  background: #241626;
}

.routing-thread dl div:last-child {
  justify-self: end;
  border-radius: 0.7rem 0.7rem 0.1rem 0.7rem;
  background: #4e2f49;
}

.routing-thread dt { color: var(--chapter-accent); font-size: 0.76rem; }
.routing-thread dd { margin: 0.2rem 0 0; font-size: 0.86rem; }

.work-index { margin-top: clamp(1.5rem, 4vw, 3rem); }

.work-index__row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 14rem;
  align-items: center;
  gap: clamp(0.5rem, 3vw, 2rem);
  padding-block: 1.15rem;
  border-top: 1px solid var(--border-color-hover);
}

.work-index__row:last-child { border-bottom: 1px solid var(--border-color-hover); }
.work-index__row p { color: var(--text-secondary); font-size: 0.86rem; }
.work-index__row h3 { line-height: 1.3; }

.work-index__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
}

.work-index__actions :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  color: var(--editorial-accent);
  font-size: 0.83rem;
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

@media (max-width: 780px) {
  .work-index__row { grid-template-columns: minmax(0, 1fr); }
  .work-index__actions { flex-wrap: wrap; justify-content: flex-start; }
}

.work-chapter--sap .work-chapter__spread { align-items: start; }

.work-chapter--sap .signoff {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  margin: 0;
  padding: clamp(1rem, 3vw, 2rem);
}

.work-chapter--sap .signoff h3 { margin-block-end: 0.4rem; }
.work-chapter--sap .signoff-comparison { margin-top: 0.7rem; }

.signoff-result:has(.signoff-verdict:empty) {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.release-ledger { margin-top: clamp(1.25rem, 4vw, 2.5rem); }
.release-ledger summary {
  width: fit-content;
  min-height: 44px;
  padding-block: 0.55rem;
  color: var(--chapter-accent);
  cursor: pointer;
}

.release-ledger figure { margin-top: 0.75rem; }

.routing-paths {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.routing-paths legend { font-size: 0.82rem; color: var(--chapter-muted); }

.routing-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  margin-block: 0.4rem 0.8rem;
}

.routing-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--chapter-line);
  border-radius: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.routing-options label:has(input:checked) { border-color: var(--chapter-accent); }
.routing-options input { accent-color: var(--chapter-accent); }

@supports selector(:has(*)) {
  .routing-paths:has(#routing-present:checked) .routing-path--missing,
  .routing-paths:has(#routing-missing:checked) .routing-path--present { display: none; }
}

@media (max-width: 780px) {
  .work-chapter { padding-block: 2.5rem; }
  .work-chapter__spread { gap: 1rem; }
}

#contact.contact-section {
  width: 100%;
  min-height: calc(100svh - 14rem);
  margin-inline: 0;
  padding-block: clamp(1.5rem, 3vw, 3rem);
}

#contact.contact-section::before { content: none; }

#contact #contact-title,
#contact .contact-layout {
  width: min(100%, 1100px);
  margin-inline: auto;
  text-align: left;
}

#contact #contact-title {
  margin-block: 0 clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(2.6rem, 5vw, 4.5rem);
}

#contact .contact-layout {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  margin-block: 0;
}

#contact .contact-links {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.8rem;
  margin: 0;
}

#contact .contact-link {
  min-width: 0;
  min-height: 135px;
  padding: 0.85rem 0.6rem;
  border-color: var(--border-color-hover);
}

#contact .contact-link-label { color: var(--text-secondary); }
#contact .contact-link-value { overflow-wrap: anywhere; }

#contact .contact-qr {
  grid-column: 1 / -1;
  justify-self: stretch;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-items: start;
  gap: 0.85rem;
  padding-block: 0.85rem;
  border-top: 1px solid var(--border-color-hover);
}

#contact .contact-card-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--editorial-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

#contact .contact-form {
  min-height: 0;
  gap: 0.9rem;
  padding: clamp(1rem, 3vw, 2rem);
  background: var(--bg-card);
}

.contact-form h3 { font-size: 1.2rem; }

.contact-field {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

#contact .contact-field :is(input, textarea) {
  min-width: 0;
  border-color: var(--text-secondary);
}

#contact .contact-field :is(input, textarea):focus-visible {
  outline: 2px solid var(--editorial-accent);
  outline-offset: 2px;
}

@media (max-width: 840px) {
  #contact .contact-layout { grid-template-columns: minmax(0, 1fr); }
  #contact .contact-form { padding: 1rem; }
}

@media (max-width: 440px) {
  #contact .contact-links { grid-template-columns: minmax(0, 1fr); }
  #contact .contact-link { min-height: 105px; }
}
