:root{
  --bg: #002832;
  --bg-deep: #001a20;
  --surface: #0b3540;
  --surface-2: #0f3d48;
  --line: rgba(134,235,11,0.16);
  --accent: #86eb0b;
  --accent-dim: #5fb800;
  --text: #eaf3f0;
  --text-muted: #8fb3ac;
  --text-faint: #5c7d78;
  --radius: 10px;
  --max: 1120px;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
/* Note: no overflow-x:hidden on html/body here — that property silently
   breaks position:sticky on descendants (like the TOC sidebar), so it's
   deliberately omitted on blog pages. */
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  *{animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; scroll-behavior:auto !important;}
}

body{margin:0; background:var(--bg); color:var(--text); font-family:var(--body); line-height:1.6; -webkit-font-smoothing:antialiased;}
img{max-width:100%; display:block;}
a{color:inherit;}

.skip-link{position:absolute; left:-9999px; top:0; background:var(--accent); color:var(--bg-deep); padding:12px 20px; z-index:100; font-weight:600; border-radius:0 0 8px 0;}
.skip-link:focus{left:0;}
:focus-visible{outline:2px solid var(--accent); outline-offset:3px;}

.wrap{max-width:var(--max); margin:0 auto; padding:0 24px;}
h1,h2,h3{font-family:var(--display); font-weight:700; line-height:1.15; margin:0;}
h2{font-size:clamp(1.7rem,3.2vw,2.4rem);}
h3{font-size:1.15rem;}
p{margin:0;}
.eyebrow{font-family:var(--mono); font-size:0.78rem; letter-spacing:0.14em; text-transform:uppercase; color:var(--accent); display:inline-flex; align-items:center; gap:8px; margin-bottom:14px;}
.eyebrow::before{content:''; width:7px; height:7px; border-radius:50%; background:var(--accent); box-shadow:0 0 8px var(--accent);}

