/*
Theme Name: Network Engineering Series
Theme URI: https://networkengineeringseries.com
Author: Martinus Moerman
Description: The official theme for the Network Engineering Series of books. Deep navy with a teal glow, Lato headings, monospace "pill" labels and node-graph artwork, matching the book covers. Includes a Books post type (cover, subtitle, store links, topics, highlights), a series homepage, an author section, article styling and block patterns such as the "Incident file". Fonts are self-hosted, so no visitor data goes to Google.
Version: 1.0.3
Requires at least: 6.3
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nes
Tags: dark, one-column, two-columns, custom-menu, custom-logo, featured-images, block-patterns, blog
*/

/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/lato-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 400; font-display: swap; src: url("assets/fonts/lato-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/lato-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 900; font-display: swap; src: url("assets/fonts/lato-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

/* ---------- Tokens (sampled from the covers) ---------- */
:root {
	--nes-abyss: #050a14;      /* cover corners */
	--nes-navy: #0a1430;       /* cover base */
	--nes-navy-2: #0e1a3a;     /* raised surface */
	--nes-navy-3: #13244a;     /* card hover / borders */
	--nes-glow: #14374a;       /* teal radial centre */
	--nes-teal: #42d3c6;       /* rings, rules, links */
	--nes-teal-line: #2f9c94;  /* graph edges */
	--nes-teal-soft: rgba(66, 211, 198, 0.14);
	--nes-yellow: #f4c963;     /* "helper", "root cause" */
	--nes-pill: #f4f6f3;       /* white label pills */
	--nes-ink: #0b1226;        /* text on pills */
	--nes-white: #ffffff;
	--nes-text: #c9d3e6;       /* body copy */
	--nes-muted: #9fb0d4;      /* subtitles */
	--nes-slate: #6f84ad;      /* "NETWORK ENGINEERING SERIES" */
	--nes-line: rgba(111, 132, 173, 0.22);

	--nes-sans: "Lato", "Helvetica Neue", Arial, sans-serif;
	--nes-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

	--nes-wide: 1200px;
	--nes-measure: 720px;
	--nes-gutter: clamp(16px, 4vw, 40px);
	--nes-radius: 10px;
	--nes-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.65), 0 12px 24px -12px rgba(0, 0, 0, 0.5);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
	margin: 0;
	background-color: var(--nes-navy);
	background-image:
		radial-gradient(ellipse 80% 60% at 50% 0%, rgba(20, 55, 74, 0.55), transparent 70%),
		linear-gradient(180deg, var(--nes-abyss) 0%, var(--nes-navy) 380px);
	background-repeat: no-repeat;
	color: var(--nes-text);
	font-family: var(--nes-sans);
	font-size: 18px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; }
a { color: var(--nes-teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--nes-white); }
:focus-visible { outline: 2px solid var(--nes-teal); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4, h5, h6 {
	color: var(--nes-white);
	font-family: var(--nes-sans);
	font-weight: 900;
	line-height: 1.12;
	letter-spacing: -0.012em;
	margin: 0 0 0.5em;
	text-wrap: balance;
}
h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); font-weight: 700; }
h4 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1.15em; }
strong, b { color: var(--nes-white); font-weight: 700; }
code, kbd, samp, pre { font-family: var(--nes-mono); font-size: 0.88em; }

.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important;
}
.screen-reader-text:focus, .skip-link:focus {
	background: var(--nes-pill); color: var(--nes-ink); clip: auto; clip-path: none; height: auto; width: auto;
	left: 12px; top: 12px; padding: 10px 16px; z-index: 1000; border-radius: 999px; font-weight: 700;
}

.nes-wrap { width: 100%; max-width: calc(var(--nes-wide) + 2 * var(--nes-gutter)); margin: 0 auto; padding: 0 var(--nes-gutter); }
.nes-narrow { max-width: calc(var(--nes-measure) + 2 * var(--nes-gutter)); }

/* ---------- Signature elements ---------- */
.nes-eyebrow {
	display: block;
	color: var(--nes-slate);
	font-family: var(--nes-sans);
	font-weight: 700;
	font-size: 0.8rem;
	letter-spacing: 0.34em;
	text-transform: uppercase;
	margin: 0 0 1.1rem;
}
.nes-rule {
	display: block;
	width: 120px;
	height: 3px;
	border: 0;
	border-radius: 2px;
	background: var(--nes-teal);
	margin: 0 0 1.4rem;
}
.nes-rule--center { margin-left: auto; margin-right: auto; }
.nes-rule--short { width: 64px; }

