/*
 * THE ROYAL CODES — ROYAL CODEX NOIR
 * Visual treatment only. Existing hierarchy, text, chapter controls, audio,
 * Stripe checkout, legal copy and native scrollbar remain intact.
 */
:root{
  --rcn-vellum:#eae2d3;
  --rcn-parchment:#d8cfc0;
  --rcn-brass:#c5a059;
  --rcn-obsidian:#0b090a;
  --rcn-oxblood:#2b090e;
  --rcn-royal:#0a1128;
  --rcn-ease:cubic-bezier(.22,1,.36,1);
}

/* Illumination follows attention; never dim the actual prose to 25%.
   The slightly darkened *ambient field* creates the torch effect without
   the halation and inaccessible low contrast of blurred body copy. */
main > section.rcn-scene{
  position:relative;
  isolation:isolate;
  scroll-margin-top:80px;
}
main > section.rcn-scene:not(.hero)::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
  background:
    radial-gradient(ellipse 75% 40% at 48% 32%,rgba(197,160,89,.115),transparent 74%),
    radial-gradient(ellipse 56% 54% at 85% 72%,rgba(43,9,14,.145),transparent 82%);
  opacity:.11;
  transition:opacity .78s var(--rcn-ease);
}
main > section.rcn-scene.rcn-active:not(.hero)::after{opacity:.95}
main > section.rcn-scene:not(.hero) > :is(.wrap,.joseph-showcase){position:relative;z-index:1}
main > section.rcn-scene:not(.hero):not(#receive){box-shadow:inset 0 1px rgba(216,207,192,.07),inset 0 -1px rgba(216,207,192,.07)}
main > section.rcn-scene:is(#read-the-argument,#lineage,#edition3,#what-opens,#questions) {
  background-blend-mode:normal;
}
main > section.rcn-scene#receive::after {
  background:radial-gradient(ellipse 65% 40% at 43% 26%,rgba(197,160,89,.14),transparent 75%);
  opacity:.2;
}
main > section.rcn-scene#receive.rcn-active::after{opacity:.55}

/* Page remains readable when JavaScript is missing, if observers are delayed,
   and when the viewer has enabled reduced motion. */
.rcn-enhanced main > section.rcn-scene:not(.rcn-revealed) > .wrap :is(h2,.eyebrow) {
  opacity:.85;
  transform:translateY(5px);
}
.rcn-enhanced main > section.rcn-scene > .wrap :is(h2,.eyebrow){
  transition:opacity .65s var(--rcn-ease),transform .65s var(--rcn-ease);
}
.rcn-enhanced main > section.rcn-scene.rcn-revealed > .wrap :is(h2,.eyebrow){opacity:1;transform:none}
.rcn-enhanced main > section.rcn-scene.rcn-active > .wrap h2{
  text-shadow:0 1px 30px rgba(227,183,114,.13);
}

/* Manuscript typography. Scope to sales-page narrative rather than
   controls, reviews, chapter previews, forms, legal text, or the paid portal. */
#read-the-argument .argument-body > p,
#read-the-argument .essay-fast > p,
#read-the-argument .essay-deep p,
#the-leak .continuity-copy > p,
#lineage .lineage-hero > p,
#edition3 .ed3-lead,
#edition3 .ed3-tail,
#the-work .reveal-copy > p,
#what-opens .vision-intro,
#acquire .final-copy > p {
  max-width:min(100%,60ch);
  line-height:1.78;
  margin-bottom:1.52em;
  letter-spacing:.006em;
}
#read-the-argument .argument-body > p,
#read-the-argument .essay-fast > p,
#read-the-argument .essay-deep p,
#the-leak .continuity-copy > p,
#lineage .lineage-hero > p,
#edition3 .ed3-lead,
#edition3 .ed3-tail,
#the-work .reveal-copy > p,
#what-opens .vision-intro,
#acquire .final-copy > p {
  text-wrap:pretty;
}
#read-the-argument .essay-fast > p,
#read-the-argument .argument-body > p,
#edition3 .ed3-lead,
#the-leak .continuity-copy > p,
#what-opens .vision-intro,
#acquire .final-copy > p{
  color:var(--rcn-vellum);
}
#read-the-argument .essay-fast strong,
#the-leak .continuity-copy strong,
#edition3 .ed3-lead strong,
#what-opens .vision-intro strong,
#acquire .final-copy strong{
  color:#f5ede0;
  font-weight:800;
  font-size:1.075em;
  text-decoration-color:rgba(197,160,89,.38);
  text-underline-offset:.18em;
}

/* Illuminated opening initials, an editorial ornament rather than new copy.
   Gold is deliberately limited to accents: the royal-blue velvet remains. */
