:root {
  --accent: #2670c0;
  --accent-hover: #1d5aa0;
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --card-bg: #ffffff;
  --text: #15171a;
  --text-muted: #5b6570;
  --border: #e5e9ee;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.05);
  --maxw: 1120px;
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --bg-alt: #15181c;
    --card-bg: #191d22;
    --text: #e8eaed;
    --text-muted: #9aa4b0;
    --border: #262c33;
    --accent: #4a92e0;
    --accent-hover: #6aa8e8;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* Hero cover image (mirrors robkerr.com .global-cover): sits behind the top of
   the page at low opacity, masked to fade downward so text stays readable. */
.global-cover {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  left: 0;
  height: 45vh;
  background: no-repeat center center / cover;
  opacity: 0.42;
  -webkit-mask-image: linear-gradient(to top, transparent, rgba(0, 0, 0, 0.55) 45%, #000);
  mask-image: linear-gradient(to top, transparent, rgba(0, 0, 0, 0.55) 45%, #000);
  pointer-events: none;
}
.global-cover.is-featured { height: 40vh; max-height: 640px; opacity: 0.38; }

@media (prefers-color-scheme: dark) {
  .global-cover { opacity: 0.32; }
  .global-cover.is-featured { opacity: 0.28; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Header — transparent so the cover shows through the top of the page. */
.site-header { background: transparent; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; padding: 12px 0; position: relative; }
.brand {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 30px;
  font-weight: 700;
  height: 36px;
  line-height: 36px;
  max-width: 300px;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.site-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.site-nav > a {
  color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
  padding: 8px 12px; border-radius: 6px;
}
.site-nav > a:hover { color: var(--accent); }

/* Nav dropdowns (CSS-only, open on hover/focus) */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  font-family: var(--font);
  font-size: 0.95rem; font-weight: 500;
  color: var(--text-muted);
  background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 6px;
}
.nav-dropdown-toggle::after { content: " ▾"; font-size: 0.7em; opacity: 0.7; }
.nav-dropdown-toggle:hover { color: var(--accent); }
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 0;
  min-width: 180px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 20;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--text); font-size: 0.92rem;
}
.nav-dropdown-menu a:hover { background: var(--bg-alt); color: var(--accent); }

/* Hamburger toggle — hidden on desktop, shown on narrow screens (see @media below) */
.nav-toggle { display: none; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 24px; height: 2px; border-radius: 2px;
  background: var(--text); transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -7px; }
.nav-toggle-bars::after { top: 7px; }

/* Hero */
.hero { padding: 56px 0 32px; text-align: center; }
.hero h1 { font-size: 2.6rem; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.02em; }
.hero-tagline { font-size: 1.15rem; color: var(--text-muted); margin: 0 auto; max-width: 640px; }

/* Sections */
.section { padding: 24px 0 40px; }
/* Section labels mirror robkerr.com .global-subtitle */
.section-title {
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 20px;
}

/* Grid */
.grid { display: grid; gap: 24px; }
.video-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.playlist-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 8px; }

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,0.12), 0 16px 40px rgba(0,0,0,0.10); }

.card-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--bg-alt); display: block; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0, 0, 0, 0.8); color: #fff;
  font-size: 0.78rem; font-weight: 500;
  padding: 2px 7px; border-radius: 5px;
}

.card-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0; line-height: 1.35; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }
.card-excerpt { margin: 0; color: var(--text-muted); font-size: 0.92rem; }
.card-meta { display: flex; gap: 14px; color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }

/* Playlist cards are text-only (no thumbnail): count sits with the bottom text */
.playlist-card .card-body { gap: 6px; }
.playlist-card .card-meta { margin-top: auto; padding-top: 6px; font-weight: 500; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 0.75rem; font-weight: 500;
  background: var(--bg-alt); border: 1px solid var(--border);
  color: var(--text-muted); padding: 3px 9px; border-radius: 999px;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

/* Page head (playlist) */
.page-head { padding: 40px 0 8px; }
.page-head h1 { font-size: 2rem; margin: 6px 0 10px; }
.breadcrumb { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 4px; }
.lede { font-size: 1.1rem; color: var(--text-muted); margin: 0 0 6px; max-width: 720px; }
.muted { color: var(--text-muted); font-size: 0.9rem; }

/* Video detail */
.video-detail { max-width: 860px; margin: 0 auto; padding: 32px 0 48px; }
.video-title { font-size: 2rem; font-weight: 700; margin: 8px 0 12px; letter-spacing: -0.01em; }
.detail-meta { margin-bottom: 14px; }
.synopsis { font-size: 1.15rem; line-height: 1.7; margin: 16px 0 22px; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.watch-cta { margin: 20px 0 8px; }
.btn {
  display: inline-block;
  background: var(--accent); color: #fff;
  font-weight: 500; padding: 11px 22px; border-radius: 8px;
}
.btn:hover { background: var(--accent-hover); color: #fff; }

.description { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 20px; }
.description h2 { font-size: 1.2rem; margin: 0 0 12px; }
.description-body { white-space: pre-wrap; color: var(--text-muted); font-size: 0.96rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 36px 0 28px; color: var(--text-muted); font-size: 0.9rem; }
.footer-brand { max-width: 560px; }
.footer-title { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.footer-description { margin: 8px 0 0; color: var(--text-muted); }
.footer-links { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 22px; }
.footer-links a { color: var(--text-muted); font-weight: 500; }
.footer-links a:hover { color: var(--accent); }
.footer-copyright { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 0.85rem; }
.footer-deployed { margin-top: 6px; font-size: 0.8rem; color: var(--text-muted); opacity: 0.8; }

/* Static markdown pages */
.static-page { max-width: 760px; margin: 0 auto; padding: 32px 0 48px; }
.prose { font-size: 1.02rem; line-height: 1.75; }
.prose h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 18px; }
.prose h2 { font-size: 1.4rem; font-weight: 700; margin: 32px 0 12px; }
.prose h3 { font-size: 1.15rem; font-weight: 700; margin: 24px 0 10px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 1.4em; }
.prose li { margin: 4px 0; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose blockquote {
  margin: 20px 0; padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt); border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}
.prose code { background: var(--bg-alt); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }
.prose pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.prose pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }
.prose img { border-radius: var(--radius); margin: 20px 0; }

/* Copy-to-clipboard button on code blocks (added by assets/copy.js) */
.code-block { position: relative; }
.code-block > pre { margin: 0 0 16px; }
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  font: 500 0.72rem/1 var(--font);
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.code-block:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: #fff; background: var(--accent); border-color: var(--accent); opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }

@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .video-title { font-size: 1.5rem; }
}

/* Narrow screens: collapse the primary nav into a hamburger menu */
@media (max-width: 768px) {
  .brand { max-width: none; font-size: 24px; }

  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin: -4px -8px -4px 0;
    cursor: pointer; border-radius: 8px;
  }
  .nav-toggle:hover .nav-toggle-bars,
  .nav-toggle:hover .nav-toggle-bars::before,
  .nav-toggle:hover .nav-toggle-bars::after { background: var(--accent); }

  .site-nav {
    display: none;
    position: absolute; top: 100%; right: 0; left: 0; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow);
    padding: 8px; margin-top: 4px;
  }
  .nav-toggle-checkbox:checked ~ .site-nav { display: flex; }

  .site-nav > a { padding: 10px 12px; }
  .nav-dropdown { position: static; }
  .nav-dropdown-toggle { width: 100%; text-align: left; }
  .nav-dropdown-toggle::after { content: ""; }
  /* On touch, show each section's items expanded (stacked) — no hover needed */
  .nav-dropdown-menu {
    position: static; display: block; min-width: 0;
    background: transparent; border: 0; box-shadow: none;
    padding: 0 0 4px 12px;
  }

  /* Animate the hamburger into an X when the menu is open */
  .nav-toggle-checkbox:checked ~ .nav-toggle .nav-toggle-bars { background: transparent; }
  .nav-toggle-checkbox:checked ~ .nav-toggle .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
  .nav-toggle-checkbox:checked ~ .nav-toggle .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }
}