.nes-subtitle { color: var(--nes-muted); font-size: clamp(1.05rem, 1.6vw, 1.3rem); line-height: 1.45; margin: 0 0 1.4rem; }
.nes-author-caps { color: var(--nes-white); font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.95rem; }

.nes-mono-line {
	color: var(--nes-teal);
	font-family: var(--nes-mono);
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	line-height: 1.7;
}

/* Pills: the white/yellow label tags from the cover art */
.nes-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1.4rem; padding: 0; list-style: none; }
.nes-pill {
	display: inline-flex; align-items: center;
	background: var(--nes-pill);
	color: var(--nes-ink);
	font-family: var(--nes-mono);
	font-weight: 500;
	font-size: 0.78rem;
	line-height: 1;
	padding: 0.55em 1.05em;
	border-radius: 999px;
	white-space: nowrap;
	text-decoration: none;
}
.nes-pill--accent { background: var(--nes-yellow); }
.nes-pill--ghost { background: transparent; color: var(--nes-teal); box-shadow: inset 0 0 0 1px rgba(66, 211, 198, 0.55); }
.nes-pill--dim { background: rgba(244, 246, 243, 0.08); color: var(--nes-muted); }
a.nes-pill:hover { filter: brightness(1.08); color: var(--nes-ink); }
a.nes-pill--ghost:hover { color: var(--nes-white); }

/* The ring node ("DHCP", "SEV 2") */
.nes-ring {
	display: inline-grid; place-items: center;
	width: 4.4rem; height: 4.4rem;
	border-radius: 50%;
	border: 3px solid var(--nes-teal);
	background: #112943;
	color: var(--nes-teal);
	font-family: var(--nes-mono);
	font-weight: 500;
	font-size: 0.95rem;
	box-shadow: 0 0 24px rgba(66, 211, 198, 0.35);
}

/* Buttons */
.nes-btn, .wp-block-button__link, button, input[type="submit"] {
	display: inline-flex; align-items: center; justify-content: center; gap: 0.55em;
	font-family: var(--nes-sans);
	font-weight: 700;
	font-size: 0.98rem;
	line-height: 1;
	padding: 0.95em 1.55em;
	border-radius: 999px;
	border: 0;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.nes-btn--primary, .wp-block-button__link, button, input[type="submit"] { background: var(--nes-yellow); color: var(--nes-ink); }
.nes-btn--primary:hover, .wp-block-button__link:hover, button:hover, input[type="submit"]:hover { color: var(--nes-ink); transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(244, 201, 99, 0.6); }
.nes-btn--outline { background: transparent; color: var(--nes-white); box-shadow: inset 0 0 0 1.5px rgba(66, 211, 198, 0.7); }
.nes-btn--outline:hover { color: var(--nes-white); background: var(--nes-teal-soft); }
.nes-btn--quiet { background: rgba(244, 246, 243, 0.07); color: var(--nes-muted); cursor: default; }
.nes-btn .nes-arrow { font-family: var(--nes-mono); font-weight: 400; }
.nes-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Header ---------- */
.nes-header { position: relative; z-index: 20; }
.nes-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 84px; }
.nes-brand { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; }
.nes-brand__mark { flex: none; width: 34px; height: 34px; }
.nes-brand__name {
	color: var(--nes-slate);
	font-weight: 700;
	font-size: 0.78rem;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	line-height: 1.3;
}
.nes-brand:hover .nes-brand__name { color: var(--nes-white); }
.custom-logo { max-height: 44px; width: auto; display: block; }

.nes-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: center; }
.nes-nav a {
	display: block;
	color: var(--nes-text);
	text-decoration: none;
	font-weight: 700;
	font-size: 0.95rem;
	padding: 0.55em 0.95em;
	border-radius: 999px;
}
.nes-nav a:hover, .nes-nav .current-menu-item > a, .nes-nav .current_page_item > a, .nes-nav .current-menu-ancestor > a {
	color: var(--nes-white);
	background: var(--nes-teal-soft);
}
.nes-nav .sub-menu { display: none; }
.nes-nav-toggle {
	display: none;
	background: transparent; color: var(--nes-white);
	box-shadow: inset 0 0 0 1.5px var(--nes-line);
	padding: 0.7em 1em; font-family: var(--nes-mono); font-weight: 500; font-size: 0.8rem;
}
.nes-nav-toggle:hover { transform: none; box-shadow: inset 0 0 0 1.5px var(--nes-teal); }

