:root{
  --bg0:#050710;
  --bg1:#0b1020;
  --card:rgba(18,26,51,.78);
  --card2:rgba(255,255,255,.03);
  --text:#eaf0ff;
  --muted:#aab6d8;
  --accent:#f4c542;
  --accent2:#ffdf7a;
  --line:rgba(255,255,255,.09);
  --shadow:0 14px 40px rgba(0,0,0,.32);
  --radius:16px;
}

/* Light theme overrides */
html[data-theme="light"]{
  --bg0:#f7f8ff;
  --bg1:#eef2ff;
  --card:rgba(255,255,255,.86);
  --card2:rgba(20,30,60,.03);
  --text:#121a33;
  --muted:rgba(20,30,60,.72);
  --line:rgba(20,30,60,.12);
  --shadow:0 14px 40px rgba(20,30,60,.12);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  background:
    radial-gradient(900px 500px at 18% -10%, rgba(244,197,66,.16), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(120,160,255,.12), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color:var(--text);
  line-height:1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a{color:inherit;text-decoration:none}
a:hover{text-decoration:underline}

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

/* Header: mobile-first, scrollable nav chips */
.top{
  position:sticky;
  top:0;
  background:rgba(7,10,20,.86);
  backdrop-filter:saturate(130%) blur(10px);
  border-bottom:1px solid var(--line);
  z-index:10
}
html[data-theme="light"] .top{background:rgba(255,255,255,.86)}
.top .wrap{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:10px;
  padding:12px 14px;
}
.top-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.brand{
  font-weight:900;
  letter-spacing:.2px;
  font-size:16px;
}
.theme-toggle{
  flex:0 0 auto;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:inherit;
  border-radius:999px;
  padding:8px 12px;
  font-weight:900;
  min-height:40px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
html[data-theme="light"] .theme-toggle{background:rgba(20,30,60,.04)}
.theme-toggle .ico{display:inline-flex;width:18px;height:18px}
.theme-toggle svg{width:18px;height:18px;display:block}
.theme-toggle .lbl{white-space:nowrap}
.theme-toggle:active{transform:translateY(1px)}
.nav{
  display:flex;
  gap:10px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom:2px;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar{display:none}
.nav a{
  flex:0 0 auto;
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(255,255,255,.02);
  font-weight:800;
  letter-spacing:.1px;
}
html[data-theme="light"] .nav a{background:rgba(20,30,60,.03)}
.nav a:active{transform:translateY(1px)}
.nav a:hover{border-color:rgba(244,197,66,.35)}

main.wrap{padding-top:14px;padding-bottom:22px}

/* Layout */
.hero{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  margin:10px 0 14px
}
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  box-shadow: var(--shadow);
}
.section{margin-top:12px}

.hero-img{
  width:100%;
  height:auto;
  display:block;
  border-radius:14px;
  border:1px solid var(--line);
  margin-bottom:10px;
  aspect-ratio:4/3;
  object-fit:cover
}

.h1{
  font-size:22px;
  margin:0 0 6px;
  font-weight:950;
  line-height:1.15;
}
.h2{
  margin:0 0 6px;
  font-size:18px;
  font-weight:950;
  letter-spacing:.1px;
}
.lead{color:var(--muted);margin:0;font-size:14px}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:rgba(244,197,66,.11);
  border:1px solid rgba(244,197,66,.26);
  color:var(--text);
  padding:9px 11px;
  border-radius:999px;
  font-weight:900;
  letter-spacing:.1px;
}

.grid{
  display:grid;
  grid-template-columns:1fr;
  gap:10px
}
.stat{
  padding:14px;
  border-radius:14px;
  background:var(--card2);
  border:1px solid var(--line);
  transition: border-color .15s ease, transform .15s ease;
}
.stat:hover{border-color:rgba(244,197,66,.26);transform:translateY(-1px)}
.stat .k{color:var(--muted);font-size:13px;font-weight:800}
.stat .v{font-size:24px;font-weight:950;margin-top:4px}
.stat .u{color:var(--muted);font-size:12px}

.muted{color:var(--muted)}
.small{font-size:12px}
.note{margin-top:10px;color:var(--muted);font-size:13px}

.cta{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:11px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  font-weight:900;
  min-height:44px;
}
.btn.primary{
  border-color:rgba(244,197,66,.40);
  background:linear-gradient(180deg, rgba(244,197,66,.14), rgba(244,197,66,.08));
}
.btn:active{transform:translateY(1px)}

.table-wrap{
  margin-top:10px;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.10);
}
html[data-theme="light"] .table-wrap{background:rgba(255,255,255,.55)}
table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:680px;
}
th,td{padding:10px 12px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap}
th{
  background:rgba(255,255,255,.04);
  color:var(--muted);
  font-weight:900;
  position:sticky;
  top:0;
}
tr:last-child td{border-bottom:none}

