/* Mobile-first (H5), wider layouts from 900px (§4, §11).
   System font stack: no web-font download, so nothing blocks rendering (§5.4).
   Design: white surfaces, one brand colour, generous spacing, hairline borders. */

:root {
  --ink: #0f1f24;
  --ink-soft: #55666c;
  --ink-faint: #7d8c91;
  --bg: #ffffff;
  --bg-soft: #f5f8f8;
  --line: #e4ebec;
  --line-strong: #c9d5d7;
  --brand: #0f5c63;
  --brand-dark: #0a434a;
  --brand-tint: #e8f3f3;
  --accent: #f2b84b;
  --warn-bg: #fff8e6;
  --warn-line: #f0d48a;
  --error: #b42318;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 31, 36, .04), 0 8px 24px rgba(15, 31, 36, .06);
  --wrap: 1120px;
  --measure: 70ch;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; color: var(--ink); letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.75rem); margin: 0 0 .75rem; letter-spacing: -0.025em; font-weight: 750; }
h2 { font-size: clamp(1.35rem, 1.2rem + .7vw, 1.65rem); margin: 3rem 0 .75rem; font-weight: 700; }
h3 { font-size: 1.12rem; margin: 1.75rem 0 .5rem; font-weight: 650; }
p { margin: 0 0 1rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 680px; padding-top: 2.5rem; padding-bottom: 4rem; }
.small { font-size: .9rem; color: var(--ink-soft); }
.lede { font-size: 1.18rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 1rem; max-width: 62ch; }
.eyebrow { font-size: .9rem; color: var(--ink-soft); margin: 0 0 .5rem; }
.visually-hidden, .hp {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.skip { position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff; padding: .5rem 1rem; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; top: 8px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: .75rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand img { width: 32px; height: 32px; flex: none; }
.brand span { line-height: 1.2; }

.menu { order: 3; }
.menu summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
}
.menu summary:hover, .menu[open] summary { background: var(--bg-soft); }
.menu summary::-webkit-details-marker { display: none; }
.menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); position: relative; content: "";
}
.menu-icon::before { position: absolute; top: -6px; }
.menu-icon::after { position: absolute; top: 6px; }
.menu nav { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 16px 32px rgba(15, 31, 36, .08); }
.menu ul { list-style: none; margin: 0; padding: .5rem 20px 1rem; }
.menu li a { display: block; padding: .85rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 550; }
.menu li:last-child a { border-bottom: 0; }
.menu a[aria-current="page"] { color: var(--brand); }
.header-cta { order: 2; }
.nav-desktop { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; border: 1.5px solid var(--brand);
  padding: .7rem 1.4rem; border-radius: 999px; font-weight: 600; font-size: 1rem;
  text-decoration: none; cursor: pointer; font-family: inherit; line-height: 1.3; min-height: 46px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--ink-faint); }
.btn-small { padding: .4rem 1rem; font-size: .92rem; min-height: 38px; white-space: nowrap; }
.link-button { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; font-size: .9rem; padding: 0; }

/* Banners */
.draft-banner { background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); padding: .5rem 20px; text-align: center; font-size: .9rem; }
.notice { background: var(--brand-tint); padding: .85rem 1.1rem; border-radius: var(--radius-sm); }

/* Breadcrumbs */
.breadcrumbs { font-size: .88rem; padding-top: 1.25rem; color: var(--ink-faint); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); text-decoration: underline; }
.breadcrumbs li + li::before { content: "/"; margin-right: .35rem; color: var(--line-strong); }
.breadcrumbs [aria-current] { color: var(--ink-faint); }

/* Hero (home) */
.hero { background: var(--bg-soft); padding: 3rem 0 2.5rem; border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 18ch; }
.hero .lede { max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.75rem 0; }
.trust-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; font-size: .95rem; color: var(--ink-soft); }
.trust-list li { display: flex; gap: .6rem; align-items: flex-start; }
.trust-list li::before {
  content: "✓"; flex: none; width: 1.35rem; height: 1.35rem; margin-top: .15rem; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand); font-weight: 700; font-size: .78rem;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Home sections */
.home-section { margin: 4rem 0; }
.home-section > h2 { margin-top: 0; }
.home-section > p { max-width: var(--measure); color: var(--ink-soft); }
.section-more { margin-top: 1.25rem; font-weight: 600; }
.section-more a { text-decoration: none; }
.section-more a:hover { text-decoration: underline; }
.home-prose { max-width: var(--measure); }

