/*
 * Article pages — matches index.html + Footer.tsx / Hero.tsx (Work Sans, NCR tokens).
 * Layout: max 1200px; responsive from iPhone SE (320px).
 */

:root {
  --background: hsl(0, 0%, 4%);
  --foreground: hsl(0, 0%, 98%);
  --card: hsl(0, 0%, 8%);
  --secondary: hsl(0, 0%, 12%);
  --muted-foreground: hsl(0, 0%, 60%);
  --border: hsl(0, 0%, 20%);
  --primary: hsl(0, 100%, 50%);
  --primary-foreground: hsl(0, 0%, 100%);
  --primary-glow: hsl(0, 100%, 60%);
  --accent-warm: hsl(25, 95%, 60%);
  --vinyl-black: hsl(0, 0%, 0%);
  --vinyl-groove: hsl(0, 0%, 8%);

  --gradient-accent: linear-gradient(90deg, var(--primary), var(--accent-warm));
  --gradient-hero: linear-gradient(135deg, var(--vinyl-black), var(--background));
  --shadow-glow: 0 0 50px hsl(0 100% 60% / 0.35);

  --layout-max: 1200px;
  --footer-inner-max: 56rem; /* Tailwind max-w-4xl — matches index footer */
  --font-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --radius: 0.5rem;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-vinyl: transform 0.6s ease-out;
}

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

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

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.625;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 640px) {
  body {
    font-size: 1.125rem;
    line-height: 1.75;
  }
}

/* Full-width content cap — homepage uses ~max-w-7xl for hero; articles use 1200px */
.layout-container {
  width: 100%;
  max-width: var(--layout-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

@media (min-width: 375px) {
  .layout-container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

@media (min-width: 640px) {
  .layout-container {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
}

/* ——— Header (brand row like homepage + Hero CTA) ——— */
.site-header {
  background: var(--vinyl-black);
  border-bottom: 1px solid var(--vinyl-groove);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--foreground);
  min-width: 0;
}

.site-brand:hover {
  opacity: 0.9;
}

.site-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  flex-shrink: 0;
}

@media (min-width: 400px) {
  .site-brand-logo {
    width: 32px;
    height: 32px;
  }
}

.site-brand-text {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.2;
  white-space: nowrap;
}

@media (min-width: 400px) {
  .site-brand-text {
    font-size: 1.5rem;
  }
}

/* Hero-style listen control (button.tsx variant="hero") */
.btn-hero-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--foreground);
  background: var(--gradient-accent);
  box-shadow: var(--shadow-glow);
  transition: var(--transition-smooth), var(--transition-vinyl);
}

.btn-hero-header:hover {
  transform: scale(1.05);
  filter: brightness(1.06);
}

.btn-hero-header:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (min-width: 640px) {
  .btn-hero-header {
    padding: 12px 24px;
    font-size: 0.875rem;
  }
}

.btn-hero-header svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .btn-hero-header svg {
    width: 20px;
    height: 20px;
  }
}

