/*
Theme Name: Zareef Modern
Theme URI: https://www.zareef.com
Author: Zareef Ahmed
Author URI: https://www.zareef.com
Description: A modern, developer-focused standalone theme for zareef.com — clean typography, monospace accents, light/dark mode, and a landing-page homepage. Built without Bootstrap/Font Awesome/jQuery.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: zareef-modern
Tags: blog, portfolio, two-columns, right-sidebar, custom-logo, custom-menu, featured-images, dark-mode, translation-ready
*/

/* ==========================================================================
   1. Design tokens (custom properties)
   ========================================================================== */
:root {
  /* Light palette (default) */
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1a202c;
  --text-muted: #4a5568;
  --text-faint: #718096;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --accent-contrast: #ffffff;
  --code-bg: #f1f5f9;
  --code-text: #0f172a;

  /* Brand colours from the legacy site header (blue + orange) */
  --brand-blue: #0077b5;
  --brand-orange: #e67e22;

  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.10);

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  --fs-300: 0.8125rem;
  --fs-400: 1rem;
  --fs-500: 1.125rem;
  --fs-600: clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);
  --fs-700: clamp(1.6rem, 1.3rem + 1.6vw, 2.1rem);
  --fs-800: clamp(2.1rem, 1.5rem + 3vw, 3.4rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 6rem;

  /* Shape */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --wrap: 1240px;
  --wrap-narrow: 760px;
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --bg-subtle: #161b22;
  --surface: #161b22;
  --surface-2: #1c2230;
  --border: #30363d;
  --border-strong: #444c56;
  --text: #e6edf3;
  --text-muted: #adbac7;
  --text-faint: #768390;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-soft: rgba(88, 166, 255, 0.12);
  --accent-contrast: #0d1117;
  --code-bg: #1c2128;
  --code-text: #e6edf3;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   2. Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-400);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-wrap: break-word;
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
svg { fill: currentColor; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: var(--fs-800); }
h2 { font-size: var(--fs-700); }
h3 { font-size: var(--fs-600); }

p, ul, ol, blockquote, pre, table { margin-bottom: var(--space-5); }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: var(--space-2); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}
pre {
  font-family: var(--font-mono);
  background: var(--code-bg);
  color: var(--code-text);
  padding: var(--space-5);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border);
  line-height: 1.55;
}
pre code { background: none; padding: 0; }

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-5);
  color: var(--text-muted);
  font-style: italic;
}

table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--border); padding: var(--space-2) var(--space-3); text-align: left; }
th { background: var(--bg-subtle); }

hr { border: none; border-top: 1px solid var(--border); margin: var(--space-8) 0; }

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

/* ==========================================================================
   3. Layout helpers
   ========================================================================== */
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.wrap-narrow { max-width: var(--wrap-narrow); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; text-decoration: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.mono { font-family: var(--font-mono); }
.kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-300);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

/* ==========================================================================
   4. Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--fs-400);
  padding: 0.7em 1.3em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-hover); color: var(--accent-contrast); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--bg-subtle); color: var(--text); border-color: var(--accent); }

/* ==========================================================================
   5. Site header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: 64px;
}
.site-brand { font-weight: 800; font-size: 1.9rem; letter-spacing: -0.03em; color: var(--brand-blue); white-space: nowrap; max-width: min(48vw, 520px); overflow: hidden; text-overflow: ellipsis; }
.site-brand:hover { text-decoration: none; color: var(--brand-blue); opacity: 0.85; }
.site-brand .dot { color: inherit; }
:root[data-theme="dark"] .site-brand { color: #fff; }
:root[data-theme="dark"] .site-brand:hover { color: #fff; }
.custom-logo { max-height: 40px; width: auto; }

.primary-nav { margin-left: auto; }
.primary-nav ul { list-style: none; display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: 0; }
.primary-nav li { margin: 0; }
.primary-nav a {
  display: block;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}
.primary-nav a:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }

.theme-toggle, .nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg, .nav-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

.nav-toggle { display: none; }

/* Mobile nav */
@media (max-width: 768px) {
  .nav-toggle { display: inline-flex; order: 3; }
  .primary-nav {
    order: 4;
    flex-basis: 100%;
    margin-left: 0;
    display: none;
    padding-bottom: var(--space-4);
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: var(--space-1); }
  .primary-nav a { padding: var(--space-3); }
  .site-header__inner { flex-wrap: wrap; }
  .site-brand { margin-right: auto; max-width: 62vw; font-size: 1.5rem; }
}