/* Responsive images (§5.4): intrinsic width/height reserve space; CSS scales. */
.picture { display: block; }
.picture img { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--bg-soft); }
.hero-image { margin: 0 0 2rem; }
.hero-grid { display: grid; gap: 2rem; align-items: center; }
.hero .hero-image { margin: 0; }
.hero .hero-image img { border-radius: 20px; box-shadow: var(--shadow); }
.figure { margin: 2rem 0; }
.figure figcaption { font-size: .9rem; color: var(--ink-soft); margin-top: .6rem; max-width: var(--measure); }

/* Content layout */
.content-layout { display: grid; gap: 2.5rem; padding-top: 1.5rem; padding-bottom: 4rem; }
.content-main { min-width: 0; }
.page-header { margin-bottom: 2rem; }
.byline { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .88rem; color: var(--ink-faint); margin: 1rem 0 0; }
.byline .pending { color: #8a5a00; }

.toc { border-left: 2px solid var(--line); padding: .15rem 0 .15rem 1.1rem; margin: 0 0 2.25rem; }
.toc-title { font-weight: 650; margin: 0 0 .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.toc ol { list-style: none; margin: 0; padding: 0; font-size: .95rem; display: grid; gap: .3rem; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--brand); text-decoration: underline; }

.prose > :first-child { margin-top: 0; }
.prose p, .prose li { max-width: var(--measure); }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.prose li { margin-bottom: .4rem; }
.prose li::marker { color: var(--ink-faint); }
.prose blockquote { margin: 1.5rem 0; padding: 1rem 1.25rem; background: var(--warn-bg); border-radius: var(--radius-sm); max-width: var(--measure); }
.prose blockquote p { margin: .25rem 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: .94rem; display: block; overflow-x: auto; margin: 1.5rem 0; line-height: 1.5; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: .7rem .9rem .7rem 0; text-align: left; vertical-align: top; }
.prose th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); font-weight: 650; border-bottom-color: var(--line-strong); white-space: nowrap; }
.prose img { border-radius: var(--radius); }

