/* AccidentRecover - styles */
:root {
  --primary: #1f3a5f;
  --primary-600: #2c5282;
  --primary-700: #18304f;
  --accent: #e8a33d;
  --accent-600: #d18a23;
  --bg: #ffffff;
  --bg-alt: #f4f6f9;
  --footer-bg: #14233b;
  --text: #1f2933;
  --muted: #5b6b7b;
  --border: #e2e8f0;
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --shadow: 0 10px 30px rgba(20, 35, 59, 0.08);
  --shadow-sm: 0 4px 14px rgba(20, 35, 59, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--accent-600); }

h1, h2, h3, h4 { line-height: 1.25; color: var(--primary-700); font-weight: 700; }
/* Keep every page-level heading compact so long titles stay within two lines. */
h1 { font-size: clamp(22px, 2.6vw, 30px); }
h2 { font-size: clamp(20px, 2.6vw, 27px); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--primary-700); font-size: 18px; letter-spacing: -0.01em; }
.brand img { width: 38px; height: 38px; border-radius: 9px; }
.brand span { line-height: 1.05; }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  padding: 9px 14px;
  border-radius: 9px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.main-nav a:hover { background: var(--bg-alt); color: var(--primary-700); }
.nav-search-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; color: var(--primary-700);
}
.nav-search-btn:hover { background: var(--bg-alt); }
.hamburger { display: none; flex-direction: column; gap: 5px; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; align-items: center; justify-content: center; }
.hamburger span { width: 20px; height: 2px; background: var(--primary-700); border-radius: 2px; }
/* Mobile hamburger menu body (desktop nav links stay untouched). */
.mobile-nav-only { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--primary-700); color: #fff; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.42; }
.hero-overlay { position: relative; padding: 84px 0 76px; }
.hero h1 { color: #fff; font-size: clamp(24px, 3.6vw, 38px); margin: 0 0 16px; max-width: 760px; letter-spacing: -0.02em; }
.hero p { font-size: 19px; max-width: 620px; color: #dbe4ef; margin: 0 0 28px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 11px; font-weight: 700; font-size: 15px; cursor: pointer;
  border: 1px solid transparent; transition: transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #2a1c05; }
.btn-primary:hover { background: var(--accent-600); color: #2a1c05; }
.btn-ghost { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.3); }
.btn-ghost:hover { background: rgba(255,255,255,0.2); color:#fff; }

/* ---------- Sections ---------- */
.section { padding: 0 0 56px; }
.section-alt { background: var(--bg-alt); }
.section-head { padding-top: 20px; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(20px, 2.6vw, 27px); margin: 0 0 6px; letter-spacing: -0.01em; }
.section-head p { color: var(--muted); margin: 0; max-width: 640px; }

/* ---------- Category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.cat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.cat-card a { color: inherit; }
.cat-card img { width: 100%; height: 150px; object-fit: cover; }
.cat-card .cat-body { padding: 16px 18px 20px; }
.cat-card h3 { margin: 0 0 6px; font-size: 18px; }
.cat-card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.cat-card .cat-count { display: inline-block; margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--primary-600); }
.cat-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Category filter & grouped lists ---------- */
.cat-nav-wrap { position: relative; display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; }
.cat-filter-bar {
  display: flex; flex-wrap: nowrap; gap: 10px; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding: 2px 2px 8px;
}
.cat-filter-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 9px 14px; white-space: nowrap;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-size: 13.5px; font-weight: 600;
  line-height: 1.3; text-decoration: none;
  transition: border-color .12s ease, background .12s ease, color .12s ease, box-shadow .12s ease;
}
.cat-chip span {
  flex: 0 0 auto; margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--bg-alt);
  color: var(--muted); font-size: 11.5px; font-weight: 700;
}
.cat-chip:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.cat-chip.is-active {
  border-color: var(--primary-600); background: var(--primary-600); color: #fff;
  box-shadow: 0 6px 16px rgba(20, 35, 59, 0.16);
}
.cat-chip.is-active span { background: rgba(255,255,255,0.18); color: #fff; }
/* Right-hand dropdown: all topics in one menu, kept outside the scroll area. */
.cat-nav-dd { flex: 0 0 auto; }
.cat-nav-dd-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  width: 44px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-family: inherit; font-size: 13.5px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cat-nav-dd-btn svg { transition: transform .15s ease; }
.cat-nav-dd.is-open .cat-nav-dd-btn { border-color: var(--primary-600); box-shadow: var(--shadow-sm); }
.cat-nav-dd.is-open .cat-nav-dd-btn svg { transform: rotate(180deg); }
.cat-nav-dd-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30;
  width: 100%; min-width: 0; padding: 8px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cat-nav-dd-menu[hidden] { display: none; }
.cat-nav-dd-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 8px; color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.cat-nav-dd-menu a:hover { background: var(--bg-alt); }
.cat-nav-dd-menu a.is-active { background: var(--primary-600); color: #fff; }
.cat-nav-dd-menu a span { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.cat-nav-dd-menu a.is-active span { color: rgba(255,255,255,0.85); }
.cat-groups { display: block; }
.cat-group { margin-bottom: 44px; }
.cat-group:last-child { margin-bottom: 0; }
.cat-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 22px;
}
.cat-group-head h3 { margin: 0; font-size: clamp(20px, 2.4vw, 25px); letter-spacing: -0.01em; }
.cat-group-count { font-size: 13px; font-weight: 700; color: var(--accent-600); white-space: nowrap; }

/* ---------- Article cards ---------- */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.article-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease;
}
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.article-card a { color: inherit; display: flex; flex-direction: column; height: 100%; }
.article-card img { width: 100%; height: 168px; object-fit: cover; }
.article-card .ac-body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.article-card .ac-cat { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-600); margin-bottom: 8px; }
.article-card h3 { margin: 0 0 8px; font-size: 18px; line-height: 1.3; }
.article-card p { margin: 0 0 14px; color: var(--muted); font-size: 14.5px; flex: 1; }
.article-card .ac-meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; }