/* ==========================================================================
   6. Hero / landing sections
   ========================================================================== */
.section { padding-block: var(--space-10); }
.section--tight { padding-block: var(--space-8); }
.section__head { margin-bottom: var(--space-6); }
.section__head h2 { margin-top: var(--space-2); }
.section__link { float: right; font-weight: 600; font-family: var(--font-mono); font-size: var(--fs-300); }

.hero { padding-block: clamp(3rem, 8vw, 6rem); }
.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-8);
  align-items: center;
}
.hero h1 { margin: var(--space-3) 0 var(--space-4); }
.hero__lead { font-size: var(--fs-500); color: var(--text-muted); max-width: 46ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* Terminal motif */
.terminal {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #adbac7;
}
.terminal__bar { display: flex; align-items: center; gap: 6px; padding: 0.7rem 1rem; background: #161b22; border-bottom: 1px solid #30363d; }
.terminal__dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal__dot--r { background: #ff5f56; }
.terminal__dot--y { background: #ffbd2e; }
.terminal__dot--g { background: #27c93f; }
.terminal__title { margin-left: auto; font-size: 0.78rem; color: #768390; }
.terminal__body { padding: 1.2rem 1.3rem; line-height: 1.9; }
.terminal__body .prompt { color: #58a6ff; }
.terminal__body .cmd { color: #e6edf3; }
.terminal__body .out { color: #768390; }
.terminal__body .tok { color: #7ee787; }
.terminal__cursor { display: inline-block; width: 8px; height: 1.05em; background: #58a6ff; vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Topics */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: var(--space-4);
}
.topic-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.topic-card:hover { text-decoration: none; color: var(--text); border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.topic-card__name { font-weight: 700; font-size: var(--fs-500); }
.topic-card__count { font-family: var(--font-mono); font-size: var(--fs-300); color: var(--text-faint); }

/* About band */
.about-band { background: var(--bg-subtle); border-block: 1px solid var(--border); }
.about-band__inner { display: grid; grid-template-columns: auto 1fr; gap: var(--space-6); align-items: center; }
.about-band__avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: var(--shadow); }

/* CTA band */
.cta-band {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--accent-contrast);
  border-radius: var(--radius);
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, 0.85); max-width: 50ch; margin-inline: auto; }
.cta-band .btn--primary { background: #fff; color: var(--accent); }
.cta-band .btn--primary:hover { background: rgba(255, 255, 255, 0.9); color: var(--accent); }
.cta-band .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.cta-band .btn--ghost:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.cta-band__actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; margin-top: var(--space-5); }

/* ==========================================================================
   7. Post grid & cards
   ========================================================================== */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: var(--space-6);
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-subtle); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.card:hover .card__media img { transform: scale(1.04); }
.card__body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); flex: 1; }
.card__eyebrow { font-family: var(--font-mono); font-size: var(--fs-300); text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.card__eyebrow a { color: inherit; }
.card__title { font-size: var(--fs-600); line-height: 1.25; }
.card__title a { color: var(--text); }
.card__title a:hover { color: var(--accent); text-decoration: none; }
.card__excerpt { color: var(--text-muted); font-size: 0.95rem; flex: 1; }
.card__meta { font-family: var(--font-mono); font-size: var(--fs-300); color: var(--text-faint); }

/* ==========================================================================
   8. Blog layout (home/archive/search with sidebar)
   ========================================================================== */
.content-area { padding-block: var(--space-8); }
.with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-8);
  align-items: start;
}
@media (max-width: 900px) {
  .with-sidebar { grid-template-columns: 1fr; }
}
.page-title { margin-bottom: var(--space-6); }
.page-title .kicker { display: block; margin-bottom: var(--space-2); }

/* Sidebar */
.sidebar { position: sticky; top: 88px; display: flex; flex-direction: column; gap: var(--space-6); }
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
}
.widget-title { font-size: var(--fs-500); margin-bottom: var(--space-4); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border); }
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li { margin-bottom: var(--space-2); }
.widget a { color: var(--text-muted); }
.widget a:hover { color: var(--accent); }
.widget .tagcloud { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.widget .tag-cloud-link {
  display: inline-block;
  font-size: 0.8rem !important;
  font-family: var(--font-mono);
  padding: 0.25em 0.7em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}
.widget .tag-cloud-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
@media (max-width: 900px) { .sidebar { position: static; } }

/* ==========================================================================
   9. Single post & pages
   ========================================================================== */
.entry { background: var(--surface); }
.entry-header { margin-bottom: var(--space-6); }
.entry-header .kicker { display: block; margin-bottom: var(--space-3); }
.entry-title { margin-bottom: var(--space-4); }
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-300);
  color: var(--text-faint);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.entry-meta a { color: var(--text-muted); }
.entry-featured { margin: var(--space-6) 0; border-radius: var(--radius); overflow: hidden; }
.entry-content { font-size: var(--fs-500); }
.entry-content h2 { margin-top: var(--space-8); margin-bottom: var(--space-3); }
.entry-content h3 { margin-top: var(--space-6); margin-bottom: var(--space-3); }
.entry-content img { border-radius: var(--radius-sm); margin-block: var(--space-4); }
.entry-content a { text-decoration: underline; text-underline-offset: 2px; }
.entry-footer { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.tag-links a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-300);
  padding: 0.2em 0.7em;
  margin-right: var(--space-1);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.post-nav { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--border); }
.post-nav .nav-links { display: flex; gap: var(--space-4); }
.post-nav .nav-previous, .post-nav .nav-next { flex: 1 1 0; min-width: 0; }
.post-nav a {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  height: 100%;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.post-nav a:hover { text-decoration: none; border-color: var(--accent); background: var(--bg-subtle); transform: translateY(-2px); }
.post-nav .nav-next a { text-align: right; align-items: flex-end; }
.post-nav .nav-label { font-family: var(--font-mono); font-size: var(--fs-300); color: var(--text-faint); }
.post-nav .nav-title { font-weight: 600; color: var(--text); line-height: 1.3; }
.post-nav a:hover .nav-title { color: var(--accent); }
@media (max-width: 600px) {
  .post-nav .nav-links { flex-direction: column; }
  .post-nav .nav-next a { text-align: left; align-items: flex-start; }
}

.author-byline { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-6) 0; padding: var(--space-4); background: var(--bg-subtle); border-radius: var(--radius); }
.author-byline img { width: 48px; height: 48px; border-radius: 50%; }

/* ==========================================================================
   10. Pagination
   ========================================================================== */
.pagination { margin-top: var(--space-8); }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.pagination .page-numbers:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.pagination .page-numbers.dots { border-color: transparent; }

/* ==========================================================================
   11. Comments
   ========================================================================== */
.comments-area { margin-top: var(--space-10); padding-top: var(--space-8); border-top: 1px solid var(--border); }
.comment-list { list-style: none; padding: 0; }
.comment-list ol { list-style: none; padding-left: var(--space-6); }
.comment-body { padding: var(--space-4) 0; border-bottom: 1px solid var(--border); }
.comment-author { display: flex; align-items: center; gap: var(--space-3); font-weight: 600; }
.comment-author img { border-radius: 50%; }
.comment-metadata { font-family: var(--font-mono); font-size: var(--fs-300); color: var(--text-faint); }
.comment-form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 640px; }
.comment-form p { margin: 0; }
input[type="text"], input[type="email"], input[type="url"], input[type="search"], input[type="password"], textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.6em 0.8em;
}
input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
label { font-weight: 500; font-size: 0.9rem; display: block; margin-bottom: var(--space-1); }

