/* thesecondworkforce.com — theme tokens per company-brain/design/theme.md.
   Engine mechanism classes (.sc-*, [data-sc-*]) are never restyled here. */
:root {
  --sc-canvas:   #FBF8F3;
  --sc-surface:  #F1EAE0;
  --sc-ink:      #10233F;
  --sc-ink-soft: #44546A;
  --sc-accent:   #B45309;
  --sc-accent-ink: #FBF8F3;
  --sc-font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sc-font-text: -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --tw-line: #D8CFC2;
  --tw-accent-soft: #F5E3CE;
  --tw-trust: #0F766E;
  --tw-risk: #9F1239;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sc-canvas:   #101B2C;
    --sc-surface:  #1A2740;
    --sc-ink:      #E8E3DA;
    --sc-ink-soft: #9FA8B8;
    --sc-accent:   #D97F1F;
    --sc-accent-ink: #101B2C;
    --tw-line: #2B3A52;
    --tw-accent-soft: rgba(217,127,31,0.13);
    --tw-trust: #2DD4BF;
    --tw-risk: #FB7185;
  }
}
body { background: var(--sc-canvas); color: var(--sc-ink); }

/* Editorial base */
.chapter { padding: clamp(4rem, 9vw, 8rem) 0; }
.measure { max-width: 62ch; margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); }
.chapter h2 {
  font-family: var(--sc-font-display); font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  line-height: 1.12; text-wrap: balance; margin: 0 0 1.1rem;
}
.chapter p { font-size: 1.15rem; line-height: 1.6; text-wrap: pretty; margin: 0 0 1rem; color: var(--sc-ink); }
.chapter p.soft { color: var(--sc-ink-soft); }
.rule { border: 0; border-top: 1px solid var(--tw-line); width: calc(min(62ch, 100%) - 2 * clamp(1.25rem, 5vw, 2.5rem)); margin-inline: auto; }
.smallcaps { font-family: var(--sc-font-text); font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sc-ink-soft); }
a { color: var(--sc-ink); text-decoration-color: var(--sc-accent); text-underline-offset: 3px; }
a:hover { color: var(--sc-accent); }
a:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 3px; }

/* Folio: chapter title in the left margin (grammar chrome, no numbers) */
.folio {
  position: fixed; left: 1.1rem; top: 50%; z-index: 5;
  /* orientation transform: later effects must COMPOSE into this line, never overwrite it */
  transform: rotate(180deg) translateY(50%); writing-mode: vertical-rl;
  font-family: var(--sc-font-text); font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--sc-ink-soft);
  background: var(--sc-canvas); padding: 0.35rem 0.15rem;
  opacity: 0; transition: opacity 240ms cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}
.folio.on { opacity: 1; }
@media (max-width: 900px) { .folio { display: none; } }

/* Hero: a title page. Type on paper, left anchored, no media above the fold. */
.hero { min-height: 92vh; display: flex; align-items: center; position: relative; }
.hero__inner { max-width: 56rem; padding-inline: clamp(1.25rem, 7vw, 5rem); }
.hero__title {
  font-family: var(--sc-font-display); font-weight: 400;
  font-size: clamp(1.9rem, 3.8vw, 2.95rem); line-height: 1.12;
  text-wrap: balance; margin: 1.2rem 0 1.4rem;
}
.hero__sub { font-size: 1.2rem; line-height: 1.6; color: var(--sc-ink-soft); max-width: 38rem; margin: 0 0 2rem; }
.hero__cta { display: flex; align-items: baseline; gap: 1.4rem; flex-wrap: wrap; margin: 0; }
.cta {
  display: inline-block; background: var(--sc-accent); color: var(--sc-accent-ink);
  font-family: var(--sc-font-text); font-weight: 600; font-size: 1rem;
  padding: 0.8rem 1.5rem; border-radius: 8px; text-decoration: none;
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}
.cta:hover { transform: translateY(-1px); color: var(--sc-accent-ink); }
.cta:active { transform: translateY(1px) scale(0.98); }
.hero__quiet { font-size: 1rem; color: var(--sc-ink-soft); }

/* Hero art: the constellation brain. Baked static SVG, themed via tokens.
   Absolute beside the copy on wide screens; in-flow below the copy block at 1200px. */
