/* Pixel To Presence brand tokens.
   Values are sampled from the supplied logo artwork itself
   (scratch/measure_logo.php): the ground is #000000, the mark and wordmark sit
   in #303078, and the dither highlights reach #FCFCFC. Every colour on the
   site is derived from those measurements so the page and the logo are the
   same identity. */
:root {
  /* Logo ground, lifted just off pure black so surfaces can be told apart. */
  --navy: #07070F;
  --navy-2: #0D0D1C;
  --navy-surface: #121229;
  --navy-card: #1A1A38;

  /* The mark's indigo. */
  --accent: #6C6BD8;
  --accent-2: #9C9BE8;
  --accent-glow: rgba(108, 107, 216, 0.22);

  /* Lighter indigo for text on a dark ground. */
  --primary: #5B5AC4;
  --primary-hover: #4A49AE;
  --primary-ink: #3F3E9E;
  --primary-light: #EDEDFB;
  /* Tints between primary-light and primary, for pill fills, input borders
     and hover states on light surfaces. */
  --primary-soft: #DEDEF7;
  --primary-border: #C9C8F0;
  --primary-ring: rgba(91, 90, 196, 0.16);
  /* Brand hero: the same indigo gradient on every page family. */
  --hero-gradient: linear-gradient(135deg, #1a1a4e 0%, #303078 50%, #1a1a4e 100%);
  --ink: #0D0D1C;
  --ink-2: #2A2A48;
  --slate-dark: #4A4A6E;
  --slate: #64748B;
  --slate-light: #9AA0BC;
  --line: #E4E4F0;
  --line-strong: #D2D2E6;
  --panel: #F7F7FC;
  --panel-2: #EFEFF9;
  --white: #FFFFFF;
  --success: #10B981;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(13, 13, 28, 0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.08), 0 2px 6px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 24px -4px rgba(0,0,0,0.12), 0 4px 12px -2px rgba(0,0,0,0.04);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --header-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button {
  font-family: var(--body);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
/* iOS Safari zooms the page when a field under 16px is focused. Opt every
   input and select out of that zoom on small screens. */
@media (max-width: 1024px) {
  input, select, textarea { font-size: 16px; }
}
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--primary); color: var(--white); padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* Header — white surface so the transparent-background logo shows at full
   colour saturation. The indigo bottom border echoes the logo's own hue. */
.site-header {
  background: #ffffff;
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px solid #303078;
  box-shadow: 0 2px 16px rgba(48, 48, 120, 0.10);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 16px; }

/* Logo — transparent PNG sits directly on the white header. No wrappers,
   no blend modes needed. */
.logo {
  display: flex; align-items: center;
  flex: 0 1 auto; min-width: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.logo:hover { opacity: 0.85; transform: translateY(-1px); }
.logo-lockup {
  display: block;
  width: auto; height: 42px;
  max-width: min(230px, 40vw);
  object-fit: contain; object-position: left center;
}
@media (max-width: 900px) {
  .logo-lockup { height: 32px; max-width: min(180px, 42vw); }
}

/* Nav links on white header — use brand indigo for clarity */
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: #4a4a7a;
  font-size: 0.9rem; font-weight: 600;
  padding: 9px 15px; border-radius: 999px;
  transition: all 0.2s ease;
}
.nav-links a:hover { color: #303078; background: rgba(48, 48, 120, 0.08); }
.nav-links a.active {
  color: #ffffff;
  background: #303078;
  box-shadow: 0 2px 8px rgba(48,48,120,0.28);
}

/* Dropdown toggle inherits nav colour on white header */
.nav-dropdown-toggle { color: #4a4a7a; }
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown-toggle[aria-expanded="true"],
.nav-dropdown.is-current .nav-dropdown-toggle { color: #303078; }

/* Shared hero bits */
.eyebrow {
  font-size: 0.75rem; font-weight: 800; color: var(--accent-2);
  letter-spacing: 0.16em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 9px;
}
/* A short rule after the eyebrow, in the mark's indigo. */
.eyebrow::after { content: ''; width: 28px; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); }
.eyebrow-dark {
  font-size: 0.8rem; font-weight: 700; color: var(--primary-ink);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.lead { color: var(--slate-light); margin-top: 14px; max-width: 560px; font-size: 1.05rem; }
.text-link { color: var(--primary-ink); font-weight: 600; }
.text-link:hover { text-decoration: underline; }
/* Standalone text links ("Read all articles", "Clear filters") are easy to
   miss with a fingertip at text height, so they get a real tap area on
   touch screens. */
@media (hover: none) {
  .text-link { display: inline-flex; align-items: center; min-height: 44px; }
}

/* --- Buttons (shared by jobs, courses, lessons and tools) --------------------------------------------------------------
   .btn and .btn-primary are otherwise only defined in admin.css. These are the
   first buttons inside the public layout, so the base family lives here.
   Hover styles need an explicit foreground: inheriting would flip a white
   label to navy-on-navy. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.9rem; font-family: var(--body);
  cursor: pointer; white-space: nowrap; text-align: center;
  transition: background-color 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); color: var(--white); }
.btn-outline {
  background: var(--white); color: var(--ink);
  border-color: var(--line-strong); box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
  border-color: var(--primary); color: var(--primary-ink);
  box-shadow: var(--shadow-sm); transform: translateX(2px);
}
.btn-outline-dark { background: transparent; color: var(--slate); border-color: var(--line-strong); }
.btn-outline-dark:hover { color: var(--primary-ink); border-color: var(--primary); background: var(--primary-light); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 0.97rem; }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

/* Pills */
.pill {
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--slate-light);
  transition: all 0.2s ease;
}
.pill:hover { color: var(--white); border-color: rgba(255,255,255,0.3); }
.pill.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Breadcrumbs */
.breadcrumbs ol { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.82rem; color: var(--slate); }
.breadcrumbs li + li::before { content: '/'; margin-right: 6px; opacity: 0.6; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs.dark ol { color: var(--slate-light); }
.breadcrumbs.dark a:hover { color: var(--accent); }
.breadcrumbs [aria-current] { color: inherit; opacity: 0.85; }

/* Blog cards (used on home, blog, 404) */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding: 10px 0 72px; }
.blog-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--white); box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.blog-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.card-image-wrap { display: block; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; background: var(--panel); position: relative; }
.card-image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.blog-card:hover .card-image-wrap img { transform: scale(1.04); }
.card-image-fallback {
  display: flex; align-items: center; justify-content: center; height: 100%;
  background: linear-gradient(135deg, var(--navy), var(--navy-card)); color: var(--accent);
  font-family: var(--mono); font-weight: 700; font-size: 2rem;
}
.card-body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.card-meta-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.category-badge {
  font-size: 0.72rem; font-weight: 700; color: var(--primary-ink); background: var(--primary-light);
  padding: 4px 10px; border-radius: var(--radius-sm); text-transform: uppercase; letter-spacing: 0.05em;
  position: relative; z-index: 2;
  /* On a phone the badge sits inline in the byline and is a link, so it needs
     a real tap target rather than the 24px of padding alone. */
  display: inline-flex; align-items: center;
}
@media (hover: hover) and (pointer: fine) {
  .article-hero .category-badge { min-height: 24px; }
}
@media (hover: none) {
  .article-hero .category-badge { min-height: 40px; padding-inline: 14px; }
}
.read-time { font-size: 0.78rem; color: var(--slate); font-weight: 500; }
.card-title { font-size: 1.2rem; color: var(--ink); line-height: 1.35; margin-top: 4px; }
.blog-card .card-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; } /* whole card clickable */
.card-title a:hover { color: var(--primary-ink); }
.card-excerpt {
  color: var(--slate); font-size: 0.9rem; margin-top: 10px; flex: 1; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot {
  display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--slate);
}
.author-info { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.author-avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.62rem; font-weight: 700; flex-shrink: 0;
}

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0 0 72px; margin-top: -32px; }
.pagination a, .pagination span {
  min-width: 42px; height: 42px; padding: 0 14px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.9rem; border: 1px solid var(--line); background: var(--white);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary-ink); }
