/*
Theme Name: Nertwork Tech
Theme URI: https://www.nertwork.com
Author: James Gomez (Nertwork)
Author URI: https://www.linkedin.com/in/james-farr/
Description: High-performance, dark-first technical engineering blog theme for Network Engineering, AI Homelab Automation, Proxmox IaC, Junos, Cisco, Cumulus Linux, and Cloud Infrastructure.
Version: 2.3.2
Requires at least: 6.0
Tested up to: 7.1.4
Requires PHP: 8.1
License: MIT
Text Domain: nertwork-tech
*/

:root,
[data-theme="dark"] {
  --bg-canvas: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #172033;
  --bg-surface-hover: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.82);
  --bg-code: #060911;
  --bg-code-header: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-subtle: #1e293b;
  --border-strong: #334155;
  --accent-primary: #38bdf8;
  --accent-secondary: #818cf8;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-glow: rgba(56, 189, 248, 0.14);
  --badge-bg: rgba(56, 189, 248, 0.12);
  --badge-border: rgba(56, 189, 248, 0.28);
  --badge-text: #7dd3fc;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 18px 40px -12px rgba(2, 132, 199, 0.25);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="light"] {
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --bg-code: #0f172a;
  --bg-code-header: #1e293b;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent-primary: #0284c7;
  --accent-secondary: #4f46e5;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-glow: rgba(2, 132, 199, 0.08);
  --badge-bg: rgba(2, 132, 199, 0.09);
  --badge-border: rgba(2, 132, 199, 0.25);
  --badge-text: #0369a1;
  --shadow-card: 0 4px 20px -4px rgba(15, 23, 42, 0.07);
  --shadow-hover: 0 14px 30px -8px rgba(2, 132, 199, 0.16);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(circle at 15% 0%, var(--accent-glow), transparent 35%),
    radial-gradient(circle at 85% 5%, rgba(129, 140, 248, 0.08), transparent 35%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  color: var(--accent-secondary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.nt-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==================== Header & Navigation ==================== */
.nt-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.nt-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 1rem;
}

.nt-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  min-width: 0;
}

.nt-brand:hover {
  color: var(--text-primary);
}

.nt-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(129, 140, 248, 0.18));
  border: 1px solid var(--badge-border);
  color: var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
}

.nt-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nt-brand-title {
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.nt-brand-sub {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.nt-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.nt-nav-list {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
}

.nt-nav-list li {
  flex-shrink: 0;
}

.nt-nav-list a,
.nt-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.72rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-sans);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nt-nav-list a:hover,
.nt-nav-list a.is-active,
.nt-nav-list .current-menu-item > a,
.nt-nav-list .current-category-ancestor > a,
.nt-dropdown-trigger:hover,
.nt-nav-dropdown.is-open .nt-dropdown-trigger {
  background: var(--bg-surface-elevated);
  color: var(--accent-primary);
  border-color: var(--border-subtle);
}

.nt-nav-dropdown {
  position: relative;
}

.nt-dropdown-caret {
  transition: transform 0.18s ease;
  opacity: 0.8;
}

.nt-nav-dropdown:hover .nt-dropdown-caret,
.nt-nav-dropdown.is-open .nt-dropdown-caret {
  transform: rotate(180deg);
}

.nt-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  z-index: 150;
}

.nt-nav-dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 0.55rem;
}

.nt-nav-dropdown:hover .nt-dropdown-menu,
.nt-nav-dropdown.is-open .nt-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nt-dropdown-header {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.15rem 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.5rem;
}

.nt-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
}

.nt-dropdown-menu .nt-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.48rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
}

.nt-dropdown-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nt-dropdown-item-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  flex-shrink: 0;
}

.nt-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.nt-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.nt-search-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.nt-search-kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.nt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.nt-icon-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--bg-surface-elevated);
}

.nt-mobile-toggle {
  display: none;
}

/* ==================== Hero Flagship Card ==================== */
.nt-hero-section {
  padding: 2.25rem 0 1.25rem;
}

.nt-hero-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nt-hero-card:hover {
  border-color: var(--badge-border);
  box-shadow: var(--shadow-hover);
}

