/* =========================================
   Subjects page only (dark mode)
   Moribund Institute — subjects.css
   ========================================= */

/* =========================
   1) Design tokens
   ========================= */
:root{
  /* Core */
  --bg:#0b0b0c;
  --panel:#101015;
  --panel2:#0d0d12;

  --text:#f1f1f1;
  --muted:#b7b7c0;

  --line:#2a2a33;
  --accent:#b9b7ff;

  --max:1100px;

  /* Pixel/Civ panel accents */
  --gold1:#c7a35a;
  --gold2:#7b6234;
  --gold3:#3a2c14;
  --gold4:#b8964e;
}

/* =========================
   2) Reset + base
   ========================= */
*{ box-sizing:border-box; }

html, body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:"IM Fell English","Noto Serif JP",serif;
  font-size:18px;
  line-height:1.55;
  letter-spacing:.2px;
}

::selection{
  background: rgba(185,183,255,.25);
}

a{
  color:inherit;
  text-decoration:none;
}
a:hover{ color:var(--accent); }

/* =========================
   3) Layout
   ========================= */
.container{
  max-width:var(--max);
  margin:0 auto;
  padding:22px 18px 40px;
}

/* =========================
   4) Site header (match homepage)
   NOTE: requires the Subjects header HTML to use:
   <header class="site-header"><div class="wrap">...</div></header>
   ========================= */