.hero__art {
  position: absolute; right: 3vw; top: 50%; transform: translateY(-50%);
  width: clamp(320px, 35vw, 640px); z-index: -1; pointer-events: none;
}
.hero__art svg { width: 100%; height: auto; display: block; }
.cb-outline { fill: none; stroke: var(--sc-ink); opacity: 0.12; stroke-width: 1.5; }
.cb-edges line { stroke: var(--sc-ink); opacity: 0.28; stroke-width: 1.25; }
.cb-node { fill: var(--sc-ink); opacity: 0.7; }
.cb-node--teal { fill: var(--tw-trust); opacity: 0.85; }
.cb-node--pulse { fill: var(--sc-accent); }
@media (prefers-reduced-motion: no-preference) {
  .cb-node--pulse { animation: cb-pulse 3.2s ease-in-out infinite; }
  @keyframes cb-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
  }
}
@media (max-width: 1200px) {
  .hero { flex-wrap: wrap; }
  .hero__art {
    position: static; transform: none; flex: 0 0 100%; max-width: 22rem;
    margin: 2.5rem auto 0;
  }
}

/* Cold open: a committed pre-dawn scene, identical in both themes.
   The scene is hardcoded dark on purpose: the cut to the paper hero
   reads as dawn breaking. Engine cues keep driving the text only. */
