/*
 * Midnight Navy — Andres Berejnoi child theme.
 * Loaded after blogfeedly/style.css.
 */

:root {
  --radius: 14px;
  --maxw: 1180px;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.38);
}

body.theme-midnight {
  --bg: #071629;
  --surface: #0d2340;
  --surface-2: #12315a;
  --text: #e9f2ff;
  --muted: #9fb6d4;
  --accent: #6fb7ff;
  --accent-2: #2f7fd1;
  --brown: #c69c6d;
  --border: rgba(148, 190, 255, 0.16);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.38);
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.theme-midnight h1,
body.theme-midnight h2,
body.theme-midnight h3,
body.theme-midnight h4,
body.theme-midnight h5,
body.theme-midnight h6,
body.theme-midnight .brand-name,
body.theme-midnight .btn,
body.theme-midnight .nav,
body.theme-midnight .eyebrow {
  font-family: 'Karla', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Headings must stay light; the parent theme ships a dark heading color. */
body.theme-midnight h1,
body.theme-midnight h2,
body.theme-midnight h3,
body.theme-midnight h4,
body.theme-midnight h5,
body.theme-midnight h6,
body.theme-midnight .entry-content h1,
body.theme-midnight .entry-content h2,
body.theme-midnight .entry-content h3,
body.theme-midnight .entry-content h4,
body.theme-midnight .entry-title,
body.theme-midnight .post-body h3,
body.theme-midnight .section-head h2,
body.theme-midnight .page-intro h1,
body.theme-midnight .archive-group h3 {
  color: var(--text);
}

body.theme-midnight .post-body h3 a,
body.theme-midnight .entry-content h1 a,
body.theme-midnight .entry-content h2 a,
body.theme-midnight .entry-content h3 a,
body.theme-midnight .entry-content h4 a,
body.theme-midnight .archive-group li a {
  color: var(--text);
}
body.theme-midnight .post-body h3 a:hover,
body.theme-midnight .entry-content h1 a:hover,
body.theme-midnight .entry-content h2 a:hover,
body.theme-midnight .entry-content h3 a:hover,
body.theme-midnight .entry-content h4 a:hover,
body.theme-midnight .archive-group li a:hover {
  color: var(--accent);
}

body.theme-midnight a { color: inherit; text-decoration: none; }
body.theme-midnight img { display: block; max-width: 100%; height: auto; }

body.theme-midnight .container {
  width: min(var(--maxw), calc(100% - 40px));
  margin-inline: auto;
}

body.theme-midnight .screen-reader-text,
body.theme-midnight .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.theme-midnight .skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100000;
  padding: 10px 16px;
  background: var(--accent);
  color: #04101f;
  border-radius: 999px;
  font-weight: 700;
}
body.theme-midnight .skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
body.theme-midnight .site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0;
  text-align: left;
  background: rgba(7, 22, 41, 0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
body.admin-bar .site-header { top: 32px; }

body.theme-midnight .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 60px;
}
body.theme-midnight.newsletter-landing-page .header-inner {
  justify-content: center;
}
body.theme-midnight .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
body.theme-midnight .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface);
}
body.theme-midnight .brand-name {
  display: block;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
body.theme-midnight .brand-tagline {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

body.theme-midnight .nav { display: flex; align-items: center; }
body.theme-midnight .nav-list {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
body.theme-midnight .nav-list li { position: relative; }
body.theme-midnight .nav-list a {
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.15s ease;
}
body.theme-midnight .nav-list a:hover,
body.theme-midnight .nav-list .current-menu-item > a,
body.theme-midnight .nav-list .current_page_item > a {
  color: var(--accent);
}
body.theme-midnight .nav-list .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  margin: 10px 0 0;
  padding: 10px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
}
body.theme-midnight .nav-list li:hover > .sub-menu,
body.theme-midnight .nav-list li:focus-within > .sub-menu { display: block; }
body.theme-midnight .nav-list .sub-menu a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
}
body.theme-midnight .nav-list .sub-menu a:hover { background: var(--surface-2); }
body.theme-midnight .menu-toggle { display: none; }

/* ---------- Layout ---------- */
body.theme-midnight .site-content { padding: 0; }
body.theme-midnight .site-main { padding-bottom: 24px; }
body.theme-midnight #page { overflow-x: clip; }

/* ---------- Hero ---------- */
body.theme-midnight .hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 42px;
  align-items: end;
  padding: 58px 0 26px;
}
body.theme-midnight .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brown);
}
body.theme-midnight .hero h1 {
  margin: 0.35em 0;
  font-size: clamp(2.2rem, 4.4vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
body.theme-midnight .hero p {
  margin: 0;
  color: var(--muted);
  max-width: 58ch;
  font-size: 1.02rem;
}
body.theme-midnight .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
body.theme-midnight .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform 0.15s ease, filter 0.15s ease;
}
body.theme-midnight .btn:hover { transform: translateY(-2px); }
body.theme-midnight .btn-primary { background: var(--accent); color: #04101f; }
body.theme-midnight .btn-ghost { border-color: var(--border); color: var(--text); }

body.theme-midnight .hero-feature {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}
body.theme-midnight .hero-feature img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
body.theme-midnight .hero-feature-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
}
body.theme-midnight .hero-feature-body { padding: 16px 18px 18px; }
body.theme-midnight .hero-feature-body span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brown);
  font-weight: 700;
}
body.theme-midnight .hero-feature-body a {
  display: block;
  margin-top: 6px;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.3;
}
body.theme-midnight .hero-feature-body a:hover { color: var(--accent); }

