/* ==========================================================================
   KG7AJM video blog stylesheet
   --------------------------------------------------------------------------
   Shares the design tokens used by rptdir.com and shackboard.com so the three
   sites read as one series:

     dark   bg #0B0F19   card #131B2E   card hover #1A243D
            edge #1F2C47 text #F1F5F9  muted #94A3B8
     light  bg slate-50  card slate-100 edge slate-300  text slate-900
     accent emerald      #34d399 (dark text) / #047857 (light text)
                         #059669 button / #10b981 button hover
     type   Plus Jakarta Sans (UI), Montserrat (headings), JetBrains Mono
            (dates, counts, callsigns, any numeral readout)

   Theme is switched by the data-theme attribute on <html>, set before first
   paint by the inline script in _layouts/default.html.
   ========================================================================== */

/* --------------------------------------------------------------- tokens -- */

:root {
  --bg: #0B0F19;
  --surface: #0E1524;
  --card: #131B2E;
  --card-hover: #1A243D;
  --edge: #1F2C47;
  --edge-strong: #334155;
  --ink: #F1F5F9;
  --body: #CBD5E1;
  --muted: #94A3B8;
  --accent: #34d399;
  --accent-ink: #10b981;
  --chip-ink: #10b981;
  /* The series paints CTAs emerald-600, but white on #059669 is only 3.77:1,
     which misses AA for a 13px label. emerald-700 clears it at 5.48:1. */
  --btn: #047857;
  --btn-hover: #065F46;
  --btn-ink: #ffffff;
  --chip-bg: rgba(16, 185, 129, 0.10);
  --chip-edge: rgba(16, 185, 129, 0.20);
  --field: #0B0F19;
  --field-edge: #334155;
  --shadow: rgba(0, 0, 0, 0.45);
  --wash-1: rgba(52, 211, 153, 0.09);
  --wash-2: rgba(52, 211, 153, 0.04);

  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 12px;
  --radius-lg: 16px;
}

[data-theme="light"] {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --card: #F1F5F9;
  --card-hover: #E2E8F0;
  --edge: #CBD5E1;
  --edge-strong: #94A3B8;
  --ink: #0F172A;
  --body: #334155;
  --muted: #475569;
  /* emerald-700 reads 5.2:1 on the flat slate-50 page but only 4.46:1 once the
     emerald chip tint sits behind it, so chips get emerald-800 to clear AA. */
  --accent: #059669;
  --accent-ink: #047857;
  --chip-ink: #065F46;
  --btn: #047857;
  --btn-hover: #065F46;
  --chip-bg: rgba(5, 150, 105, 0.10);
  --chip-edge: rgba(5, 150, 105, 0.22);
  --field: #FFFFFF;
  --field-edge: #CBD5E1;
  --shadow: rgba(15, 23, 42, 0.10);
  --wash-1: rgba(16, 185, 129, 0.10);
  --wash-2: rgba(16, 185, 129, 0.05);
}

/* ----------------------------------------------------------------- base -- */

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg);
  color: var(--body);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 160ms ease, color 160ms ease;
}

/* Soft accent wash instead of the old blurred gradient blobs: the same move
   the hub page at / makes, so the two read as one site. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55rem 28rem at 10% -10%, var(--wash-1), transparent 62%),
    radial-gradient(40rem 22rem at 100% 0%, var(--wash-2), transparent 60%);
}

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

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }

/* Shared small-caps monospace chip, used for dates and view counts. */
.chip {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.6;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--edge);
  border-radius: 5px;
  color: var(--muted);
  white-space: nowrap;
}

.chip.accent {
  color: var(--chip-ink);
  background: var(--chip-bg);
  border-color: var(--chip-edge);
}

/* --------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--edge);
  transition: background-color 160ms ease, border-color 160ms ease;
}

@supports not (background: color-mix(in srgb, red 95%, transparent)) {
  .site-header { background: var(--bg); }
}

.header-container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }

.brand-tile {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--chip-bg);
  border: 1px solid var(--chip-edge);
}

.brand-tile svg { width: 19px; height: 19px; color: var(--accent-ink); }

.brand-text { display: flex; align-items: baseline; gap: 0.55rem; }

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-button,
.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.icon-button {
  width: 38px;
  height: 38px;
  background: var(--card);
  border: 1px solid var(--edge-strong);
  color: var(--body);
}

.icon-button svg { width: 17px; height: 17px; }

.icon-button:hover { background: var(--card-hover); }

.nav-button {
  min-height: 38px;
  padding: 0 0.9rem;
  background: var(--card);
  border: 1px solid var(--edge-strong);
  color: var(--body);
}

.nav-button:hover { background: var(--card-hover); }

/* Small trailing glyph inside a header button. */
.nav-icon { width: 14px; height: 14px; opacity: 0.75; }