/* ==========================================================================
   12. Search form
   ========================================================================== */
.search-form { display: flex; gap: var(--space-2); }
.search-form .search-field { flex: 1; }
.search-form .search-submit { white-space: nowrap; }

/* ==========================================================================
   13. Footer
   ========================================================================== */
.site-footer { background: var(--bg-subtle); border-top: 1px solid var(--border); margin-top: var(--space-12); }
.footer-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-6);
  padding-block: var(--space-8);
}
.footer-widgets .widget { background: transparent; border: none; padding: 0; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  align-items: center;
  padding-block: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-faint);
}
.footer-social { display: flex; gap: var(--space-3); }
.footer-social a { color: var(--text-muted); display: inline-flex; }
.footer-social a:hover { color: var(--accent); }
.footer-social svg { width: 20px; height: 20px; }

/* ==========================================================================
   14. Misc
   ========================================================================== */
.entry-content .wp-caption,
.entry-content figure { max-width: 100%; }
.wp-caption-text, figcaption { font-size: 0.85rem; color: var(--text-faint); text-align: center; margin-top: var(--space-2); }
.sticky-badge, .alignleft { margin-right: var(--space-4); }
.alignright { float: right; margin-left: var(--space-4); }
.alignleft { float: left; }
.aligncenter { display: block; margin-inline: auto; }
.screen-reader-text {
  border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
  height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute;
}

