:root{
  --bg:#070a12;
  --bg2:#0b1020;
  --surface: rgba(14, 19, 35, .72);
  --card: rgba(14, 19, 35, .78);
  --text:#e8eefc;
  --muted:#aab7d2;
  --border: rgba(232,238,252,.12);

  --accent:#7aa2ff;
  --accent2:#4dd9ff;

  --shadow: 0 1px 2px rgba(0,0,0,.38), 0 18px 70px rgba(0,0,0,.50);
  --radius: 16px;
  --radius2: 22px;

  --font-sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Source Serif 4", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;

  --sidebar-w: 330px;
  --content-w: 980px;

  --gutter: 18px;
  --stack: 16px;
}

/* User-selected override from JS */
html[data-theme="light"]{
  color-scheme: light;
  --bg:#ffffff;
  --bg2:#f6f8fc;
  --surface: rgba(255,255,255,.72);
  --card: rgba(255,255,255,.80);
  --text:#0b1220;
  --muted:#5b667a;
  --border: rgba(15, 23, 42, .12);
  --accent:#2563eb;
  --accent2:#06b6d4;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 60px rgba(2,6,23,.10);
}
html[data-theme="dark"]{ color-scheme: dark; }

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  color:var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  overflow-x:hidden;
  background:
    radial-gradient(1100px 650px at 18% -10%, rgba(122,162,255,.18), transparent 60%),
    radial-gradient(900px 600px at 105% 12%, rgba(77,217,255,.12), transparent 55%),
    linear-gradient(180deg, var(--bg2), var(--bg));
}

a{
  color: var(--accent);
  text-decoration:none;
  border-bottom: 1px solid rgba(122,162,255,.35);
}
html[data-theme="light"] a{ border-bottom-color: rgba(37,99,235,.35); }
a:hover{ border-bottom-color: rgba(122,162,255,.70); }

img, video, iframe, object{ max-width:100%; height:auto; }

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip: rect(0,0,0,0); white-space:nowrap; border:0;
}

.skip-link{
  position:absolute; left:-999px; top:auto; width:1px; height:1px; overflow:hidden;
}
.skip-link:focus{
  left:16px; top:16px; width:auto; height:auto;
  padding:10px 12px;
  background: var(--card);
  border:1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index:9999;
  backdrop-filter: blur(10px);
}

/* ===== Layout ===== */
.layout{
  min-height:100vh;
  display:grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 0;
}

/* ===== Sidebar (desktop) ===== */
.sidebar{
  padding: 18px 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  position: sticky;
  top: 0;
  height: 100vh;
  overflow:auto;
}

/* Sidebar cards */
.profile-card{
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 14px;
}

.profile-img-wrap{ display:flex; justify-content:center; }
.profile-img{
  width: 168px; height: 168px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: 0 14px 46px rgba(0,0,0,.22);
}

.profile-name{
  margin-top: 10px;
  font-weight: 900;
  font-size: 18px;
  text-align:center;
}
.profile-role{
  color: var(--muted);
  text-align:center;
  font-size: 14px;
  margin-top: 2px;
}
.profile-meta{
  color: var(--muted);
  text-align:center;
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.45;
}

.profile-actions{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration:none;
  cursor:pointer;
  box-shadow: 0 10px 40px rgba(0,0,0,.12);
}
.btn:hover{ transform: translateY(-1px); border-color: rgba(122,162,255,.28); }

.btn-primary{
  background:
    radial-gradient(900px 260px at 0% 0%, rgba(122,162,255,.18), transparent 55%),
    radial-gradient(900px 260px at 100% 0%, rgba(77,217,255,.12), transparent 55%),
    var(--card);
}
.btn-ghost{
  background: transparent;
  box-shadow: none;
}

.dot{
  width:10px; height:10px; border-radius:999px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
}

/* Nav */
.nav{
  margin-top: 14px;
  display:flex;
  flex-direction:column;
  gap: 6px;
}

.nav-link{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-bottom: none;
  font-weight: 650;
}
.nav-link:hover{
  background: rgba(122,162,255,.10);
  border-color: rgba(122,162,255,.22);
}
.nav-link.active{
  background: rgba(122,162,255,.14);
  border-color: rgba(122,162,255,.26);
  font-weight: 850;
}