/* One sun/moon glyph at a time, cross-faded rather than rotated away. */
[data-theme="dark"] .sun-icon { display: none; }
html:not([data-theme="dark"]) .moon-icon { display: none; }

@media (max-width: 560px) {
  .brand-sub { display: none; }
  .nav-button .nav-label { display: none; }
  .nav-button { width: 38px; padding: 0; }
}

/* ------------------------------------------------------------ page head -- */

/* No width cap here: the heading and lede are single-purpose lines, and a
   measure-limited column forced both to wrap on a desktop viewport. They only
   wrap now when the text genuinely cannot fit, which is phones. */
.page-head { padding: 2.5rem 0 1.5rem; }

.eyebrow {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.75rem;
  /* Fits one line from ~600px up. Below that it must wrap; balance keeps the
     phone break even instead of stranding a single word. */
  text-wrap: balance;
}

.lede { font-size: 1.0625rem; color: var(--body); }

/* ------------------------------------------------------- filter toolbar -- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
}

.field-wrap { position: relative; flex: 1 1 15rem; min-width: 0; }

.field-wrap > svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input,
.sort-box select {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  background: var(--field);
  border: 1px solid var(--field-edge);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.search-box input { padding-left: 2.25rem; }

.search-box input::placeholder { color: var(--muted); font-weight: 500; }

.search-box input:focus,
.sort-box select:focus {
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 3px var(--chip-bg);
}

.sort-box { position: relative; flex: 0 0 auto; }

/* Custom chevron, never the cramped native arrow. */
.sort-box select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  cursor: pointer;
}

.sort-box .chevron {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.count-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  background: var(--chip-bg);
  border: 1px solid var(--chip-edge);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  white-space: nowrap;
}

/* ----------------------------------------------------------- card grid -- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  padding-bottom: 3rem;
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.post-card:hover {
  border-color: var(--edge-strong);
  box-shadow: 0 6px 20px -6px var(--shadow);
}

.post-card-image {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--surface);
}

.post-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.45);
  opacity: 0;
  transition: opacity 140ms ease;
}

.post-card:hover .play-overlay,
.post-card:focus-within .play-overlay { opacity: 1; }

.play-overlay span {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(5, 150, 105, 0.92);
  border: 1px solid rgba(52, 211, 153, 0.7);
}

.play-overlay svg { width: 20px; height: 20px; color: #fff; margin-left: 2px; }

.post-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  flex: 1;
  padding: 0.875rem;
}

.post-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

.post-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.post-card-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 140ms ease;
}

.post-card-title a:hover { color: var(--accent-ink); }

.stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-excerpt {
  margin-top: auto;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.no-results {
  padding: 3rem 0;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ------------------------------------------------------------ post page -- */

.post { max-width: 56rem; margin: 0 auto; padding: 2.5rem 0 3rem; }

.post-header { margin-bottom: 1.5rem; }

.post-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3.4vw, 2.15rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0.75rem 0 0.9rem;
}

.video-container {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--edge);
  background: #000;
  box-shadow: 0 12px 32px -14px var(--shadow);
}

.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.post-content {
  margin: 2rem 0;
  max-width: 44rem;
  font-size: 1.0625rem;
  color: var(--body);
}

.post-content p + p { margin-top: 0.9rem; }

.post-footer { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 2rem; }

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 1.25rem;
  border-radius: var(--radius);
  background: var(--btn);
  border: 1px solid var(--btn);
  color: var(--btn-ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.cta-button:hover { background: var(--btn-hover); border-color: var(--btn-hover); }

.cta-button.secondary {
  background: var(--card);
  border-color: var(--edge-strong);
  color: var(--body);
}

.cta-button.secondary:hover { background: var(--card-hover); }

.cta-button svg { width: 15px; height: 15px; }

/* --------------------------------------------------------------- footer -- */

.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--edge);
}

.footer-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--muted);
}

.footer-container a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }

.footer-container a:hover { text-decoration: underline; }

.footer-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------- utility -- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ motion -- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 640px) {
  .controls { flex-direction: column; align-items: stretch; }
  .field-wrap, .sort-box { flex: 1 1 auto; width: 100%; }
  .post-grid { grid-template-columns: 1fr; }
  .page-head { padding-top: 1.75rem; }
}