#read-the-argument .essay-fast > p:first-child::first-letter,
#lineage .lineage-hero > p:first-of-type::first-letter,
#edition3 .ed3-lead::first-letter,
#what-opens .vision-intro::first-letter,
#acquire .final-copy > p:first-of-type::first-letter{
  float:left;
  font-family:"Cormorant Garamond",Georgia,serif;
  font-weight:600;
  font-size:3.7em;
  line-height:.77;
  padding:.09em .13em .03em 0;
  color:var(--rcn-brass);
  text-shadow:0 3px 18px rgba(197,160,89,.17);
}
#read-the-argument .argument-folio,
#edition3 .eyebrow,
#lineage .small-cap,
#what-opens .vision-kicker,
#receive .eyebrow,
#acquire .eyebrow {
  letter-spacing:.17em;
}
#read-the-argument .argument-folio,
#lineage .lineage-caption,
#edition3 .ed3-cross-grid article > span {
  border-color:rgba(197,160,89,.25);
}

/* Breathing rooms without reordering one block or changing any copy.
   Existing larger sections were already spacious; increase moderately
   rather than tripling the entire page into an endless scroll. */
main > section.rcn-scene:is(#the-turn,#the-leak,#read-the-argument,#lineage,#edition3,#the-work,#what-opens,#families,#receive,#questions,#acquire){
  padding-block:clamp(103px,10.5vw,158px);
}
main > section.rcn-scene:is(#the-proof,#inspection-record){
  padding-block:clamp(82px,8vw,126px);
}
main > section.rcn-scene#experience{
  padding-block:clamp(100px,10vw,150px);
}

/* Hairline chapter breaks and quiet surface changes, not new cards. */
main > section.rcn-scene:not(#top):not(#receive):not(#experience){
  border-top-color:rgba(197,160,89,.18);
}
#read-the-argument blockquote,
#the-leak .continuity-quote,
#lineage blockquote {
  border-color:rgba(197,160,89,.22);
  text-shadow:0 5px 27px rgba(197,160,89,.055);
}
#read-the-argument .argument-source,
#the-leak .continuity-cite,
#lineage .lineage-caption{
  font-variant-numeric:oldstyle-nums;
}

/* The thin visual chapter spine supplements, rather than hides, the browser
   scrollbar. Everything is nonblocking, including close-to-edge controls. */
.rcn-spine{
  --rcn-progress:0;
  pointer-events:none;
  position:fixed;
  top:24vh;
  right:clamp(9px,1.6vw,26px);
  height:52vh;
  width:24px;
  z-index:23;
  color:var(--rcn-brass);
  opacity:.85;
}
.rcn-spine-track,
.rcn-spine-fill{
  position:absolute;
  right:0;
  top:0;
  height:100%;
  width:1px;
}
.rcn-spine-track{
  background:linear-gradient(180deg,rgba(197,160,89,.12),rgba(197,160,89,.40),rgba(197,160,89,.14));
}
.rcn-spine-fill{
  display:block;
  background:linear-gradient(180deg,#f2d9a2,#c5a059 68%,#f9e0ab);
  box-shadow:0 0 10px rgba(197,160,89,.72),0 0 19px rgba(197,160,89,.19);
  transform-origin:center top;
  transform:scaleY(var(--rcn-progress));
  transition:transform .15s linear;
}
.rcn-spine-tick{
  position:absolute;
  right:8px;
  transform:translateY(-50%);
  font:600 10px/1 "Cormorant Garamond",Georgia,serif;
  letter-spacing:.06em;
  text-shadow:0 1px 6px rgba(0,0,0,.72);
  color:#e9d1a4;
}
.rcn-spine-tick::after{
  content:"";
  position:absolute;
  right:-9px;
  top:50%;
  width:4px;
  border-top:1px solid #d2b16e;
}

/* Tactile instrument controls; no :after overrides on existing arrows,
   FAQ disclosure markers, purchase-modal elements, or form affordances. */
main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,.rcd .rcd-tab,#shareRoyalAI){
  transition:
    transform .64s var(--rcn-ease),
    box-shadow .7s var(--rcn-ease),
    border-color .7s var(--rcn-ease),
    filter .7s var(--rcn-ease);
}
main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,.rcd .rcd-tab,#shareRoyalAI):hover:not(:disabled){
  filter:brightness(1.07);
  box-shadow:0 9px 27px rgba(0,0,0,.22),inset 0 0 12px rgba(14,9,10,.24),0 0 0 1px rgba(197,160,89,.26);
  transform:translateY(-1px);
}
main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,.rcd .rcd-tab,#shareRoyalAI):active:not(:disabled){
  transform:translateY(1px);
  transition-duration:.15s;
}
/* Light sheen isolated to genuine buttons that have no authored ::after icon. */
main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,#shareRoyalAI){
  position:relative;
  overflow:hidden;
}
main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,#shareRoyalAI)::after{
  content:"";
  position:absolute;
  inset:-20% auto -20% -70%;
  width:38%;
  pointer-events:none;
  background:linear-gradient(105deg,transparent,rgba(245,231,207,.24),transparent);
  transform:skewX(-22deg) translateX(0);
  opacity:0;
  transition:transform .75s var(--rcn-ease),opacity .75s var(--rcn-ease);
}
main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,#shareRoyalAI):hover:not(:disabled)::after{
  transform:skewX(-22deg) translateX(550%);
  opacity:.7;
}
/* Make native focus indicators stronger than the ambient sheen. */
main :is(button,a,summary,select,textarea,input):focus-visible{
  outline:3px solid #e7c58b;
  outline-offset:3px;
}