.sidebar-note{
  margin-top: 14px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* ===== Main ===== */
.main{ min-width:0; display:flex; flex-direction:column; }

.topbar{
  display:none;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.topbar-title{
  font-weight: 900;
  color: var(--text);
  border-bottom: none;
}

.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 14px;
  color: var(--text);
  cursor:pointer;
}
.icon-btn:hover{ box-shadow: var(--shadow); }

/* Content card */
.content{
  padding: 18px var(--gutter) 56px var(--gutter);
}
.content-inner{
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 26px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.page-title{
  margin: 0 0 14px 0;
  font-family: var(--font-serif);
  font-size: clamp(26px, 2.4vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Better default spacing inside markdown */
.content-inner > * + *{ margin-top: var(--stack); }
.content-inner h2{
  font-family: var(--font-serif);
  margin-top: 28px;
  margin-bottom: 10px;
}
.content-inner h3{
  font-family: var(--font-serif);
  margin-top: 22px;
  margin-bottom: 8px;
}
.content-inner ul, .content-inner ol{ padding-left: 22px; }
.content-inner li{ margin: 6px 0; }
.content-inner hr{
  border:0;
  border-top:1px solid var(--border);
  margin: 18px 0;
}
.content-inner code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
  font-size: .95em;
  background: rgba(232,238,252,.08);
  padding: 0.12em 0.35em;
  border-radius: 8px;
}
html[data-theme="light"] .content-inner code{ background: rgba(2,6,23,.06); }

/* Footer */
.footer{
  padding: 0 var(--gutter) 26px var(--gutter);
  color: var(--muted);
}
.footer-inner{
  max-width: var(--content-w);
  margin: 0 auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display:flex;
  flex-wrap:wrap;
  gap: 10px 16px;
  font-size: 13px;
}

/* ===== Mobile: sidebar becomes overlay, topbar appears ===== */
@media (max-width: 980px){
  :root{ --gutter: 14px; --sidebar-w: 320px; }

  .layout{ grid-template-columns: 1fr; }

  .topbar{ display:flex; }

  .sidebar{
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    max-width: 88vw;
    height: 100vh;
    transform: translateX(-110%);
    transition: transform .18s ease;
    z-index: 100;
    box-shadow: var(--shadow);
    background: var(--surface);
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--border);
  }
  .sidebar.open{ transform: translateX(0); }

  .content{ padding: 16px var(--gutter) 44px var(--gutter); }
  .content-inner{ padding: 22px 18px; }
}

/* ===== Home page enhancements ===== */
.hero{
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 28px;
  background:
    radial-gradient(560px 300px at -10% -20%, rgba(122,162,255,.24), transparent 60%),
    radial-gradient(520px 280px at 115% 0%, rgba(77,217,255,.18), transparent 58%),
    linear-gradient(145deg, rgba(255,255,255,.05), rgba(255,255,255,.01));
}
.hero h1{
  margin: 6px 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.05;
}
.hero-kicker{
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--muted);
}
.hero-subtitle{
  margin: 10px 0 0;
  max-width: 66ch;
  color: var(--muted);
}
.hero-actions{
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-badges{
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-badge{
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(122,162,255,.12);
}

.spotlight-grid{
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
.spotlight-card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(165deg, rgba(255,255,255,.05), rgba(255,255,255,.01));
}
.spotlight-label{
  margin: 0;
  color: var(--accent2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.spotlight-card h3{
  margin: 8px 0 6px;
  font-size: 18px;
}
.spotlight-card p{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.theme-list{
  display: grid;
  gap: 10px;
}
.theme-item{
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,.02);
}
.theme-item span{
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(122,162,255,.16);
  color: var(--accent2);
}

.quick-links-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}
.quick-link-card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  transition: transform .16s ease, border-color .16s ease;
}
.quick-link-card strong{
  display: block;
  font-size: 17px;
  margin-bottom: 4px;
}
.quick-link-card p{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.quick-link-card:hover{
  transform: translateY(-2px);
  border-color: rgba(122,162,255,.45);
}

@media (max-width: 980px){
  .hero{ padding: 22px 18px; }
  .spotlight-grid,
  .quick-links-grid{ grid-template-columns: 1fr; }
}