@media (max-width: 768px) {
  .hero__grid { grid-template-columns: 1fr; }
  .about-band__inner { grid-template-columns: 1fr; text-align: center; }
  .about-band__avatar { margin-inline: auto; }
  .section__link { float: none; display: block; margin-top: var(--space-2); }
}

/* ==========================================================================
   15. Books
   ========================================================================== */
.books-intro__lead { color: var(--text-muted); font-size: var(--fs-500); max-width: 60ch; margin-top: var(--space-3); }

.book-badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.3em 0.7em;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
}

/* Books grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--space-6);
}
.book-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.book-card:hover { border-color: var(--border-strong); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.book-card__cover { position: relative; display: block; width: 100%; background: var(--bg-subtle); }
.book-card__cover img { width: 100%; height: auto; display: block; }
.book-card__placeholder { display: flex; align-items: center; justify-content: center; aspect-ratio: 2 / 3; padding: var(--space-3); font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-faint); text-align: center; }
.book-card__body { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5); flex: 1; min-width: 0; }
.book-card__series { font-family: var(--font-mono); font-size: var(--fs-300); text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.book-card__title { font-size: var(--fs-600); line-height: 1.25; }
.book-card__title a { color: var(--text); }
.book-card__title a:hover { color: var(--accent); text-decoration: none; }
.book-card__subtitle { color: var(--text-muted); font-weight: 500; }
.book-card__excerpt { color: var(--text-muted); font-size: 0.92rem; margin: 0; }
.book-card__foot { display: flex; align-items: center; gap: var(--space-4); margin-top: auto; padding-top: var(--space-3); }
.book-card__price { font-family: var(--font-mono); font-weight: 600; color: var(--text); }

/* Single book */
.back-link { display: inline-block; font-family: var(--font-mono); font-size: var(--fs-300); color: var(--text-muted); margin-bottom: var(--space-5); }
.back-link:hover { color: var(--accent); }
.book-single__grid { display: grid; grid-template-columns: 300px 1fr; gap: var(--space-8); align-items: start; }
.book-single__media { position: sticky; top: 88px; display: flex; flex-direction: column; gap: var(--space-4); }
.book-single__cover { position: relative; margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--bg-subtle); }
.book-single__cover img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.book-buy { justify-content: center; width: 100%; }
.book-meta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-5); margin: 0; }
.book-meta__row { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.book-meta__row:last-child { border-bottom: none; }
.book-meta dt { font-family: var(--font-mono); font-size: var(--fs-300); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); margin: 0; }
.book-meta dd { margin: 0; font-weight: 600; text-align: right; }
.book-single__title { margin: var(--space-2) 0 var(--space-3); }
.book-single__subtitle { font-size: var(--fs-500); color: var(--text-muted); margin-bottom: var(--space-5); }
.book-single__desc { font-size: var(--fs-500); }
.book-single__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--border); }

@media (max-width: 860px) {
  .book-single__grid { grid-template-columns: 1fr; }
  .book-single__media { position: static; max-width: 320px; }
}

/* ==========================================================================
   16. Full-width pages & galleries
   ========================================================================== */
.entry--full .entry-header { text-align: center; margin-bottom: var(--space-8); }
.entry--full .entry-header .kicker { display: block; margin-bottom: var(--space-2); }
.entry-content--full { font-size: var(--fs-500); }
.entry-content--full > p:first-of-type { text-align: center; color: var(--text-muted); font-size: var(--fs-500); max-width: 60ch; margin-inline: auto; }
.entry-content--full .wp-block-group__inner-container { margin: 0; }