/* ---------- Section headers ---------- */
body.theme-midnight .section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 48px 0 18px;
}
body.theme-midnight .section-head h2 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}
body.theme-midnight .section-head a {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
}
body.theme-midnight .section-head a:hover { text-decoration: underline; }

/* ---------- Post cards ---------- */
body.theme-midnight .post-grid { display: grid; gap: 16px; }
body.theme-midnight .midnight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.theme-midnight .post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
body.theme-midnight .post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
body.theme-midnight .midnight-grid .post-card {
  display: grid;
  grid-template-columns: 42% 1fr;
  min-height: 200px;
}
body.theme-midnight .post-thumb { display: block; height: 100%; }
body.theme-midnight .midnight-grid .post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body.theme-midnight .post-thumb-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 170px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
}
body.theme-midnight .post-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 15px 17px 16px;
}
body.theme-midnight .post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
body.theme-midnight .post-meta .cat,
body.theme-midnight .post-meta a { color: var(--brown); font-weight: 700; }
body.theme-midnight .post-body h3 {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
body.theme-midnight .post-body h3 a:hover { color: var(--accent); }
body.theme-midnight .post-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}
body.theme-midnight .read-more {
  margin-top: auto;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}
body.theme-midnight .read-more:hover { text-decoration: underline; }

/* ---------- Newsletter ---------- */
body.theme-midnight .newsletter {
  margin: 58px 0;
  padding: 34px;
  border-radius: calc(var(--radius) + 6px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
}
body.theme-midnight .newsletter-band {
  margin: 58px 0 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}
body.theme-midnight .newsletter-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
}
body.theme-midnight .newsletter h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
body.theme-midnight .newsletter p { margin: 0; color: var(--muted); font-size: 0.94rem; }
body.theme-midnight .newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
body.theme-midnight .newsletter-form input[type="email"] {
  flex: 1 1 220px;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}
body.theme-midnight .newsletter-form input[type="email"]::placeholder { color: var(--muted); }
body.theme-midnight .newsletter-form button {
  padding: 13px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--brown);
  color: #1a1008;
  font-family: 'Karla', sans-serif;
  font-weight: 900;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}
body.theme-midnight .newsletter-form button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
body.theme-midnight .form-note {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}
body.theme-midnight .topic-choices {
  flex-basis: 100%;
  margin: 6px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}
body.theme-midnight .topic-choices legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.82rem;
}
body.theme-midnight .topic-choices label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
body.theme-midnight .topic-choices input { accent-color: var(--accent); }

