:root{
  --bg:#0b0c0f;
  --panel:#121318;
  --text:#e6e9ee;
  --muted:#a0a6b0;
  --line:#1b1e25;
  --accent:#a9c9ff;
  --violet:#8fa6ff;
  --glow:#cfd6ff;
  --radius:16px;
  --radius-sm:12px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --sans:system-ui,-apple-system,Segoe UI,Roboto,Inter,Ubuntu,"Helvetica Neue",Arial,sans-serif;
  --serif:"Georgia","Iowan Old Style","Times New Roman",serif;
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;scroll-behavior:smooth}
body{
  font:500 16px/1.7 var(--sans);
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 85% -10%, #1a1f2e 0%, rgba(26,31,46,.12) 60%, transparent 80%),
    var(--bg);
  -webkit-font-smoothing:antialiased;
}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}

.wrap{
  max-width:1100px;
  margin:0 auto;
  padding:24px 24px 48px;
}

/* ===== Header / Brand ===== */
header.site{
  position:sticky;
  top:0;
  z-index:40;
  background:linear-gradient(180deg,rgba(11,12,15,.96),rgba(11,12,15,.8));
  backdrop-filter:saturate(120%) blur(8px);
  border-bottom:1px solid var(--line);
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
}
.brand h1{
  margin:0;
  font-size:18px;
  letter-spacing:.4px;
}
.dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 16px var(--accent);
}
header.site .sub{
  color:var(--muted);
  font-size:12px;
  margin-left:auto;
}

/* ===== Cards / Panels ===== */
.card{
  background:linear-gradient(180deg,#121318,#0f1014);
  border-radius:var(--radius);
  border:1px solid var(--line);
  box-shadow:var(--shadow);
  padding:22px;
}
.card-soft{
  background:radial-gradient(600px 400px at 0% 0%,rgba(169,201,255,.12),transparent 60%),#101219;
  border-radius:var(--radius);
  border:1px solid var(--line);
  padding:22px;
}

h2.title{
  margin:0 0 10px;
  font-size:28px;
}
.muted{color:var(--muted);}

/* ===== Portal Grid ===== */
.portal-hero{
  min-height:40vh;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-end;
  gap:14px;
  padding:40px 0 24px;
}
.portal-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(230px,1fr));
  gap:18px;
  margin-top:16px;
}
.portal-card{
  position:relative;
  border-radius:var(--radius-sm);
  border:1px solid var(--line);
  padding:18px 18px 20px;
  background:radial-gradient(420px 260px at 10% -20%,rgba(169,201,255,.09),transparent 65%),#0f1117;
  box-shadow:0 14px 34px rgba(0,0,0,.45);
  display:flex;
  flex-direction:column;
  gap:6px;
  overflow:hidden;
  cursor:pointer;
  transition:transform .18s ease-out, box-shadow .18s ease-out, border-color .18s ease-out;
}
.portal-card:hover{
  transform:translateY(-3px);
  border-color:var(--accent);
  box-shadow:0 18px 40px rgba(0,0,0,.7);
}
.portal-tag{
  font-size:11px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--violet);
}
.portal-title{
  font-size:18px;
  font-weight:600;
}
.portal-desc{
  font-size:13px;
  color:var(--muted);
}
.portal-pill{
  margin-top:8px;
  font-size:11px;
  color:var(--accent);
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.portal-pill span.arrow{
  font-size:14px;
  transform:translateY(1px);
}

/* ===== Sections / Layout ===== */
.section{
  margin:32px 0;
}
.section-header{
  margin-bottom:12px;
}
.section-header h3{
  font-size:18px;
  margin-bottom:4px;
}
.section-header p{
  font-size:14px;
  color:var(--muted);
}

/* Simple inline “back” link */
.back-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  color:var(--muted);
  margin-bottom:16px;
}
.back-link span{
  font-size:16px;
  transform:translateY(1px);
}

/* ===== Lists / Legend ===== */
.chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:5px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  font-size:11px;
  color:var(--muted);
}
.chip.ok{
  border-color:#1f3b2a;
  color:#a9e4ba;
  background:#0c1510;
}
.chip.err{
  border-color:#4a2024;
  color:#ffc0c6;
  background:#160b0d;
}

.legend{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}
.list{
  margin:0;
  padding-left:18px;
}
.list li{
  margin:5px 0;
}

/* ===== Essays / Longform ===== */
.longform{
  max-width:860px;
  margin:0 auto;
}
.longform h1,
.longform h2,
.longform h3{
  font-family:var(--serif);
}
.longform h1{
  font-size:34px;
  margin-bottom:6px;
  text-shadow:0 0 14px rgba(255,255,255,.08);
}
.longform h2{
  font-size:24px;
  margin:22px 0 8px;
}
.longform h3{
  font-size:18px;
  margin:18px 0 6px;
}
.longform p{
  margin:8px 0;
}
.longform em{
  color:#e9e9e9;
}
blockquote{
  border-left:2px solid var(--line);
  padding-left:16px;
  margin:18px 0;
  color:var(--muted);
  font-style:italic;
}

/* ===== Small utility things ===== */
.center{text-align:center;}
.toplink{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:50;
  border:1px solid var(--line);
  background:#0f1219;
  color:var(--text);
  padding:9px 11px;
  border-radius:10px;
  font-size:12px;
  text-decoration:none;
  opacity:.82;
}
.toplink:hover{opacity:1}

/* Reveal-on-scroll hook (optional JS later) */
.reveal{opacity:0;transform:translateY(14px);transition:opacity .6s ease,transform .6s ease;}
.reveal.in{opacity:1;transform:none;}

footer.site{
  margin-top:24px;
  padding-top:16px;
  border-top:1px solid var(--line);
  font-size:12px;
  color:var(--muted);
  text-align:center;
}

/* Mobile */
@media (max-width:700px){
  .wrap{padding:18px 16px 32px;}
  .portal-hero{padding-top:28px;}
}