/* Gallery: a clean grid of large, uniform tiles. Strong overrides because the
   WordPress core block-library stylesheet styles classic galleries as flex. */
.entry-content .wp-block-gallery { max-width: none !important; margin: var(--space-8) 0 !important; }
/* When a classic gallery holds a .blocks-gallery-grid list, the outer <figure>
   must be a plain full-width block (WP 7 otherwise lays it out as flex/grid,
   which shrinks the inner list). :has() targets exactly that case. */
.entry-content .wp-block-gallery:has(.blocks-gallery-grid) { display: block !important; width: 100%; }
/* The grid goes on the real item container: the classic list, or the modern
   nested-images figure (which holds the image items directly). */
.entry-content .blocks-gallery-grid,
.entry-content .wp-block-gallery.has-nested-images {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4) !important;
  list-style: none;
  margin: 0 !important;
  padding: 0;
  max-width: none !important;
}
.entry-content .blocks-gallery-item {
  width: auto !important;
  margin: 0 !important;
}
.entry-content .blocks-gallery-item > figure,
.entry-content .wp-block-gallery .wp-block-image {
  position: relative;
  display: block;
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.entry-content .blocks-gallery-item img,
.entry-content .wp-block-gallery img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}
.entry-content .blocks-gallery-item:hover img,
.entry-content .wp-block-gallery .wp-block-image:hover img { transform: scale(1.06); }
.entry-content .blocks-gallery-item__caption,
.entry-content .wp-block-gallery figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: var(--space-4) var(--space-3) var(--space-2);
  max-height: none;
  overflow: visible;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: left;
}

@media (max-width: 900px) {
  .entry-content .blocks-gallery-grid,
  .entry-content .wp-block-gallery.has-nested-images { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .entry-content .blocks-gallery-grid,
  .entry-content .wp-block-gallery.has-nested-images { grid-template-columns: 1fr; }
}

/* Classic [gallery] shortcode — same large-tile grid (overrides the core
   .gallery-columns-N flex layout used on the Pictures sub-albums). */
.entry-content .gallery {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4) !important;
  margin: var(--space-8) 0 !important;
}
.entry-content .gallery-item {
  width: auto !important;
  margin: 0 !important;
  float: none !important;
  text-align: left;
}
.entry-content .gallery-icon {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.entry-content .gallery-icon a,
.entry-content .gallery-icon img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  border: none !important;
  object-fit: cover;
}
.entry-content .gallery-icon img { cursor: zoom-in; transition: transform 0.3s ease; }
.entry-content .gallery-item:hover .gallery-icon img { transform: scale(1.06); }
.entry-content .gallery-caption { font-size: 0.85rem; color: var(--text-faint); padding-top: var(--space-2); }

@media (max-width: 900px) { .entry-content .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .entry-content .gallery { grid-template-columns: 1fr; } }

/* Classic [caption] blocks (the album covers on the Pictures landing page)
   styled as cards. */
.entry-content .wp-caption {
  width: auto !important;
  max-width: 560px;
  margin: var(--space-6) auto !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.entry-content .wp-caption:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.entry-content .wp-caption > a,
.entry-content .wp-caption > img { display: block; border-radius: var(--radius-sm); overflow: hidden; }
.entry-content .wp-caption img { width: 100%; height: auto; display: block; }
.entry-content .wp-caption-text { text-align: center; color: var(--text-muted); font-size: 0.9rem; padding-top: var(--space-3); margin: 0; }

/* Album navigation links on the Pictures landing page (override the legacy
   inline right-align) — present them as centred "view album" buttons. */
.entry-content--full h3 { text-align: center !important; margin: var(--space-3) 0 var(--space-8); }
.entry-content--full h3 a {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55em 1.2em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}
.entry-content--full h3 a:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-subtle); }

/* Lightbox */
.zm-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(4px);
}
.zm-lightbox.is-open { display: flex; }
.zm-lightbox img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.zm-lightbox__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-5);
  width: 44px;
  height: 44px;
  font-size: 1.8rem;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.zm-lightbox__close:hover { background: rgba(255, 255, 255, 0.28); }