/* Header (matches main site) */
header{position:sticky; top:0; z-index:50; background:rgba(0,26,32,0.82); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border-bottom:1px solid var(--line); box-shadow:0 1px 0 rgba(134,235,11,0.06), 0 12px 30px -18px rgba(0,0,0,0.6);}
.nav{display:flex; align-items:center; justify-content:space-between; gap:20px; padding:12px 24px; min-height:64px;}
.brand{display:flex; align-items:center; gap:12px; font-family:var(--display); font-weight:700; font-size:1.08rem; text-decoration:none; color:var(--text); flex-shrink:0;}
.brand-mark{width:42px; height:42px; border-radius:10px; flex-shrink:0; display:flex; align-items:center; justify-content:center; background:radial-gradient(circle at 35% 30%, rgba(134,235,11,0.22), rgba(134,235,11,0.03) 70%); border:1px solid var(--line);}
.brand img{width:30px; height:30px; display:block;}
.brand-text{display:flex; flex-direction:column; line-height:1.15;}
.brand-text .status{font-family:var(--mono); font-size:0.66rem; letter-spacing:0.08em; text-transform:uppercase; color:var(--text-muted); display:inline-flex; align-items:center; gap:5px; font-weight:500; margin-top:2px;}
.brand-text .status::before{content:''; width:6px; height:6px; border-radius:50%; background:var(--accent); box-shadow:0 0 6px var(--accent);}
.nav-links ul{list-style:none; display:flex; gap:30px; margin:0; padding:0;}
.nav-links ul a{text-decoration:none; font-size:0.92rem; font-weight:500; color:var(--text-muted); transition:color .15s; position:relative;}
.nav-links ul a:hover, .nav-links ul a.nav-active{color:var(--text);}
.nav-links ul a::after{content:''; position:absolute; left:0; right:0; bottom:-6px; height:2px; background:var(--accent); transform:scaleX(0); transition:transform .18s ease; transform-origin:left;}
.nav-links ul a:hover::after, .nav-links ul a.nav-active::after{transform:scaleX(1);}
.nav-links{display:flex; align-items:center;}
.nav-actions{display:flex; align-items:center; gap:14px; flex-shrink:0;}
.btn{display:inline-flex; align-items:center; gap:8px; background:var(--accent); color:var(--bg-deep); font-weight:700; font-size:0.9rem; padding:11px 22px; border-radius:8px; text-decoration:none; border:1px solid var(--accent); transition:transform .15s ease, box-shadow .15s ease; white-space:nowrap; cursor:pointer;}
.btn:hover{transform:translateY(-2px); box-shadow:0 10px 24px -6px rgba(134,235,11,0.4);}
.btn-ghost{background:transparent; color:var(--text); border:1px solid var(--line);}
.btn-ghost:hover{border-color:var(--accent); color:var(--accent);}
.btn-danger{background:transparent; color:#ff8a8a; border:1px solid rgba(255,110,110,0.35);}
.btn-danger:hover{background:rgba(255,80,80,0.1); border-color:#ff8a8a;}
.btn-sm{padding:8px 14px; font-size:0.82rem;}
.menu-toggle{display:none; background:none; border:1px solid var(--line); color:var(--text); width:40px; height:40px; border-radius:8px; align-items:center; justify-content:center; flex-direction:column; gap:4px; flex-shrink:0; cursor:pointer;}
.menu-toggle span{display:block; width:18px; height:2px; background:var(--text); border-radius:2px; transition:transform .2s ease, opacity .2s ease;}
.menu-toggle[aria-expanded="true"] span:nth-child(1){transform:translateY(6px) rotate(45deg);}
.menu-toggle[aria-expanded="true"] span:nth-child(2){opacity:0;}
.menu-toggle[aria-expanded="true"] span:nth-child(3){transform:translateY(-6px) rotate(-45deg);}

section{padding:64px 0;}
.section-head{max-width:60ch; margin-bottom:36px;}
.section-head p{color:var(--text-muted); margin-top:14px; font-size:1.02rem;}

/* Footer (matches main site) */
footer{border-top:1px solid var(--line); padding:40px 0; background:var(--bg-deep);}
.footer-grid{display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:20px;}
.footer-links{display:flex; gap:24px; list-style:none; margin:0; padding:0;}
.footer-links a{text-decoration:none; color:var(--text-muted); font-size:0.9rem;}
.footer-links a:hover{color:var(--accent);}
.footer-note{color:var(--text-faint); font-size:0.85rem;}

/* Blog hero */
.blog-hero{padding:64px 0 40px; position:relative; overflow:hidden;}
.blog-hero::before{content:''; position:absolute; inset:0; z-index:-1; background:radial-gradient(circle at 85% 10%, rgba(134,235,11,0.1), transparent 45%);}
.blog-hero h1{font-size:clamp(2rem,4vw,3rem); letter-spacing:-0.01em; max-width:20ch;}
.blog-hero p{margin-top:16px; color:var(--text-muted); font-size:1.05rem; max-width:56ch;}

/* Post grid / cards */
.post-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:24px;}
.post-card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; transition:border-color .15s, transform .15s; display:flex; flex-direction:column; text-decoration:none; color:var(--text);}
.post-card:hover{border-color:var(--accent); transform:translateY(-3px);}
.post-card-img{aspect-ratio:16/9; background:var(--bg-deep); overflow:hidden;}
.post-card-img img{width:100%; height:100%; object-fit:cover;}
.post-card-body{padding:22px; display:flex; flex-direction:column; gap:10px; flex:1;}
.post-card-meta{font-family:var(--mono); font-size:0.72rem; color:var(--text-faint); text-transform:uppercase; letter-spacing:0.06em;}
.post-card h3{font-size:1.1rem; line-height:1.3;}
.post-card p{color:var(--text-muted); font-size:0.92rem; flex:1;}
.post-card-readmore{color:var(--accent); font-size:0.85rem; font-weight:600; margin-top:4px;}
.empty-state{text-align:center; padding:60px 20px; color:var(--text-muted); border:1px dashed var(--line); border-radius:14px;}

/* Pagination */
.pagination{display:flex; justify-content:center; gap:10px; margin-top:44px;}
.pagination a, .pagination span{display:inline-flex; align-items:center; justify-content:center; min-width:40px; height:40px; padding:0 12px; border-radius:8px; border:1px solid var(--line); color:var(--text-muted); text-decoration:none; font-size:0.9rem; font-family:var(--mono);}
.pagination a:hover{border-color:var(--accent); color:var(--accent);}
.pagination .current{background:var(--accent); color:var(--bg-deep); border-color:var(--accent); font-weight:700;}
.pagination .disabled{opacity:0.35; pointer-events:none;}

