/* =============================================================================
   How-To Content Platform — public editorial stylesheet (mobile-first, no framework)
   A53 (performance), A71 (design), A72 (accessibility).
   ============================================================================= */

:root {
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #5c6470;
  --line: #e5e7eb;
  --brand: #0b6e4f;
  --brand-ink: #07503a;
  --accent: #b45309;
  --surface: #f8fafc;
  --radius: 10px;
  --maxw: 1080px;
  --gap: 1rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.65;
}
a { color: var(--brand-ink); text-underline-offset: 2px; }
a:hover { color: var(--brand); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: 2px;
  border-radius: 4px;
}
img { max-width: 100%; height: auto; display: block; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }
.visually-hidden,
.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus {
  position: absolute; left: 1rem; top: 1rem; z-index: 100;
  background: #fff; color: var(--fg); padding: .5rem .75rem; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

/* ---------------------------------------------------------------- Header */
.site-header { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .75rem 1rem; }
.site-brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--fg); display: inline-flex; align-items: center; }
.site-brand img { height: 40px; width: auto; display: block; }
.primary-nav { order: 3; width: 100%; }
.primary-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: .5rem 0 0; padding: 0; }
.primary-nav a { text-decoration: none; font-size: .95rem; }
.nav-toggle { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .35rem .6rem; cursor: pointer; }
.site-search { margin-left: auto; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.site-search input { padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 8px; min-width: 8rem; width: auto; }
.site-search button { border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 8px; padding: .4rem .7rem; cursor: pointer; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .primary-nav { order: 2; width: auto; }
  .primary-nav ul { margin: 0; }
  .site-search { order: 3; }
}

/* ------------------------------------------------------------ Typography */
h1 { font-size: 1.7rem; line-height: 1.25; margin: 1rem 0 .5rem; }
h2 { font-size: 1.3rem; margin: 1.6rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 0 0 .35rem; }
p { margin: 0 0 .9rem; }
.muted { color: var(--muted); font-size: .85rem; }
.empty { color: var(--muted); font-style: italic; }
.meta-sep { color: var(--muted); margin: 0 .35rem; }
.page-header { margin-bottom: .5rem; }
.page-intro, .topic-intro { color: #333; font-size: 1.02rem; max-width: 60ch; }
@media (min-width: 720px) {
  h1 { font-size: 2.05rem; }
  h2 { font-size: 1.45rem; }
}

/* ---------------------------------------------------------- Breadcrumbs */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: .75rem 0 0; margin: 0; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: .35rem; color: var(--muted); }

/* ---------------------------------------------------------------- Cards */
.card-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); margin: 1rem 0; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: #fff; }
.card-title { margin: 0 0 .35rem; }
.card-title a { text-decoration: none; }
.card-excerpt { margin: 0 0 .5rem; color: #333; font-size: .95rem; }
.card-date, .card-meta { color: var(--muted); font-size: .8rem; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.badge { display: inline-block; background: #f3f4f6; color: #374151; border-radius: 999px; padding: .1rem .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; }
.badge-confirmed { background: #dcfce7; color: #166534; }
.badge-reported, .badge-update, .badge-follow_up { background: #e0f2fe; color: #075985; }
.badge-expected { background: #fef9c3; color: #854d0e; }
.badge-speculation, .badge-correction, .badge-do_not_publish { background: #fee2e2; color: #991b1b; }

/* --------------------------------------------------------------- Article */
.article-header { margin-top: .5rem; }
.article-meta { color: var(--muted); font-size: .9rem; }
.quick-answer { background: #f0fdf4; border-left: 4px solid var(--brand); padding: .75rem 1rem; border-radius: 6px; }
.quick-answer h2 { margin-top: 0; font-size: 1.05rem; }
.correction-notice { background: #fff7ed; border-left: 4px solid var(--accent); padding: .5rem .75rem; font-size: .9rem; }
.article-section { margin: 1.5rem 0; }
.section-warning { background: #fffbeb; border-left: 4px solid var(--accent); padding: .5rem .75rem; }
.section-tip, .section-note { background: var(--surface); border-left: 4px solid #94a3b8; padding: .5rem .75rem; }
.section-steps { border-left: 4px solid var(--brand); padding-left: .75rem; }
.section-troubleshooting, .section-common_mistake { background: #fdf2f8; border-left: 4px solid #be185d; padding: .5rem .75rem; }
.section-what_you_need { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; }
.section-image, .featured { border-radius: var(--radius); margin: .75rem 0; }
.image-caption { color: var(--muted); font-size: .82rem; }
.featured-image, .hero-image { margin: 1rem 0; }
.featured-image img, .hero-image img { width: 100%; border-radius: var(--radius); }
.faq { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq-answer { padding: .5rem 0 0; }
.article-corrections { background: #fff7ed; border: 1px solid #fed7aa; border-radius: var(--radius); padding: .75rem 1rem; margin: 1.5rem 0; }
.article-corrections ul { padding-left: 1.1rem; }
.article-topics { color: var(--muted); font-size: .9rem; }
.detail-list, .label-list { margin: 0; }
.label-list dt { margin-top: .5rem; font-weight: 600; }
.label-list dd { margin: 0 0 .25rem; color: var(--muted); font-size: .92rem; }
.news-status { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; margin: 0 0 .25rem; }
.news-label-help { color: var(--muted); font-size: .85rem; }
.dek { font-size: 1.08rem; color: #333; }

/* ------------------------------------------------- Author / topic / misc */
.author-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface); margin: 2rem 0; }
.author-box h2 { margin-top: 0; }
.author-box-name { font-weight: 700; margin-bottom: .25rem; }
.author-header { display: flex; flex-direction: column; gap: .5rem; }
.author-avatar img, .avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }
.author-expertise { font-weight: 600; margin: 0; }
.topic-actions { margin: 1.5rem 0; }
.contact-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
.static-body { max-width: 68ch; }
.section-more { margin-top: .5rem; }
.hero { margin: 1rem 0 1.5rem; }
.hero .tagline { font-size: 1.1rem; color: #333; max-width: 65ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.home-section { margin: 2rem 0; }
.prev-next { display: grid; gap: .75rem; margin: 2rem 0; border-top: 1px solid var(--line); padding-top: 1rem; }
@media (min-width: 720px) { .prev-next { grid-template-columns: 1fr 1fr; } }
.prev-next a { text-decoration: none; display: block; }
.prev-next .muted { display: block; }

/* ---------------------------------------------------------------- Lists */
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: .5rem 0; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; text-decoration: none; font-size: .9rem; }
.link-list, .topic-list, .author-list { list-style: none; padding: 0; }
.link-list li, .topic-list li, .author-list li { padding: .5rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.related-block ul { padding-left: 1.1rem; }
.related-content { display: grid; gap: 1rem; margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1rem; }
@media (min-width: 720px) { .related-content { grid-template-columns: 1fr 1fr; } }

/* ----------------------------------------------------------- Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin: 1.5rem 0; }
.pagination-status { color: var(--muted); font-size: .9rem; }
.pagination .disabled { color: #9ca3af; }

/* --------------------------------------------------------------- Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 2.5rem; padding: 1.5rem 0; background: var(--surface); }
.footer-inner { display: grid; gap: 1.25rem; }
@media (min-width: 720px) { .footer-inner { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.footer-heading { font-size: .95rem; margin: 0 0 .35rem; }
.site-footer nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; }
.footer-copy, .footer-brand, .footer-legal { color: var(--muted); font-size: .85rem; }
.footer-brand { font-weight: 700; color: var(--fg); margin: 0 0 .25rem; }
.footer-legal { margin-top: 1rem; }

/* ---------------------------------------------------------------- Forms */
label { display: block; font-weight: 600; margin-bottom: .25rem; }
input, select, textarea { font: inherit; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; width: 100%; max-width: 32rem; }
button, .btn { border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 8px; padding: .5rem .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--brand-ink); color: #fff; }
.btn-secondary { background: #fff; color: var(--brand-ink); }
.btn-secondary:hover { background: #fff; color: var(--brand); }
.form-error { color: #991b1b; font-weight: 600; }
.form-help { color: var(--muted); font-size: .85rem; margin: .35rem 0 0; max-width: 32rem; }
.search-form { margin: 1rem 0; }
.search-count { color: #333; }

/* ------------------------------------------------------------- Ad slots */
.ad-slot-wrap { margin: 1.25rem 0; text-align: center; }
.ad-slot { display: block; min-height: 60px; }

/* ----------------------------------------------------------- Error page */
.error-page { padding: 3rem 1rem; text-align: center; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--brand); margin: 0; line-height: 1; }
.error-actions { margin: 1.25rem 0 .5rem; }
.error-hint { color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------- News legend / sources */
.news-legend { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface); margin: 1.25rem 0; }
.news-legend h2 { margin-top: 0; font-size: 1.05rem; }
.news-legend dl { margin: 0; max-width: 70ch; }
.news-sources { margin: 2rem 0; }
.news-sources ul { padding-left: 1.1rem; }
.news-sources li { margin-bottom: .4rem; }
.news-sources time { color: var(--muted); font-size: .82rem; margin-left: .35rem; }
.news-body { max-width: 72ch; }
.blank-layout { padding: 1rem 0; }

/* ------------------------------------------------------------- A11y/print */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
  .site-header, .site-footer, .ad-slot-wrap, .pagination, .nav-toggle, .site-search { display: none !important; }
  a { color: #000; }
}