.nt-hero-media {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.nt-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.nt-hero-card:hover .nt-hero-media img {
  transform: scale(1.03);
}

.nt-hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.nt-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.nt-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--badge-text);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nt-badge:hover {
  background: var(--accent-primary);
  color: #090d16;
}

.nt-badge-featured {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--accent-emerald);
}

.nt-hero-title {
  font-size: clamp(1.5rem, 2.5vw, 2.15rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0 0 0.9rem;
  font-weight: 700;
}

.nt-hero-title a {
  color: var(--text-primary);
}

.nt-hero-title a:hover {
  color: var(--accent-primary);
}

.nt-hero-excerpt {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.65;
  margin: 0 0 1.35rem;
}

.nt-hero-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.nt-author-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.nt-author-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #090d16;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nt-read-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-primary);
}

/* ==================== Category Filter Bar ==================== */
.nt-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 1rem 0 1.5rem;
  scrollbar-width: thin;
}

.nt-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nt-filter-pill:hover,
.nt-filter-pill.is-active {
  background: var(--badge-bg);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.nt-filter-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}

/* ==================== Post Grid & Cards ==================== */
.nt-grid-section {
  padding-bottom: 3.5rem;
}

.nt-post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.nt-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nt-card:hover {
  transform: translateY(-3px);
  border-color: var(--badge-border);
  box-shadow: var(--shadow-hover);
}

.nt-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-surface-elevated);
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

.nt-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.nt-card:hover .nt-card-media img {
  transform: scale(1.04);
}

.nt-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.35rem;
}

.nt-card-title {
  font-size: 1.15rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin: 0 0 0.65rem;
  font-weight: 700;
}

.nt-card-title a {
  color: var(--text-primary);
}

.nt-card-title a:hover {
  color: var(--accent-primary);
}

.nt-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nt-card-footer {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ==================== Archive Header ==================== */
.nt-archive-header {
  padding: 2.25rem 0 1rem;
}

.nt-archive-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
}

.nt-archive-title {
  margin: 0.35rem 0 0.5rem;
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  letter-spacing: -0.025em;
}

.nt-archive-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ==================== Pagination ==================== */
.nt-pagination {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
}

.nt-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.nt-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
}

.nt-pagination .page-numbers.current,
.nt-pagination .page-numbers:hover {
  background: var(--badge-bg);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ==================== Single Article Layout ==================== */
.nt-article-header {
  padding: 2.5rem 0 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2.25rem;
}

.nt-breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.nt-breadcrumbs a {
  color: var(--text-secondary);
}

.nt-breadcrumbs a:hover {
  color: var(--accent-primary);
}

.nt-article-title {
  font-size: clamp(1.85rem, 3.2vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0.6rem 0 1.25rem;
  font-weight: 800;
  max-width: 960px;
}

.nt-article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.nt-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 780px) minmax(280px, 340px);
  justify-content: space-between;
  gap: 3rem;
  padding-bottom: 4rem;
}

.nt-article-main {
  min-width: 0;
}

.nt-article-featured-img {
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  aspect-ratio: 16 / 9;
  width: 100%;
}

.nt-article-featured-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ==================== Technical Prose Typography ==================== */
.nt-prose {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.78;
  overflow-wrap: break-word;
}

.nt-prose > *:first-child {
  margin-top: 0;
}

.nt-prose p {
  margin: 0 0 1.35rem;
}

.nt-prose h1,
.nt-prose h2,
.nt-prose h3,
.nt-prose h4,
.nt-prose h5,
.nt-prose h6 {
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 2.25rem 0 0.9rem;
  scroll-margin-top: 90px;
}

.nt-prose h2 {
  font-size: 1.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
}

.nt-prose h3 {
  font-size: 1.25rem;
}

.nt-prose h4 {
  font-size: 1.08rem;
}

.nt-prose a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nt-prose ul,
.nt-prose ol {
  margin: 0 0 1.4rem;
  padding-left: 1.5rem;
}

.nt-prose li {
  margin-bottom: 0.45rem;
}

.nt-prose blockquote {
  margin: 1.75rem 0;
  padding: 1.1rem 1.35rem;
  background: var(--bg-surface);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-primary);
  font-style: italic;
}