/* The legacy site-wide ConvertKit form is replaced by the native form. */
body.theme-midnight form[data-sv-form="2899455"],
body.theme-midnight .formkit-form[data-sv-form="2899455"] {
  display: none !important;
}

/* ---------- Newsletter landing ---------- */
body.theme-midnight .newsletter-landing {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 56px 0;
}
body.theme-midnight .newsletter-card {
  width: min(640px, 100%);
  padding: 42px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
body.theme-midnight .newsletter-card .brand-mark {
  margin: 0 auto 18px;
  width: 64px;
  height: 64px;
}
body.theme-midnight .newsletter-card h1 {
  margin: 0 0 12px;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
body.theme-midnight .newsletter-card > p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}
body.theme-midnight .newsletter-card .newsletter-form { justify-content: center; }
body.theme-midnight .newsletter-card .newsletter-form input[type="email"] { flex-basis: 100%; }
body.theme-midnight .newsletter-card .newsletter-form button { flex: 1 1 100%; }
body.theme-midnight .newsletter-card .newsletter-form .form-note { text-align: center; }
body.theme-midnight .newsletter-social {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}
body.theme-midnight .newsletter-social a { color: var(--accent); }
body.theme-midnight .newsletter-social a:hover { text-decoration: underline; }
body.theme-midnight .newsletter-card .back {
  display: inline-block;
  margin-top: 18px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}
body.theme-midnight .newsletter-card .back:hover { text-decoration: underline; }

/* ---------- Archive ---------- */
body.theme-midnight .archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  margin: 26px 0 10px;
}
body.theme-midnight .archive-group h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brown);
  font-size: 1.02rem;
}
body.theme-midnight .archive-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
body.theme-midnight .archive-group li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}
body.theme-midnight .archive-group time {
  white-space: nowrap;
  font-size: 0.76rem;
  color: var(--muted);
}
body.theme-midnight .archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
body.theme-midnight .archive-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}
body.theme-midnight .archive-list a { color: var(--muted); }
body.theme-midnight .archive-list a:hover { color: var(--accent); }
body.theme-midnight .archive-description {
  margin-top: 12px;
  color: var(--muted);
}
body.theme-midnight .archive-post-list {
  list-style: none;
  margin: 26px 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
body.theme-midnight .archive-post-list li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
body.theme-midnight .archive-post-list a { color: var(--text); font-weight: 700; }
body.theme-midnight .archive-post-list a:hover { color: var(--accent); }
body.theme-midnight .archive-post-list time {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---------- Page intro ---------- */
body.theme-midnight .page-intro {
  max-width: 780px;
  padding: 52px 0 10px;
}
body.theme-midnight .page-intro h1 {
  margin: 0.25em 0 0.3em;
  font-size: clamp(2rem, 3.6vw, 3rem);
  letter-spacing: -0.03em;
}
body.theme-midnight .page-intro p { margin: 0; color: var(--muted); }

/* ---------- Social links page ---------- */
body.theme-midnight .social-page-container { max-width: 1080px; }
body.theme-midnight .social-intro {
  max-width: 780px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.98rem;
}
body.theme-midnight .social-intro p { margin: 0 0 10px; }
body.theme-midnight .social-intro a { color: var(--accent); }
body.theme-midnight .social-intro a:hover { text-decoration: underline; }
body.theme-midnight .social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 8px 0 30px;
  align-items: stretch;
}
body.theme-midnight .social-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
body.theme-midnight .social-card h4 {
  margin: 0;
  padding: 16px 18px 0;
  font-size: 1.1rem;
  line-height: 1.3;
}
body.theme-midnight .social-card h4 a { color: var(--text); }
body.theme-midnight .social-card h4 a:hover { color: var(--accent); }
body.theme-midnight .social-card .wp-block-media-text {
  display: block;
  margin: 12px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body.theme-midnight .social-card .wp-block-media-text__media {
  margin: 0;
  width: 100%;
}
body.theme-midnight .social-card .wp-block-media-text__media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0;
}
body.theme-midnight .social-card .wp-block-media-text__content { padding: 14px 18px 18px; }
body.theme-midnight .social-card .wp-block-media-text__content p {
  margin: 0 0 0.8em;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
body.theme-midnight .social-card .wp-block-media-text__content p:last-child { margin-bottom: 0; }
body.theme-midnight .social-card .wp-block-media-text__content a { color: var(--accent); }
body.theme-midnight .social-card .sharedaddy,
body.theme-midnight .social-card .sd-sharing,
body.theme-midnight .social-card .jp-relatedposts { display: none !important; }
body.theme-midnight .social-subhead {
  margin: 8px 0 14px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

/* ---------- Article / page ---------- */
body.theme-midnight .article-container { max-width: 840px; }
body.theme-midnight .page-container { max-width: 860px; }
body.theme-midnight .article { margin-top: 34px; }
body.theme-midnight .article-header { margin-bottom: 22px; }
body.theme-midnight .entry-title {
  margin: 0.2em 0 0.3em;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}
body.theme-midnight .article-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}
body.theme-midnight .article-image { margin: 26px 0; }
body.theme-midnight .article-image img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
body.theme-midnight .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0;
}
body.theme-midnight .tags a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
}
body.theme-midnight .tags a:hover { color: var(--accent); border-color: var(--accent); }

body.theme-midnight .entry-content {
  color: var(--text);
  font-size: 1.02rem;
}
body.theme-midnight .entry-content > * { margin-top: 0; }
body.theme-midnight .entry-content h2,
body.theme-midnight .entry-content h3,
body.theme-midnight .entry-content h4 {
  margin: 1.7em 0 0.5em;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
body.theme-midnight .entry-content h2 { font-size: 1.6rem; }
body.theme-midnight .entry-content h3 { font-size: 1.3rem; }
body.theme-midnight .entry-content p,
body.theme-midnight .entry-content ul,
body.theme-midnight .entry-content ol { margin-bottom: 1.1em; }
body.theme-midnight .entry-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.theme-midnight .entry-content a:hover { color: #a8d8ff; }
body.theme-midnight .entry-content img,
body.theme-midnight .entry-content .wp-block-image img {
  border-radius: 12px;
  height: auto;
}
body.theme-midnight .entry-content figure { margin: 1.6em 0; }
body.theme-midnight .entry-content figcaption,
body.theme-midnight .wp-caption-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}
body.theme-midnight .entry-content blockquote,
body.theme-midnight .wp-block-quote {
  margin: 1.6em 0;
  padding: 0.4em 0 0.4em 1.2em;
  border-left: 3px solid var(--brown);
  color: var(--muted);
}
body.theme-midnight .entry-content pre,
body.theme-midnight .wp-block-code {
  margin: 1.4em 0;
  padding: 16px 18px;
  overflow: auto;
  background: #04101f;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #d9e8ff;
  font-size: 0.88rem;
  line-height: 1.5;
}
body.theme-midnight .entry-content code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #04101f;
  border: 1px solid var(--border);
  font-size: 0.9em;
}
body.theme-midnight .entry-content pre code,
body.theme-midnight .wp-block-code code {
  padding: 0;
  border: 0;
  background: transparent;
}
body.theme-midnight .entry-content table,
body.theme-midnight .wp-block-table table {
  width: 100%;
  margin: 1.6em 0;
  border-collapse: collapse;
}
body.theme-midnight .entry-content th,
body.theme-midnight .entry-content td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
}
body.theme-midnight .entry-content th { background: var(--surface); }
body.theme-midnight .entry-content hr,
body.theme-midnight .wp-block-separator {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
body.theme-midnight .entry-content .alignleft { float: left; margin: 0 20px 16px 0; }
body.theme-midnight .entry-content .alignright { float: right; margin: 0 0 16px 20px; }
body.theme-midnight .entry-content .aligncenter { margin-inline: auto; }
body.theme-midnight .entry-content .wp-block-button__link {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #04101f;
  font-weight: 700;
  text-decoration: none;
}
body.theme-midnight .entry-content .wp-block-button__link:hover { filter: brightness(1.08); }
body.theme-midnight .entry-content .wp-block-group,
body.theme-midnight .entry-content .wp-block-columns {
  margin-bottom: 1.4em;
}
body.theme-midnight .entry-content .wp-block-media-text {
  margin: 24px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
body.theme-midnight .entry-content .wp-block-media-text__content { padding: 22px; }
body.theme-midnight .entry-content .wp-block-media-text img {
  border-radius: 0;
  height: 100%;
  object-fit: cover;
}
body.theme-midnight .entry-content .wp-block-media-text .wp-block-media-text__content a { color: var(--accent); }
body.theme-midnight .entry-content .wp-block-media-text h4 { margin-top: 0; }
body.theme-midnight .entry-content .wp-block-gallery { gap: 8px; }
body.theme-midnight .entry-content .wp-block-gallery img { border-radius: 8px; }

/* TOC + math + code plugins */
body.theme-midnight #toc_container,
body.theme-midnight .toc_container {
  padding: 18px 22px;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px;
}
body.theme-midnight #toc_container a,
body.theme-midnight .toc_container a { color: var(--accent) !important; }
body.theme-midnight .katex { color: var(--text); }
body.theme-midnight .syntaxhighlighter {
  padding: 14px !important;
  background: #04101f !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
}

/* ---------- Post navigation / pagination ---------- */
body.theme-midnight .post-navigation,
body.theme-midnight .navigation.pagination {
  margin: 36px 0;
}
body.theme-midnight .navigation.pagination {
  padding: 12px 0;
}
body.theme-midnight .pagination .prev,
body.theme-midnight .pagination .next {
  position: static;
  top: auto;
  left: auto;
  right: auto;
}
body.theme-midnight .post-navigation .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}
body.theme-midnight .navigation.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
body.theme-midnight .post-navigation a,
body.theme-midnight .navigation.pagination a {
  color: var(--accent);
}
body.theme-midnight .page-numbers {
  display: inline-block;
  min-width: 34px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}
body.theme-midnight .page-numbers.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #04101f;
  font-weight: 700;
}
body.theme-midnight .page-numbers:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Comments ---------- */
body.theme-midnight .comments-area {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}
body.theme-midnight .comments-title { font-size: 1.3rem; }
body.theme-midnight .comment-list { list-style: none; padding: 0; margin: 18px 0; }
body.theme-midnight .comment-list .children { list-style: none; padding-left: 22px; }
body.theme-midnight .comment-body {
  margin: 14px 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
body.theme-midnight .comment-meta { color: var(--muted); font-size: 0.8rem; }
body.theme-midnight .comment-form input,
body.theme-midnight .comment-form textarea,
body.theme-midnight .search-field {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}
body.theme-midnight .comment-form .submit,
body.theme-midnight .search-submit {
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #04101f;
  font-weight: 700;
  cursor: pointer;
}
body.theme-midnight .search-form { display: flex; gap: 8px; }

/* ---------- Footer ---------- */
body.theme-midnight .site-footer {
  padding: 28px 0 46px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
}
body.theme-midnight .footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
}
body.theme-midnight .footer-inner a:hover { color: var(--accent); }

