/* =========================================
   TopAIToolRank - Blog Page (Standalone CSS)
   File: blog.css
   Purpose: Fully self-contained styles for blog.html
========================================= */

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

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: #0f172a;
  background: #f8fafc;
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px 6px;
}

/* Accessible focus */
:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

/* Screen-reader-only */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout Utilities ---------- */
.container {
  width: 92%;
  max-width: 1120px;
  margin: 0 auto;
}

main {
  display: block;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
}

.logo a {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: #0f172a;
}

.nav-inner nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-inner nav a {
  font-size: 14px;
  color: #334155;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav-inner nav a:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.nav-inner nav a[aria-current="page"] {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

/* ---------- Hero ---------- */
.hero {
  padding: 40px 0 18px 0;
  background: radial-gradient(1200px 400px at 20% 10%, rgba(37, 99, 235, 0.10), transparent 60%),
              radial-gradient(900px 380px at 90% 0%, rgba(14, 165, 233, 0.10), transparent 55%),
              #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.hero h1 {
  margin: 0 0 10px 0;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  max-width: 70ch;
  color: #475569;
  font-size: 15px;
}

.hero-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  text-decoration: none;
  background: #f8fafc;
  transform: translateY(-1px);
}

.trust-line {
  margin-top: 14px;
  font-size: 13px;
  color: #64748b;
}

/* ---------- Blog Section ---------- */
.blog-rows {
  padding: 26px 0 60px 0;
}

/* Toolbar */
.blog-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px 0;
}

.blog-search {
  width: 100%;
  max-width: 620px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.blog-search::placeholder {
  color: #94a3b8;
}

.blog-search:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Row (rail) */
.rail {
  margin-top: 26px;
}

.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rail-h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.rail-h2 a {
  color: #0f172a;
  text-decoration: none;
}

.rail-h2 a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.rail-sub {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
}

/* Netflix-style horizontal scroller */
.rail-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 280px;
  gap: 14px;

  overflow-x: auto;
  overflow-y: hidden;

  padding: 4px 2px 10px 2px;

  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.rail-track:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  border-radius: 14px;
}

/* scrollbar (kept subtle) */
.rail-track::-webkit-scrollbar {
  height: 10px;
}
.rail-track::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 999px;
}
.rail-track::-webkit-scrollbar-track {
  background: transparent;
}

/* Card */
.rail-card {
  scroll-snap-align: start;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  min-width: 0;
}

.rail-card:hover {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.rail-link {
  display: grid;
  grid-template-rows: 150px 1fr;
  height: 100%;
  text-decoration: none;
}

.rail-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: #f1f5f9;
}

.rail-img--placeholder {
  background:
    linear-gradient(180deg, rgba(241, 245, 249, 1) 0%, rgba(255, 255, 255, 1) 100%),
    radial-gradient(600px 120px at 40% 30%, rgba(37, 99, 235, 0.12), transparent 60%);
}

.rail-body {
  padding: 12px 12px 14px 12px;
}

.rail-title {
  margin: 0 0 6px 0;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: -0.01em;

  /* clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rail-excerpt {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rail-meta {
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Empty state inside a row */
.rail-empty {
  border: 1px dashed #e2e8f0;
  background: #f8fafc;
  border-radius: 16px;
  padding: 16px;
  color: #475569;
}

/* Generic card fallback box */
.article-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 22px 0;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-inner strong {
  display: inline-block;
  margin-bottom: 6px;
}

.footer-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #334155;
  font-size: 14px;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 10px;
}

.footer-links a:hover {
  background: #f1f5f9;
  text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero h1 {
    font-size: 30px;
  }

  .nav-inner {
    align-items: flex-start;
  }

  .nav-inner nav {
    gap: 8px;
  }
}

@media (max-width: 680px) {
  .hero {
    padding: 32px 0 16px 0;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero p {
    font-size: 14px;
  }

  .rail-track {
    grid-auto-columns: 78vw; /* Netflix feel on mobile */
  }

  .rail-link {
    grid-template-rows: 140px 1fr;
  }

  .rail-img {
    height: 140px;
  }

  .blog-search {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
    transition: none !important;
  }
}