/* ---------- Detail ---------- */
.detail-hero-img { width: 100%; height: 320px; object-fit: cover; border-radius: var(--radius); margin: 18px 0 4px; }
.detail-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; max-width: 820px; margin: 0 auto; }
.detail-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 14px; margin: 6px 0 4px; flex-wrap: wrap; }
.detail-cat { font-weight: 700; color: var(--accent-600); text-transform: uppercase; letter-spacing: 0.05em; font-size: 12px; }
.detail-body { font-size: 18px; }
.detail-body h3 { font-size: 23px; margin: 32px 0 10px; letter-spacing: -0.01em; }
.detail-body p { margin: 0 0 18px; }
.detail-body img { width: 100%; border-radius: var(--radius-sm); margin: 18px 0; }
.detail-body blockquote { margin: 22px 0; padding: 16px 20px; border-left: 4px solid var(--accent); background: var(--bg-alt); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text); font-style: italic; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* ---------- Search ---------- */
.search-bar { display: flex; gap: 10px; max-width: 620px; }
.search-bar input { flex: 1; padding: 14px 16px; border: 1px solid var(--border); border-radius: 11px; font-size: 16px; font-family: inherit; }
.search-bar button { padding: 0 22px; }
.search-results .article-card h3 { font-size: 16px; }
.result-count { color: var(--muted); margin: 4px 0 20px; }
.no-results { padding: 30px; background: var(--bg-alt); border-radius: var(--radius); color: var(--muted); }