/* ---------- Blog sidebar ---------- */
body.theme-midnight .with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 38px;
  align-items: start;
}
body.theme-midnight .blog-layout,
body.theme-midnight .archive-layout { margin-top: 10px; }
body.theme-midnight .blog-main,
body.theme-midnight .archive-main { min-width: 0; }
body.theme-midnight .blog-main .midnight-grid { grid-template-columns: 1fr; }
body.theme-midnight .single-layout {
  grid-template-columns: minmax(0, 840px) 270px;
  justify-content: space-between;
}
body.theme-midnight .single-main { min-width: 0; max-width: 840px; }
body.theme-midnight .sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
}
body.admin-bar .sidebar { top: 114px; max-height: calc(100vh - 132px); }
body.theme-midnight .sidebar-widget {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
body.theme-midnight .sidebar-title {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
body.theme-midnight .category-list,
body.theme-midnight .category-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
body.theme-midnight .category-list li {
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  line-height: 1.35;
}
body.theme-midnight .category-list li:last-child { border-bottom: 0; }
body.theme-midnight .category-list a { color: var(--muted); }
body.theme-midnight .category-list a:hover { color: var(--accent); }
body.theme-midnight .category-list .current-cat > a,
body.theme-midnight .category-list .current-cat-parent > a { color: var(--accent); }
body.theme-midnight .category-list ul.children {
  margin: 4px 0 0;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
body.theme-midnight .category-list ul.children li {
  border-bottom: 0;
  padding: 4px 0;
  font-size: 0.8rem;
}
body.theme-midnight .sidebar-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
body.theme-midnight .sidebar-links li { padding: 5px 0; font-size: 0.86rem; }
body.theme-midnight .sidebar-links a { color: var(--muted); }
body.theme-midnight .sidebar-links a:hover { color: var(--accent); }

/* Mobile category strip replaces the full category widget on small screens. */
body.theme-midnight .category-strip {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 14px;
  scrollbar-width: none;
}
body.theme-midnight .category-strip::-webkit-scrollbar { display: none; }
body.theme-midnight .category-chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
body.theme-midnight .category-chip:hover,
body.theme-midnight .category-chip.is-active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  body.theme-midnight .hero { grid-template-columns: 1fr; padding-top: 40px; }
  body.theme-midnight .hero-feature { display: none; }
  body.theme-midnight .midnight-grid { grid-template-columns: 1fr; }
  body.theme-midnight .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.theme-midnight .with-sidebar,
  body.theme-midnight .single-layout { grid-template-columns: 1fr; }
  body.theme-midnight .single-main { max-width: none; }
  body.theme-midnight .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
  }
  body.theme-midnight .category-strip { display: flex; }
  body.theme-midnight .sidebar-categories-widget { display: none; }
  body.theme-midnight .social-grid { grid-template-columns: 1fr; }
}
@media (max-width: 782px) {
  body.admin-bar .site-header { top: 46px; }
}
@media (max-width: 760px) {
  body.theme-midnight .header-inner { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  body.theme-midnight .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
  }
  body.theme-midnight .menu-toggle-icon {
    position: relative;
    display: block;
    width: 16px;
    height: 2px;
    background: currentColor;
  }
  body.theme-midnight .menu-toggle-icon::before,
  body.theme-midnight .menu-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 16px;
    height: 2px;
    background: currentColor;
  }
  body.theme-midnight .menu-toggle-icon::before { top: -5px; }
  body.theme-midnight .menu-toggle-icon::after { top: 5px; }
  body.theme-midnight .nav {
    display: none;
    width: 100%;
    overflow: visible;
  }
  body.theme-midnight .nav.is-open {
    display: flex;
    padding-top: 6px;
    border-top: 1px solid var(--border);
  }
  body.theme-midnight .nav-list {
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 2px 0;
  }
  body.theme-midnight .nav-list a { white-space: nowrap; }
  body.theme-midnight .midnight-grid .post-card { grid-template-columns: 1fr; }
  body.theme-midnight .midnight-grid .post-thumb img { aspect-ratio: 16 / 9; height: auto; }
  body.theme-midnight .newsletter,
  body.theme-midnight .newsletter-inner { grid-template-columns: 1fr; padding: 24px; }
  body.theme-midnight .archive-grid { grid-template-columns: 1fr; }
  body.theme-midnight .newsletter-card { padding: 30px 22px; }
  body.theme-midnight .sidebar { grid-template-columns: 1fr; }
  body.theme-midnight .article-container,
  body.theme-midnight .page-container { width: min(var(--maxw), calc(100% - 32px)); }
}
@media (max-width: 900px) {
  body.theme-midnight .brand-tagline { display: none; }
}
