/* ============================================================
   SmartSavings — style.css
   ============================================================ */

/* ── Design Tokens ── */
:root {
  --bg:           #f8f5f0;
  --surface:      #ffffff;
  --surface-alt:  #f2ede6;
  --border:       #e5dfd6;
  --text:         #1c1917;
  --text-2:       #57534e;
  --text-3:       #a8a29e;
  --accent:       #b5341a;
  --accent-soft:  #fdf2ef;
  --accent-hover: #941f0e;
  --tag-bg:       #ede8e0;
  --tag-text:     #44403c;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-ui:      system-ui, -apple-system, sans-serif;
  --radius:       8px;
  --max-w:        1200px;
  --content-w:    680px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-card:  0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --transition:   150ms ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  min-height: 100vh;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { cursor: pointer; font-family: inherit; }

/* ── Progress bar ── */
#progress-bar {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: var(--accent);
  z-index: 9999;
  transition: width .1s linear;
  pointer-events: none;
}

/* ── Header ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; gap: 24px;
}
.site-logo {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.site-logo:hover { color: var(--accent-hover); }
.site-nav { display: flex; gap: 2px; flex: 1; }
.site-nav a {
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.site-nav a:hover { background: var(--surface-alt); color: var(--text); }
.header-search {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg);
  flex-shrink: 0;
}
.header-search input {
  border: none; background: transparent;
  padding: 7px 14px;
  font-size: 13px; font-family: var(--font-ui);
  color: var(--text); outline: none;
  width: 180px;
}
.header-search button {
  background: none; border: none;
  padding: 7px 12px;
  color: var(--text-2);
  display: flex; align-items: center;
  transition: color var(--transition);
}
.header-search button:hover { color: var(--accent); }

/* ── Footer ── */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,.7);
  padding: 48px 24px 32px;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 48px;
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800;
  color: #fff; text-decoration: none;
  display: block; margin-bottom: 8px;
}
.footer-tagline { font-size: 13px; color: rgba(255,255,255,.5); line-height: 1.6; }
.footer-nav, .footer-legal { display: flex; flex-wrap: wrap; gap: 6px 16px; align-content: flex-start; }
.footer-nav-label {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: rgba(255,255,255,.4); margin-bottom: 4px;
}
.footer-nav a, .footer-legal a {
  font-family: var(--font-ui);
  font-size: 13px; color: rgba(255,255,255,.6);
  text-decoration: none; transition: color var(--transition);
}
.footer-nav a:hover, .footer-legal a:hover { color: #fff; }
.footer-copy {
  grid-column: 1 / -1;
  font-family: var(--font-ui);
  font-size: 12px; color: rgba(255,255,255,.35);
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.1);
}
@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; }
  .site-nav { display: none; }
}

/* ══════════════════════════════════════════════════
   HOMEPAGE
   ══════════════════════════════════════════════════ */

/* Hero */
.hero {
  background: linear-gradient(135deg, #1c1917 0%, #2d1f1a 100%);
  color: #fff;
  padding: 60px 0 72px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(192,57,43,.18) 0%, transparent 65%);
  pointer-events: none;
}
.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(192,57,43,.2);
  border: 1px solid rgba(192,57,43,.35);
  color: #f87171;
  font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 99px;
  margin-bottom: 20px;
  font-family: var(--font-ui);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 68px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.02em;
  margin-bottom: 18px; color: #fff;
}
.hero-title em { font-style: normal; color: #c0392b; }
.hero-sub {
  font-size: clamp(15px, 2vw, 18px);
  color: rgba(255,255,255,.65);
  max-width: 500px; line-height: 1.6;
  margin-bottom: 32px;
  font-family: var(--font-ui);
}
.hero-cats { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-cat-link {
  padding: 7px 16px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 99px;
  color: rgba(255,255,255,.75);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: all .2s;
  background: rgba(255,255,255,.05);
  font-family: var(--font-ui);
}
.hero-cat-link:hover {
  background: rgba(192,57,43,.25);
  border-color: rgba(192,57,43,.5);
  color: #fff; text-decoration: none;
}

/* Category sections */
.cat-section {
  padding: 52px 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 64px;
}
.cat-section:last-child { border-bottom: none; }
.cat-section:nth-child(even) { background: rgba(0,0,0,.018); }
.cat-section .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 40px;
}

.section-header {
  display: flex; align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.section-eyebrow {
  font-size: 11px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 3px;
  font-family: var(--font-ui);
}
.section-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  color: var(--text); margin: 0; line-height: 1.2;
}
.section-more {
  font-size: 13px; color: var(--accent);
  font-weight: 500; text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-ui);
}
.section-more:hover { text-decoration: underline; }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (max-width: 1024px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px)  { .card-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
@media (max-width: 480px)  { .card-grid { grid-template-columns: 1fr; } }

/* Article card */
.article-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.article-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.1);
}
.card-cover {
  display: block;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg);
  position: relative; flex-shrink: 0;
}
.card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .35s; display: block;
}
.article-card:hover .card-cover img { transform: scale(1.04); }
.card-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: flex-end; padding: 14px;
  position: relative; overflow: hidden;
}
.ph-bg { position: absolute; inset: 0; z-index: 0; }
.ph-label {
  position: relative; z-index: 1;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700; line-height: 1.3; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-body {
  padding: 14px 16px 18px;
  flex: 1; display: flex; flex-direction: column;
}
.card-cat {
  font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 5px;
  font-family: var(--font-ui);
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  line-height: 1.35; margin: 0 0 8px; flex: 1;
}
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-excerpt {
  font-size: 13px; color: var(--text-2);
  line-height: 1.55; margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
  font-family: var(--font-ui);
}
.card-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3);
  margin-top: auto; font-family: var(--font-ui);
}
.card-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.card-read-more {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  color: var(--accent); text-decoration: none;
  margin-top: 10px; font-family: var(--font-ui);
}
.card-read-more:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .hero-inner { padding: 0 20px; }
  .cat-section .inner { padding: 0 20px; }
  .cat-section { padding: 36px 0; }
}

