/* ===== Theme variables ===== */
/* Default theme: DARK */
:root{
  --bg:#0b1020;
  --fg:#e8ecff;
  --muted:rgba(232,236,255,.82);

  --card:rgba(255,255,255,.06);
  --border:rgba(255,255,255,.12);
  --shadow:rgba(0,0,0,.35);

  --chip:rgba(255,255,255,.10);
  --btn:rgba(0,0,0,.22);
  --btn2:rgba(255,255,255,.08);

  --navbg: rgba(11,16,32,.72);
  --navborder: rgba(255,255,255,.08);

  --max:1040px;

  /* Brand */
  --accent:#64ffda;   /* mint */
  --accent2:#7dd3fc;  /* soft blue */
  --title:rgba(232,236,255,.92);
  --subtitle:rgba(232,236,255,.62);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* LIGHT theme overrides */
:root[data-theme="light"]{
  --bg:#f6f7fb;
  --fg:#12162a;
  --muted:rgba(18,22,42,.75);

  --card:rgba(255,255,255,.78);
  --border:rgba(18,22,42,.12);
  --shadow:rgba(18,22,42,.12);

  --chip:rgba(18,22,42,.06);
  --btn:rgba(255,255,255,.88);
  --btn2:rgba(18,22,42,.08);

  --navbg: rgba(246,247,251,.72);
  --navborder: rgba(18,22,42,.10);

  --accent:#0ea5a4;
  --accent2:#2563eb;
  --title:rgba(18,22,42,.92);
  --subtitle:rgba(18,22,42,.62);
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(100,255,218,.10), transparent 55%),
    radial-gradient(700px 500px at 80% 0%, rgba(125,211,252,.10), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(255,255,255,.06), transparent 60%),
    var(--bg);
  color:var(--fg);
}

a{color:var(--fg);text-decoration:none}
a:hover{opacity:.95}

/* ===== Nav ===== */
.nav{
  position:sticky; top:0; z-index:10;
  backdrop-filter: blur(12px);
  background: linear-gradient(to bottom, rgba(11,16,32,.86), rgba(11,16,32,.55));
  border-bottom:1px solid rgba(255,255,255,.07);
}
:root[data-theme="light"] .nav{
  background: linear-gradient(to bottom, rgba(246,247,251,.92), rgba(246,247,251,.70));
  border-bottom:1px solid rgba(18,22,42,.10);
}

.nav-inner{
  max-width:var(--max);
  margin:0 auto;
  padding:12px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  font-weight:780;
  letter-spacing:.2px;
  display:flex;
  align-items:center;
  gap:10px;
  white-space:nowrap;
}

.nav-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.nav-links{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.menu a{
  padding:8px 10px;
  border:0;
  background:transparent;
  border-radius:12px;
  font-size:13px;
  color: var(--subtitle);
}
.menu a:hover{
  color: var(--title);
  background: rgba(255,255,255,.06);
}
:root[data-theme="light"] .menu a:hover{
  background: rgba(18,22,42,.06);
}
.nav-links a.active{
  color: var(--title);
  background: rgba(255,255,255,.08);
}
:root[data-theme="light"] .nav-links a.active{
  background: rgba(18,22,42,.08);
}

/* Kicker / numbers */
.kicker{
  font-family: var(--mono);
  font-size:12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--subtitle);
}

/* Resume button */
.resume-btn{
  display:inline-block;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(100,255,218,.35);
  color: var(--accent);
  background: transparent;
  font-size: 13px;
}
.resume-btn:hover{
  border-color: rgba(100,255,218,.60);
  background: rgba(100,255,218,.08);
}

/* ===== Online dot ===== */
.dot{
  width:10px;
  height:10px;
  border-radius:99px;
  background:#22c55e;
  box-shadow:
    0 0 0 4px rgba(34,197,94,.18),
    0 0 18px rgba(34,197,94,.35);
  animation: onlinePulse 2.2s ease-in-out infinite;
}
:root[data-theme="light"] .dot{
  box-shadow:
    0 0 0 4px rgba(34,197,94,.14),
    0 0 16px rgba(34,197,94,.28);
}
@media (prefers-reduced-motion: reduce){
  .dot{ animation:none; }
}
@keyframes onlinePulse{
  0%   { transform: scale(1);   box-shadow: 0 0 0 4px rgba(34,197,94,.18), 0 0 18px rgba(34,197,94,.25); }
  50%  { transform: scale(1.12);box-shadow: 0 0 0 7px rgba(34,197,94,.10), 0 0 26px rgba(34,197,94,.45); }
  100% { transform: scale(1);   box-shadow: 0 0 0 4px rgba(34,197,94,.18), 0 0 18px rgba(34,197,94,.25); }
}