/* Subtle fixed vellum grain: only a presentation layer, never an overlay
   that steals taps or touches checkout iframes. */
.rcn-grain{
  position:fixed;
  inset:0;
  pointer-events:none;
  user-select:none;
  z-index:8;
  opacity:.032;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23grain)' opacity='.75'/%3E%3C/svg%3E");
}
@keyframes rcn-candle{
  from{opacity:.66}
  to{opacity:.97}
}
@media (prefers-reduced-motion:no-preference){
  main > section.rcn-scene.rcn-active:not(.hero)::after{
    animation:rcn-candle 16s ease-in-out infinite alternate;
  }
}
/* Preserve all white-on-vellum manuscript reader contrasts established in the
   previous deploy: these selectors explicitly exclude #experience text. */
@media(max-width:980px){
  main > section.rcn-scene:is(#the-turn,#the-leak,#read-the-argument,#lineage,#edition3,#the-work,#what-opens,#families,#receive,#questions,#acquire){
    padding-block:clamp(76px,10vw,112px);
  }
  .rcn-spine{right:5px;opacity:.58;width:12px}
  .rcn-spine-tick{display:none}
}
@media(max-width:600px){
  .rcn-spine{top:18vh;height:64vh;right:3px;opacity:.5;width:4px}
  .rcn-grain{opacity:.022}
  main > section.rcn-scene:not(.hero)::after{opacity:.07}
  #read-the-argument .essay-fast > p:first-child::first-letter,
  #lineage .lineage-hero > p:first-of-type::first-letter,
  #edition3 .ed3-lead::first-letter,
  #what-opens .vision-intro::first-letter,
  #acquire .final-copy > p:first-of-type::first-letter{
    font-size:3.05em;
  }
}
@media(prefers-reduced-motion:reduce){
  .rcn-enhanced main > section.rcn-scene > .wrap :is(h2,.eyebrow),
  main > section.rcn-scene:not(.hero)::after,
  .rcn-spine-fill,
  main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,.rcd .rcd-tab,#shareRoyalAI),
  main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,#shareRoyalAI)::after{
    animation:none!important;
    transition:none!important;
    transform:none!important;
  }
  .rcn-spine-fill{transform:scaleY(var(--rcn-progress))!important}
  main :is(.btn,.turn-choice,.passage-step,.rcd .rcd-tool,.rcd .rcd-play,#shareRoyalAI)::after{display:none}
  .rcn-enhanced main > section.rcn-scene > .wrap :is(h2,.eyebrow){opacity:1!important}
}
@media(forced-colors:active){
  .rcn-grain,.rcn-spine,main > section.rcn-scene:not(.hero)::after{display:none}
  #read-the-argument .essay-fast > p:first-child::first-letter,
  #lineage .lineage-hero > p:first-of-type::first-letter,
  #edition3 .ed3-lead::first-letter,
  #what-opens .vision-intro::first-letter,
  #acquire .final-copy > p:first-of-type::first-letter{color:CanvasText}
}


/* Sharp editorial headlines with restrained technical marginal labels. */
#read-the-argument h2,
#lineage .lineage-hero h2,
#edition3 h2,
#what-opens h2,
#acquire .final-copy h2 {
  font-family:"Cormorant Garamond",Georgia,serif;
  font-weight:600;
  font-size:clamp(43px,5.4vw,76px);
  line-height:1.04;
  letter-spacing:-.03em;
}
#read-the-argument .argument-folio,
#edition3 .eyebrow,
#lineage .lineage-hero .small-cap,
#what-opens .vision-kicker,
#acquire .eyebrow {
  font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Consolas,monospace;
  font-size:clamp(9px,.78vw,11px);
  letter-spacing:.085em;
}
@media(max-width:620px){
  #read-the-argument h2,
  #lineage .lineage-hero h2,
  #edition3 h2,
  #what-opens h2,
  #acquire .final-copy h2 {
    font-size:clamp(40px,9vw,54px);
  }
}