/* ══════════════════════════════════════════════════
   ARTICLE DETAIL
   ══════════════════════════════════════════════════ */
.article-wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 18px 80px;
}
.article-cover {
  width: 100%; aspect-ratio: 16/7;
  object-fit: cover;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 28px;
  background: var(--surface-alt);
}
.article-meta {
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3);
  margin: 20px 0 10px;
  font-family: var(--font-ui);
}
.article-cat {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  text-decoration: none;
}
.article-cat:hover { background: var(--accent); color: #fff; }
.article-meta-sep { color: var(--border); }
.article-meta-item { color: var(--text-3); }
.article-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 800; line-height: 1.2;
  color: var(--text); margin: 0 0 18px;
  letter-spacing: -.01em;
}
.article-lead {
  font-size: 17px; line-height: 1.7;
  color: var(--text-2);
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin: 0 0 28px;
}
.article-body { font-size: 16px; line-height: 1.8; color: var(--text); }
.article-body h2 {
  font-family: var(--font-display);
  font-size: clamp(19px, 4vw, 24px);
  font-weight: 700; line-height: 1.25;
  margin: 36px 0 12px; color: var(--text);
}
.article-body h3 {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700;
  margin: 26px 0 10px; color: var(--text);
}
.article-body p { margin-bottom: 18px; }
.article-body ul, .article-body ol { padding-left: 22px; margin-bottom: 18px; }
.article-body li { margin-bottom: 10px; line-height: 1.7; }
.article-body strong { font-weight: 700; color: var(--text); }
.article-body a { color: var(--accent); text-decoration: underline; }
.article-body a:hover { color: var(--accent-hover); }
.article-body blockquote {
  border-left: 3px solid var(--border);
  padding: 4px 0 4px 16px;
  color: var(--text-2); margin: 24px 0; font-style: italic;
}

/* Ad slot */
.ad-slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px; margin: 28px 0;
}
.ad-slot-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); margin-bottom: 12px;
  font-family: var(--font-ui);
}
.afs-container { min-height: 60px; }
.kw-row { display: flex; flex-wrap: wrap; gap: 8px; }
.kw-tag {
  display: inline-block;
  background: var(--tag-bg); color: var(--tag-text);
  padding: 7px 14px; border-radius: 20px;
  font-size: 13px; text-decoration: none;
  border: 1px solid var(--border);
  transition: background .15s, color .15s;
  font-family: var(--font-ui); line-height: 1;
}
.kw-tag:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.related-tags { border-top: 1px solid var(--border); padding-top: 28px; margin-top: 36px; }
.related-tags-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); margin-bottom: 14px;
  font-family: var(--font-ui);
}

@media (max-width: 480px) {
  .article-wrap { padding: 0 16px 60px; }
  .article-lead { font-size: 16px; }
  .article-body { font-size: 15px; }
  .article-body h2 { font-size: 19px; }
  .kw-tag { font-size: 12px; padding: 6px 12px; }
}

/* ══════════════════════════════════════════════════
   SEARCH PAGE
   ══════════════════════════════════════════════════ */
.search-wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 24px 18px 60px;
}
.search-query-label { font-size: 12px; color: var(--text-3); margin-bottom: 2px; font-family: var(--font-ui); }
.search-query-text {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  color: var(--text); line-height: 1.2;
}

/* ══════════════════════════════════════════════════
   STATIC PAGES
   ══════════════════════════════════════════════════ */
.article-body { font-size: 16px; line-height: 1.8; }

/* ══════════════════════════════════════════════════
   ADMIN
   ══════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  text-decoration: none; border: none;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap; font-family: var(--font-ui);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #dc2626; color: #fff; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-ai     { background: #dbeafe; color: #1d4ed8; }
.badge-manual { background: #dcfce7; color: #15803d; }
.alert {
  padding: 12px 16px; border-radius: 6px;
  font-size: 13px; margin-bottom: 20px;
  border-left: 3px solid; font-family: var(--font-ui);
}
.alert-success { background: #f0fdf4; border-color: #22c55e; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #ef4444; color: #dc2626; }
.alert-info    { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }
