/* =========================================
   AI Navigator Blog — Shared Stylesheet
   Clean & Minimal
   ========================================= */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --text:       #1a1a1a;
  --text-muted: #6b7280;
  --border:     #e5e7eb;
  --bg:         #ffffff;
  --bg-subtle:  #f9fafb;
  --accent:     #2563eb;
  --accent-light: #eff6ff;
  --accent-dark:  #1d4ed8;
  --tag-bg:     #f3f4f6;
  --tag-text:   #374151;
  --radius:     8px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06);
  --shadow:     0 4px 16px rgba(0,0,0,.08);
  --max-w:      720px;
  --max-w-wide: 1100px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 1rem; color: var(--text); }
p:last-child { margin-bottom: 0; }

/* --- Layout Utilities --- */
.container {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container--narrow { max-width: var(--max-w); }

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
}

.nav__logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav__logo:hover { text-decoration: none; color: var(--accent); }
.nav__logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.nav__links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
  align-items: center;
}

.nav__links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color .15s;
  text-decoration: none;
}
.nav__links a:hover, .nav__links a.active { color: var(--text); }

/* --- Hero (Home) --- */
.hero {
  padding: 5rem 1.5rem 3.5rem;
  text-align: center;
  max-width: var(--max-w);
  margin: 0 auto;
}
.hero__eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.hero__title { margin-bottom: 1rem; }
.hero__desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* --- Tag Filter Bar --- */
.tag-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 2rem;
}

.tag-bar__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-right: 0.25rem;
}

/* --- Tags --- */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  transition: background .15s, color .15s;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}
.tag:hover { background: var(--accent-light); color: var(--accent); }
.tag.active {
  background: var(--accent);
  color: #fff;
}

/* Tag colors by category */
.tag--ai-tools    { --tag-bg: #eff6ff; --tag-text: #2563eb; }
.tag--experiments { --tag-bg: #f0fdf4; --tag-text: #16a34a; }
.tag--opinions    { --tag-bg: #fef3c7; --tag-text: #d97706; }
.tag--data        { --tag-bg: #fdf4ff; --tag-text: #9333ea; }
.tag--tutorials   { --tag-bg: #fff1f2; --tag-text: #e11d48; }

/* --- Post Grid --- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}

/* --- Post Card --- */
.post-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  background: var(--bg);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.post-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

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

/* --- "New" badge on recent posts --- */
.badge--new {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
  border-radius: 100px;
  padding: 2px 8px;
  line-height: 1.4;
  flex-shrink: 0;
}
.post-card__title { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.post-card__excerpt { font-size: 0.9rem; color: var(--text-muted); line-height: 1.55; }
.post-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.post-card__meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }

/* --- No Results --- */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.no-results p { font-size: 1.1rem; }

/* --- Section Divider --- */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* --- Newsletter --- */
.newsletter {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 4rem;
}
.newsletter h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.newsletter p { color: var(--text-muted); margin-bottom: 1.5rem; }

.newsletter__form {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.newsletter__input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
  transition: border-color .15s;
  background: var(--bg);
}
.newsletter__input:focus { border-color: var(--accent); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--bg-subtle); text-decoration: none; color: var(--text); }

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }

/* --- Post Page Layout --- */
.post-layout {
  max-width: var(--max-w);
  margin: 3rem auto 5rem;
  padding: 0 1.5rem;
}

.post-header { margin-bottom: 2.5rem; }
.post-header__tags { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.post-header__title { margin-bottom: 0.75rem; }
.post-header__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

/* --- Post Body --- */
.post-body { line-height: 1.8; }

.post-body h2 {
  font-size: 1.4rem;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.post-body h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
.post-body p { color: var(--text); margin-bottom: 1.25rem; }

.post-body ul, .post-body ol {
  margin: 1rem 0 1.25rem 1.5rem;
  color: var(--text);
}
.post-body li { margin-bottom: 0.4rem; }

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-body code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85em;
  background: var(--tag-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: #e11d48;
}

/* --- Chart Container --- */
.chart-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.chart-wrap__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 1rem;
}
.chart-wrap canvas { max-height: 300px; }

/* --- Data Table --- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  background: var(--bg-subtle);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.data-table th:hover { color: var(--text); }
.data-table th .sort-icon { margin-left: 4px; opacity: 0.4; }
.data-table th.sorted .sort-icon { opacity: 1; color: var(--accent); }

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-subtle); }

/* Score bar inside table */
.score-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.score-bar__track {
  flex: 1;
  height: 6px;
  background: var(--tag-bg);
  border-radius: 999px;
  overflow: hidden;
}
.score-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .3s;
}

/* --- About Page --- */
.about-layout {
  max-width: var(--max-w);
  margin: 4rem auto 6rem;
  padding: 0 1.5rem;
}
.about-header { margin-bottom: 2.5rem; }
.about-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 1.25rem;
}

/* --- Toast / Success --- */
.toast {
  display: none;
  background: #022c22;
  color: #86efac;
  font-size: 0.85rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  margin-top: 0.75rem;
  text-align: center;
}
.toast.show { display: block; }
.toast.toast--error {
  background: #450a0a;
  color: #fecaca;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .nav__links { gap: 1rem; }
  .post-grid { grid-template-columns: 1fr; }
  .newsletter { padding: 1.5rem 1rem; }
  .newsletter__form { flex-direction: column; }
  .hero { padding: 3rem 1rem 2rem; }
}
