/* SCALELIST UNIVERSE — site v2 (2026-10-23, YWAPOS). One stylesheet for the whole site. */
:root {
  --bg: #090b10;
  --bg2: #0e121a;
  --card: #131824;
  --card2: #181e2c;
  --line: #232b3b;
  --line2: #2e384c;
  --text: #ece6d8;
  --muted: #a3abbb;
  --faint: #6f7889;
  --gold: #e2b04a;
  --gold2: #f5d98e;
  --cork: #b98a4a;
  --greed: #19a974; --wrath: #c1121f; --lust: #e8b923; --sloth: #7b4fd6;
  --pride: #c0c7d0; --envy: #e48aa6; --gluttony: #e0a030; --none: #b98a4a;
  --accent: var(--gold);
  --radius: 14px;
  --maxw: 1180px;
  --read: 760px;
  --display: "Cinzel", "Georgia", serif;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Literata", "Georgia", serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--ui);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(226,176,74,.07), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(123,79,214,.06), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--gold2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: #000; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(9,11,16,.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(46,56,76,.6);
}
.site-head .wrap { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--display); letter-spacing: .14em; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .ring { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gold); position: relative; box-shadow: 0 0 14px rgba(226,176,74,.35); }
.brand .ring::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--gold); animation: beat 2.4s infinite; }
@keyframes beat { 0%, 100% { transform: scale(.55); opacity: .75; } 10% { transform: scale(.9); opacity: 1; } 20% { transform: scale(.62); } 30% { transform: scale(.85); opacity: 1; } 45% { transform: scale(.55); opacity: .75; } }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-size: 15px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: rgba(255,255,255,.05); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--gold2); }
.search-btn { background: var(--card); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 7px 12px; font: 14px var(--ui); cursor: pointer; display: flex; gap: 8px; align-items: center; }
.search-btn kbd { font: 11px var(--ui); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 5px; color: var(--faint); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 7px 10px; cursor: pointer; }
@media (max-width: 760px) {
  .menu-btn { display: block; margin-left: auto; }
  .nav { display: none; position: absolute; top: 62px; left: 0; right: 0; background: var(--bg2); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 10px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; }
  .search-btn kbd { display: none; }
}

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 80px; padding: 34px 0 44px; color: var(--faint); font-size: 14px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }
.site-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-foot a { color: var(--muted); }
.sigil { font-size: 22px; color: var(--gold); }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .02em; line-height: 1.2; }
h1 { font-size: clamp(30px, 5vw, 52px); margin: 0 0 12px; }
h2 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 14px; }
h3 { font-size: 19px; margin: 22px 0 10px; }
.eyebrow { font: 600 12px var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.lede { font-size: 18px; color: var(--muted); max-width: 680px; }
.muted { color: var(--muted); }
.gold { color: var(--gold2); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px; font: 600 15px var(--ui); border: 1px solid var(--line2); color: var(--text); background: var(--card); transition: transform .15s, border-color .15s, background .15s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--gold); }
.btn.primary { background: linear-gradient(135deg, #f0c45c, #c8902e); color: #1a1205; border: 0; box-shadow: 0 8px 30px rgba(226,176,74,.25); }
.btn.primary:hover { box-shadow: 0 10px 36px rgba(226,176,74,.38); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 90px 0 70px; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 720px; height: 720px; border-radius: 50%;
  background: radial-gradient(circle, rgba(226,176,74,.16), transparent 62%); animation: glow 7s ease-in-out infinite; pointer-events: none; }
@keyframes glow { 50% { transform: scale(1.08); opacity: .8; } }
.hero h1 { font-size: clamp(38px, 7vw, 84px); letter-spacing: .06em;
  background: linear-gradient(180deg, #fff6dd 0%, #f2cf7a 55%, #b88634 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .tag { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 2.4vw, 23px); color: var(--muted); max-width: 640px; }
.rings { position: absolute; right: -120px; top: 40px; width: 560px; height: 560px; pointer-events: none; opacity: .5; }
.rings span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(226,176,74,.35); animation: ripple 6s linear infinite; }
.rings span:nth-child(2) { animation-delay: 2s; } .rings span:nth-child(3) { animation-delay: 4s; }
@keyframes ripple { from { transform: scale(.35); opacity: .9; } to { transform: scale(1.05); opacity: 0; } }
@media (max-width: 760px) { .rings { width: 360px; height: 360px; right: -160px; } .hero { padding: 56px 0 40px; } }

/* ---------- sections & grids ---------- */
.section { padding-top: 46px; padding-bottom: 46px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid.crew6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 980px) { .grid.crew6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .grid.crew6 { grid-template-columns: repeat(2, 1fr); } }
.grid.c6 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; transition: border-color .2s, transform .2s, background .2s; }
a.card { color: var(--text); display: block; }
a.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); background: var(--card2); }
.card h3 { margin-top: 0; }
.card p { color: var(--muted); margin: 6px 0 0; }

