/* Site styles: satellite (climate) mode by default, Souls mode under body.souls. */
:root {
  --bg: #050b16; --ink: #eaf4ff; --muted: #9db4cc; --panel: rgba(5, 13, 26, .74);
  --line: rgba(120, 190, 255, .22); --accent: #ffb547; --cool: #4fd1ff;
  --display: "Space Grotesk", system-ui, sans-serif; --body: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
body.souls {
  --bg: #0a0806; --ink: #ddd0b6; --muted: #9c8b6c; --panel: rgba(18, 13, 8, .84);
  --line: rgba(200, 162, 90, .28); --accent: #e0b25e; --cool: #e0b25e;
  --display: "Cinzel", serif; --body: "EB Garamond", serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6; overflow-x: hidden; transition: background .6s; }
a { color: var(--cool); text-decoration: none; }
a:hover { text-decoration: underline; }
#sst, #embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

/* Which elements belong to which mode */
#embers, .fog, .soapstone, .stats, .boss, .souls-only { display: none; }
body.souls #sst, body.souls .hud, body.souls .popup, body.souls .climate-only { display: none; }
body.souls #embers, body.souls .fog, body.souls .stats, body.souls .boss, body.souls .souls-only { display: block; }
body.souls .soapstone { display: grid; }

.fog { position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(40% 30% at 30% 70%, rgba(120, 100, 80, .25), transparent 70%),
              radial-gradient(35% 25% at 75% 40%, rgba(90, 80, 70, .22), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate(6%, -4%) scale(1.1); } }

/* HUD */
.hud { position: fixed; z-index: 5; font-family: var(--mono); font-size: 12px; color: #bfe6ff; letter-spacing: .04em; text-shadow: 0 0 8px rgba(0, 0, 0, .8); }
.hud.tr { top: 16px; right: 18px; text-align: right; pointer-events: none; }
.hud.bl { bottom: 14px; left: 18px; pointer-events: none; }
.hud.br { bottom: 14px; right: 18px; text-align: right; pointer-events: none; }
.hud b { color: var(--accent); font-weight: 600; }
.hud.tr, .hud.bl, .hud.br { background: rgba(3, 10, 22, .72); padding: 3px 8px; border-radius: 6px; }
.layers { top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; background: rgba(3, 10, 22, .7); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(8px); }
.layercap { top: 58px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #cfe6ff; white-space: nowrap; pointer-events: none; }
.layers button { white-space: nowrap; position: relative; overflow: hidden; font: inherit; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #9fc3e0; background: none; border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.layers button.on { color: #04121f; background: var(--cool); }
.layers button .prog { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--accent); }
.scope { bottom: 40px; left: 18px; width: 200px; padding: 10px 12px; background: rgba(3, 10, 22, .78); border: 1px solid var(--line); border-radius: 10px; pointer-events: none; }
.scope canvas { display: block; width: 176px; height: 96px; }
.scope div { margin-top: 6px; font-size: 11px; color: #cfe6ff; }
.switch { position: fixed; top: 14px; left: 16px; z-index: 20; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; backdrop-filter: blur(8px); }
.switch:hover { border-color: var(--accent); }
body.souls .switch { font-family: "Cinzel", serif; text-transform: none; letter-spacing: .08em; }

/* Layer popups over the field */
.popup { position: fixed; z-index: 2; pointer-events: none; animation: pop-in .5s ease-out, pop-out .6s ease-in 3.4s forwards; }
.popup .tag { position: absolute; left: calc(var(--d) - 8px); top: -6px; white-space: nowrap; font-family: var(--mono); font-size: 11px; color: #04121f; background: var(--c); padding: 2px 7px; border-radius: 3px; }
.popup.flip .tag { left: auto; right: calc(var(--d) - 8px); }
.popup .ring { width: var(--d); height: var(--d); border: 1.5px dashed var(--c); border-radius: 50%; animation: spin 9s linear infinite; box-shadow: 0 0 18px -4px var(--c); }
.popup .cell { width: var(--d); height: var(--d); border: 1.5px solid var(--c); box-shadow: 0 0 18px -4px var(--c);
  background-image: linear-gradient(var(--c) 1px, transparent 1px), linear-gradient(90deg, var(--c) 1px, transparent 1px);
  background-size: 100% 100%; animation: refine 1.6s steps(3) .4s forwards; }
@keyframes refine { to { background-size: 25% 25%; } }
.popup .dot { width: var(--d); height: var(--d); border-radius: 50%; border: 2px solid var(--c); display: grid; place-items: center; color: var(--c); font: 600 11px var(--mono); }
@keyframes pop-in { from { opacity: 0; transform: scale(1.6); } }
@keyframes pop-out { to { opacity: 0; transform: scale(.85); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
main { position: relative; z-index: 3; max-width: 1080px; margin: 0 auto; padding: 0 20px 140px; }
.hero { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 90px 0 40px; position: relative; }
.hero::before { content: ""; position: absolute; inset: 8% -10%; z-index: -1; pointer-events: none;
  background: radial-gradient(50% 45% at 50% 55%, rgba(3, 8, 18, .72), rgba(3, 8, 18, .35) 60%, transparent 80%); }
body.souls .hero::before { background: radial-gradient(50% 45% at 50% 55%, rgba(0, 0, 0, .6), transparent 75%); }
.portrait { width: 132px; height: 132px; border-radius: 50%; border: 2px solid var(--line); object-fit: cover; box-shadow: 0 0 40px -10px var(--cool); }
body.souls .portrait { border-radius: 4px; filter: grayscale(1) sepia(.5) contrast(1.15); box-shadow: 0 0 50px -12px #e07a2e; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(44px, 9vw, 108px); line-height: .95; letter-spacing: -.03em; margin: 22px 0 10px; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
body.souls h1 { font-weight: 600; letter-spacing: .04em; color: #efe0c0; text-shadow: 0 0 30px rgba(224, 122, 46, .35); }
.tagline { font-size: clamp(16px, 2.2vw, 21px); color: var(--muted); margin: 0 auto 22px; max-width: 760px; text-shadow: 0 1px 12px rgba(0, 0, 0, .9); }
.tagline b { color: var(--ink); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 24px; }
.chip { font-family: var(--mono); font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; backdrop-filter: blur(8px); }
.chip.on { border-color: var(--accent); color: var(--accent); }
body.souls .chip { font-family: "Cinzel", serif; border-radius: 2px; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); backdrop-filter: blur(8px); }
.btn.primary { background: var(--accent); color: #1a1000; border-color: var(--accent); font-weight: 600; }
body.souls .btn { font-family: "Cinzel", serif; border-radius: 2px; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.stats { margin: 26px auto 0; max-width: 560px; text-align: left; background: var(--panel); border: 1px solid var(--line); padding: 14px 18px; }
.stats h4 { font-family: "Cinzel", serif; font-weight: 400; letter-spacing: .14em; font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.stats .row { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(200, 162, 90, .15); padding: 3px 0; font-size: 16px; }
.stats .row span:last-child { color: #efe0c0; }
.stats .build { margin: 10px 0 0; font-style: italic; color: var(--accent); font-size: 15px; }

section { margin: 0 0 90px; position: relative; scroll-margin-top: 120px; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
body.souls .kicker { font-family: "Cinzel", serif; letter-spacing: .2em; }
h2 { font-family: var(--display); font-size: clamp(30px, 5vw, 52px); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 22px; }
body.souls h2 { letter-spacing: .03em; color: #efe0c0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; backdrop-filter: blur(10px); }
body.souls .panel { border-radius: 2px; }

.intro p:first-child { margin-top: 0; } .intro p:last-child { margin-bottom: 0; }
.papers { display: grid; gap: 10px; }
.paper { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 18px; align-items: start; padding: 16px 22px; }
.cites { font-family: var(--mono); text-align: center; }
.cites b { display: block; font-size: 26px; color: var(--accent); line-height: 1; }
.cites small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
body.souls .cites b { font-family: "Cinzel", serif; }
.paper h3 { font-family: var(--display); font-size: 18px; line-height: 1.25; margin: 0 0 4px; }
.paper h3 a { color: var(--ink); }
.meta { font-size: 14px; color: var(--muted); }

.outreach { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.outreach h3 { font-family: var(--display); font-size: 19px; margin: 0 0 6px; }
.outreach p { margin: 0; color: var(--muted); font-size: 15px; }

.stripes { display: flex; height: 120px; border-radius: 10px; overflow: hidden; box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .8); }
.stripes span { flex: 1; }
body.souls .stripes { border-radius: 0; filter: saturate(.8) sepia(.2); }
.stripes-caption { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 8px; text-shadow: 0 1px 6px #000; }

footer { text-align: center; color: var(--muted); font-size: 14px; }
footer .site-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 0 0 12px; font-family: var(--mono); font-size: 13px; }
body.souls footer .site-nav { font-family: "Cinzel", serif; }
footer .site-nav a { color: var(--ink); }
footer .site-nav a[aria-current] { color: var(--accent); }
footer p { display: inline-block; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; backdrop-filter: blur(8px); }

/* Subpages (About, Publications, Outreach, News, 404) */
/* Reading pages: calmer background, no popups */
body.layout-page #sst { opacity: .35; }
body.layout-page .popup { display: none; }
.back, .lead { text-shadow: 0 1px 10px rgba(0, 0, 0, .9); }
.more { margin: 14px 0 0; font-size: 15px; }
.page { padding: 150px 0 60px; }
.back { font-family: var(--mono); font-size: 13px; }
body.souls .back { font-family: "Cinzel", serif; }
.page-title { font-size: clamp(36px, 6vw, 64px); margin: 12px 0 26px; }
.lead { font-size: 19px; color: var(--muted); margin: 0 0 22px; }
.prose { font-size: 17px; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h3 { font-family: var(--display); font-size: 22px; line-height: 1.25; margin: 1.6em 0 .5em; }
body.souls .prose h3 { color: #efe0c0; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--accent); }
.prose .message { margin: 0 0 1.4em; padding: 12px 16px; border-left: 3px solid var(--accent); background: rgba(255, 255, 255, .04); }
.paper .links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; }
.paper .links span { color: var(--muted); overflow-wrap: anywhere; }
.updated { margin-top: 14px; font-size: 13px; }

/* Souls: soapstone messages, toasts, boss bar, banners */
.soapstone { position: absolute; z-index: 4; width: 34px; height: 34px; place-items: center; border-radius: 50%; cursor: pointer; border: 0;
  background: radial-gradient(circle, rgba(255, 150, 60, .95) 0 18%, rgba(255, 120, 40, .35) 40%, transparent 70%); animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { transform: scale(1.25); filter: brightness(1.4); } }
.note-pop { position: fixed; z-index: 40; width: 250px; background: rgba(12, 9, 6, .96); border: 1px solid #6b5432; padding: 14px 16px; font-size: 17px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .7); animation: lift .25s ease-out; }
.note-pop small { display: block; font-family: "Cinzel", serif; font-size: 11px; letter-spacing: .14em; color: var(--muted); margin-bottom: 6px; }
.note-pop .rate { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.note-pop button { font-family: "Cinzel", serif; font-size: 12px; background: none; color: var(--accent); border: 1px solid #6b5432; padding: 4px 10px; cursor: pointer; }
@keyframes lift { from { opacity: 0; transform: translateY(6px) scale(.96); } }
.toast { position: fixed; left: 50%; bottom: 86px; z-index: 30; transform: translateX(-50%); min-width: 300px; text-align: center; background: rgba(10, 8, 5, .94);
  border-top: 1px solid #6b5432; border-bottom: 1px solid #6b5432; padding: 10px 26px; animation: toast 3.2s ease forwards; pointer-events: none; }
.toast small { display: block; font-family: "Cinzel", serif; font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.toast b { font-family: "Cinzel", serif; font-weight: 600; color: #f0dcae; font-size: 18px; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.boss { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 34px max(4vw, calc((100vw - 720px) / 2)) 16px;
  background: linear-gradient(transparent, rgba(5, 3, 2, .94) 32%); pointer-events: none; }
.boss .name { font-family: "Cinzel", serif; font-size: 15px; color: #efe0c0; margin-bottom: 4px; }
.boss .bar { height: 10px; background: rgba(0, 0, 0, .7); border: 1px solid #5c4a2e; }
.boss .fill { height: 100%; width: 0; background: linear-gradient(90deg, #7a1010, #c0241a); transition: width 2.5s ease-out; }
.boss .hp { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; margin-top: 3px; }
.banner { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; pointer-events: none; animation: banner 2.6s ease forwards; }
.banner div { width: 100%; text-align: center; padding: 34px 0; font-size: clamp(30px, 6vw, 66px); }
.banner.souls div { background: linear-gradient(transparent, rgba(0, 0, 0, .85) 25%, rgba(0, 0, 0, .85) 75%, transparent); font-family: "Cinzel", serif; color: #f2cf7e; letter-spacing: .12em; text-shadow: 0 0 30px rgba(240, 140, 50, .6); }
.banner.climate div { background: linear-gradient(transparent, rgba(2, 10, 22, .85) 25%, rgba(2, 10, 22, .85) 75%, transparent); font-family: var(--mono); color: #7fe3ff; letter-spacing: .3em; font-size: clamp(20px, 3.4vw, 36px); text-shadow: 3px 0 #ff3d6e, -3px 0 #3dfff0; }
@keyframes banner { 0% { opacity: 0; } 20%, 70% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 1180px), (max-height: 860px) {
  .scope { display: none; }
  .hud.tr { top: auto; bottom: 34px; }
}
@media (max-width: 1000px) {
  .layers { top: 56px; }
  .layercap { top: 98px; }
}
@media (max-width: 760px) {
  .layers { top: 56px; } .layers button { padding: 5px 8px; font-size: 10px; }
  .layercap { top: 96px; }
  .hud.tr, .hud.bl, .popup .tag { display: none; }
  .paper { grid-template-columns: 1fr; gap: 6px; }
  .cites { text-align: left; } .cites b { display: inline; font-size: 22px; margin-right: 6px; }
}