/* ---------- Generic page ---------- */
.page-wrap { max-width: 820px; margin: 0 auto; }
.page-wrap h2 { margin-top: 34px; font-size: 21px; }
.page-wrap h3 { margin-top: 26px; font-size: 19px; }
.page-wrap p { color: #2c3a47; }
.page-wrap ul { color: #2c3a47; padding-left: 22px; }
.page-wrap li { margin: 6px 0; }

/* ---------- Contact form ---------- */
.contact-form { display: grid; gap: 16px; max-width: 560px; }
.contact-form label { font-weight: 600; font-size: 14px; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 15px;
}
.contact-note { color: var(--muted); font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: #c4cedb; margin-top: 50px; padding: 46px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.footer-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; }
.footer-brand img { width: 34px; height: 34px; border-radius: 8px; }
.site-footer h4 { color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 12px; }
.site-footer a { color: #c4cedb; display: block; margin: 7px 0; font-size: 14.5px; }
.site-footer a:hover { color: #fff; }
.footer-cookie { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 30px; padding-top: 18px; font-size: 13px; color: #93a2b5; }
.footer-copy { margin-top: 14px; font-size: 13px; color: #7d8da0; }

/* ---------- Advertisement slots (demo config) ----------
   Every slot starts VISIBLE with a centered "Advertisement" placeholder: no
   box, no background, no border. The platform's own signal decides the rest;
   an unfilled slot folds with height:0 (never display:none) so it stays in the
   layout tree and a late creative can expand it again. */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  position: relative;
  width: 100%;
  box-sizing: border-box;
  margin: 24px 0;
}
/* Until the platform concludes, keep the placeholder visible. Scoped away from
   the folded state so it can never interfere with the height:0 collapse. */
.ad-slot:not([data-ad-state="empty"]) { min-height: 50px; }
.ad-slot::before {
  content: "Advertisement";
  position: absolute;
  left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-size: 12px;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--muted);
  opacity: .55;
  pointer-events: none;
}
/* A decided slot drops the centered placeholder. Only platform signals drive
   this - never an iframe heuristic. */
.ad-slot:has(ins[data-ad-status="filled"])::before,
.ad-slot[data-ad-state]::before { content: none; }
/* A real creative keeps the label, but sits ABOVE the ad. */
.ad-slot[data-ad-state="filled"],
.ad-slot:has(ins[data-ad-status="filled"]) {
  flex-direction: column;
  justify-content: flex-start;
}
.ad-slot[data-ad-state="filled"]::before,
.ad-slot:has(ins[data-ad-status="filled"])::before {
  content: "Advertisement";
  position: static;
  left: auto; right: auto; top: auto;
  transform: none;
  display: block;
  width: 100%;
  margin: 0 0 6px;
  line-height: 1.4;
}
.ad-slot iframe, .ad-slot ins { display: block; width: 100%; }
.ad-slot > div,
.ad-slot > ins,
.ad-slot > iframe {
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
}
.ad-slot[data-slot^="home"] { margin-left: auto; margin-right: auto; }
.ad-slot[data-slot^="home"] iframe,
.ad-slot[data-slot^="home"] ins {
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}
.ad-slot[data-slot="home1"] { margin-top: 20px; }
/* Fold the WHOLE block - container and label - after an unfilled verdict. */
[data-slot][data-ad-state="empty"],
.ad-anchor-wrap[data-ad-state="empty"] {
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
[data-slot][data-ad-state="empty"]::before,
.ad-anchor-wrap[data-ad-state="empty"]::before { content: none !important; }

/* anchor: visible from the first frame, label only, no background */
.ad-anchor-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: block;
  text-align: center;
}
.ad-anchor-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; position: relative; }
.ad-anchor-wrap .ad-slot { margin: 0; border: none; background: transparent; }
/* The reserved strip below the footer follows the ACTUAL anchor material
   height (set by ads.js), and collapses with it. */
body.has-inter {
  background:
    linear-gradient(var(--footer-bg), var(--footer-bg)) bottom / 100% var(--inter-pad, 62px) no-repeat,
    var(--bg);
}

/* interstitial: the site never renders its own popup. Its slot stays a plain
   container in the page, hidden until a real filled creative is connected. */
.ad-inter-host { display: block; }
.ad-slot[data-slot="inter"] {
  height: 0 !important; min-height: 0 !important; margin: 0 !important;
  padding: 0; border: none; overflow: hidden;
}
.ad-slot[data-slot="inter"]::before { content: none; }
.ad-slot[data-slot="inter"][data-ad-state="filled"] {
  height: auto !important; min-height: 50px; overflow: visible;
}
.ad-slot[data-slot="inter"][data-ad-state="filled"]::before { content: "Advertisement"; }

/* ---------- Back to top / home ---------- */
.fab {
  position: fixed; right: 20px; z-index: 90;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary-700); color: #fff; box-shadow: var(--shadow);
  display: none; align-items: center; justify-content: center;
}
.fab:hover { background: var(--primary-600); }
.fab svg { width: 22px; height: 22px; }
#backToTop { bottom: 212px; }
#backHome { bottom: 150px; }
.fab.is-visible { display: flex; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 90px 0; }
.notfound h1 { font-size: 72px; margin: 0; color: var(--accent); }
.notfound p { color: var(--muted); font-size: 18px; }

/* The top-of-article back link sits on a light background; the hero's white
   ghost-button palette would make its label invisible there. */
#detailHead .btn-ghost { background: #fff; color: var(--primary-700); border-color: var(--border); }
#detailHead .btn-ghost:hover { background: var(--bg-alt); color: var(--primary-700); }

/* Home banners now sit between the category cards: keep them full-width rows. */
.cat-grid > .ad-slot { grid-column: 1 / -1; }

/* With the banners moved out, keep the three article grids evenly separated. */
#homeGridMid, #homeGridBot { margin-top: 22px; }

/* The first home banner sits inside the dark hero; keep its label legible. */
.hero > .ad-slot::before { color: rgba(255, 255, 255, 0.85); opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .nav-search-btn { display: inline-flex; margin-left: auto; margin-right: 12px; }
  .main-nav.is-open {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; top: 68px; left: 0; right: 0; background: #fff;
    border-bottom: 1px solid var(--border); padding: 10px 16px; box-shadow: var(--shadow-sm);
  }
  .main-nav.is-open a { padding: 12px 10px; }
  .main-nav.is-open > a { display: none; }
  .main-nav.is-open .mobile-nav-only { display: flex; flex-direction: column; gap: 2px; }
  /* Footer: brand keeps its own row, the three link groups share one row and wrap when space runs out. */
  .footer-grid { display: flex; flex-wrap: wrap; gap: 24px 16px; }
  .footer-grid > div:first-child { flex: 1 0 100%; }
  .footer-grid > div:not(:first-child) { flex: 1 1 96px; min-width: 96px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero-overlay { padding: 56px 20px 50px; }
  .cat-grid { grid-template-columns: 1fr; }
  .article-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .detail-hero-img { height: 200px; }
  /* Category nav: a single horizontally scrollable row plus the dropdown. */
  .cat-nav-wrap { gap: 8px; }
  .cat-chip { padding: 9px 12px; font-size: 13px; }
  .cat-nav-dd-btn { padding: 0; font-size: 13px; }
  .cat-nav-dd-menu { width: 100%; min-width: 0; }
}