.nt-prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-primary);
  padding: 0.15em 0.4em;
  border-radius: 5px;
}

.nt-prose pre code {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* ==================== Interactive Terminal Code Blocks ==================== */
.nt-code-block {
  margin: 1.65rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-code);
  overflow: hidden;
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.45);
}

.nt-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.95rem;
  background: var(--bg-code-header);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #94a3b8;
}

.nt-code-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nt-code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.nt-code-dot.red { background: #ef4444; }
.nt-code-dot.amber { background: #f59e0b; }
.nt-code-dot.green { background: #10b981; }

.nt-code-lang {
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7dd3fc;
  font-weight: 600;
}

.nt-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nt-copy-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
}

.nt-copy-btn.is-copied {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
}

.nt-code-block pre {
  margin: 0;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  color: #e2e8f0;
  background: transparent;
}

/* Token coloring inside terminal blocks */
.nt-tok-comment { color: #64748b; font-style: italic; }
.nt-tok-kw { color: #38bdf8; font-weight: 600; }
.nt-tok-flag { color: #c084fc; }
.nt-tok-ip { color: #34d399; }
.nt-tok-str { color: #fde047; }

/* ==================== Engineering Reference Tables ==================== */
.nt-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.75rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.nt-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  color: var(--text-secondary) !important;
  background: transparent !important;
  border: none !important;
}

.nt-prose table th,
.nt-prose table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle) !important;
  color: var(--text-secondary) !important;
  background: transparent !important;
  vertical-align: top;
}

.nt-prose table th,
.nt-prose table thead tr,
.nt-prose table tr:first-child th {
  background: var(--bg-surface-elevated) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.nt-prose table th *,
.nt-prose table td * {
  color: inherit !important;
  margin: 0;
}

.nt-prose table tr:hover td {
  background: rgba(56, 189, 248, 0.04) !important;
}

/* ==================== Bounded Native Sponsor / AdSense Slot ==================== */
.nt-sponsor-slot {
  margin: 2.25rem 0;
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  min-height: 112px;
  overflow: hidden;
  position: relative;
}

.nt-sponsor-slot--home {
  margin: 0.25rem 0 1.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-elevated) 100%);
  box-shadow: var(--shadow-card);
}

.nt-sponsor-slot.is-collapsed,
.nt-sponsor-slot:has(ins.nt-manual-ad[data-ad-status="unfilled"]) {
  display: none !important;
}

.nt-sponsor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nt-sponsor-tag {
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.64rem;
}

.nt-sponsor-body {
  position: relative;
  min-height: 90px;
}

.nt-adsbygoogle-unit {
  position: relative;
  z-index: 2;
}

.nt-adsbygoogle-unit[data-ad-status="unfilled"] {
  display: none !important;
}

/* Strictly suppress ALL non-manual AdSense Anchor Bars, Vignette Popups, and Footer Pixel/Iframe Blank Lines */
ins.adsbygoogle:not(.nt-manual-ad),
.google-auto-placed,
div.grippy-host,
ins[data-anchor-status],
ins[data-anchor-shown],
ins[data-vignette-loaded],
#google_vignette,
div[id^="google_ads_top_frame"],
iframe[name^="google_ads_top_frame"],
iframe[id^="google_esf"],
iframe[name="google_esf"],
img#wpstats,
#wpstats,
#likes-other-gravatars,
body > iframe[height="1"][width="1"],
body > iframe[style*="visibility: hidden"],
body > ins.adsbygoogle,
#cookie-law-info-bar,
#cookie-law-info-again,
.cli-modal-backdrop,
.cli-modal {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  min-height: 0 !important;
  width: 0 !important;
  opacity: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  pointer-events: none !important;
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  z-index: -9999 !important;
  overflow: hidden !important;
}

html,
body {
  padding-bottom: 0px !important;
  margin-bottom: 0px !important;
  top: 0px !important;
}

/* ==================== Article Tags, Prev/Next & Related ==================== */
.nt-tags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 2rem 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.nt-tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.nt-tag-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.nt-post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0 2.5rem;
}

.nt-post-nav-card {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease;
}

.nt-post-nav-card:hover {
  border-color: var(--accent-primary);
}

.nt-post-nav-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.nt-post-nav-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* ==================== Sticky Right Rail (ToC & Engineer Card) ==================== */
.nt-rail {
  position: relative;
}

.nt-rail-sticky {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nt-rail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
}

.nt-rail-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.nt-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border-subtle);
}