.footer{border-top:1px solid var(--line);padding:18px 0 26px;margin-top:16px}
.projects{margin-bottom:12px}
.projects-links{display:flex;gap:10px;flex-wrap:wrap}
.proj{
  display:inline-flex;
  align-items:center;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  font-weight:900;
}
html[data-theme="light"] .proj{background:rgba(20,30,60,.03)}
.error{padding:14px;border-radius:14px;border:1px solid rgba(255,60,60,.25);background:rgba(255,60,60,.08)}
html[data-theme="light"] .error{background:rgba(255,60,60,.06)}

.chart{
  width:100%;
  height:220px;
  display:block;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  margin-top:10px;
}
html[data-theme="light"] .chart{background:rgba(0,0,0,.01)}

.chart-wrap{position:relative}
.chart-tip{
  position:absolute;
  left:12px;
  top:12px;
  padding:10px 11px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(7,10,20,.78);
  backdrop-filter: blur(10px) saturate(130%);
  color:var(--text);
  box-shadow: var(--shadow);
  font-size:13px;
  line-height:1.25;
  pointer-events:none;
  opacity:0;
  transform:translateY(-4px);
  transition: opacity .12s ease, transform .12s ease;
  max-width:240px;
}
html[data-theme="light"] .chart-tip{background:rgba(255,255,255,.92)}
.chart-tip.show{opacity:1;transform:translateY(0)}
.chart-tip .t{font-weight:950}
.chart-tip .m{color:var(--muted);margin-top:2px;font-size:12px}

.cols{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  margin-top:12px;
}
@media (min-width: 680px){
  .cols{grid-template-columns:1fr 1fr;gap:14px}
}

/* Wider screens */
@media (min-width: 680px){
  .wrap{padding:0 16px}
  .top .wrap{flex-direction:row;align-items:center;justify-content:space-between}
  .nav{overflow:visible}
  .hero{grid-template-columns:1.15fr .85fr;gap:14px;margin:14px 0 18px}
  .grid{grid-template-columns:repeat(2,1fr);gap:12px}
  .h1{font-size:28px}
  .lead{font-size:15px}
}
@media (min-width: 980px){
  .grid{grid-template-columns:repeat(4,1fr)}
}

/* Calculators */
.calc{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  margin-top:10px;
}
@media (min-width: 680px){
  .calc{grid-template-columns:1fr 1fr}
}
.field{display:flex;flex-direction:column;gap:6px}
.label{font-weight:900;font-size:13px;color:var(--muted)}
.row{display:flex;gap:10px;align-items:stretch;flex-direction:column}
.row .input{flex:1 1 auto;min-width:0}
.row .select{flex:0 0 auto;min-width:0}
@media (min-width: 520px){
  .row{flex-direction:row;align-items:center}
  .row .select{flex:0 0 160px;width:auto}
  .row .input{width:auto}
}
.tag{
  flex:0 0 auto;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  font-weight:900;
  color:var(--muted);
  min-height:44px;
  display:flex;
  align-items:center;
}
html[data-theme="light"] .tag{background:rgba(20,30,60,.03)}
.input, .select{
  width:100%;
  min-height:44px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  font-weight:800;
  outline:none;
}
html[data-theme="light"] .input, html[data-theme="light"] .select{background:rgba(20,30,60,.03)}
.input:focus, .select:focus{border-color:rgba(244,197,66,.45)}
.result{
  padding:12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
}
html[data-theme="light"] .result{background:rgba(255,255,255,.7)}
.result .big{font-weight:950;font-size:20px;margin-top:2px}
.result .sub{color:var(--muted);font-size:12px;margin-top:2px}

