/* Semantic surfaces follow the OS immediately, including in no-JS mode. */
:root{
  color-scheme:light;
  --paper:#f4e9da;--cream:#e9ddcc;--ink:#302c26;--muted:#5e5649;
  --rose:#b57b83;--rose-light:#e8c9c0;--line:rgba(48,44,38,.17);
  --theme-chrome:#faf1e5;--theme-card:#fff4e5;--theme-green:#e0e1ce;
  --theme-rose:#ead1c8;--theme-partner:#e7dfca;--theme-accent:#81534f;
  --theme-selected:#e7c6bd;--theme-button:#383a2d;--theme-button-ink:#fff1dc;
  --theme-art:#30382b;--theme-art-ink:#f6e7d2;--theme-art-muted:#c8c8b4;
  --theme-art-accent:#e7baad;--theme-art-panel:#3e4837;
  --theme-specimen-rose:#e3bbad;--theme-art-selection:#65473f;--theme-art-rose:#3d302d;
  --theme-art-rose-panel:#62443e;--theme-art-olive:#4b4b36;
  --theme-diagram:#f1ebdc;--theme-diagram-ink:#414836;--theme-diagram-line:#8e6159;
  --m4-night:#30382b;--m4-rose:#b57b83;
}
@media(prefers-color-scheme:dark){
  :root{
    color-scheme:dark;
    --paper:#252820;--cream:#2f3027;--ink:#f2e6d4;--muted:#c5bdae;
    --rose:#d9aa9e;--rose-light:#59413d;--line:rgba(242,230,212,.18);
    --theme-chrome:#292b23;--theme-card:#33362b;--theme-green:#3a3f30;
    --theme-rose:#4b3835;--theme-partner:#3e3c2c;--theme-accent:#e7b9aa;
    --theme-selected:#614641;--theme-button:#e4bdae;--theme-button-ink:#302b24;
    --theme-art:#20271e;--theme-art-ink:#f6e7d2;--theme-art-muted:#c6c6ad;
    --theme-art-accent:#eec1ad;--theme-art-panel:#35412f;
    --theme-specimen-rose:#e3bbad;--theme-art-selection:#65473f;--theme-art-rose:#3d302d;
    --theme-art-rose-panel:#62443e;--theme-art-olive:#4b4b36;
    --theme-diagram:#282f23;--theme-diagram-ink:#f2e6d4;--theme-diagram-line:#e5b5a3;
    --m4-night:#20271e;--m4-rose:#d9aa9e;
  }
}
.site-header,.detail-page .site-header,.mast{background:var(--paper);color:var(--ink);border-color:var(--line)}
.projects-section,.anomaly-section,.specimen-section{background:var(--cream)}
.principles-section,.experience-void{background:var(--paper)}
.living-lab,.experience-agents,.detail-hero.sage{background:var(--theme-green);color:var(--ink)}
.experience-sophidea,.detail-hero.rose,.detail-action,.signal-tape{background:var(--theme-rose);color:var(--ink)}
.experience-partner{background:var(--theme-partner);color:var(--ink)}
.project-card-copy,.project-agents .project-card-copy,.project-knapsack .project-card-copy{background:var(--theme-card);color:var(--ink)}
.site-footer,.detail-footer-note{background:var(--cream);color:var(--ink)}
.desktop-nav,.eyebrow,.section-index,.section-heading>p,.hero-lede,.hero-index,.hero-footnote,.manifest-copy>p,.manifest-bottom,.principles-intro>p,.principles-grid p,.project-card-copy>div>p,.project-stage,.project-symbol,.project-card-bottom,.detail-lead p,.detail-section p,.detail-facts dt,.detail-action p,.site-footer>p,.site-footer nav,.footer-end,.anomaly-copy>p,.micro-badge,.specimen-footnote,.lab-intro>p,.lab-caveat,.experience-heading>p{color:var(--muted)}
.hero h1 .serif-accent,.hero-comma,.manifest-copy h2 em,.section-heading h2 em,.principles-intro h2 em,.detail-lead h2 em,.detail-section h2 em,.experience-heading h2 em,.lab-intro h2 em{color:var(--theme-accent)}
.hero-period{color:var(--muted)}
.pill-button-dark,.filter-chip.is-active,.lab-button{background:var(--theme-button);color:var(--theme-button-ink);border-color:transparent}
.filter-chip,.lab-button-outline{color:var(--ink);border-color:var(--line)}
.lab-button-outline{background:transparent}
.mood-button{color:var(--ink);border-color:var(--line)}
.mood-button.is-current,.mood-button:hover{background:var(--theme-selected);color:var(--ink)}
.hero-art,.visual-void,.lab-stage,.detail-hero.dark,.partner-hero,.closing-section,.void-terminal{background:var(--theme-art);color:var(--theme-art-ink)}
.detail-hero.dark .detail-head>p,.partner-hero .detail-head>p,.closing-section>p{color:var(--theme-art-muted)}
.detail-hero.dark h1 em,.partner-hero h1 em{color:var(--theme-art-accent)}
.art-top,.art-bottom,.art-interaction-note{color:var(--theme-art-muted)}
.visual-agents,.visual-knapsack{background:var(--theme-green);color:var(--ink)}
.agent-board{background:var(--theme-card);color:var(--ink)}
.visual-ideas{background:var(--theme-rose);color:var(--ink)}
.portal-sheet{background:var(--paper);color:var(--ink)}
.portal-close,.portal-trigger{color:var(--ink);border-color:var(--line)}
.portal-sheet-top,.portal-sheet-bottom,.portal-foot{color:var(--muted)}
.portal-list a{color:var(--ink);border-color:var(--line)}
.portal-links a{background:var(--theme-card);color:var(--ink);border-color:var(--line)}
/* The journal has its own layout; it shares only semantic theme surfaces. */
.article,.journal-motion-toggle{background:var(--theme-rose);color:var(--ink);border-color:var(--line)}
.mast-index,.mast-links,.edition-head>p,.article-category,.article-tease,.article-meta,.article-body{color:var(--muted)}
.edition-head h2 em,.article h3,.journal-page .hero h1 em{color:var(--theme-accent)}
@media(max-width:860px){
  .m4-appbar,.m4-tabbar{background:var(--theme-chrome);color:var(--ink);border-color:var(--line)}
  .m4-appbar-label small{color:var(--muted)}
  .m4-appbar-back,.m4-appbar-action{background:var(--theme-card);color:var(--ink);border-color:var(--line)}
  .m4-tab{color:var(--muted)}
  .m4-tab[aria-current="page"],.m4-tab[aria-expanded="true"]{color:var(--ink)}
  .m4-tab[aria-current="page"]::before,.m4-tab[aria-expanded="true"]::before{background:var(--theme-selected)}
  .m4-sheet-panel{background:var(--paper);color:var(--ink)}
  .m4-sheet-handle{background:var(--muted)}
  .m4-sheet-title small,.m4-link small{color:var(--muted)}
  .m4-sheet-close{background:var(--theme-card);color:var(--ink);border-color:var(--line)}
  .m4-link{background:var(--theme-card);color:var(--ink);border-color:var(--line)}
  .m4-link:nth-child(1){background:var(--theme-green)}
  .m4-link:nth-child(2){background:var(--theme-rose)}
  .m4-link:nth-child(3){background:var(--theme-card)}
  .m4-link:nth-child(4){background:var(--theme-partner)}
  .m4-sheet-utilities a,.m4-sheet-utilities a:any-link,.m4-sheet-utilities a:visited,.m4-sheet-utilities button{background:var(--theme-card);color:var(--ink)!important;border-color:var(--line)}
  .m4-segment a,.m4-segment a:any-link,.m4-segment a:visited{background:var(--theme-card);color:var(--ink)!important;border-color:var(--line)}
  .m4-segment a:first-child,.m4-segment a:first-child:any-link{background:var(--theme-button);color:var(--theme-button-ink)!important}
  .page-home .m4-shelf-progress{color:var(--muted)}
  .page-home .m4-shelf-progress strong{color:var(--ink)}
  .page-home .m4-shelf-track{background:var(--line)}
  .anomaly-modes .mood-button{color:var(--ink)!important}
  .anomaly-modes .mood-button span{color:var(--theme-accent)!important}
}

