/* Legends & Lore: champion hall (grid) and long-form profiles. Follows the Scholar reading-room look. */
.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 20px; margin-top: 28px; }
body.roman-menu .legend-card { position: relative; overflow: hidden; display: grid; grid-template-rows: auto 1fr; padding: 0; border: 1px solid var(--ec-line-2); border-radius: 20px; background: linear-gradient(180deg, rgb(48 14 10 / .9), rgb(26 7 5 / .95)); color: var(--ec-text); text-align: left; cursor: pointer; box-shadow: var(--ec-shadow-1); transition: transform var(--ec-med) var(--ec-ease), border-color var(--ec-fast), box-shadow var(--ec-med); }
body.roman-menu .legend-card:hover, body.roman-menu .legend-card:focus-visible { transform: translateY(-5px); border-color: var(--ec-gold-hi); box-shadow: 0 28px 60px -22px rgb(0 0 0 / .9), 0 0 0 1px rgb(246 220 156 / .35); }
.legend-portrait { display: block; background-color: #1d0907; background-size: cover; background-position: center top; background-repeat: no-repeat; }
.legend-card .legend-portrait { aspect-ratio: 3 / 4; border-bottom: 1px solid var(--ec-line-2); transition: transform 700ms var(--ec-ease); }
.legend-card:hover .legend-portrait { transform: scale(1.03); }
.legend-card { isolation: isolate; }
.legend-meta { display: grid; align-content: start; gap: 4px; padding: 14px 16px 18px; background: inherit; position: relative; z-index: 1; }
.legend-meta small { color: var(--ec-gold); font: 700 10.5px var(--ec-font-ui); letter-spacing: .16em; text-transform: uppercase; }
.legend-meta strong { font: 600 clamp(22px, 2vw, 27px)/1.1 var(--ec-font-display); color: var(--ec-text); }
.legend-meta em { color: var(--ec-text-2); font: italic 500 16px/1.3 var(--ec-font-display); }
.legend-meta i { margin-top: 4px; color: var(--ec-text-3); font: 600 11px var(--ec-font-ui); font-style: normal; letter-spacing: .12em; text-transform: uppercase; }

.legend-read { padding-bottom: 40px; }
.legend-step { display: flex; gap: 8px; }
.legend-step button { width: 38px; height: 38px; padding: 0; border: 1px solid var(--ec-line-2); border-radius: 50%; background: rgb(14 4 3 / .6); color: var(--ec-gold-hi); font: 600 24px/1 var(--ec-font-display); cursor: pointer; }
.legend-step button:hover { border-color: var(--ec-gold-hi); }
.legend-head { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: clamp(20px, 4vw, 44px); align-items: center; margin: 30px 0 22px; }
.legend-photo { aspect-ratio: 3 / 4; border: 2px solid var(--ec-gold); border-radius: 18px; box-shadow: 0 24px 60px -20px rgb(0 0 0 / .9), 0 0 0 6px rgb(246 220 156 / .08); }
body.roman-menu .legend-head h1 { margin: 10px 0 12px; font-size: clamp(40px, 5.6vw, 72px); }
.legend-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 auto 28px; max-width: 1080px; }
.legend-toc a { padding: 7px 14px; border: 1px solid var(--ec-line-2); border-radius: var(--ec-r-pill); background: rgb(14 4 3 / .45); color: var(--ec-text-2); font: 600 12px var(--ec-font-ui); letter-spacing: .06em; text-decoration: none; }
.legend-toc a:hover { color: var(--ec-gold-hi); border-color: var(--ec-gold-hi); }
.legend-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(20px, 3vw, 36px); align-items: start; max-width: 1080px; margin: 0 auto; }
.legend-body { padding: clamp(22px, 4vw, 52px); border-radius: 20px; background: linear-gradient(180deg, #f6ead2, #ecdbb9); color: #3b2515; box-shadow: 0 30px 70px -28px rgb(0 0 0 / .85), inset 0 0 0 1px rgb(143 101 38 / .35), inset 0 0 80px rgb(143 101 38 / .16); }
.legend-body section { scroll-margin-top: 140px; }
.legend-body section + section { margin-top: 1.6em; }
.legend-body h2, body.roman-menu main .legend-body h2 { margin: 0 0 .5em; padding-bottom: .3em; border-bottom: 1px solid rgb(143 101 38 / .4); color: #6a1f2a; font: 700 clamp(26px, 2.6vw, 34px)/1.15 var(--ec-font-display); }
.legend-body p { margin: 0 0 1.1em; color: #3b2515; font: 500 clamp(19px, 1.7vw, 21px)/1.7 var(--ec-font-display); text-wrap: pretty; hyphens: auto; }
.legend-body section:first-child p:first-of-type::first-letter { float: left; margin: 6px 10px 0 0; font: 700 74px/.78 var(--ec-font-display); color: #8a2a2f; }
.legend-facts { position: sticky; top: 140px; padding: 22px 22px 18px; border: 1px solid rgb(246 220 156 / .5); border-radius: 20px; background: radial-gradient(110% 80% at 50% 0%, rgb(217 171 82 / .2), transparent 70%), rgb(30 8 6 / .88); box-shadow: var(--ec-shadow-1);
  /* Its own scroll box: hover it to read the facts, then the page carries on (game.js forwards the wheel). */
  max-height: calc(100vh - 160px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgb(217 171 82 / .5) transparent; }
.legend-facts h2 { margin: 0; color: var(--ec-gold-hi); font: 700 clamp(26px, 2.4vw, 32px)/1.1 var(--ec-font-display); }
.legend-facts-sub { margin: 4px 0 14px; color: var(--ec-text-3); font: 600 11px var(--ec-font-ui); letter-spacing: .14em; text-transform: uppercase; }
.legend-facts ol { margin: 0; padding: 0; list-style: none; counter-reset: fact; display: grid; gap: 11px; }
.legend-facts > ol > li { counter-increment: fact; position: relative; padding-left: 34px; color: var(--ec-text); font: 500 16.5px/1.45 var(--ec-font-display); }
.legend-facts > ol > li::before { content: counter(fact); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border: 1px solid var(--ec-gold); border-radius: 50%; color: var(--ec-gold-hi); font: 700 12px/22px var(--ec-font-ui); text-align: center; }
.legend-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 1080px; margin: 36px auto 0; }
body.roman-menu .legend-pager-btn { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--ec-line-2); border-radius: 18px; background: linear-gradient(180deg, rgb(48 14 10 / .9), rgb(26 7 5 / .95)); color: var(--ec-text); cursor: pointer; text-align: left; transition: border-color var(--ec-fast), transform var(--ec-med) var(--ec-ease); }
body.roman-menu .legend-pager-btn:hover { border-color: var(--ec-gold-hi); transform: translateY(-3px); }
.legend-pager-btn:last-child { justify-content: space-between; text-align: right; }
.legend-pager-btn small { display: block; color: var(--ec-gold); font: 700 10.5px var(--ec-font-ui); letter-spacing: .16em; text-transform: uppercase; }
.legend-pager-btn strong { font: 600 clamp(20px, 2vw, 26px)/1.15 var(--ec-font-display); }
.legend-thumb { flex: none; width: 54px; height: 72px; border: 1px solid var(--ec-gold); border-radius: 10px; }
/* Reading progress rail, fixed on the left side of the screen. */
.legend-progress { position: fixed; left: clamp(8px, 1.6vw, 22px); top: 50%; z-index: 20; width: 4px; height: min(52vh, 420px); transform: translateY(-50%); border-radius: 4px; background: rgb(255 236 214 / .12); overflow: hidden; pointer-events: none; }
.legend-progress i { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(180deg, var(--ec-gold-lo), var(--ec-gold-hi)); transform-origin: top; transform: scaleY(var(--p, 0)); box-shadow: 0 0 10px rgb(246 220 156 / .7); }

@media (max-width: 900px) {
  .legend-layout { grid-template-columns: 1fr; }
  .legend-facts { position: static; order: -1; max-height: none; overflow: visible; }
}
@media (max-width: 760px) {
  .legend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .legend-meta { padding: 10px 12px 14px; }
  .legend-meta strong { font-size: 20px; }
  .legend-meta em { font-size: 14px; }
  .legend-head { grid-template-columns: 110px 1fr; gap: 16px; margin: 20px 0 16px; }
  .legend-photo { border-radius: 12px; }
  body.roman-menu .legend-head h1 { font-size: clamp(30px, 9vw, 40px); }
  .legend-head .read-tagline { font-size: 17px; }
  .legend-body { padding: 22px 18px; border-radius: 16px; }
  .legend-body section { scroll-margin-top: 120px; }
  .legend-pager { grid-template-columns: 1fr; }
  .legend-pager-btn:last-child { flex-direction: row-reverse; justify-content: flex-end; text-align: left; }
  .legend-toc { flex-wrap: nowrap; overflow-x: auto; margin-inline: -4px; padding: 0 4px 6px; scrollbar-width: none; }
  .legend-toc a { flex: none; }
}
@media (max-width: 380px) { .legend-head { grid-template-columns: 1fr; } .legend-photo { max-width: 140px; } }

/* Learn dropdown icon (open book) */
#legends-open { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6dc9c' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 6c-2-1.5-5-2-8-1.5v13c3-.5 6 0 8 1.5 2-1.5 5-2 8-1.5v-13C17 4 14 4.5 12 6zM12 6v13'/%3E%3C/svg%3E"); }