.coldopen {
  display: grid; align-items: center; overflow: clip;
  background:
    radial-gradient(120% 90% at 82% 108%, rgba(180, 83, 9, 0.28) 0%, rgba(180, 83, 9, 0.10) 32%, transparent 60%),
    radial-gradient(90% 70% at 90% 100%, rgba(251, 248, 243, 0.10) 0%, transparent 45%),
    linear-gradient(180deg, #0B1420 0%, #101B2C 55%, #16233A 100%);
}
.coldopen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.skyline { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; opacity: 0.8; pointer-events: none; }
.skyline .lit { fill: rgba(180, 83, 9, 0.75); }
.skyline .lit-cool { fill: rgba(45, 212, 191, 0.55); }

/* Circuit dawn: right-angle traces rising from tower roofs into the sky.
   Hardcoded colours on purpose: the scene is committed dark in both themes.
   Pulses ride stroke-dashoffset over pathLength-normalised paths. */
.skyline .trace { stroke: rgba(45, 212, 191, 0.22); stroke-width: 1.5; }
.skyline .trace--far { stroke: rgba(45, 212, 191, 0.13); stroke-width: 1.25; }
.skyline .tracenodes circle { fill: rgba(45, 212, 191, 0.35); }
.skyline .trace-pulse { stroke: #2DD4BF; stroke-width: 1.5; stroke-dasharray: 26 1674; stroke-dashoffset: 1700; opacity: 0; }
.skyline .trace-pulse--warm { stroke: #D97F1F; }
@media (prefers-reduced-motion: no-preference) {
  .skyline .trace-pulse { opacity: 0.9; animation: trace-pulse 7s linear infinite; }
  /* negative delays: start mid-cycle so no dash sits parked at the roof before first run */
  .skyline .trace-pulse--warm { animation-duration: 9s; animation-delay: -3.4s; }
  .skyline .trace-pulse--slow { animation-duration: 8s; animation-delay: -5s; }
  @keyframes trace-pulse {
    from { stroke-dashoffset: 1700; }
    to   { stroke-dashoffset: 0; }
  }
}
.mote { position: absolute; border-radius: 50%; background: rgba(45, 212, 191, 0.5); box-shadow: 0 0 10px rgba(45, 212, 191, 0.35); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .mote { animation: mote-drift 14s ease-in-out infinite alternate; }
  /* nth-of-type relies on the motes being the stage's only span children */
  .mote:nth-of-type(odd) { animation-duration: 19s; animation-delay: -7s; }
  @keyframes mote-drift {
    from { transform: translate(0, 0); }
    to   { transform: translate(-14px, 22px); }
  }
}
.coldopen__inner { position: relative; z-index: 2; grid-area: 1 / 1; max-width: 40rem; padding-inline: clamp(1.25rem, 10vw, 7rem); }
.coldopen__inner > p[data-sc-cue] {
  font-family: var(--sc-font-display); font-size: clamp(1.35rem, 2.8vw, 2rem);
  line-height: 1.3; text-wrap: balance; margin: 0 0 1.1rem; color: #E8E3DA;
}
.feed { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.55rem; }
.feed li {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92rem; line-height: 1.45; color: #E8E3DA;
  background: rgba(22, 35, 58, 0.72); border: 1px solid rgba(232, 227, 218, 0.14);
  border-left: 3px solid #2DD4BF; border-radius: 6px; padding: 0.5rem 0.75rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35), 0 0 0.5px rgba(45, 212, 191, 0.4);
}
.feed time { color: #2DD4BF; margin-right: 0.5em; font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgba(45, 212, 191, 0.45); }
.hero__cut { font-family: var(--sc-font-display); font-style: italic; font-size: 1.15rem; color: var(--sc-ink-soft); margin: 0 0 0.8rem; }
@media (max-width: 900px) {
  .coldopen__inner { max-width: 100%; }
  .feed li { font-size: 0.8rem; }
}

/* Decay chapter: pinned copy centre-left, fragments drifting in the field */
.decay { display: grid; align-items: center; }
.decay__copy { grid-area: 1 / 1; max-width: 34rem; padding-inline: clamp(1.25rem, 10vw, 7rem); }
.decay__copy p {
  font-family: var(--sc-font-display); font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.3; margin: 0 0 1.1rem; text-wrap: balance;
}
.frags { grid-area: 1 / 1; position: relative; height: 100%; pointer-events: none; }
.frag {
  position: absolute; display: block; width: min(15rem, 40vw);
  background: var(--sc-surface); border: 1px solid var(--tw-line); border-radius: 8px;
  padding: 0.7rem 0.9rem; font-family: var(--sc-font-text); font-size: 0.86rem;
  line-height: 1.4; color: var(--sc-ink); box-shadow: 0 6px 18px rgba(16, 35, 63, 0.08);
  will-change: transform, opacity;
}
.frag em { display: block; font-style: normal; color: var(--sc-ink-soft); font-size: 0.76rem; margin-top: 0.25rem; }
.frag[data-frag="strategy"] { right: 14%; top: 8%; }
.frag[data-frag="pilot"]    { right: 5%;  top: 24%; }
.frag[data-frag="workflow"] { right: 20%; top: 40%; }
.frag[data-frag="platform"] { right: 7%;  top: 55%; }
.frag[data-frag="skills"]   { right: 18%; top: 70%; }
.frag[data-frag="data"]     { right: 9%;  top: 84%; }
@media (max-width: 900px) {
  .frag { width: 11rem; font-size: 0.72rem; }
  .frag[data-frag="strategy"] { right: 4%; top: 6%; }
  .frag[data-frag="pilot"]    { right: 14%; top: 18%; }
  .frag[data-frag="data"]     { right: 6%; top: 82%; }
  .frag[data-frag="workflow"],
  .frag[data-frag="platform"],
  .frag[data-frag="skills"]   { display: none; }
}

/* Forming chapter: the peak. Brain SVG centre, copy in the left margin column. */
.forming { display: grid; grid-template-columns: minmax(16rem, 26rem) 1fr; align-items: center; gap: 2rem; padding-inline: clamp(1.25rem, 6vw, 5rem); }
.forming__copy p {
  font-family: var(--sc-font-display); font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  line-height: 1.3; margin: 0 0 1rem; text-wrap: balance;
}
.forming__fig { grid-column: 2; grid-row: 1; margin: 0; position: relative; }
.forming__fig svg { width: 100%; max-height: 82vh; height: auto; display: block; }
.forming__fig figcaption { font-size: 0.9rem; margin-top: 0.5rem; }
.forming__copy { grid-column: 1; grid-row: 1; }
.frags--forming { position: absolute; inset: 0; }
.frags--forming .frag { opacity: 0; left: 0; top: 0; transform-origin: top left; }
@media (max-width: 900px) {
  .forming { grid-template-columns: 1fr; align-content: center; gap: 1rem; }
  .forming__fig, .forming__copy { grid-column: 1; grid-row: auto; }
  .forming__fig svg { max-height: 52vh; }
  .frags--forming .frag { width: 5.6rem; font-size: 0.5rem; padding: 0.3rem 0.4rem; line-height: 1.2; }
  .frags--forming .frag em { display: none; }
}

/* Running chapter: copy column + media column */
.running__grid {
  display: grid; grid-template-columns: minmax(18rem, 30rem) minmax(18rem, 34rem);
  gap: clamp(1.5rem, 4vw, 4rem); justify-content: center; align-items: start;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem); position: relative;
}
.running__fig { margin: 0; }
.running__fig svg { width: 100%; height: auto; display: block; background: var(--sc-surface); border-radius: 8px; padding: 0.75rem; box-sizing: border-box; }
.running__fig figcaption { font-size: 0.9rem; margin-top: 0.5rem; }
.running__note { grid-column: 1; font-size: 0.95rem; max-width: 22rem; border-top: 1px solid var(--tw-line); padding-top: 0.7rem; }
@media (max-width: 900px) { .running__grid { grid-template-columns: 1fr; } }

/* Engagements: asymmetric editorial spreads, zigzag, never three in a row */
.ladder { max-width: 56rem; margin: 2.5rem auto 0; padding-inline: clamp(1.25rem, 5vw, 2.5rem); display: grid; gap: 2.2rem; }
.rung { max-width: 34rem; border-top: 1px solid var(--tw-line); padding-top: 1.2rem; }
.rung--right { justify-self: end; }
.rung h3 { font-family: var(--sc-font-display); font-size: 1.45rem; margin: 0 0 0.6rem; }
.rung p { margin: 0 0 0.6rem; line-height: 1.55; }
/* .chapter p (0,1,1) sets the specificity floor for paragraph overrides in chapters; .rung p only survives by later-source tie at 0,1,1 */
.chapter .rung__meta { font-size: 0.9rem; color: var(--sc-ink-soft); }
.notinc { margin-top: 3.5rem; }
.notinc h3 { font-family: var(--sc-font-display); font-size: 1.3rem; margin-bottom: 0.6rem; }

/* Editorial plates: kit diagrams set as printed figures in the calm chapters */
.plate { max-width: 62rem; margin: 3rem auto 0; padding-inline: clamp(1.25rem, 5vw, 2.5rem); }
.plate figure { margin: 0; border-top: 2px solid var(--sc-ink); border-bottom: 1px solid var(--tw-line); padding: 1.6rem 0 1.1rem; }
.plate img { width: 100%; height: auto; display: block; border-radius: 4px; }
.plate figcaption {
  font-family: var(--sc-font-text); font-size: 0.9rem; letter-spacing: 0.02em;
  color: var(--sc-ink-soft); margin-top: 0.9rem; display: flex; gap: 1em; justify-content: space-between;
}
.plate__no { font-variant: small-caps; letter-spacing: 0.12em; color: var(--sc-accent); white-space: nowrap; }

/* Practice: lateral bench rail (pan act). Stacks vertically on phones.
   #practice deliberately does not carry .chapter (its padding would fight
   the pin's [data-sc-stage] sizing), so the editorial type rules are
   mirrored here rather than inherited. Keep these declarations identical to
   .chapter h2 / .chapter p.soft above. */
#practice h2 {
  font-family: var(--sc-font-display); font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  line-height: 1.12; text-wrap: balance; margin: 0 0 1.1rem;
}
#practice .soft { color: var(--sc-ink-soft); font-size: 1.15rem; line-height: 1.6; }
.bench { display: flex; align-items: center; gap: 2rem; height: 100vh; padding-inline: clamp(1.25rem, 6vw, 5rem); width: max-content; }
.bench__lead { width: 22rem; flex: none; }
.seat {
  width: 20rem; flex: none; border-top: 1px solid var(--tw-line); padding-top: 1.1rem;
  font-size: 1.0625rem; line-height: 1.55; min-height: 8.75rem; box-sizing: border-box;
}
.seat p { margin: 0; }
.practice--stacked .bench { flex-direction: column; align-items: flex-start; height: auto; width: auto; padding-block: 3rem; }
.practice--stacked .bench__lead, .practice--stacked .seat { width: auto; max-width: 34rem; min-height: 0; }
.routing p { font-size: 1.0625rem; }

/* Close: colophon plate. Holds; does not fade out. (No height on .closepage: it IS the stage element; the engine's .sc-stage sizing must win.) */
.closepage { display: flex; flex-direction: column; justify-content: center; }
.closepage__inner { max-width: 44rem; margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); text-align: left; }
.closepage__line { font-family: var(--sc-font-display); font-size: clamp(1.3rem, 2.5vw, 1.8rem); line-height: 1.4; margin: 1rem 0 0; }
.closepage__sub { font-size: 1.0625rem; font-family: var(--sc-font-text); color: var(--sc-ink-soft); }
.colophon { position: absolute; bottom: 1.2rem; left: 0; right: 0; text-align: center; }
.colophon p { font-size: 0.82rem; color: var(--sc-ink-soft); margin: 0; }

/* Keyboard focus can land inside a [data-sc-cue] element before scroll
   progress has reached its reveal threshold — the engine writes opacity as
   an inline style every frame, so a focused-but-not-yet-cued link is
   invisible (WCAG 2.4.7). Force the cue's own opacity to 1 while focus is
   inside it; :focus-within only matches during actual keyboard/pointer
   focus, so normal scroll-driven fades are untouched once focus moves on. */
#close [data-sc-cue]:focus-within { opacity: 1 !important; transition: opacity 160ms; }