.journal-page .article{background:var(--theme-card);border-color:var(--line)}
.journal-page .article:nth-child(2){background:var(--theme-rose)}
.journal-page .article:nth-child(3){background:var(--theme-green)}
.journal-page .article-body,.journal-page .article-body p,.journal-page .article-body strong{color:var(--ink)}
.journal-page .hero h1 em{color:var(--theme-accent)}

/* Vector ornaments remain crisp and avoid emoji/font-dependent rendering. */
.ui-glyph{display:inline-block;width:1em;height:1em;max-width:none;vertical-align:-.1em;flex:none}
.m4-link:after{content:"";width:20px;height:20px;background:currentColor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 19 19 5M5 5h14v14' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") center/contain no-repeat;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 19 19 5M5 5h14v14' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") center/contain no-repeat}
@media(max-width:860px){
  .m4-link b{padding-right:22px;overflow-wrap:break-word}
  .m4-sheet-utilities .ui-glyph{margin-left:6px}
}

/* Explicit legacy foregrounds must follow their themed surfaces too. */
.footer-end a{color:var(--ink)}
.anomaly-copy>p:not(.anomaly-eyebrow),.manifest-copy>p:not(.manifest-kicker),.principles-intro>p:last-child,.project-ordinal,.specimen-head p,.living-lab .section-index,.lab-kicker,.experience-tag,.detail-list>article>span,.principles-grid>article>span:first-child{color:var(--muted)}
.anomaly-copy h2 em,.detail-hero.sage h1 em,.detail-hero.rose h1 em,.project-card h3 span{color:var(--theme-accent)}
.project-card h3 .project-title-period{color:var(--muted)}
.mood-caption{color:var(--muted)}
.atrium-task span{color:inherit}
.route-chip.is-selected .route-number,.route-chip.is-selected small{color:var(--ink)}
.thought-word{color:#543542}
.motion-toggle,.motion-text,.eyebrow-index,.filter-end{color:var(--muted)}
/* The journal keeps its own shell, including a separate phone navigation. */
@media(max-width:640px){
  .journal-page .mobile-bottom{background:var(--theme-chrome);border-color:var(--line);color:var(--ink)}
  .journal-page .mobile-bottom a{color:var(--muted)!important}
  .journal-page .mobile-bottom a[aria-current="page"]{color:var(--ink)!important;background:var(--theme-selected);border-radius:16px}
}

/* Theme interactive states as well as their resting surfaces. */
a:focus-visible,button:focus-visible,summary:focus-visible{outline-color:var(--theme-accent)}
.journal-page .article summary:focus-visible,.anomaly-modes .mood-button:focus-visible{outline-color:var(--theme-accent)}
.journal-page .mast-links a:hover,.desktop-nav a:hover,.site-footer nav a:hover,.footer-end a:hover{color:var(--theme-accent)}
.nav-cta:hover,.portal-trigger:hover,.portal-links a:hover,.lab-button-outline:hover{background:var(--theme-selected);border-color:var(--line)}
.site-header .motion-toggle:hover{background:var(--theme-selected);border-color:var(--line);color:var(--ink)}
.atrium-task:focus-visible,.stance:focus-visible,.next-thought:focus-visible{outline-color:currentColor}
/* Dark art fields keep a light focus ring even when the page theme is light. */
:is(.detail-hero.dark,.partner-hero,.closing-section,.lab-stage) :focus-visible{outline-color:var(--theme-art-accent)}

/* Warm art surfaces share the palette; no full-page tint/filter or extra render loop. */
.anomaly-stage{background:var(--theme-art);color:var(--theme-art-ink)}
.anomaly-stage[data-mood-active="orbit"]{background:var(--theme-art-rose)}
.anomaly-stage[data-mood-active="storm"]{background:var(--theme-art-panel)}
.anomaly-stamp,.anomaly-hint{color:var(--theme-art-muted)}
.anomaly-running{color:var(--theme-art-accent)}
.atrium-console,.atrium-sidebar{background:var(--theme-art);color:var(--theme-art-ink)}
.atrium-sidebar p,.atrium-sidebar small,.atrium-title{color:var(--theme-art-muted)}
.atrium-task{color:var(--theme-art-ink)}
.sophidea-theatre{background:var(--theme-art-rose);color:var(--theme-art-ink)}
.sophidea-ask>span,.next-thought{color:var(--theme-art-accent);border-color:var(--theme-art-accent)}
.sophidea-field,.sophidea-field[data-stance-active="no"]{background:var(--theme-art-rose-panel)}
.sophidea-field[data-stance-active="yes"]{background:var(--theme-art-panel)}
.sophidea-field[data-stance-active="unsure"]{background:var(--theme-art-olive)}
.sophidea-field>p{color:var(--theme-art-ink)}
.sophidea-pole{color:var(--theme-art-muted)}
.sophidea-cloud,.sophidea-needle{color:var(--theme-art-accent)}
.partner-theatre{background:var(--theme-art);color:var(--theme-art-ink)}
.partner-theatre-art{background:var(--theme-art-panel)}
.partner-theatre-art[data-composition="1"]{background:var(--theme-art-olive)}
.partner-theatre-art[data-composition="2"]{background:var(--theme-art-rose-panel)}
.partner-glyph{color:var(--theme-art-accent)}
.editorial-ribbon{background:var(--theme-art);color:var(--theme-art-ink)}
.ribbon-sophidea{background:var(--theme-art-rose)}
.ribbon-knapsack{background:var(--theme-art-olive)}

/* Keep warm secondary labels legible without opacity washing out their contrast. */
.detail-head .section-index{opacity:1;color:var(--muted)}
.detail-hero.dark .detail-head .section-index,.partner-hero .detail-head .section-index{color:var(--theme-art-muted)}
.specimen-card{background:var(--theme-art-panel);color:var(--theme-art-ink)}
.specimen-card:nth-child(2){background:var(--theme-specimen-rose);color:#302c26}
.specimen-card:nth-child(3){background:var(--theme-art-olive)}
.specimen-label{background:rgba(37,29,21,.12)}
.specimen-label>span,.specimen-label p{opacity:1;color:inherit}
.thought-word{color:#543a32}
.transit-code,.partner-grain{color:var(--theme-art-muted)}
