/*
Theme Name: WTechNI
Theme URI: https://dev.wtechni.com
Author: WTechNI
Description: A custom editorial theme for AI engineering writing. Dark, typographic, built for long-form technical posts with code and data tables.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: wtechni
*/

/* =========================================================
   1. Tokens
   ========================================================= */
:root {
  --bg: #07080B;
  --bg-soft: #0B0D12;
  --surface: #0E1016;
  --surface-2: #14171F;
  --line: #1E222B;
  --line-soft: #171A22;
  --text: #E9EBF1;
  --text-soft: #B9BEC9;
  --muted: #8A909E;
  --accent: #7C8CFF;
  --accent-2: #46E3A0;
  --accent-ink: #0A0C14;
  --radius: 14px;
  --radius-sm: 9px;
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --wrap: 1180px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* =========================================================
   2. Reset
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .18s var(--ease), opacity .18s var(--ease); }
a:hover { color: #9AA6FF; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.screen-reader-text {
  border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
  height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute;
}

/* =========================================================
   3. Layout
   ========================================================= */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.wrap-narrow { max-width: 760px; }
.site { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

/* =========================================================
   4. Header
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(7,8,11,.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: 1.06rem; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2A2F45, #14161F);
  border: 1px solid #2C3244;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent);
  letter-spacing: -.04em;
}
.brand-sub { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; border-left: 1px solid var(--line); padding-left: 11px; margin-left: 2px; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text-soft); font-size: .875rem; font-weight: 500;
  padding: 8px 13px; border-radius: 8px; transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.is-active { color: var(--text); }
.nav .nav-cta {
  margin-left: 8px; color: var(--accent-ink); background: var(--accent);
  font-weight: 600; padding: 9px 16px;
}
.nav .nav-cta:hover { background: #95A2FF; color: var(--accent-ink); }

.nav-toggle {
  display: none; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); width: 40px; height: 38px; border-radius: 9px; cursor: pointer;
  align-items: center; justify-content: center;
}

/* =========================================================
   5. Hero
   ========================================================= */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line-soft); }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px; opacity: .5;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 25%, transparent 78%);
  pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; top: -220px; left: 50%; transform: translateX(-50%);
  width: 820px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,140,255,.20), transparent 62%);
  filter: blur(18px); pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center;
  padding: 84px 0 88px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 22px;
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--accent); display: inline-block; }
.hero h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.035em;
  font-size: clamp(2.35rem, 5vw, 3.65rem); line-height: 1.06; margin: 0 0 22px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-lede { font-size: 1.075rem; color: var(--text-soft); max-width: 46ch; margin: 0 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; font-size: .93rem; font-weight: 600;
  border: 1px solid transparent; transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #96A2FF; color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: #333A4A; background: var(--surface); color: var(--text); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 26px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.hero-stats b { display: block; color: var(--text); font-size: 19px; font-family: var(--font-display); letter-spacing: -.02em; margin-bottom: 2px; }

/* code card */
.hero-visual { position: relative; }
.code-card {
  background: linear-gradient(180deg, #101320, #0B0D14);
  border: 1px solid #232A3D; border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(124,140,255,.06);
}
.code-bar { display: flex; align-items: center; gap: 7px; padding: 13px 16px; border-bottom: 1px solid #1C2233; background: rgba(255,255,255,.015); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #2B3245; }
.dot.r { background: #3A2430; } .dot.y { background: #3A3524; } .dot.g { background: #243A2E; }
.code-file { margin-left: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.code-body { margin: 0; padding: 20px 18px 24px; font-family: var(--font-mono); font-size: 12.7px; line-height: 1.85; overflow-x: auto; color: #C6CCDB; }
.code-body .k { color: #9C8CFF; }
.code-body .s { color: #7FD1A8; }
.code-body .c { color: #5F6878; font-style: italic; }
.code-body .f { color: #7FB4FF; }
.code-body .n { color: #E8C27A; }

/* =========================================================
   6. Sections
   ========================================================= */
.section { padding: 74px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.section-head h2 {
  font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -.03em; margin: 0; font-weight: 700;
}
.section-head .kicker { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin: 0 0 9px; }
.section-link { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-soft); white-space: nowrap; }
.section-link:hover { color: var(--accent); }

/* =========================================================
   7. Cards
   ========================================================= */
.featured {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, #0F1220 0%, #0B0D13 60%);
  margin-bottom: 22px;
  transition: border-color .22s var(--ease), transform .22s var(--ease);
}
.featured:hover { border-color: #2C3448; transform: translateY(-2px); }
.featured-body { padding: 38px 40px; display: flex; flex-direction: column; justify-content: center; }
.featured-aside {
  border-left: 1px solid var(--line); padding: 30px 32px;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 100% 0%, rgba(124,140,255,.10), transparent 60%);
}
.card-meta { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); letter-spacing: .04em; margin-bottom: 16px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 6px;
  background: rgba(124,140,255,.12); color: #A9B4FF; border: 1px solid rgba(124,140,255,.22);
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase; font-family: var(--font-mono);
}
.featured h3 { font-family: var(--font-display); font-size: clamp(1.45rem, 2.5vw, 1.95rem); line-height: 1.18; letter-spacing: -.03em; margin: 0 0 14px; }
.featured h3 a { color: var(--text); }
.featured h3 a:hover { color: var(--accent); }
.featured p { color: var(--text-soft); margin: 0 0 22px; font-size: .97rem; }
.read-more { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); display: inline-flex; align-items: center; gap: 7px; }
.read-more:hover { gap: 11px; }

.card-aside-item { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.card-aside-item:last-child { border-bottom: 0; padding-bottom: 0; }
.card-aside-item:first-child { padding-top: 0; }
.card-aside-item a { color: var(--text); font-weight: 600; font-size: .95rem; line-height: 1.35; display: block; }
.card-aside-item a:hover { color: var(--accent); }
.card-aside-item span { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 5px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 24px 24px; transition: border-color .22s var(--ease), transform .22s var(--ease), background .22s var(--ease);
}
.card:hover { border-color: #2C3448; transform: translateY(-3px); background: var(--surface-2); }
.card h3 { font-family: var(--font-display); font-size: 1.12rem; line-height: 1.28; letter-spacing: -.02em; margin: 0 0 10px; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--text-soft); font-size: .9rem; margin: 0 0 18px; }
.card .card-foot { margin-top: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }

/* =========================================================
   8. Topics strip
   ========================================================= */
.topics { border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--bg-soft); }
.topics-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 22px 0; }
.topics-label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.topic {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-soft);
  font-size: .85rem; transition: all .18s var(--ease);
}
.topic:hover { color: var(--text); border-color: #333B4D; background: var(--surface-2); }
.topic .count { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }

/* =========================================================
   9. CTA band
   ========================================================= */
.cta-band { padding: 70px 0; }
.cta-card {
  position: relative; overflow: hidden;
  border: 1px solid #232A3D; border-radius: 18px; padding: 52px 48px;
  background: linear-gradient(135deg, #10131F 0%, #0B0D14 100%);
  display: grid; grid-template-columns: 1.4fr auto; gap: 32px; align-items: center;
}
.cta-card::after {
  content: ""; position: absolute; right: -120px; top: -120px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(70,227,160,.13), transparent 65%);
}
.cta-card h2 { font-family: var(--font-display); font-size: clamp(1.4rem, 2.4vw, 1.85rem); letter-spacing: -.03em; margin: 0 0 10px; }
.cta-card p { color: var(--text-soft); margin: 0; max-width: 52ch; font-size: .96rem; }
.cta-card .btn { position: relative; z-index: 1; }

/* =========================================================
   10. Single post
   ========================================================= */
.post-header { padding: 60px 0 36px; border-bottom: 1px solid var(--line-soft); margin-bottom: 44px; }
.post-header .chip { margin-bottom: 18px; }
.post-header h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.035em;
  font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.1; margin: 0 0 20px; max-width: 22ch;
}
.post-header .lede { color: var(--text-soft); font-size: 1.05rem; max-width: 62ch; margin: 0 0 26px; }
.post-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.post-byline .avatar { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); }
.post-byline .sep { color: #333A4A; }

.prose { font-size: 1.045rem; line-height: 1.78; color: var(--text-soft); }
.prose > * + * { margin-top: 1.15em; }
.prose h2 {
  font-family: var(--font-display); font-size: clamp(1.35rem, 2.4vw, 1.7rem); line-height: 1.25;
  letter-spacing: -.025em; color: var(--text); margin: 2.1em 0 .65em; scroll-margin-top: 90px;
}
.prose h3 { font-family: var(--font-display); font-size: 1.16rem; letter-spacing: -.015em; color: var(--text); margin: 1.7em 0 .5em; }
.prose p { max-width: 70ch; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { text-decoration: underline; text-decoration-color: rgba(124,140,255,.4); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { max-width: 70ch; padding-left: 22px; }
.prose li { margin: .4em 0; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  margin: 1.8em 0; padding: 20px 24px; border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, rgba(124,140,255,.07), transparent 85%);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text);
}
.prose blockquote p { margin: 0; font-size: 1.02rem; }
.prose code {
  font-family: var(--font-mono); font-size: .875em; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 5px; padding: .14em .42em; color: #C9D0E4;
}
.prose pre {
  background: #0A0C12; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 20px 22px; overflow-x: auto; font-size: .855rem; line-height: 1.72;
  margin: 1.6em 0;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: #C6CCDB; }
.prose table {
  width: 100%; border-collapse: collapse; margin: 1.7em 0; font-size: .9rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.prose thead { background: var(--surface-2); }
.prose th {
  text-align: left; padding: 11px 14px; font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text); border-bottom: 1px solid var(--line);
}
.prose td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); color: var(--text-soft); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: rgba(255,255,255,.018); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--line); }

.post-footer { margin-top: 56px; padding-top: 30px; border-top: 1px solid var(--line-soft); }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.post-tags a {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}
.post-tags a:hover { color: var(--text); border-color: #333B4D; }

.related { padding: 60px 0; border-top: 1px solid var(--line-soft); }

/* =========================================================
   11. Archive / list
   ========================================================= */
.archive-head { padding: 56px 0 34px; border-bottom: 1px solid var(--line-soft); margin-bottom: 10px; }
.archive-head h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 3.6vw, 2.6rem); letter-spacing: -.03em; margin: 0 0 10px; }
.archive-head p { color: var(--muted); margin: 0; max-width: 60ch; }
.list { display: flex; flex-direction: column; }
.list-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 22px; align-items: start; padding: 28px 0; border-bottom: 1px solid var(--line-soft); }
.list-num { font-family: var(--font-mono); font-size: 12px; color: #4A5162; padding-top: 5px; }
.list-item h2 { font-family: var(--font-display); font-size: 1.28rem; line-height: 1.3; letter-spacing: -.02em; margin: 0 0 8px; }
.list-item h2 a { color: var(--text); }
.list-item h2 a:hover { color: var(--accent); }
.list-item p { color: var(--text-soft); font-size: .92rem; margin: 0; max-width: 62ch; }
.list-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; padding-top: 6px; }

.pagination { padding: 40px 0; }
.pagination .nav-links { display: flex; gap: 8px; }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-soft); font-size: .875rem;
}
.pagination .page-numbers.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.pagination .page-numbers:hover { border-color: #333B4D; color: var(--text); }

/* =========================================================
   12. 404
   ========================================================= */
.error-page { padding: 110px 0; text-align: center; }
.error-page .code { font-family: var(--font-mono); font-size: clamp(4rem, 14vw, 8rem); line-height: 1; color: #1B1F2A; letter-spacing: -.04em; margin: 0; }
.error-page h1 { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.03em; margin: -20px 0 14px; }
.error-page p { color: var(--muted); max-width: 46ch; margin: 0 auto 30px; }

/* =========================================================
   13. Footer
   ========================================================= */
.site-footer { border-top: 1px solid var(--line-soft); background: #06070A; padding: 52px 0 40px; margin-top: 20px; }
.footer-inner { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.footer-brand { max-width: 300px; }
.footer-brand p { color: var(--muted); font-size: .875rem; margin: 14px 0 0; }
.footer-cols { display: flex; gap: 64px; flex-wrap: wrap; }
.footer-col h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; font-weight: 500; }
.footer-col a { display: block; color: var(--text-soft); font-size: .875rem; margin-bottom: 9px; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 11.5px; color: #5F6675; }
.footer-bottom a { color: #5F6675; }
.footer-bottom a:hover { color: var(--text-soft); }

/* =========================================================
   14. Responsive
   ========================================================= */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; gap: 44px; padding: 62px 0 68px; }
  .hero-visual { max-width: 560px; }
  .featured { grid-template-columns: 1fr; }
  .featured-aside { border-left: 0; border-top: 1px solid var(--line); }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .cta-card { grid-template-columns: 1fr; padding: 38px 30px; }
  .footer-cols { gap: 40px; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 20px; }
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px; background: #0A0C11; border-bottom: 1px solid var(--line); padding: 10px 20px 16px; }
  .nav.is-open { display: flex; }
  .nav a { padding: 11px 12px; border-radius: 8px; }
  .nav .nav-cta { margin: 6px 0 0; text-align: center; }
  .nav-toggle { display: flex; }
  .header-inner { position: relative; }
  .brand-sub { display: none; }
  .grid { grid-template-columns: 1fr; }
  .section { padding: 52px 0; }
  .featured-body { padding: 28px 24px; }
  .featured-aside { padding: 24px; }
  .list-item { grid-template-columns: 1fr; gap: 8px; }
  .list-num, .list-meta { padding: 0; }
  .post-header { padding: 40px 0 28px; }
  .cta-card { padding: 32px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
