/* ------------
   JamFeed design tokens & base styles
   Style: modern music editorial + data product
   ------------ */

@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk-var.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Color tokens */
  --bg-dark: #0b0d0f;
  --bg-light: #f6f6f1;
  --surface: #ffffff;
  --text-primary: #111315;
  --text-on-dark: #f7f8f3;
  --text-muted: #62676d;
  --accent: #b7f34a;
  --accent-ink: #1a2405; /* text on accent, AA contrast */
  --border: #d9ddd5;
  --border-dark: #23272b;
  --error: #d64545;

  /* Typography */
  --font-heading: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  /* Layout */
  --max-width: 1200px;
  --content-width: 720px;
  --radius: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-light);
}

@media (min-width: 768px) {
  body {
    font-size: 18px;
  }
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
}
h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
}
h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
}

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

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

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* ------------ Header ------------ */
.site-header {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  border-bottom: 1px solid var(--border-dark);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}
.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-on-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .logo-mark {
  width: 22px;
  height: 22px;
  flex: none;
}
.main-nav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.main-nav a {
  display: block;
  padding: 10px 12px;
  min-height: 44px;
  color: var(--text-on-dark);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius);
}
.main-nav a:hover {
  color: var(--accent);
}
.main-nav a[aria-current="page"] {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-dark);
  color: var(--text-on-dark);
  padding: 10px 14px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }
  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-dark);
    z-index: 50;
  }
  .main-nav.open {
    display: block;
  }
  .main-nav ul {
    flex-direction: column;
    padding: 12px 20px 20px;
  }
  .main-nav a {
    padding: 12px;
  }
  .site-header {
    position: relative;
  }
}