/* ——— Breadcrumb ——— */
.breadcrumb {
  padding: 12px 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

@media (min-width: 640px) {
  .breadcrumb {
    padding: 16px 0;
    font-size: 0.875rem;
  }
}

.breadcrumb a {
  color: var(--muted-foreground);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb span:last-child {
  word-break: break-word;
}

/* ——— Article hero (section header band — similar to bg-card sections on home) ——— */
.article-hero {
  background: var(--card);
  padding: 36px 0 40px;
  border-bottom: 1px solid hsl(0 0% 100% / 0.06);
}

@media (min-width: 640px) {
  .article-hero {
    padding: 56px 0 48px;
  }
}

@media (min-width: 1024px) {
  .article-hero {
    padding: 72px 0 56px;
  }
}

.article-meta {
  margin: 0 0 12px;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 600;
}

@media (min-width: 640px) {
  .article-meta {
    margin-bottom: 16px;
    font-size: 12px;
  }
}

/* H1 scale aligned with Hero.tsx / index hero */
.article-hero h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.875rem;
  line-height: 1.15;
  margin: 0 0 16px;
  max-width: 48rem;
}

@media (min-width: 640px) {
  .article-hero h1 {
    font-size: 2.25rem;
    margin-bottom: 20px;
  }
}

@media (min-width: 768px) {
  .article-hero h1 {
    font-size: 3rem;
  }
}

@media (min-width: 1024px) {
  .article-hero h1 {
    font-size: 3.75rem;
  }
}

.article-intro {
  font-size: 1rem;
  color: var(--muted-foreground);
  font-weight: 400;
  line-height: 1.625;
  margin: 0;
  max-width: 48rem;
}

@media (min-width: 640px) {
  .article-intro {
    font-size: 1.125rem;
    line-height: 1.6;
  }
}

@media (min-width: 1024px) {
  .article-intro {
    font-size: 1.25rem;
  }
}

/* ——— Body ——— */
.article-body {
  padding: 20px 0 32px;
}

@media (min-width: 640px) {
  .article-body {
    padding: 28px 0 40px;
  }
}

.article-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body a:hover {
  color: var(--primary-glow);
}

.article-body h2 {
  font-family: var(--font-sans);
  font-size: 1.375rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 12px;
  line-height: 1.2;
  border-left: 3px solid var(--primary);
  padding-left: 14px;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .article-body h2 {
    font-size: 1.75rem;
    margin-top: 3rem;
    margin-bottom: 16px;
    padding-left: 16px;
  }
}

.article-body h3 {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 10px;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .article-body h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
  }
}

.article-body p {
  margin: 0 0 1.25rem;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .article-body p {
    margin-bottom: 1.5rem;
  }
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  line-height: 1.7;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .article-body ul,
  .article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    line-height: 1.75;
  }
}

.article-body li {
  margin-bottom: 8px;
}

.article-body strong {
  color: var(--foreground);
  font-weight: 600;
}

.article-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 14px 18px;
  background: var(--card);
  margin: 1.75rem 0;
  font-style: italic;
  color: var(--muted-foreground);
  border-radius: 0 4px 4px 0;
}

@media (min-width: 640px) {
  .article-body blockquote {
    padding: 16px 24px;
    margin: 2rem 0;
  }
}

.highlight-box {
  background: hsl(0 0% 8% / 0.6);
  border: 1px solid hsl(0 0% 100% / 0.08);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 1.75rem 0;
}

@media (min-width: 640px) {
  .highlight-box {
    padding: 24px 28px;
    margin: 2rem 0;
  }
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.75rem 0;
}

@media (min-width: 640px) {
  .table-scroll {
    margin: 2rem 0;
  }
}

.comparison-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

@media (min-width: 640px) {
  .comparison-table {
    font-size: 1rem;
  }
}

.comparison-table th {
  background: var(--secondary);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 12px 12px;
  border-bottom: 2px solid var(--primary);
}

@media (min-width: 640px) {
  .comparison-table th {
    font-size: 0.875rem;
    padding: 14px 16px;
  }
}

.comparison-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--muted-foreground);
}

@media (min-width: 640px) {
  .comparison-table td {
    padding: 12px 16px;
  }
}

.comparison-table td.win {
  color: var(--primary);
  font-weight: 600;
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.ranked-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: rank;
}

.ranked-list li {
  counter-increment: rank;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
  .ranked-list li {
    gap: 16px;
    padding: 14px 0;
    align-items: baseline;
  }
}

.ranked-list li::before {
  content: counter(rank);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 28px;
  flex-shrink: 0;
  line-height: 1.4;
}

@media (min-width: 640px) {
  .ranked-list li::before {
    font-size: 1.375rem;
    min-width: 36px;
  }
}

.cta-block {
  background: var(--gradient-hero);
  border: 1px solid hsl(0 100% 50% / 0.35);
  border-radius: 12px;
  padding: 32px 18px;
  margin: 48px 0 28px;
  text-align: center;
  box-shadow: var(--shadow-glow);
}

@media (min-width: 640px) {
  .cta-block {
    padding: 48px 40px;
    margin: 64px 0 36px;
  }
}

@media (min-width: 1024px) {
  .cta-block {
    padding: 56px 48px;
    margin: 80px 0 40px;
  }
}

.cta-block .cta-label {
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 600;
}

