/* Unified archive motion and interaction polish. GSAP owns arrival choreography;
   CSS keeps hover/focus feedback immediate and inexpensive. */
.motion-enhanced body:not(.home-mode) .page-head,
.motion-enhanced body:not(.home-mode) .timeline--panel,
.motion-enhanced body:not(.home-mode) .profile-grid,
.motion-enhanced body:not(.home-mode) .world-list,
.motion-enhanced body:not(.home-mode) .timeline-item,
.motion-enhanced body:not(.home-mode) .profile-card,
.motion-enhanced body:not(.home-mode) .world-list > article{
  animation:none!important;
  opacity:1;
  transform:none;
}

:root{
  --archive-ease:cubic-bezier(.2,.78,.24,1);
  --archive-gold:#d8b875;
  --archive-gold-bright:#f0d698;
  --archive-violet:#332044;
  --archive-panel:rgba(8,13,23,.78);
}

.page-head{width:min(780px,100%);padding-bottom:clamp(34px,5vw,54px)}
.page-head h1{max-width:16ch;margin-bottom:18px;font-size:clamp(46px,6.2vw,72px);line-height:1.01;letter-spacing:-.025em}
.page-head>p:last-child{max-width:60ch;margin-bottom:0;font-size:clamp(16px,1.45vw,19px);line-height:1.62}
.reading-page,.detail-page{font-size:clamp(17px,1.3vw,19px);line-height:1.75}
.story-header h1,.detail-page h1{max-width:13ch;margin-bottom:20px;font-size:clamp(44px,5.2vw,64px);line-height:1.02;letter-spacing:-.025em}
.story-header>p:last-child{max-width:55ch;font-size:clamp(19px,1.8vw,23px);line-height:1.55}
.story-body{max-width:66ch;line-height:1.82}
.detail-page>p:not(.back):not(.eyebrow){max-width:62ch;line-height:1.78}