.site-header{
  border-bottom:1px solid var(--line);
  background:#0b0b0c; /* fallback */
  background:linear-gradient(#0d0d10, #0b0b0c);
}

.site-header .wrap{
  max-width:var(--max);
  margin:0 auto;
  padding:20px 18px;
}

.site-header .top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

.site-header .brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.site-header .logo{
  width:48px;
  height:48px;
  border-radius:10px;
  background:#1a1a22;
  border:1px solid var(--line);
}

.site-header .brand-title{
  font-weight:700;
  color:var(--text);
}

.site-header .brand-subtitle{
  color:var(--muted);
  font-size:13px;
}

.site-header .site-nav{
  display:flex;
  gap:16px;
  color:var(--muted);
  font-size:14px;
  flex-wrap:wrap;
}

.site-header .site-nav a{
  padding:6px 8px;
  border-radius:8px;
}

.site-header .site-nav a:hover{
  background:#151520;
  color:var(--text);
}

.site-header h1{
  margin:18px 0 6px;
  font-size:28px;
  letter-spacing:.2px;
  font-weight:600;
}

.subtitle{
  margin:0;
  max-width:80ch;
  color:var(--muted);
  font-size:16px;
}

/* =========================
   5) TOC tabs (sticky)
   ========================= */
.toc-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;

  margin:16px 0 18px;
  padding:12px;

  border:1px solid var(--line);
  border-radius:16px;

  background:linear-gradient(180deg,#0f0f14,#0b0b0c);

  position:sticky;
  top:0;
  z-index:50;
}

.toc-tab{
  display:inline-block;
  padding:9px 12px;

  border-radius:12px;
  border:1px solid var(--line);
  background:#12121a;

  color:var(--muted);
  font-size:16px;
  line-height:1;

  transition:
    background 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
}

.toc-tab:hover{
  background:#171724;
  color:var(--text);
}

.toc-tab.is-active{
  background:#171724;
  color:var(--accent);
  border-color:#3a3a48;
}

.toc-tab-alt{ margin-left:auto; }

/* =========================
   6) Subject blocks (JS toggles active)
   ========================= */
.subject-block{
  display:none; /* JS turns on the active panel */
  margin-bottom:14px;
}
.subject-block.is-active{ display:block; }

.subject-block h2{
  margin:0 0 12px;
  font-size:26px;
  font-weight:400;
  color:var(--text);
}

.subject-block ul{
  margin:0;
  padding-left:22px;
}

.subject-block li{
  margin:12px 0;
  color:var(--muted);
}

.subject-block strong{
  color:var(--text);
  font-weight:400;
}

.subject-block em{ color:#cfcfe0; }

.shelf-note,
.note{
  margin:0 0 14px;
  color:var(--muted);
}

/* Special marker */
.outside-dewey{ border-color:#3a3a48; }

/* =========================
   7) Pixel / Civ-style panel skin
   (apply .pixel-panel)
   ========================= */
.pixel-panel{
  position:relative;

  background:linear-gradient(180deg,#0f1118,#0a0b10);
  border-radius:14px;

  padding:22px 22px 18px;

  border:2px solid #2e2e3a;

  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.04),
    0 12px 40px rgba(0,0,0,.55);
}

/* Gold bevel frame */
.pixel-panel::before{
  content:"";
  position:absolute;
  inset:-6px;

  border-radius:18px;
  border:2px solid transparent;

  background:linear-gradient(
    180deg,
    var(--gold1),
    var(--gold2) 45%,
    var(--gold3) 55%,
    var(--gold4)
  );

  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite:xor;
          mask-composite:exclude;

  pointer-events:none;
}

/* Inner glow */
.pixel-panel::after{
  content:"";
  position:absolute;
  inset:4px;

  border-radius:12px;
  box-shadow: inset 0 0 18px rgba(185,183,255,.08);

  pointer-events:none;
}

.pixel-panel h2{
  color:#f3f3f6;
  text-shadow:
    0 1px 0 #000,
    0 0 8px rgba(185,183,255,.15);
  letter-spacing:.4px;
}

.pixel-panel hr{
  border:none;
  height:1px;
  margin:14px 0;
  background:linear-gradient(
    90deg,
    transparent,
    rgba(185,183,255,.35),
    transparent
  );
}

.pixel-panel .ornament{
  position:absolute;
  top:-14px;
  right:18px;

  font-size:14px;
  color:var(--accent);
  opacity:.75;

  text-shadow:0 0 6px rgba(185,183,255,.4);
}

/* =========================
   8) Link cards (hub shelves)
   ========================= */
.link-grid{
  list-style:none;
  padding:0;
  margin:0;

  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(260px, 1fr));
  gap:14px;
}

.link-card{
  border:1px solid rgba(255,255,255,.10);
  border-radius:16px;
  background:rgba(0,0,0,.35);
  overflow:hidden;
}

.link-main{
  display:block;
  padding:14px 14px 10px;
}

.link-title{
  display:block;
  font-size:18px;
  letter-spacing:.2px;
}

.link-desc{
  display:block;
  margin-top:6px;

  color:var(--muted);
  font-size:14px;
  line-height:1.45;
}

.link-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;

  padding:0 14px 14px;
}

/* Pills */
.pill{
  display:inline-block;
  padding:4px 10px;

  border-radius:999px;
  font-size:12px;

  background:#1b1b22;
  border:1px solid rgba(255,255,255,.14);

  color:#cfcfe6;
  text-decoration:none;
}

.pill:hover{
  background:#2a2a38;
  color:#fff;
}

.pill.muted{
  opacity:.65;
}

.meta-link{
  font-size:12px;
  color:var(--text);
  opacity:.85;

  text-decoration:underline;
  text-underline-offset:3px;
}

.meta-link:hover{ opacity:1; }

/* =========================
   9) Footer
   ========================= */
.page-footer{
  margin-top:18px;
  padding-top:14px;

  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:16px;
}

/* =========================
   10) Mobile
   ========================= */
@media (max-width: 520px){
  .site-header .wrap{ padding:16px 14px; }

  .site-header h1{ font-size:26px; }
  .subtitle{ font-size:15px; }

  .toc-tabs{ padding:10px; gap:8px; }
  .toc-tab{ padding:8px 10px; font-size:15px; }

  .pixel-panel{ padding:16px; }
  .subject-block h2{ font-size:22px; }
}