/* Cards: the whole card is the link target. */
.cards { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; }
.card {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.35rem 1.35rem;
  background: #fff; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.card:focus-within { border-color: var(--brand); }
.card h3 { margin: 0 0 .4rem; font-size: 1.08rem; line-height: 1.35; }
.card h3 a { text-decoration: none; color: var(--ink); }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card:hover h3 a { color: var(--brand); }
.card p { margin: 0; font-size: .94rem; line-height: 1.55; color: var(--ink-soft); }

/* CTA */
.cta { background: var(--brand); color: #fff; border-radius: 20px; padding: 1.75rem 1.5rem; margin: 3rem 0 0; }
.cta h2 { color: #fff; margin: 0 0 .5rem; font-size: 1.3rem; }
.cta p { color: #dcebed; font-size: .98rem; line-height: 1.55; margin-bottom: 1.25rem; }
.cta .btn { background: #fff; color: var(--brand-dark); border-color: #fff; }
.cta .btn:hover { background: var(--brand-tint); border-color: var(--brand-tint); color: var(--brand-dark); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:first-of-type { border-top: 1px solid var(--line); }
.faq-item summary { cursor: pointer; list-style: none; position: relative; padding: .2rem 2.25rem .2rem 0; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; position: absolute; right: .4rem; top: 50%; width: .55rem; height: .55rem; margin-top: -.45rem;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg); transition: transform .15s;
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -.1rem; }
.faq-item summary:hover h3 { color: var(--brand); }
.faq-item summary h3 { display: inline-block; margin: 1rem 0; font-size: 1.04rem; font-weight: 600; letter-spacing: 0; text-wrap: wrap; }
.faq-item p { margin: 0 0 1.25rem; color: var(--ink-soft); max-width: var(--measure); }

.sources ul { font-size: .9rem; color: var(--ink-soft); padding-left: 1.2rem; max-width: var(--measure); }
.sources li { margin-bottom: .4rem; }
.disclaimer { border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 3rem; max-width: var(--measure); }
.related h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 2rem 0 0; }
.related .cards { margin-top: .75rem; gap: .75rem; }

/* Comments */
.comments { margin-top: 3.5rem; border-top: 1px solid var(--line); }
.threads, .replies { list-style: none; padding: 0; margin: 1.25rem 0; }
.thread { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.replies { margin: .5rem 0 0; padding-left: 1rem; border-left: 2px solid var(--line); }
.comment { padding: .5rem 0; }
.comment-meta { display: flex; gap: .75rem; align-items: baseline; font-size: .94rem; }
.comment-meta time { color: var(--ink-faint); font-size: .85rem; }
.comment-body p { margin: .4rem 0; }
.comment-actions { display: flex; gap: 1rem; align-items: flex-start; font-size: .85rem; flex-wrap: wrap; }
.comment-actions a { color: var(--ink-soft); }
.report summary, .reply-box summary { cursor: pointer; color: var(--ink-soft); }
.report form { display: grid; gap: .5rem; margin-top: .5rem; max-width: 320px; }
.reply-box summary { color: var(--brand); font-size: .92rem; font-weight: 600; }
.comment-form { display: grid; gap: .6rem; margin: 1.25rem 0; }
.signout { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.comment-cta { margin-top: 1.75rem; font-weight: 600; }
.thread-list { list-style: none; padding: 0; margin: 1.25rem 0; }
.thread-list li { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.thread-list li:first-child { border-top: 1px solid var(--line); }
.thread-list li > a { display: block; font-weight: 600; text-decoration: none; }
.thread-list li > a:hover { text-decoration: underline; }
.pagination { display: flex; justify-content: space-between; margin: 1.5rem 0; }

/* Forms */
.form { display: grid; gap: 1.25rem; margin: 1.5rem 0 2.5rem; max-width: 640px; }
.field { display: grid; gap: .35rem; }
.field label, .comment-form label { font-weight: 600; font-size: .96rem; }
.optional { font-weight: 400; color: var(--ink-faint); }
.hint { margin: 0; font-size: .88rem; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; /* ≥16px avoids iOS zoom */
  padding: .75rem .9rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 4px var(--brand-tint); }
[aria-invalid="true"] { border-color: var(--error) !important; }
.field-error, .form-error { color: var(--error); margin: 0; font-size: .92rem; }
.form-error { background: #fdecea; padding: .85rem 1.1rem; border-radius: var(--radius-sm); }
.checkbox { grid-template-columns: auto 1fr; align-items: start; gap: .7rem; }
.checkbox input { width: 22px; height: 22px; margin-top: .2rem; accent-color: var(--brand); }
.checkbox label { font-weight: 400; font-size: .95rem; line-height: 1.55; }
.checkbox .field-error { grid-column: 1 / -1; }

/* Moderation */
.moderation-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.moderation-actions { display: flex; gap: .5rem; }
.flagged { color: var(--error); font-weight: 600; }

/* Footer */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); color: var(--ink-soft); margin-top: 3rem; padding: 3.5rem 0 1.5rem; font-size: .95rem; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.site-footer .small { color: var(--ink-faint); }
.footer-grid .small { max-width: 46ch; }
.footer-grid { display: grid; gap: 2.25rem; }
.footer-brand { font-weight: 700; color: var(--ink); font-size: 1.1rem; margin: 0 0 .35rem; }
.footer-heading { font-weight: 650; color: var(--ink); margin: 0 0 .75rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.25rem; }
.footer-bottom p { margin: 0; }

.aside-link { font-size: .95rem; margin: 1.25rem 0 0; }
.community-teaser { background: var(--bg-soft); border-radius: 20px; padding: 2rem 1.5rem; }
.community-teaser .thread-list li { border-color: var(--line-strong); }

/* Tablet and up */
@media (min-width: 640px) {
  .wrap { padding: 0 28px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
  .community-teaser { padding: 2.5rem; }
  .cta { padding: 2.25rem; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

/* PC */
@media (min-width: 900px) {
  .hero { padding: 5rem 0 4.5rem; }
  .hero-grid { grid-template-columns: 1.15fr 1fr; gap: 4rem; }
  .trust-list { grid-template-columns: 1fr; gap: .55rem; }
  .home-section { margin: 5.5rem 0; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
  .content-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 4rem; padding-top: 2rem; }
  .content-aside > :first-child { margin-top: 0; }
  .content-aside { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; }
  .content-aside .cta { padding: 1.5rem; }
  .content-aside .cards { grid-template-columns: 1fr; }
  .content-main .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-aside { scrollbar-width: thin; }
  .content-aside .card { padding: .85rem 1rem; }
  .content-aside .card h3 { margin: 0; font-size: .96rem; font-weight: 600; }
  .content-aside .card p { display: none; }
  .content-aside .card:hover { transform: none; }
}

/* Full navigation once all items fit on one line */
@media (min-width: 1040px) {
  .menu { display: none; }
  .nav-desktop { display: block; margin-right: .75rem; }
  .nav-desktop ul { list-style: none; display: flex; gap: .15rem; margin: 0; padding: 0; }
  .nav-desktop a { display: block; color: var(--ink-soft); text-decoration: none; font-weight: 550; font-size: .94rem; padding: .45rem .75rem; border-radius: 999px; white-space: nowrap; }
  .nav-desktop a:hover { color: var(--ink); background: var(--bg-soft); }
  .nav-desktop a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }
}

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