/* ---------- character cards ---------- */
.ccard { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--line); color: var(--text); display: block; transition: transform .2s, border-color .2s; --accent: var(--gold); }
.ccard:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); }
.ccard .pic { aspect-ratio: 3/4; background: var(--bg2); position: relative; }
.ccard .pic img { width: 100%; height: 100%; object-fit: cover; }
.ccard .meta { padding: 10px 12px 12px; }
.ccard .name { font-family: var(--display); font-size: 17px; font-weight: 600; }
.ccard .epi { color: var(--muted); font-size: 13px; line-height: 1.35; }
.ccard::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); opacity: .8; }

/* emblem used when there is no portrait yet */
.emblem { width: 100%; height: 100%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%), var(--bg2); }
.emblem .er { width: 58%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center;
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 0 24px color-mix(in srgb, var(--accent) 22%, transparent); }
.emblem .er::before { content: ""; position: absolute; width: 74%; aspect-ratio: 1; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.emblem .ini { font-family: var(--display); font-size: clamp(30px, 5vw, 54px); color: var(--accent); }

/* ---------- filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 24px; }
.chip { border: 1px solid var(--line2); background: var(--card); color: var(--muted); border-radius: 999px; padding: 7px 14px; font: 14px var(--ui); cursor: pointer; }
.chip[aria-pressed="true"] { color: #1a1205; background: var(--gold); border-color: var(--gold); }
.group-title { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; }
.group-title h2 { margin: 0; }
.group-title .muted { font-size: 14px; }

/* ---------- profile ---------- */
.profile-hero { display: grid; grid-template-columns: 340px 1fr; gap: 34px; align-items: start; padding: 40px 0 10px; }
.profile-hero .portrait { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 3/4; box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.profile-hero .portrait img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero h1 { margin-bottom: 4px; }
.profile-hero .epithet { font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--muted); margin-bottom: 18px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 18px 0; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.fact b { display: block; font: 600 11px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
.quote { font-family: var(--serif); font-style: italic; font-size: 19px; border-left: 3px solid var(--accent); padding: 6px 0 6px 16px; color: var(--text); margin: 16px 0; }
.plate { font: 600 12.5px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; background: #0d1018; border: 1px solid var(--line2); border-radius: 6px; padding: 2px 7px; color: var(--gold2); white-space: normal; }
.prose { font-family: var(--serif); font-size: 17px; line-height: 1.7; }
.prose ul { padding-left: 1.2em; } .prose li { margin: 6px 0; }
.prose { overflow-wrap: anywhere; }
.prose table { display: block; overflow-x: auto; max-width: 100%; width: 100%; border-collapse: collapse; font: 14.5px/1.5 var(--ui); margin: 14px 0; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
.prose th { color: var(--faint); font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.prose blockquote { margin: 12px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--line2); color: var(--muted); }
.psec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin: 18px 0; }
.psec > h2 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.psec > h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
details.spoiler { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 22px; margin: 18px 0; }
details.spoiler summary { cursor: pointer; font-family: var(--display); font-size: 19px; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.spoiler summary::-webkit-details-marker { display: none; }
details.spoiler summary::after { content: "Show · spoilers"; font: 13px var(--ui); color: var(--faint); }
details.spoiler[open] summary::after { content: "Hide"; }
@media (max-width: 860px) { .profile-hero { grid-template-columns: 1fr; } .profile-hero .portrait { max-width: 360px; } }

/* ---------- library (read index) ---------- */
.saga { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 22px 0; overflow: hidden; }
.saga > summary { list-style: none; cursor: pointer; padding: 22px 24px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.saga > summary::-webkit-details-marker { display: none; }
.saga .num { font: 600 12px var(--ui); letter-spacing: .22em; color: var(--gold); text-transform: uppercase; }
.saga h2 { margin: 2px 0 0; }
.saga .range { color: var(--faint); font-size: 14px; white-space: nowrap; }
.saga .body { padding: 0 24px 22px; }
.arc { margin: 18px 0 6px; }
.arc h3 { font-family: var(--ui); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.chlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.chlist a { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-size: 15px; border: 1px solid transparent; }
.chlist a:hover { background: var(--card2); border-color: var(--line2); text-decoration: none; }
.chlist .n { color: var(--faint); font-variant-numeric: tabular-nums; min-width: 34px; }
.chlist a.read .n { color: var(--gold); }
.continue { display: none; }
.continue.show { display: inline-flex; }

/* ---------- reader ---------- */
.reader-top { position: sticky; top: 62px; z-index: 40; height: 3px; background: transparent; }
.reader-top .bar { height: 3px; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold2)); }
.chapter-head { max-width: var(--read); margin: 0 auto; padding: 44px 20px 10px; text-align: center; }
.chapter-head .crumbs { color: var(--faint); font-size: 14px; letter-spacing: .06em; }
.chapter-head h1 { margin: 10px 0 6px; }
.chapter-body { max-width: var(--read); margin: 0 auto; padding: 0 20px; }
.page { margin: 34px 0; }
.page > .plabel { display: flex; align-items: center; gap: 12px; color: var(--faint); font: 600 12px var(--ui); letter-spacing: .24em; text-transform: uppercase; margin-bottom: 12px; }
.page > .plabel::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.page.splash { border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); border-radius: var(--radius); padding: 18px 20px 6px; background: linear-gradient(180deg, rgba(226,176,74,.07), transparent 40%); }
.page.splash > .plabel { color: var(--gold); }
.panel { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px; margin: 12px 0; }
.panel .pid { font: 700 11px var(--ui); color: var(--bg); background: var(--faint); border-radius: 6px; padding: 1px 6px; margin-right: 8px; }
.panel .shot { font: 600 12px var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.panel .desc { font-family: var(--serif); font-size: 16.5px; line-height: 1.65; color: #cfc8b9; margin: 6px 0 0; }
.panel .desc strong { color: var(--text); }
.line { display: grid; grid-template-columns: minmax(80px, 140px) 1fr; gap: 12px; margin: 10px 0 2px; align-items: start; }
.line .who { font: 700 12px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gold2); padding-top: 9px; text-align: right; word-break: break-word; }
.line .who small { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); font-size: 12px; }
.balloon { position: relative; background: #f4efe4; color: #16130d; font: 500 16.5px/1.5 var(--ui); padding: 9px 14px; border-radius: 18px; }
.balloon::before { content: ""; position: absolute; left: -7px; top: 13px; border: 7px solid transparent; border-right-color: #f4efe4; border-left: 0; }
.balloon em { font-style: italic; }
.caption-box { background: #f1d98f; color: #1e1606; font: 500 15.5px/1.5 var(--serif); padding: 9px 14px; border-radius: 4px; margin: 10px 0 2px; box-shadow: 3px 3px 0 rgba(0,0,0,.35); }
.sfx { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--gold); letter-spacing: .06em; margin: 10px 0 2px; transform: rotate(-1.5deg); text-shadow: 0 0 18px rgba(226,176,74,.35); }
.note { font-family: var(--serif); font-style: italic; color: var(--muted); margin: 8px 0 0; }
.chapter-end { text-align: center; color: var(--faint); letter-spacing: .3em; font-size: 13px; margin: 40px 0; }
.pager { max-width: var(--read); margin: 30px auto 0; padding: 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.pager a:hover { text-decoration: none; border-color: var(--gold); }
.pager .dir { display: block; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.pager .next { text-align: right; }
.script-note { max-width: var(--read); margin: 18px auto 0; padding: 0 20px; color: var(--faint); font-size: 14px; text-align: center; }
@media (max-width: 600px) {
  .line { grid-template-columns: 1fr; gap: 4px; }
  .line .who { text-align: left; padding-top: 0; }
  .balloon::before { display: none; }
}

/* ---------- world ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 8px; }
.toc a { border: 1px solid var(--line2); border-radius: 999px; padding: 6px 13px; color: var(--muted); font-size: 14px; }
.toc a:hover { color: var(--text); border-color: var(--gold); text-decoration: none; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.swatch { border-radius: 12px; padding: 14px; border: 1px solid var(--line); background: var(--card); }
.swatch i { display: block; width: 100%; height: 34px; border-radius: 8px; margin-bottom: 8px; background: var(--accent); box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 40%, transparent); }
.tree-figure { margin: 10px auto 0; max-width: 520px; }

/* ---------- search ---------- */
.search-dlg { position: fixed; inset: 0; z-index: 200; background: rgba(4,5,8,.72); backdrop-filter: blur(6px); display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.search-dlg.open { display: flex; }
.search-box { width: min(640px, 100%); background: var(--bg2); border: 1px solid var(--line2); border-radius: 16px; box-shadow: 0 30px 90px rgba(0,0,0,.6); overflow: hidden; }
.search-box input { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font: 18px var(--ui); padding: 18px 20px; outline: none; }
.search-res { max-height: 55vh; overflow: auto; padding: 8px; }
.search-res a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.search-res a:hover, .search-res a.sel { background: var(--card2); text-decoration: none; }
.search-res .k { color: var(--faint); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.search-empty { color: var(--faint); padding: 16px 12px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }

/* generated faces (2026-10-24): fade in over the emblem once loaded (see site.js) */
.pic, .portrait { position: relative; }
.genface { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease; }
.genface.on { position: static; opacity: 1; }