@media (max-width: 820px) {
	.nes-nav-toggle { display: inline-flex; }
	.nes-nav { display: none; position: absolute; left: var(--nes-gutter); right: var(--nes-gutter); top: 76px; background: var(--nes-navy-2); border: 1px solid var(--nes-line); border-radius: 16px; padding: 10px; box-shadow: var(--nes-shadow); }
	.nes-nav.is-open { display: block; }
	.nes-nav ul { flex-direction: column; align-items: stretch; }
	.nes-nav a { padding: 0.8em 1em; border-radius: 10px; }
}

/* ---------- Network graph artwork ---------- */
.nes-graph { display: block; width: 100%; height: auto; }
.nes-graph .edge { stroke: var(--nes-teal-line); stroke-width: 1.6; fill: none; opacity: 0.75; }
.nes-graph .edge--faint { opacity: 0.35; }
.nes-graph .node { fill: #e3e8ee; }
.nes-graph .node--accent { fill: var(--nes-yellow); }
.nes-graph .ring { fill: #112943; stroke: var(--nes-teal); stroke-width: 3; }
.nes-graph .ring-text { fill: var(--nes-teal); font-family: var(--nes-mono); font-weight: 500; font-size: 22px; letter-spacing: 0.04em; }
.nes-graph .tag { fill: var(--nes-pill); }
.nes-graph .tag--accent { fill: var(--nes-yellow); }
.nes-graph .tag-text { fill: var(--nes-ink); font-family: var(--nes-mono); font-weight: 500; font-size: 17px; }
.nes-graph .baseline { stroke: var(--nes-slate); stroke-width: 1.2; stroke-dasharray: 2 7; opacity: 0.6; }
.nes-graph .packet { stroke: var(--nes-teal); stroke-width: 3; fill: none; stroke-linecap: round; stroke-dasharray: 10 900; stroke-dashoffset: 910; animation: nes-packet 7s linear infinite; filter: drop-shadow(0 0 4px rgba(66, 211, 198, 0.9)); }
.nes-graph .packet--2 { animation-delay: -3.5s; animation-duration: 9s; }
.nes-graph .halo { fill: none; stroke: var(--nes-teal); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; animation: nes-halo 4s ease-out infinite; }
@keyframes nes-packet { to { stroke-dashoffset: 0; } }
@keyframes nes-halo { 0% { opacity: 0.55; transform: scale(1); } 100% { opacity: 0; transform: scale(1.9); } }
@media (prefers-reduced-motion: reduce) {
	.nes-graph .packet, .nes-graph .halo { animation: none; display: none; }
}

/* ---------- Hero ---------- */
.nes-hero { position: relative; padding: clamp(24px, 5vw, 64px) 0 clamp(64px, 9vw, 120px); isolation: isolate; overflow-x: clip; }
.nes-hero::before {
	content: ""; position: absolute; inset: -84px 0 0; z-index: -2;
	background: radial-gradient(ellipse 55% 60% at 68% 45%, rgba(20, 55, 74, 0.95), transparent 70%);
}
.nes-hero__art { position: absolute; z-index: -1; top: 0; bottom: 0; right: -6%; width: 72%; display: flex; align-items: center; pointer-events: none; opacity: 0.6;
	-webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 38%); mask-image: linear-gradient(90deg, transparent 0%, #000 38%); }
.nes-hero__art .nes-graph { width: 100%; max-width: none; }
@media (max-width: 900px) { .nes-hero__art { width: 140%; right: -20%; opacity: 0.35; align-items: flex-start; } }
.nes-hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.nes-hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.6rem); margin-bottom: 0.35em; }
.nes-hero .nes-subtitle { max-width: 34em; }
.nes-hero__author { margin: 1.8rem 0 0; }

.nes-hero__shelf { position: relative; display: flex; justify-content: center; align-items: flex-end; min-height: 420px; }
.nes-hero__shelf .nes-cover { width: min(270px, 46%); }
.nes-hero__shelf .nes-cover:first-child { transform: translateX(14%) rotate(-5deg) translateY(16px); z-index: 1; }
.nes-hero__shelf .nes-cover:nth-child(2) { transform: translateX(-14%) rotate(4deg); z-index: 2; }
.nes-hero__shelf .nes-cover:only-child { transform: none; width: min(300px, 70%); }
.nes-hero__shelf a.nes-cover:hover { z-index: 3; transform: translateY(-8px) rotate(0); }

@media (max-width: 900px) {
	.nes-hero__grid { grid-template-columns: 1fr; }
	.nes-hero__shelf { min-height: 0; order: -1; margin-bottom: 8px; }
	.nes-hero__shelf .nes-cover { width: min(200px, 44%); }
}

/* ---------- Book covers ---------- */
.nes-cover {
	position: relative;
	display: block;
	aspect-ratio: 2 / 3;
	border-radius: 3px 6px 6px 3px;
	overflow: hidden;
	background: var(--nes-navy-2);
	box-shadow: var(--nes-shadow), 0 0 0 1px rgba(255, 255, 255, 0.06);
	transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
}
.nes-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nes-cover::after { /* spine highlight */
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: linear-gradient(90deg, rgba(255,255,255,0.10) 0, rgba(255,255,255,0.02) 2.5%, rgba(0,0,0,0.25) 3.5%, transparent 7%);
}
.nes-cover--placeholder { display: grid; place-items: center; padding: 18px; text-align: center; color: var(--nes-white); font-weight: 900; font-size: 1.2rem; background: radial-gradient(circle at 50% 40%, var(--nes-glow), var(--nes-navy) 70%); }

/* ---------- Sections ---------- */
.nes-section { padding: clamp(64px, 9vw, 120px) 0; position: relative; }
.nes-section--raised { background: linear-gradient(180deg, rgba(14, 26, 58, 0.0), rgba(14, 26, 58, 0.75) 18%, rgba(14, 26, 58, 0.75) 82%, rgba(14, 26, 58, 0)); }
.nes-section__head { max-width: 760px; margin: 0 0 clamp(36px, 5vw, 56px); }
.nes-section__head--center { margin-left: auto; margin-right: auto; text-align: center; }
.nes-section__head--center .nes-rule { margin-left: auto; margin-right: auto; }
.nes-section__head p { color: var(--nes-muted); font-size: 1.1rem; }

/* Book feature rows */
.nes-books { display: grid; gap: clamp(56px, 8vw, 96px); }
.nes-book { display: grid; grid-template-columns: minmax(200px, 330px) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.nes-book:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(200px, 330px); }
.nes-book:nth-child(even) .nes-book__cover { order: 2; }
.nes-book__cover a.nes-cover:hover { transform: translateY(-6px); }
.nes-book__meta { display: flex; align-items: center; gap: 14px; margin-bottom: 1rem; }
.nes-book__num { font-family: var(--nes-mono); color: var(--nes-teal); font-size: 0.85rem; letter-spacing: 0.08em; }
.nes-book__title { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.25em; }
.nes-book__title a { color: inherit; text-decoration: none; }
.nes-book__title a:hover { color: var(--nes-teal); }
.nes-book__excerpt { max-width: 38em; }
.nes-book__audience { margin: 0 0 1.6rem; }
@media (max-width: 760px) {
	.nes-book, .nes-book:nth-child(even) { grid-template-columns: 1fr; }
	.nes-book:nth-child(even) .nes-book__cover { order: 0; }
	.nes-book__cover { max-width: 240px; }
}

/* Book grid (archive / "more in the series") */
.nes-book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: clamp(28px, 4vw, 44px); }
.nes-book-card { text-decoration: none; color: inherit; display: block; }
.nes-book-card .nes-cover { margin-bottom: 1.1rem; }
.nes-book-card:hover .nes-cover { transform: translateY(-6px); }
.nes-book-card h3 { margin: 0.2em 0 0.25em; color: var(--nes-white); }
.nes-book-card p { color: var(--nes-muted); font-size: 0.98rem; margin: 0; }