.pagination .current { background: var(--navy); color: var(--white); border-color: var(--navy); }
.pagination .gap { border: none; }

/* Code blocks + copy button (article + course) */
.code-block-wrapper { position: relative; border-radius: var(--radius-md); overflow: hidden; background: var(--navy); }
.code-block-wrapper pre {
  margin: 0; padding: 20px; padding-right: 54px; background: transparent; color: #F8FAFC;
  font-family: var(--mono); font-size: 0.88rem; line-height: 1.6; overflow-x: auto; tab-size: 2;
}
.code-block-wrapper pre code { background: none !important; color: inherit !important; padding: 0 !important; font-size: inherit !important; }
.copy-code-btn {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--slate-light); border-radius: var(--radius-sm); z-index: 5;
}
.copy-code-btn:hover { background: rgba(255, 255, 255, 0.25); color: var(--white); }
.copy-code-btn.copied { background: var(--success); border-color: var(--success); color: var(--white); }
.copy-code-btn svg { width: 16px; height: 16px; fill: currentColor; pointer-events: none; }

.empty-state { color: var(--slate); padding: 40px 0 80px; }

/* Footer */
.site-footer {
  background: linear-gradient(180deg, #08081A 0%, #0D0D1C 100%);
  color: var(--slate-light);
  padding: 56px 0 36px;
  font-size: 0.88rem;
  text-align: center;
  border-top: 1px solid rgba(108, 107, 216, 0.2);
  box-shadow: inset 0 1px 0 rgba(108,107,216,0.12);
}
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; }
.footer-links a:hover { color: var(--white); }