/* Tag pills */
.tag-pill{font-family:var(--mono); font-size:0.72rem; color:var(--accent); border:1px solid var(--line); border-radius:999px; padding:5px 12px; display:inline-block;}
.tag-row{display:flex; flex-wrap:wrap; gap:8px;}

/* Single post */
.post-header{padding:56px 0 32px;}
.post-header .eyebrow{margin-bottom:18px;}
.post-header h1{font-size:clamp(1.9rem,4vw,2.9rem); letter-spacing:-0.01em; max-width:24ch;}
.post-meta-row{display:flex; flex-wrap:wrap; gap:16px; align-items:center; margin-top:20px; color:var(--text-muted); font-size:0.88rem; font-family:var(--mono);}
.post-meta-row span{display:inline-flex; align-items:center; gap:6px;}
.post-featured-img{width:100%; aspect-ratio:21/9; object-fit:cover; border-radius:14px; border:1px solid var(--line); margin:12px 0 8px;}

.post-body{max-width:760px; margin:0 auto; padding-bottom:40px;}

/* Post + TOC layout */
.post-layout{display:grid; grid-template-columns:240px 1fr; gap:40px; align-items:start;}
.post-body-col{min-width:0;}
.post-body-col .post-body{margin:0; max-width:760px;}
.toc-sidebar{position:sticky; top:88px;}
.toc-card{background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:22px;}
.toc-header{display:flex; align-items:center; justify-content:space-between; width:100%; background:none; border:none; color:var(--text); cursor:pointer; padding:0; font-family:var(--display);}
.toc-header h4{font-size:1rem; font-weight:700;}
.toc-chevron{color:var(--text-muted); flex-shrink:0; transition:transform .18s ease;}
.toc-card.collapsed .toc-chevron{transform:rotate(180deg);}
.toc-list{list-style:none; margin:16px 0 0; padding:0; display:flex; flex-direction:column;}
.toc-card.collapsed .toc-list{display:none;}
.toc-item{border-left:2px solid var(--line); padding:7px 0 7px 16px; transition:border-color .15s;}
.toc-item.level-3{padding-left:28px;}
.toc-item a{display:block; color:var(--text-muted); text-decoration:none; font-size:0.9rem; line-height:1.4; transition:color .15s;}
.toc-item:hover a{color:var(--text);}
.toc-item.active{border-left-color:var(--accent);}
.toc-item.active a{color:var(--accent); font-weight:600;}

.post-content h2, .post-content h3{scroll-margin-top:90px;}

@media (max-width: 900px){
  .post-layout{grid-template-columns:1fr;}
  .toc-sidebar{position:static; margin-bottom:8px;}
}
.post-content{font-size:1.05rem; line-height:1.8; color:var(--text);}
.post-content > * + *{margin-top:22px;}
.post-content h2{font-size:1.5rem; margin-top:40px;}
.post-content h3{font-size:1.2rem; margin-top:32px;}
.post-content p{color:var(--text);}
.post-content a{color:var(--accent); text-decoration:underline; text-underline-offset:3px;}
.post-content ul, .post-content ol{padding-left:1.4em; color:var(--text);}
.post-content li + li{margin-top:8px;}
.post-content blockquote{border-left:3px solid var(--accent); padding:4px 0 4px 20px; color:var(--text-muted); font-style:italic;}
.post-content img{border-radius:12px; border:1px solid var(--line);}
.post-content code{background:var(--surface); padding:2px 6px; border-radius:4px; font-family:var(--mono); font-size:0.88em;}
.post-tags{margin-top:36px; padding-top:24px; border-top:1px solid var(--line);}

.post-cta{max-width:760px; margin:48px auto 0; background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:36px; text-align:center;}
.post-cta h3{font-size:1.3rem;}
.post-cta p{color:var(--text-muted); margin-top:10px;}
.post-cta .btn{margin-top:20px;}

.back-link{display:inline-flex; align-items:center; gap:6px; color:var(--text-muted); font-size:0.9rem; text-decoration:none; margin-bottom:20px;}
.back-link:hover{color:var(--accent);}

/* Forms (shared by contact + admin) */
form{display:flex; flex-direction:column; gap:14px;}
label{font-size:0.85rem; color:var(--text-muted);}
input, textarea, select{width:100%; background:var(--bg-deep); border:1px solid var(--line); border-radius:8px; padding:12px 14px; color:var(--text); font-family:var(--body); font-size:0.95rem;}
input:focus, textarea:focus, select:focus{border-color:var(--accent); outline:none;}
textarea{resize:vertical; min-height:110px;}