/* Method strip ("every chapter is an incident file") */
.nes-method { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: step; position: relative; }
.nes-method::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: var(--nes-teal-line); opacity: 0.6; }
.nes-method__step { position: relative; padding: 36px 24px 0 0; }
.nes-method__step::before { content: ""; position: absolute; left: 0; top: 0; width: 16px; height: 16px; border-radius: 50%; background: #e3e8ee; box-shadow: 0 0 0 5px var(--nes-navy); }
.nes-method__step:nth-child(3)::before { background: var(--nes-yellow); }
.nes-method__step .nes-pill { margin-bottom: 1rem; }
.nes-method__step h3 { font-size: 1.2rem; margin-bottom: 0.4em; }
.nes-method__step p { color: var(--nes-muted); font-size: 0.98rem; margin: 0; }
@media (max-width: 860px) {
	.nes-method { grid-template-columns: 1fr 1fr; row-gap: 40px; }
	.nes-method::before { display: none; }
}
@media (max-width: 520px) { .nes-method { grid-template-columns: 1fr; } }

/* Author */
.nes-author { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.nes-author__photo { width: 200px; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 3px solid var(--nes-teal); box-shadow: 0 0 40px rgba(66, 211, 198, 0.25); background: #112943; display: grid; place-items: center; }
.nes-author__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nes-author__initials { font-family: var(--nes-mono); font-weight: 500; color: var(--nes-teal); font-size: 2.6rem; letter-spacing: 0.04em; }
.nes-author h2 { margin-bottom: 0.6em; }
.nes-author__bio { font-size: 1.08rem; max-width: 40em; }
@media (max-width: 680px) {
	.nes-author { grid-template-columns: 1fr; }
	.nes-author__photo { width: 140px; }
}

/* CTA band */
.nes-cta { text-align: center; padding: clamp(56px, 8vw, 96px) var(--nes-gutter); border: 1px solid var(--nes-line); border-radius: 24px; background: radial-gradient(ellipse 70% 120% at 50% 0%, rgba(20, 55, 74, 0.9), rgba(10, 20, 48, 0.6) 70%); }
.nes-cta h2 { margin-bottom: 0.4em; }
.nes-cta p { color: var(--nes-muted); max-width: 36em; margin-left: auto; margin-right: auto; }
.nes-cta .nes-actions { justify-content: center; margin-top: 1.8rem; }

/* ---------- Article cards ---------- */
.nes-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.nes-card {
	display: flex; flex-direction: column;
	background: rgba(14, 26, 58, 0.7);
	border: 1px solid var(--nes-line);
	border-radius: 16px;
	overflow: hidden;
	transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}
.nes-card:hover { border-color: rgba(66, 211, 198, 0.5); transform: translateY(-3px); background: rgba(19, 36, 74, 0.8); }
.nes-card__thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--nes-glow); }
.nes-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nes-card__body { padding: 26px 26px 28px; display: flex; flex-direction: column; flex: 1; }
.nes-card__meta { font-family: var(--nes-mono); font-size: 0.76rem; color: var(--nes-slate); margin-bottom: 0.9rem; letter-spacing: 0.03em; }
.nes-card__meta a { color: var(--nes-teal); text-decoration: none; }
.nes-card h3 { font-size: 1.35rem; margin-bottom: 0.5em; }
.nes-card h3 a { color: var(--nes-white); text-decoration: none; }
.nes-card h3 a::after { content: ""; position: absolute; inset: 0; }
.nes-card { position: relative; }
.nes-card__excerpt { color: var(--nes-muted); font-size: 0.98rem; margin: 0 0 1.2rem; }
.nes-card__excerpt p { margin: 0; }
.nes-card__more { margin-top: auto; font-family: var(--nes-mono); font-size: 0.8rem; color: var(--nes-teal); }

/* ---------- Page / article headers ---------- */
.nes-page-head { padding: clamp(36px, 6vw, 80px) 0 clamp(28px, 4vw, 48px); }
.nes-page-head h1 { margin-bottom: 0.3em; }
.nes-page-head--center { text-align: center; }
.nes-page-head--center .nes-rule { margin-left: auto; margin-right: auto; }
.nes-page-head .nes-mono-line { color: var(--nes-slate); }
.nes-featured { margin: 0 0 clamp(32px, 5vw, 56px); border-radius: 16px; overflow: hidden; border: 1px solid var(--nes-line); }
.nes-featured img { display: block; width: 100%; }

/* ---------- Single book ---------- */
.nes-book-hero { padding: clamp(28px, 5vw, 64px) 0 clamp(48px, 7vw, 88px); position: relative; isolation: isolate; }
.nes-book-hero::before { content: ""; position: absolute; inset: -84px 0 0; z-index: -1; background: radial-gradient(ellipse 50% 70% at 25% 45%, rgba(20, 55, 74, 0.95), transparent 70%); }
.nes-book-hero__grid { display: grid; grid-template-columns: minmax(220px, 380px) minmax(0, 1fr); gap: clamp(36px, 6vw, 88px); align-items: center; }
.nes-book-hero h1 { font-size: clamp(2.4rem, 5vw, 3.8rem); margin-bottom: 0.25em; }
.nes-formats { margin: 1rem 0 0; font-family: var(--nes-mono); font-size: 0.8rem; color: var(--nes-slate); }
@media (max-width: 800px) {
	.nes-book-hero__grid { grid-template-columns: 1fr; }
	.nes-book-hero__grid .nes-cover { max-width: 260px; }
}
.nes-book-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(36px, 6vw, 80px); align-items: start; }
.nes-book-body .nes-content > :first-child { margin-top: 0; }
@media (max-width: 900px) { .nes-book-body { grid-template-columns: 1fr; } }
.nes-panel { background: rgba(14, 26, 58, 0.75); border: 1px solid var(--nes-line); border-radius: 16px; padding: 28px; position: sticky; top: 24px; }
.nes-panel h2 { font-size: 0.8rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--nes-white); margin-bottom: 1.2rem; font-weight: 700; }
.nes-panel + .nes-panel { margin-top: 20px; position: static; }