.cta-block h2 {
  font-family: var(--font-sans);
  font-size: clamp(1.375rem, 4vw, 2.5rem);
  font-weight: 700;
  margin: 0 0 12px;
  border: none;
  padding: 0;
  color: var(--foreground);
  line-height: 1.15;
}

.cta-block p {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  max-width: 30rem;
  margin: 0 auto 24px;
  line-height: 1.6;
}

@media (min-width: 640px) {
  .cta-block p {
    font-size: 1.0625rem;
    margin-bottom: 28px;
  }
}

.cta-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Primary CTA — Hero button (gradient) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gradient-accent);
  color: var(--foreground);
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: var(--shadow-glow);
  transition: var(--transition-smooth), var(--transition-vinyl);
}

.btn-primary:hover {
  transform: scale(1.05);
  filter: brightness(1.06);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .btn-primary {
    font-size: 0.9375rem;
    padding: 14px 28px;
  }

  .btn-primary svg {
    width: 20px;
    height: 20px;
  }
}

/* Secondary — outline, homepage app-style */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--foreground);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.btn-secondary:hover {
  border-color: var(--muted-foreground);
  background: hsla(0, 0%, 100%, 0.04);
}

@media (min-width: 640px) {
  .btn-secondary {
    font-size: 0.9375rem;
    padding: 14px 28px;
  }
}

/* ——— Footer — matches index.html / Footer.tsx ——— */
.site-footer {
  background: var(--vinyl-black);
  border-top: 1px solid var(--vinyl-groove);
  padding-bottom: env(safe-area-inset-bottom);
}

.footer-shell {
  max-width: var(--footer-inner-max);
  margin: 0 auto;
  padding: 48px max(16px, env(safe-area-inset-left)) 48px max(16px, env(safe-area-inset-right));
  text-align: center;
}

@media (min-width: 640px) {
  .footer-shell {
    padding-top: 3rem;
    padding-bottom: 3rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

.footer-brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.footer-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
}

.footer-brand-title {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
}

.footer-tagline {
  margin: 0 auto 2rem;
  max-width: 42rem;
  font-size: 1.0625rem;
  line-height: 1.625;
  color: var(--muted-foreground);
}

@media (min-width: 640px) {
  .footer-tagline {
    font-size: 1.125rem;
  }
}

.footer-cta-wrap {
  margin: 0 0 2rem;
}

/* index footer: solid primary, not gradient */
.btn-footer-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 32px;
  border-radius: calc(var(--radius) - 2px);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--primary-foreground);
  background: var(--primary);
  transition: background 0.2s ease;
}

.btn-footer-primary:hover {
  background: hsl(0 100% 50% / 0.9);
}

.footer-social-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.footer-social-btn {
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--vinyl-groove);
  background: var(--vinyl-black);
  color: var(--foreground);
  text-decoration: none;
  transition: var(--transition-vinyl);
}

.footer-social-btn:hover {
  transform: scale(1.05);
  background: hsl(0 100% 50% / 0.2);
}

.footer-social-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.footer-social-btn svg {
  display: block;
}

.footer-legal {
  border-top: 1px solid var(--vinyl-groove);
  padding-top: 2rem;
}

.footer-copyright {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.footer-legal-link {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-legal-link:hover {
  color: var(--foreground);
}

/* Related reading */
.related-articles {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  margin-top: 40px;
}

.related-articles h3 {
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 14px;
  font-weight: 600;
}

.related-articles ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.related-articles li a {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.related-articles li a:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* /articles/ hub index */
.articles-index-section {
  padding-bottom: 3rem;
}

.articles-index-intro {
  color: var(--muted-foreground);
  max-width: 42rem;
  margin: 0 0 1.25rem;
  font-size: 1rem;
}

@media (min-width: 640px) {
  .articles-index-intro {
    font-size: 1.0625rem;
  }
}

ul.articles-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.articles-index-list li {
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
}

.articles-index-list li:first-child {
  border-top: 1px solid var(--border);
}

.articles-index-list a {
  color: var(--foreground);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-smooth);
  display: inline-block;
}

.articles-index-list a:hover {
  color: var(--primary);
}