/* ==========================================================================
   17. Book slider (homepage)
   ========================================================================== */
.book-slider { position: relative; }
.book-slider__viewport { overflow: hidden; border-radius: var(--radius); }
.book-slider__track { display: flex; will-change: transform; transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1); }
@media (prefers-reduced-motion: reduce) { .book-slider__track { transition: none; } }

.book-slide {
  flex: 0 0 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-8) clamp(var(--space-5), 5vw, var(--space-10));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.book-slide__cover {
  position: relative;
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--bg-subtle);
  aspect-ratio: 2 / 3;
}
.book-slide__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-slide__body { min-width: 0; }
.book-slide__body .kicker { display: block; margin-bottom: var(--space-2); }
.book-slide__title { font-size: var(--fs-700); line-height: 1.15; margin-bottom: var(--space-2); }
.book-slide__title a { color: var(--text); }
.book-slide__title a:hover { color: var(--accent); text-decoration: none; }
.book-slide__subtitle { font-size: var(--fs-500); color: var(--text-muted); margin-bottom: var(--space-4); }
.book-slide__excerpt { color: var(--text-muted); margin-bottom: var(--space-5); }
.book-slide__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.book-slide__price { font-family: var(--font-mono); font-weight: 600; color: var(--text); }

/* Controls */
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 2;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.slider-btn:hover { color: var(--accent); border-color: var(--accent); }
.slider-btn svg { width: 22px; height: 22px; }
.slider-prev { left: -10px; }
.slider-next { right: -10px; }

.slider-dots { display: flex; justify-content: center; gap: var(--space-2); margin-top: var(--space-5); }
.slider-dots button {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border-strong);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.slider-dots button:hover { background: var(--text-faint); }
.slider-dots button[aria-selected="true"] { background: var(--accent); transform: scale(1.25); }

@media (max-width: 720px) {
  .book-slide { grid-template-columns: 1fr; gap: var(--space-5); padding: var(--space-6); text-align: center; }
  .book-slide__cover { max-width: 200px; margin-inline: auto; }
  .book-slide__body .kicker { margin-inline: auto; }
  .book-slide__foot { justify-content: center; }
  .slider-prev { left: 2px; }
  .slider-next { right: 2px; }
}

/* ==========================================================================
   18. AI / ML highlight band
   ========================================================================== */
.ai-band {
  background:
    radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--bg-subtle);
  border-block: 1px solid var(--border);
}
.ai-band__inner { max-width: 720px; }
.ai-band__text .kicker { display: block; margin-bottom: var(--space-2); }
.ai-band__text h2 { margin-bottom: var(--space-4); }
.ai-band__text p { color: var(--text-muted); font-size: var(--fs-500); }
.ai-band__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }
.ai-band__posts { margin-top: var(--space-8); }

/* ==========================================================================
   19. In-article book promo
   ========================================================================== */
.entry-content .zm-book-promo {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: var(--space-6);
  margin: var(--space-10) 0 var(--space-4);
  padding: var(--space-6);
  background:
    radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.entry-content .zm-book-promo__cover { align-self: start; margin: 0; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-lg); }
.entry-content .zm-book-promo__cover img { display: block; width: 100%; height: auto; }
.entry-content .zm-book-promo__body { min-width: 0; }
.entry-content .zm-book-promo__eyebrow { display: block; font-family: var(--font-mono); font-size: var(--fs-300); text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.entry-content .zm-book-promo h3 { margin: var(--space-1) 0 var(--space-3); font-size: var(--fs-600); }
.entry-content .zm-book-promo p { margin-bottom: var(--space-3); }
.entry-content .zm-book-promo ul { margin: 0 0 var(--space-4); padding-left: 1.2em; }
.entry-content .zm-book-promo li { margin-bottom: var(--space-1); }
.entry-content .zm-book-promo__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0; }
.entry-content .zm-book-promo__cta a { text-decoration: none; }

@media (max-width: 560px) {
  .entry-content .zm-book-promo { grid-template-columns: 1fr; text-align: center; }
  .entry-content .zm-book-promo__cover { max-width: 150px; margin-inline: auto; }
  .entry-content .zm-book-promo ul { text-align: left; display: inline-block; }
  .entry-content .zm-book-promo__cta { justify-content: center; }
}