/* "Inside you will learn" list: nodes on a line */
.nes-learn { list-style: none; margin: 0; padding: 0; position: relative; }
.nes-learn::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; background: var(--nes-teal-line); opacity: 0.6; }
.nes-learn li { position: relative; padding: 0 0 0.95rem 32px; color: var(--nes-text); font-size: 0.98rem; line-height: 1.5; }
.nes-learn li::before { content: ""; position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #e3e8ee; box-shadow: 0 0 0 4px var(--nes-navy-2); }
.nes-learn li:last-child { padding-bottom: 0; }
.nes-learn li:last-child::before { background: var(--nes-yellow); }

/* ---------- Post content ---------- */
.nes-content { color: var(--nes-text); }
.nes-content > * { margin-top: 0; }
.nes-content h2 { margin-top: 2.2em; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.nes-content h3 { margin-top: 1.9em; }
.nes-content h2::before { content: ""; display: block; width: 56px; height: 3px; border-radius: 2px; background: var(--nes-teal); margin-bottom: 0.7em; }
.nes-content ul, .nes-content ol { padding-left: 1.3em; margin: 0 0 1.3em; }
.nes-content li { margin-bottom: 0.45em; }
.nes-content li::marker { color: var(--nes-teal); }
.nes-content img { border-radius: 10px; }
.nes-content figure { margin: 2em 0; }
.nes-content figcaption, .wp-element-caption { color: var(--nes-slate); font-family: var(--nes-mono); font-size: 0.78rem; margin-top: 0.7em; text-align: center; }
.nes-content hr, .wp-block-separator { border: 0; height: 3px; width: 120px; background: var(--nes-teal); border-radius: 2px; margin: 3em auto; opacity: 1; }
.nes-content hr.is-style-wide, .wp-block-separator.is-style-wide { width: 100%; height: 1px; background: var(--nes-line); }
.nes-content blockquote, .wp-block-quote {
	margin: 2em 0; padding: 0.4em 0 0.4em 1.4em;
	border-left: 3px solid var(--nes-teal);
	color: var(--nes-white); font-size: 1.2rem; line-height: 1.5;
}
.nes-content blockquote cite, .wp-block-quote cite { display: block; margin-top: 0.8em; color: var(--nes-slate); font-family: var(--nes-mono); font-size: 0.78rem; font-style: normal; }
.wp-block-pullquote { border-top: 3px solid var(--nes-teal); border-bottom: 1px solid var(--nes-line); padding: 2em 0; text-align: center; }
.wp-block-pullquote blockquote { border: 0; padding: 0; font-size: 1.5rem; font-weight: 700; }

.nes-content :not(pre) > code {
	background: rgba(66, 211, 198, 0.1); color: var(--nes-teal);
	padding: 0.15em 0.45em; border-radius: 6px; font-size: 0.85em;
}
.nes-content pre, .wp-block-code, .wp-block-preformatted {
	background: var(--nes-abyss);
	color: #d7e0ee;
	border: 1px solid var(--nes-line);
	border-top: 3px solid var(--nes-teal);
	border-radius: 10px;
	padding: 1.2em 1.4em;
	overflow-x: auto;
	line-height: 1.6;
	font-size: 0.86rem;
	margin: 1.8em 0;
}
.wp-block-code code { background: none; color: inherit; padding: 0; }

.nes-content table, .wp-block-table table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.wp-block-table { margin: 2em 0; overflow-x: auto; }
.nes-content th, .nes-content td { padding: 0.75em 1em; border-bottom: 1px solid var(--nes-line); text-align: left; vertical-align: top; }
.nes-content th { color: var(--nes-white); font-family: var(--nes-mono); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 2px solid var(--nes-teal-line); }
.nes-content td code { white-space: nowrap; }
.wp-block-table thead, .wp-block-table tfoot { border: 0; }
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: rgba(14, 26, 58, 0.6); }
.wp-block-table.is-style-stripes { border: 0; }

.alignwide { width: min(1040px, 100vw - 2 * var(--nes-gutter)); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.alignfull { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.alignleft { float: left; margin: 0.3em 1.5em 1em 0; }
.alignright { float: right; margin: 0.3em 0 1em 1.5em; }
.aligncenter { margin-left: auto; margin-right: auto; }

/* Pattern: incident file */
.nes-incident { border: 1px solid var(--nes-line); border-radius: 16px; overflow: hidden; margin: 2.2em 0; background: rgba(5, 10, 20, 0.55); }
.nes-incident > .wp-block-group__inner-container, .nes-incident { padding: 0; }
.nes-incident__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--nes-line); background: rgba(20, 55, 74, 0.45); margin: 0 !important; }
.nes-incident__head p { margin: 0 !important; font-family: var(--nes-mono); font-size: 0.8rem; color: var(--nes-white); letter-spacing: 0.05em; }
.nes-incident dl, .nes-incident__rows { margin: 0; padding: 6px 20px 14px; }
.nes-incident__row { display: grid !important; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--nes-line); margin: 0 !important; }
.nes-incident__row:last-child { border-bottom: 0; }
.nes-incident__row > * { margin: 0 !important; }
.nes-incident__label { font-family: var(--nes-mono); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--nes-teal); padding-top: 0.2em; }
@media (max-width: 560px) { .nes-incident__row { grid-template-columns: 1fr; gap: 4px; } }

