.chronicle {
  --archive: #e9e6da;
  --archive-ink: #151b18;
  --archive-line: #b9b7a9;
  color: var(--archive-ink);
  background: var(--archive);
  padding-block: clamp(22px, 3vw, 42px) clamp(35px, 5vw, 72px);
  scroll-margin-top: 75px;
}

.chronicle-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-block-end: 22px;
}
.chronicle-heading h1 {
  margin-block: 4px 0;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.07;
  letter-spacing: -.055em;
}
[lang="ar"] .chronicle-heading h1 { letter-spacing: 0 }
.chronicle-intro {
  max-width: 38ch;
  color: #3c463e;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.5;
}
.chronicle-intro a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  color: var(--archive-ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.chronicle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 11px/1.3 var(--mono);
  letter-spacing: .1em;
}
[lang="ar"] .chronicle-label { font-family: var(--type); letter-spacing: 0; font-size: 13px }
.chronicle-label > span { width: 8px; height: 8px; background: #ad432b; transform: rotate(45deg) }

.chronicle-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0,1fr));
  isolation: isolate;
  margin-block-end: 14px;
  border: 1px solid var(--archive-line);
  border-radius: 8px;
  overflow: hidden;
  background: #dedbcf;
}
.chronicle-rail::before {
  position: absolute;
  inset-inline: 0;
  inset-block-start: 35px;
  z-index: -1;
  height: 1px;
  background: #a6aa9d;
  content: '';
}
.chronicle-rail a {
  position: relative;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 7px;
  min-height: 76px;
  padding: 8px 12px 9px;
  color: #39433b;
  font-size: 12px;
  font-weight: 750;
  transition: background .23s, color .23s;
}
.chronicle-rail a + a { border-inline-start: 1px solid #b1b5a7 }
.chronicle-rail a bdi { color: inherit; font: 750 14px/1.2 var(--mono); letter-spacing: -.04em }
.chronicle-rail a:hover { background: #c8cec1; color: var(--archive-ink) }
.chronicle-rail a:focus-visible { outline-offset: -3px }
.rail-node {
  display: block;
  width: 8px;
  height: 8px;
  border: 1px solid #68736a;
  border-radius: 50%;
  background: var(--archive);
}
.chronicle-rail a:is([aria-current], [aria-selected="true"]) {
  background: #1a211c;
  color: #eef1e7;
}
.chronicle-rail a:is([aria-current], [aria-selected="true"]) .rail-node {
  border-color: var(--lime);
  background: var(--lime);
  box-shadow: 0 0 12px #cefa53a0;
}

.chronicle:not([data-enhanced]) .chapter-panel:not([data-current]):not(:target),
.chronicle:not([data-enhanced]):has(.chapter-panel:target) .chapter-panel:not(:target) { display: none }
.chapter-panel {
  --plate: #111b15;
  --chapter-accent: #d0ff68;
  --solid: #1b2b1c;
  position: relative;
  display: grid;
  grid-template-columns: 1.38fr .82fr;
  border: 1px solid #29392e;
  border-radius: 12px;
  overflow: hidden;
  background: #111814;
  color: #f4f2e8;
  box-shadow: 0 14px 32px #172c1a24;
  scroll-margin-top: 105px;
}
.chapter-panel[data-tone="amber"] { --plate: #1f180f; --chapter-accent: #ffd586; --solid: #382a17 }
.chapter-panel[data-tone="aqua"] { --plate: #112023; --chapter-accent: #8aefe4; --solid: #16363b }
.chapter-panel[data-tone="iris"] { --plate: #17172b; --chapter-accent: #c4b8ff; --solid: #2e2851 }
.chapter-panel[data-tone="peach"] { --plate: #231815; --chapter-accent: #ffc3a0; --solid: #3a241f }
.chapter-panel[data-tone="pink"] { --plate: #231522; --chapter-accent: #ffa9e4; --solid: #412443 }
.chapter-figure {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  min-width: 0;
  min-height: 330px;
  background: var(--plate);
  border-inline-end: 1px solid #ffffff23;
}
.figure-label {
  position: absolute;
  inset: 13px 18px auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--chapter-accent);
  font: 600 10px/1 var(--mono);
  letter-spacing: .08em;
}
.figure-label span { flex: 1; height: 1px; background: currentColor; opacity: .35 }
.chapter-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 510px;
  padding: 24px 12px 7px;
  color: var(--chapter-accent);
}
.chapter-svg .ink, .chapter-svg .fine, .chapter-svg .dash, .chapter-svg .solid {
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chapter-svg :is(.ink, .fine, .dash) { fill: none }
.chapter-svg .ink { opacity: .86 }
.chapter-svg .fine { opacity: .21; stroke-width: .85 }
.chapter-svg .dash { opacity: .55; stroke-dasharray: 3 7 }
.chapter-svg .solid { stroke-width: 1.15 }
.chapter-svg .solid:not(.focus-surface) { fill: var(--solid) }
.chapter-svg .frame-corners { opacity: .44 }
.chapter-svg .node, .chapter-svg .dim-node { fill: currentColor }
.chapter-svg .dim-node { opacity: .42 }
.chapter-svg .glow-stop { stop-color: var(--chapter-accent); stop-opacity: .15 }
.chapter-panel:not([hidden]) .drawing { transform-origin: center; animation: draw-in .58s cubic-bezier(.2,.67,.22,1) both }
.chapter-panel:not([hidden]) .drawing .dash { animation: trace-flow 1.65s ease-out both }
@keyframes draw-in { from { opacity: .38; transform: translateY(8px) scale(.975) } }
@keyframes trace-flow { to { stroke-dashoffset: -40 } }

.chapter-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(20px, 3.25vw, 48px);
  gap: 8px;
}
.chapter-index {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px 12px;
  margin-block-end: 18px;
  padding-block-end: 9px;
  border-block-end: 1px solid #ffffff35;
  color: #c1c8bc;
  font-size: 12px;
  font-weight: 700;
}
.chapter-index bdi { color: var(--chapter-accent); font-family: var(--mono) }
.chapter-type { color: var(--chapter-accent); font-size: 13px; font-weight: 800 }
.chapter-text h2 {
  font-size: clamp(30px, 3.8vw, 58px);
  line-height: 1.08;
  letter-spacing: -.055em;
  overflow-wrap: anywhere;
}
[lang="ar"] .chapter-text h2 { letter-spacing: 0 }
.chapter-story {
  max-width: 36ch;
  color: #e5e8db;
  margin-block-start: 8px;
  font-size: clamp(15px, 1.45vw, 18px);
  line-height: 1.65;
}
.chapter-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 39px;
  padding-inline: 11px;
  margin-block-start: 12px;
  background: var(--chapter-accent);
  color: #111814;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 800;
}
[dir="rtl"] [data-chapter-step] .icon { transform: scaleX(-1) }
.chapter-action:hover { filter: brightness(1.12) }

@media (max-width: 800px) {
  .chronicle { scroll-margin-top: 100px }
  .chapter-panel { grid-template-columns: 1.12fr .88fr }
  .chapter-figure { min-height: 275px }
  .chapter-index { margin-block-end: 8px }
}
@media (max-width: 620px) {
  .chronicle-heading { display: grid; gap: 8px; margin-block-end: 13px }
  .chronicle-intro { font-size: 13px }
  .chronicle-rail { grid-template-columns: repeat(12,minmax(0,1fr)); margin-block-end: 8px }
  .chronicle-rail::before { display: none }
  .chronicle-rail a { grid-column: span 3; grid-template-columns: auto 1fr; align-items: center; justify-items: start; gap: 2px 5px; min-height: 52px; padding: 6px 5px; font-size: 10px }
  .chronicle-rail a bdi { font-size: 13px; grid-column: 2 }
  .chronicle-rail a .rail-node { grid-row: 1; grid-column: 1 }
  .chronicle-rail a > span:last-child { grid-column: 2 }
  .chronicle-rail a:nth-child(5) { border-inline-start: 0 }
  .chronicle-rail a:nth-child(n+5) { grid-column: span 4; border-block-start: 1px solid #b1b5a7 }
  .chapter-panel { grid-template-columns: 1fr }
  .chapter-figure { min-height: 0; border-inline-end: 0; border-block-end: 1px solid #ffffff23 }
  .chapter-svg { max-height: 260px; padding: 14px 8px 0 }
  .figure-label { inset: 10px 12px auto; font-size: 8px }
  .chapter-text { padding: 14px; gap: 4px }
  .chapter-index { margin-block-end: 4px; padding-block-end: 5px }
  .chapter-story { margin-block-start: 5px; font-size: 14px }
  .chapter-action { margin-block-start: 6px }
}
@media (prefers-reduced-motion: reduce) {
  .chapter-panel:not([hidden]) .drawing, .chapter-panel:not([hidden]) .drawing .dash { animation: none }
}

.chapter-svg .solid.focus-surface { stroke-width: 1.65; filter: drop-shadow(0 0 10px color-mix(in srgb, currentColor 28%, transparent)) }
.chapter-svg .surface-light { stop-color: #36482b }
.chapter-svg .surface-dark { stop-color: #182319 }