/* Admin shell */
.admin-shell{min-height:70vh; padding:40px 0;}
.admin-topbar{display:flex; justify-content:space-between; align-items:center; margin-bottom:32px; flex-wrap:wrap; gap:16px;}
.admin-topbar h1{font-size:1.6rem;}
.admin-user{color:var(--text-muted); font-size:0.88rem;}
.admin-card{background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:28px;}
.admin-table{width:100%; border-collapse:collapse;}
.admin-table th{text-align:left; font-family:var(--mono); font-size:0.72rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text-faint); padding:10px 12px; border-bottom:1px solid var(--line);}
.admin-table td{padding:14px 12px; border-bottom:1px solid var(--line); font-size:0.92rem; vertical-align:middle;}
.admin-table tr:last-child td{border-bottom:none;}
.admin-table .title-cell{font-weight:600; max-width:320px;}
.admin-actions{display:flex; gap:8px; flex-wrap:wrap;}
.status-badge{font-family:var(--mono); font-size:0.7rem; text-transform:uppercase; padding:4px 10px; border-radius:999px; letter-spacing:0.04em;}
.status-badge.published{background:rgba(134,235,11,0.14); color:var(--accent);}
.status-badge.draft{background:rgba(143,179,172,0.14); color:var(--text-muted);}
.admin-form-grid{display:grid; grid-template-columns:1.4fr 1fr; gap:28px; align-items:start;}
.admin-toolbar{display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px; padding:8px; background:var(--bg-deep); border:1px solid var(--line); border-radius:8px;}
.admin-toolbar button{background:var(--surface-2); color:var(--text); border:1px solid var(--line); border-radius:6px; padding:6px 10px; font-size:0.8rem; cursor:pointer; font-family:var(--mono);}
.admin-toolbar button:hover{border-color:var(--accent); color:var(--accent);}
.admin-content-textarea{min-height:420px; font-family:var(--mono); font-size:0.9rem; line-height:1.6;}
.field-hint{font-size:0.78rem; color:var(--text-faint);}
.char-count{font-size:0.75rem; color:var(--text-faint); text-align:right;}
.admin-login-wrap{max-width:400px; margin:80px auto; padding:0 20px;}
.alert{padding:14px 18px; border-radius:10px; font-size:0.9rem; margin-bottom:20px;}
.alert-success{background:rgba(134,235,11,0.12); color:var(--accent); border:1px solid var(--line);}
.alert-error{background:rgba(255,80,80,0.1); color:#ff8a8a; border:1px solid rgba(255,110,110,0.3);}
.current-thumb{width:100%; aspect-ratio:16/9; object-fit:cover; border-radius:10px; border:1px solid var(--line); margin-bottom:10px;}

@media (max-width: 900px){
  .post-grid{grid-template-columns:1fr 1fr;}
  .admin-form-grid{grid-template-columns:1fr;}
}
@media (max-width: 640px){
  header{padding:0;}
  .nav{min-height:64px; padding:10px 16px; gap:10px;}
  .brand{min-width:0; flex:1 1 auto; gap:8px;}
  .brand-mark{width:30px; height:30px; flex:0 0 30px;}
  .brand-mark img{width:30px; height:30px;}
  .brand-text{font-size:0.86rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .brand-text .status{display:none;}
  .nav-links{position:fixed; top:64px; left:0; right:0; width:100%; background:var(--bg); flex-direction:column; padding:20px 20px 24px; border-bottom:1px solid var(--line); display:none; gap:18px; box-shadow:0 16px 30px -12px rgba(0,0,0,0.5); z-index:1000;}
  .nav-links.open{display:flex;}
  .nav-links ul{flex-direction:column; gap:16px; width:100%;}
  .nav-links ul a{display:block; padding:4px 0;}
  .nav-actions{gap:7px; flex:0 0 auto;}
  .nav-actions .btn{display:inline-flex; padding:9px 11px; font-size:0.76rem; border-radius:7px;}
  .menu-toggle{display:flex; width:38px; height:38px;}
  .post-grid{grid-template-columns:1fr;}
  section{padding:44px 0;}
  .admin-table{display:block; overflow-x:auto; white-space:nowrap;}
}