/* Pattern: takeaway callout */
.nes-callout { border-left: 3px solid var(--nes-yellow); background: rgba(244, 201, 99, 0.07); border-radius: 0 12px 12px 0; padding: 1.2em 1.4em; margin: 2em 0; }
.nes-callout > :last-child { margin-bottom: 0; }
.nes-callout .nes-callout__label { font-family: var(--nes-mono); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--nes-yellow); margin-bottom: 0.5em; }

/* Post footer: tags, nav */
.nes-post-foot { margin-top: clamp(40px, 6vw, 64px); padding-top: 28px; border-top: 1px solid var(--nes-line); }
.nes-post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.nes-post-nav a { display: block; padding: 18px 20px; border: 1px solid var(--nes-line); border-radius: 14px; text-decoration: none; color: var(--nes-white); font-weight: 700; line-height: 1.35; }
.nes-post-nav a:hover { border-color: rgba(66, 211, 198, 0.5); background: var(--nes-teal-soft); }
.nes-post-nav span { display: block; font-family: var(--nes-mono); font-size: 0.74rem; color: var(--nes-teal); font-weight: 400; margin-bottom: 6px; }
.nes-post-nav .nes-post-nav__next { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .nes-post-nav { grid-template-columns: 1fr; } .nes-post-nav .nes-post-nav__next { grid-column: 1; text-align: left; } }

/* Pagination */
.nes-pagination { margin-top: 56px; }
.nes-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.nes-pagination .page-numbers { font-family: var(--nes-mono); font-size: 0.85rem; min-width: 44px; height: 44px; padding: 0 14px; display: inline-grid; place-items: center; border-radius: 999px; color: var(--nes-text); text-decoration: none; border: 1px solid var(--nes-line); }
.nes-pagination .page-numbers.current { background: var(--nes-pill); color: var(--nes-ink); border-color: var(--nes-pill); }
.nes-pagination a.page-numbers:hover { border-color: var(--nes-teal); color: var(--nes-white); }

/* Forms */
input[type="text"], input[type="email"], input[type="url"], input[type="search"], input[type="password"], textarea, select {
	width: 100%;
	background: var(--nes-abyss);
	color: var(--nes-white);
	border: 1px solid var(--nes-line);
	border-radius: 12px;
	padding: 0.85em 1em;
	font: inherit;
	font-size: 1rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--nes-teal); box-shadow: 0 0 0 3px var(--nes-teal-soft); }
label { color: var(--nes-white); font-weight: 700; font-size: 0.95rem; }
.search-form { display: flex; gap: 10px; max-width: 520px; }
.search-form label { flex: 1; }
.nes-page-head--center .search-form { margin: 1.5rem auto 0; }