.detail-page,.reading-page{
  border-color:rgba(224,194,128,.38);
  box-shadow:24px 0 70px rgba(0,0,0,.34),inset 1px 0 rgba(250,226,174,.08);
  will-change:transform,opacity;
}
.scene--palace .detail-page--palace{
  background:linear-gradient(125deg,rgba(7,10,19,.95),rgba(38,20,53,.86) 72%,rgba(20,13,33,.9));
  color:#f6eddf;
  border-color:rgba(222,190,127,.42);
  box-shadow:24px 0 70px rgba(0,0,0,.48),inset 1px 0 rgba(244,216,158,.08);
}
.scene--palace .detail-page--palace h1{color:#fff5e6}
.scene--palace .detail-page--palace>p:not(.back):not(.eyebrow){color:#e8dee9}
.scene--palace .detail-page--palace blockquote{color:#f2e5d8;border-color:var(--archive-gold);font-size:clamp(21px,2vw,26px);line-height:1.48}

.recent-file,.world-atlas__tile,.people-ledger>article,.chronicle-rail__viewport>article,
.timeline-item,.profile-card,.world-list>article,.archive-grid>article,.tag-links>a{
  will-change:transform;
}
.timeline-item{grid-template-columns:39px 168px minmax(0,1fr)}
.timeline-item:not(:last-child)::after{left:18px}
.timeline-date{padding:4px 22px 0 4px;line-height:1.55}
.timeline-entry h2{font-size:clamp(27px,3vw,36px);line-height:1.18}

@media(min-width:701px){
  .timeline-dot{grid-column:1;grid-row:1}
  .timeline-date{grid-column:2;grid-row:1}
  .timeline-entry{grid-column:3;grid-row:1}
}

.timeline-entry{transition:transform .5s var(--archive-ease),background-color .4s ease}
.timeline-dot{transition:transform .45s var(--archive-ease),box-shadow .45s ease,background-color .45s ease}
.profile-card,.archive-grid>article{
  transition:transform .5s var(--archive-ease),border-color .35s ease,box-shadow .5s var(--archive-ease),background-color .35s ease;
}
.profile-card .portrait,.people-ledger .character-portrait{
  transition:transform .58s var(--archive-ease),border-color .38s ease,box-shadow .48s ease;
}
.world-list>article{
  padding-left:0;
  transition:transform .5s var(--archive-ease),background-color .35s ease,border-color .35s ease;
}
.archive-grid>article{position:relative;overflow:hidden}
.archive-grid>article::after{
  content:"";position:absolute;right:18px;bottom:18px;width:28px;border-bottom:1px solid rgba(231,200,132,.45);
  transform:scaleX(.42);transform-origin:right;transition:transform .45s var(--archive-ease),border-color .35s ease;
}
.tag-links>a,.ledger-button,.back a{
  transition:color .3s ease,border-color .3s ease,background-color .3s ease,transform .4s var(--archive-ease),letter-spacing .4s var(--archive-ease);
}
.ledger-button{position:relative}
.ledger-button::after{transition:transform .4s var(--archive-ease)}

@media (hover:hover) and (pointer:fine){
  .recent-file:hover{transform:translateY(-7px);background:linear-gradient(180deg,rgba(214,178,103,.1),rgba(13,18,27,.25));box-shadow:0 18px 38px rgba(0,0,0,.22)}
  .recent-file:hover h2 a{color:#fff5df;text-decoration-color:var(--archive-gold-bright)}
  .world-atlas__tile:hover{box-shadow:inset 0 0 0 1px rgba(239,211,148,.32),0 16px 38px rgba(0,0,0,.18)}
  .people-ledger>article:hover,.profile-card:hover{transform:translateY(-8px) scale(1.012);border-color:rgba(239,211,150,.78);box-shadow:8px 15px 0 rgba(3,4,10,.4),0 24px 42px rgba(0,0,0,.3)}
  .people-ledger>article:hover .character-portrait,.profile-card:hover .portrait{transform:scale(1.025);border-color:rgba(244,218,159,.88);box-shadow:inset 0 0 0 7px rgba(17,12,31,.35),0 14px 28px rgba(0,0,0,.34)}
  .chronicle-rail__viewport>article:hover{transform:translateX(10px);background:linear-gradient(90deg,rgba(215,181,108,.08),transparent 72%)!important}
  .timeline-item:hover .timeline-entry{transform:translateX(9px)}
  .timeline-item:hover .timeline-dot{transform:scale(1.16);background:#c3974d;box-shadow:0 0 0 7px rgba(216,180,111,.17),0 0 24px rgba(241,203,121,.78)}
  .world-list>article:hover{padding-left:0;transform:translateX(12px);background:linear-gradient(90deg,rgba(229,191,116,.12),transparent 76%);border-color:rgba(237,207,143,.48)}
  .profile-card:hover h2 a,.world-list>article:hover h2 a,.timeline-item:hover h2 a{color:#fff3d7;text-decoration-color:var(--archive-gold-bright)}
  .archive-grid>article:hover{transform:translateY(-6px);border-color:rgba(235,205,140,.68);background:rgba(12,30,29,.65);box-shadow:0 18px 34px rgba(0,0,0,.24)}
  .archive-grid>article:hover::after{transform:scaleX(1);border-color:var(--archive-gold-bright)}
  .tag-links>a:hover{transform:translateY(-3px);color:#fff3d8;border-color:rgba(235,205,140,.72);background:rgba(215,180,108,.1)}
  .ledger-button:hover{color:#fff0c7;letter-spacing:.125em}
  .ledger-button:hover::after{transform:translateX(6px)}
  .back a:hover{color:#fff0c7;letter-spacing:.07em}
}

a:focus-visible{outline:1px solid var(--archive-gold-bright);outline-offset:6px}
.profile-card:focus-within,.people-ledger>article:focus-within,.archive-grid>article:focus-within{border-color:rgba(239,211,150,.82)}

@media(max-width:860px){
  .page-head h1{font-size:clamp(40px,10vw,56px);line-height:1.05}
  .story-header h1,.detail-page h1{font-size:clamp(38px,10vw,52px)}
  .reading-page,.detail-page{font-size:17px}
  .scene--palace .profile-card .character-card__role{font-size:12px}
  .scene--palace .profile-card h2{font-size:clamp(23px,6vw,30px)}
}

@media(prefers-reduced-motion:reduce){
  .recent-file,.world-atlas__tile,.people-ledger>article,.chronicle-rail__viewport>article,
  .timeline-entry,.timeline-dot,.profile-card,.portrait,.character-portrait,.world-list>article,
  .archive-grid>article,.tag-links>a,.ledger-button,.back a{transition:none!important;will-change:auto!important}
}