/* ===== Layout ===== */
.wrap{max-width:var(--max);margin:0 auto;padding:28px 16px 64px}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.10);
  border-radius:20px;
  box-shadow:0 10px 30px var(--shadow);
}
:root[data-theme="light"] .card{
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(18,22,42,.10);
}

.pad{padding:22px}

h1{margin:0 0 10px;font-size:36px;line-height:1.12;color:var(--title)}
h2{margin:0 0 10px;font-size:18px;color:var(--title)}
@media (max-width:900px){h1{font-size:30px}}

p{margin:0;color:var(--muted);line-height:1.6}
.small{font-size:13px;color:var(--muted);line-height:1.55}

code{
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  padding:2px 6px;
  border-radius:8px
}
:root[data-theme="light"] code{
  background:rgba(18,22,42,.06);
  border:1px solid rgba(18,22,42,.10);
}

/* ===== Buttons ===== */
.btn{
  display:inline-block;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:var(--btn);
  color:var(--fg);
  font-size:13px;
}
button.btn{cursor:pointer}

.btn.primary{
  background: transparent;
  border: 1px solid rgba(100,255,218,.35);
  color: var(--accent);
}
.btn.primary:hover{
  border-color: rgba(100,255,218,.60);
  background: rgba(100,255,218,.08);
}

/* ===== Hero ===== */
.hero{display:grid;grid-template-columns:1.45fr .85fr;gap:16px;align-items:stretch}
@media (max-width:900px){.hero{grid-template-columns:1fr}}

.hero-title{
  margin:10px 0 10px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.05;
  color: var(--title);
  font-weight: 850;
}
.hero-title .accent{
  color: rgba(232,236,255,.58);
}
:root[data-theme="light"] .hero-title .accent{
  color: rgba(18,22,42,.52);
}

.hero-sub{
  max-width: 62ch;
  color: var(--subtitle);
  font-size: 15px;
  line-height: 1.7;
}

/* ===== Page headers (non-home) ===== */
.page-header{margin-top:18px}
.page-title{
  margin:0 0 8px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.12;
  color: var(--title);
  font-weight: 850;
}
.page-sub{
  margin:0;
  max-width:70ch;
  color: var(--subtitle);
}

/* ===== Components ===== */
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:14px}
@media (max-width:900px){.grid3{grid-template-columns:1fr}}

.list{display:grid;gap:10px}

.item{
  padding:14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.14);
}
:root[data-theme="light"] .item{
  background:rgba(18,22,42,.04);
  border:1px solid rgba(18,22,42,.10);
}
.item b{display:block;margin-bottom:6px;color:var(--title)}

.chips{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 0}
.chip{
  font-size:12px;
  border:1px solid rgba(255,255,255,.14);
  background:var(--chip);
  padding:6px 10px;
  border-radius:999px;
  color:var(--muted)
}
:root[data-theme="light"] .chip{
  border:1px solid rgba(18,22,42,.10);
  color: rgba(18,22,42,.70);
}

.split{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media (max-width:900px){.split{grid-template-columns:1fr}}

.footer{margin-top:26px;color:rgba(232,236,255,.62);font-size:12px}
:root[data-theme="light"] .footer{color:rgba(18,22,42,.55)}

/* ===== Substack subscribe embed ===== */

.substack-embed{
  border-radius:18px;
  overflow:hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

.substack-embed iframe{
  width:100%;
  height:150px;
  border:0;
  background:transparent;
}

/* Light theme refinement */
:root[data-theme="light"] .substack-embed{
  background: linear-gradient(180deg, #ffffff, #f7f8fc);
  border:1px solid rgba(18,22,42,.12);
  box-shadow: 0 6px 18px rgba(18,22,42,.10);
}

/* ===== Featured article buttons (orange) ===== */

.article-btn{
  display:inline-block;
  margin-top:10px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid rgba(251,146,60,.45);
  background: rgba(251,146,60,.08);
  font-size:13px;
  color:#fb923c;
  transition: all .15s ease;
}

/* Hover = premium glow */
.article-btn:hover{
  border-color: rgba(251,146,60,.75);
  background: rgba(251,146,60,.14);
  transform: translateY(-1px);
  box-shadow:
    0 0 0 4px rgba(251,146,60,.12),
    0 0 22px rgba(251,146,60,.35);
}

.article-btn:active{
  transform: translateY(0);
}

/* Light theme tuning */
:root[data-theme="light"] .article-btn{
  color:#ea580c;
  border-color: rgba(234,88,12,.45);
  background: rgba(234,88,12,.06);
}

:root[data-theme="light"] .article-btn:hover{
  border-color: rgba(234,88,12,.75);
  background: rgba(234,88,12,.12);
  box-shadow:
    0 0 0 4px rgba(234,88,12,.10),
    0 0 22px rgba(234,88,12,.28);
}