@media (max-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .blog-grid { grid-template-columns: 1fr; }
  .nav-links a { padding: 8px 10px; }
}

/* =============================================================================
   Banner controls: one look for every search box, dropdown and filter pill on
   the indigo heroes (home, articles, jobs, tools). Before, each page had its
   own: a light translucent box on home, solid near-black pills on articles
   and jobs. They now share the same glass surface as the hero chips.
   ========================================================================== */
:root {
  --hero-field-bg: rgba(255, 255, 255, 0.08);
  --hero-field-bg-hover: rgba(255, 255, 255, 0.12);
  --hero-field-border: rgba(255, 255, 255, 0.18);
  --hero-field-border-hover: rgba(255, 255, 255, 0.32);
  --hero-field-ring: rgba(156, 155, 232, 0.28);
  --hero-field-text: #ffffff;
  --hero-field-muted: rgba(255, 255, 255, 0.62);
  --hero-field-h: 48px;
}
.catalog-hero .search-box,
.blog-hero .blog-search,
.jobs-hero .jobs-search,
.jobs-hero .jobs-select {
  background-color: var(--hero-field-bg);
  border: 1px solid var(--hero-field-border);
  border-radius: 999px;
  min-height: var(--hero-field-h);
  color: var(--hero-field-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.catalog-hero .search-box { padding: 0 18px; }
.catalog-hero .search-box:hover, .blog-hero .blog-search:hover,
.jobs-hero .jobs-search:hover, .jobs-hero .jobs-select:hover {
  background-color: var(--hero-field-bg-hover); border-color: var(--hero-field-border-hover);
}
.catalog-hero .search-box:focus-within, .blog-hero .blog-search:focus-within,
.jobs-hero .jobs-search:focus-within, .jobs-hero .jobs-select:focus-visible {
  background-color: var(--hero-field-bg-hover); border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--hero-field-ring); outline: none;
}
.catalog-hero .search-box input, .blog-hero .blog-search input, .jobs-hero .jobs-search input { color: var(--hero-field-text); }
.catalog-hero .search-box input::placeholder, .blog-hero .blog-search input::placeholder,
.jobs-hero .jobs-search input::placeholder { color: var(--hero-field-muted); opacity: 1; }
.catalog-hero .search-icon, .jobs-hero .jobs-search-icon,
.blog-hero .blog-search button, .jobs-hero .jobs-search-go { color: var(--hero-field-muted); }
.blog-hero .blog-search button:hover, .jobs-hero .jobs-search-go:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.jobs-hero .jobs-select {
  color: var(--hero-field-text); font-weight: 600;
  /* Chevron in the same muted white as the other icons. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23ffffff' stroke-opacity='0.7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* The open list is drawn by the OS; give it the brand's dark surface. */
.jobs-hero .jobs-select option { background: #1a1a4e; color: #fff; }

/* Filter pills on the same heroes: same surface and height as the fields. */
.catalog-hero .pill, .blog-hero .pill, .tools-page .tool-jump .pill {
  min-height: 44px; display: inline-flex; align-items: center;
  background: rgba(255, 255, 255, 0.06); border-color: var(--hero-field-border); color: rgba(255, 255, 255, 0.82);
}
.catalog-hero .pill:hover, .blog-hero .pill:hover, .tools-page .tool-jump .pill:hover {
  background: var(--hero-field-bg-hover); border-color: var(--hero-field-border-hover); color: #fff;
}
.catalog-hero .pill.active, .blog-hero .pill.active {
  background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(91, 90, 196, 0.8);
}
/* Exact heights, whatever each page's padding: 48px fields, 44px pills. */
.blog-hero .blog-search, .jobs-hero .jobs-search { height: var(--hero-field-h); min-height: 0; padding-top: 0; padding-bottom: 0; }
.blog-hero .blog-search button, .jobs-hero .jobs-search-go { width: 38px; height: 38px; }
.jobs-hero .jobs-select { height: var(--hero-field-h); min-height: 0; }
.catalog-hero .pill, .blog-hero .pill, .tools-page .tool-jump .pill { height: 44px; min-height: 0; padding-top: 0; padding-bottom: 0; }