.nt-toc-list li {
  margin: 0;
}

.nt-toc-list a {
  display: block;
  padding: 0.35rem 0 0.35rem 0.85rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: all 0.15s ease;
}

.nt-toc-list a.nt-toc-h3 {
  padding-left: 1.5rem;
  font-size: 0.8rem;
}

.nt-toc-list a:hover,
.nt-toc-list a.is-active {
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
}

.nt-quote-box {
  padding: 0.9rem 1rem;
  background: var(--bg-surface-elevated);
  border-left: 3px solid var(--accent-emerald);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.nt-quote-cite {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.nt-rail-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nt-rail-links li {
  border-bottom: 1px solid var(--border-subtle);
}

.nt-rail-links li:last-child {
  border-bottom: none;
}

.nt-rail-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.nt-rail-links a:hover {
  color: var(--accent-primary);
}

/* ==================== Search Modal ==================== */
.nt-search-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(9, 13, 22, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem;
}

.nt-search-modal.is-open {
  display: flex;
}

.nt-search-dialog {
  width: 100%;
  max-width: 600px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.nt-search-form {
  display: flex;
  gap: 0.6rem;
}

.nt-search-input {
  flex: 1;
  background: var(--bg-canvas);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
}

.nt-search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.nt-search-submit {
  background: var(--accent-primary);
  color: #090d16;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 1.2rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==================== Comments Section ==================== */
.nt-comments-area {
  margin-top: 2.5rem;
  padding: 1.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.nt-comments-area h2,
.nt-comments-area h3 {
  margin-top: 0;
  font-size: 1.2rem;
}

.nt-comments-area textarea,
.nt-comments-area input[type="text"],
.nt-comments-area input[type="email"],
.nt-comments-area input[type="url"] {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  margin-bottom: 0.75rem;
}

.nt-comments-area .submit {
  background: var(--accent-primary);
  color: #090d16;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==================== Footer ==================== */
.nt-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 3rem 0 2rem;
  margin-top: 3rem;
}

.nt-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.nt-footer-heading {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

.nt-footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nt-footer-list a {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.nt-footer-list a:hover {
  color: var(--accent-primary);
}

.nt-footer-bottom {
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==================== Responsive & Portrait Breakpoints ==================== */
@media (max-width: 1024px) {
  .nt-brand-sub {
    display: none;
  }
  .nt-hero-card {
    grid-template-columns: 1fr;
  }
  .nt-post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nt-article-layout {
    grid-template-columns: 1fr;
  }
  .nt-rail-sticky {
    position: static;
  }
}

@media (max-width: 860px) {
  .nt-header-inner {
    min-height: 60px;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }
  .nt-brand-sub {
    display: none;
  }
  .nt-search-btn span,
  .nt-search-kbd {
    display: none;
  }
  .nt-search-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    justify-content: center;
  }
  .nt-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-strong);
    padding: 0.85rem 1.25rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
    overflow-x: visible;
  }
  .nt-nav.is-open {
    display: block;
  }
  .nt-nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }
  .nt-nav-list a,
  .nt-dropdown-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    font-size: 0.92rem;
  }
  .nt-dropdown-menu {
    position: static;
    transform: none;
    width: 100%;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    box-shadow: none;
    border: none;
    background: var(--bg-canvas);
    margin-top: 0.25rem;
    padding: 0.65rem;
  }
  .nt-nav-dropdown:hover .nt-dropdown-menu,
  .nt-nav-dropdown.is-open .nt-dropdown-menu {
    transform: none;
  }
  .nt-dropdown-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nt-mobile-toggle {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .nt-dropdown-grid,
  .nt-post-grid,
  .nt-post-nav,
  .nt-footer-grid {
    grid-template-columns: 1fr;
  }
}