/* Comments */
.nes-comments { margin-top: 64px; }
.nes-comments .comment-list { list-style: none; padding: 0; margin: 0 0 40px; }
.nes-comments .comment-list .children { list-style: none; padding-left: 28px; border-left: 2px solid var(--nes-line); }
.nes-comments .comment-body { padding: 20px 0; border-bottom: 1px solid var(--nes-line); }
.nes-comments .comment-meta { font-family: var(--nes-mono); font-size: 0.78rem; color: var(--nes-slate); margin-bottom: 0.6em; }
.nes-comments .comment-meta a { color: var(--nes-slate); text-decoration: none; }
.nes-comments .comment-author { color: var(--nes-white); font-family: var(--nes-sans); font-size: 1rem; font-weight: 700; }
.nes-comments .comment-author img { border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.nes-comments .says { display: none; }
.nes-comments .reply a { font-family: var(--nes-mono); font-size: 0.78rem; }
.comment-form p { margin-bottom: 1em; }

/* 404 */
.nes-404 { text-align: center; padding: clamp(48px, 10vw, 140px) 0; }
.nes-404 .nes-ring { width: 8rem; height: 8rem; font-size: 1.5rem; margin-bottom: 2rem; }
.nes-404 .nes-pills { justify-content: center; }

/* ---------- Footer ---------- */
.nes-footer { margin-top: clamp(64px, 9vw, 120px); padding: 56px 0 40px; border-top: 1px solid var(--nes-line); background: linear-gradient(180deg, transparent, var(--nes-abyss)); }
.nes-footer__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.nes-footer p { color: var(--nes-muted); font-size: 0.95rem; max-width: 30em; }
.nes-footer__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: flex-end; }
.nes-footer__nav a { color: var(--nes-text); text-decoration: none; font-weight: 700; font-size: 0.95rem; }
.nes-footer__nav a:hover { color: var(--nes-teal); }
.nes-footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--nes-line); font-family: var(--nes-mono); font-size: 0.75rem; color: var(--nes-slate); }
.nes-footer__base a { color: var(--nes-slate); }
@media (max-width: 720px) { .nes-footer__grid { grid-template-columns: 1fr; } .nes-footer__nav ul { justify-content: flex-start; } }

/* WordPress core classes */
.sticky .nes-card__meta::before { content: "pinned · "; color: var(--nes-yellow); }
.bypostauthor > .comment-body .comment-author { color: var(--nes-teal); }
.gallery-caption { color: var(--nes-slate); }
.wp-block-image img { border-radius: 10px; }
.has-text-align-center { text-align: center; }

/* Patterns inside content: keep the CTA band's rule centred */
.nes-content .nes-cta h2::before { margin-left: auto; margin-right: auto; }
.nes-content .nes-cta .wp-block-buttons { justify-content: center; }
.nes-content .nes-cta .nes-eyebrow { margin-bottom: 0.8rem; }

/* Palette helper classes for the block editor */
.has-navy-color { color: #0a1430; } .has-navy-background-color { background-color: #0a1430; }
.has-abyss-color { color: #050a14; } .has-abyss-background-color { background-color: #050a14; }
.has-teal-color { color: #42d3c6; } .has-teal-background-color { background-color: #42d3c6; }
.has-yellow-color { color: #f4c963; } .has-yellow-background-color { background-color: #f4c963; }
.has-pill-color { color: #f4f6f3; } .has-pill-background-color { background-color: #f4f6f3; }
.has-muted-color { color: #9fb0d4; } .has-slate-color { color: #6f84ad; }
.has-mono-font-family { font-family: var(--nes-mono); }

/* Override core table borders */
.nes-content .wp-block-table td, .nes-content .wp-block-table th { border: 0; border-bottom: 1px solid var(--nes-line); }
.nes-content .wp-block-table th { border-bottom: 2px solid var(--nes-teal-line); }

/* Contact line */
.nes-cta .nes-cta__line { color: var(--nes-text); font-size: 1.15rem; margin-bottom: 0; }
.nes-cta .nes-cta__line a { color: var(--nes-teal); font-weight: 700; white-space: nowrap; }
.nes-cta .nes-cta__line a:hover { color: var(--nes-white); }