/* ------------ Hero ------------ */
.hero {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 72px 0 80px;
  overflow: hidden;
}
.hero .container {
  display: grid;
  gap: 40px;
  align-items: center;
}
@media (min-width: 960px) {
  .hero .container {
    grid-template-columns: 1.2fr 0.8fr;
  }
}
.eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 16px;
}
.hero p.sub {
  font-size: 1.15rem;
  color: #c7cbc4;
  max-width: 560px;
}
.btn-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.btn {
  display: inline-block;
  padding: 13px 24px;
  min-height: 44px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-secondary {
  border-color: var(--text-on-dark);
  color: var(--text-on-dark);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Equalizer visual */
.eq-visual {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
}
.eq-visual span {
  flex: 1;
  background: var(--accent);
  opacity: 0.85;
  border-radius: 3px 3px 0 0;
  animation: eq-pulse 1.6s ease-in-out infinite;
  transform-origin: bottom;
}
.eq-visual span:nth-child(odd) {
  background: #3a4148;
}
@keyframes eq-pulse {
  0%,
  100% {
    transform: scaleY(0.55);
  }
  50% {
    transform: scaleY(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .eq-visual span {
    animation: none;
  }
  .btn {
    transition: none;
  }
}

/* ------------ Sections ------------ */
.section {
  padding: 64px 0;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-header .more-link {
  font-weight: 600;
  font-size: 0.95rem;
}

.card-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease;
}
.card:hover {
  border-color: var(--text-primary);
}
.card h3 a {
  text-decoration: none;
}
.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}
.card .card-icon {
  width: 36px;
  height: 36px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.card .card-link {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ------------ Footer ------------ */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 56px 0 32px;
  margin-top: 64px;
}
.footer-grid {
  display: grid;
  gap: 36px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 40px;
}
.footer-grid h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 14px;
}
.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-grid li {
  margin-bottom: 10px;
}
.footer-grid a {
  color: #c7cbc4;
  text-decoration: none;
  font-size: 0.95rem;
}
.footer-grid a:hover {
  color: var(--accent);
}
.footer-about p {
  color: #c7cbc4;
  font-size: 0.95rem;
}
.footer-bottom {
  border-top: 1px solid var(--border-dark);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-bottom a {
  color: #c7cbc4;
}

/* ------------ Content pages ------------ */
.page-main {
  min-height: 50vh;
}
.prose {
  max-width: var(--content-width);
}
.prose h2 {
  margin-top: 1.6em;
}

/* ------------ Forms / admin ------------ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 440px;
  margin: 64px auto;
}
.form-field {
  margin-bottom: 18px;
}
.form-field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.form-field input {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-primary);
}
.form-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--text-primary);
}
.form-error {
  color: var(--error);
  font-weight: 500;
  margin-bottom: 16px;
}
.admin-topbar {
  background: var(--bg-dark);
  color: var(--text-on-dark);
}
.admin-topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}
.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-top: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat .stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
}
.stat .stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}
.site-header :focus-visible,
.site-footer :focus-visible,
.hero :focus-visible {
  outline-color: var(--accent);
}

/* ===== Tools pages ===== */
.page-hero {
  padding: 3rem 0 1.5rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.page-hero .sub {
  max-width: 46rem;
  opacity: 0.85;
  margin-top: 0.75rem;
}
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  opacity: 0.75;
}
.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.35rem;
  opacity: 0.5;
}
.tool-layout {
  display: grid;
  gap: 2rem;
  align-items: start;
}
@media (min-width: 960px) {
  .tool-layout {
    grid-template-columns: minmax(280px, 360px) 1fr;
  }
  .tool-layout .tool-form {
    position: sticky;
    top: 1.5rem;
  }
}
.tool-form .form-note {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.75rem;
}
.form-field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  background: var(--surface, #14161c);
  color: inherit;
  font: inherit;
}
.form-field .optional { opacity: 0.6; font-weight: 400; }
.tool-intro { margin-top: 3rem; max-width: 46rem; }
.card .card-title { font-size: 1.15rem; margin: 0 0 0.5rem; }
.card .card-title a { color: inherit; text-decoration: none; }

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 2rem;
}
.example-report { margin-bottom: 1rem; }
.badge {
  display: inline-block;
  font-size: 0.65em;
  vertical-align: middle;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: #B7F34A;
  color: #10120a;
}
.top-posts { padding-left: 1.25rem; margin: 1rem 0 2rem; }
.top-posts li { margin-bottom: 0.75rem; }
.top-post-meta { display: block; font-size: 0.85rem; opacity: 0.7; }
.recommendations { padding-left: 1.25rem; margin: 1rem 0 2rem; }
.recommendations li { margin-bottom: 0.75rem; max-width: 46rem; }

.status-card {
  max-width: 34rem;
  margin: 3rem auto;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 16px;
}
.status-card h1 { font-size: 1.5rem; margin: 1rem 0 0.75rem; }
.spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(183, 243, 74, 0.25);
  border-top-color: #B7F34A;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.plan-phase { margin-bottom: 2rem; }
.plan-phase h2 { margin-bottom: 0.75rem; }
.phase-range { font-size: 0.75em; opacity: 0.6; font-weight: 400; margin-left: 0.5rem; }
.plan-table-wrap { overflow-x: auto; }
.plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 640px;
}
.plan-table th, .plan-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.plan-table thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.plan-table .task-cell { max-width: 26rem; }
.plan-table .check-col { text-align: center; width: 3rem; }

@media print {
  .site-header, .site-footer, .tool-form, .plan-actions, .breadcrumbs, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .plan-table th, .plan-table td { border-color: #ccc; }
  a { color: inherit; text-decoration: none; }
}

/* ------------ CMS: public content ------------ */
.page-hero { background: var(--bg-dark); color: var(--text-on-dark); padding: 48px 0 56px; }
.page-hero h1 { color: var(--text-on-dark); }
.page-hero .sub { color: #c7cbc4; max-width: 640px; font-size: 1.1rem; }
.breadcrumbs { font-size: 0.85rem; margin-bottom: 16px; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; opacity: 0.5; }
.breadcrumbs a { color: inherit; }
.page-hero .breadcrumbs { color: #9aa09b; }
.post-card-category { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin: 0 0 4px; }
.post-card-category a { color: inherit; text-decoration: none; }
.post-card-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0; }
.post-card-media img { width: 100%; height: auto; border-radius: var(--radius); display: block; margin-bottom: 12px; }
.empty-note { color: var(--text-muted); }
.container-narrow { max-width: var(--content-width); }
.article-header { background: var(--bg-dark); color: var(--text-on-dark); padding: 48px 0; margin-bottom: 32px; }
.article-header h1 { color: var(--text-on-dark); }
.article-header .breadcrumbs { color: #9aa09b; }
.article-excerpt { font-size: 1.15rem; color: #c7cbc4; }
.article-meta { color: #9aa09b; font-size: 0.9rem; }
.article-author { color: var(--text-on-dark); }
.article-featured img { width: 100%; height: auto; border-radius: var(--radius); }
.article-featured figcaption { font-size: 0.85rem; color: var(--text-muted); margin-top: 6px; }
.toc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px 20px; margin: 24px 0; }
.toc summary { font-family: var(--font-heading); font-weight: 600; cursor: pointer; }
.toc ol { list-style: none; margin: 12px 0 0; padding: 0; }
.toc li { margin: 6px 0; }
.toc li.toc-l3 { padding-left: 20px; font-size: 0.95rem; }
.prose { line-height: 1.7; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; margin: 20px 0; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose blockquote { border-left: 3px solid var(--accent); margin: 20px 0; padding: 4px 0 4px 20px; color: var(--text-muted); }
.prose pre { background: var(--bg-dark); color: var(--text-on-dark); padding: 16px; border-radius: var(--radius); overflow-x: auto; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.2em; }
.author-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 20px 24px; margin: 40px 0; }
.author-box h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.related-section { border-top: 1px solid var(--border); }
.hub-intro { max-width: var(--content-width); margin-bottom: 32px; }

/* ------------ Admin CMS ------------ */
.admin-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 16px 0; border-bottom: 1px solid var(--border); }
.admin-nav a { display: block; padding: 8px 14px; text-decoration: none; color: var(--text-primary); border-radius: var(--radius) var(--radius) 0 0; }
.admin-nav a[aria-current="page"] { background: var(--bg-dark); color: var(--text-on-dark); }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 24px 0 16px; }
.admin-head h1 { font-size: 1.8rem; margin: 0; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table th, .admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.95rem; }
.admin-table th { font-family: var(--font-heading); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: 0.8rem; font-weight: 600; }
.badge-pub { background: var(--accent); color: var(--accent-ink); }
.badge-draft { background: var(--border); color: var(--text-primary); }
.admin-form { max-width: 860px; margin-bottom: 48px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 20px 0; }
.form-fieldset legend { font-family: var(--font-heading); font-weight: 600; padding: 0 8px; }
.admin-form input[type="text"], .admin-form input[type="number"], .admin-form input:not([type]), .admin-form select, .admin-form textarea,
.form-card input[type="text"], .form-card input[type="file"] { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: var(--surface); }
textarea.mono { font-family: ui-monospace, monospace; font-size: 0.85rem; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-size: 0.95rem; }
.hint { color: var(--text-muted); font-size: 0.9rem; }
.form-success { color: #22701f; background: #e6f4e0; border: 1px solid #b7e0a8; border-radius: var(--radius); padding: 10px 14px; }
.btn-danger { background: var(--error); color: #fff; border: none; cursor: pointer; }
.btn-link, .btn-link-danger { background: none; border: none; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.btn-link-danger { color: var(--error); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin: 24px 0 48px; }
.media-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px; }
.media-card img { width: 100%; height: 130px; object-fit: cover; border-radius: var(--radius); }
.media-name { margin: 8px 0 2px; font-size: 0.9rem; word-break: break-all; }

/* report-card-overflow-hotfix-20260825 */
.report-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.report-grid .stat {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
}
.report-grid .stat-value {
  display: block;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.report-grid .stat-label {
  display: block;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
  }
  .report-grid .stat {
    min-height: 108px;
    padding: 0.875rem;
    gap: 0.45rem;
  }
  .report-grid .stat-value {
    font-size: clamp(1.15rem, 5.5vw, 1.55rem);
  }
  .report-grid .stat-label {
    font-size: 0.8rem;
  }
}
