/* ==========================================================================
   Compare Accounting Firms — design system
   Concept: premium data-led comparison publication
   Palette: paper white, institutional navy, measured greys, ok-green accent
   Type: Source Serif 4 (editorial) + Inter (interface)
   ========================================================================== */

:root {
  --ink: #111820;
  --ink-soft: #46525f;
  --ink-muted: #6d7a87;
  --rule: #dde3e8;
  --rule-strong: #c3ccd4;
  --paper: #ffffff;
  --panel: #f5f7f8;
  --panel-2: #eef2f4;
  --navy: #16324f;
  --navy-deep: #0e2438;
  --navy-tint: #e7edf3;
  --link: #1c4f7c;
  --signal: #1f7a5c;
  --signal-tint: #e6f2ec;
  --warn-tint: #fdf4e6;
  --warn-rule: #e6cfa0;
  --shadow: 0 1px 2px rgba(17, 24, 32, .06), 0 8px 24px rgba(17, 24, 32, .05);
  --radius: 3px;
  --wrap: 1180px;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--link); text-underline-offset: .18em; }
a:hover { color: var(--navy-deep); }

:focus-visible {
  outline: 3px solid #b8822a;
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: .7rem 1rem;
  z-index: 999;
  font-family: var(--font-ui);
  font-size: .85rem;
}
.skip-link:focus { left: .5rem; top: .5rem; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Utility bar + masthead ---------- */

.util {
  background: var(--navy-deep);
  color: #cfd9e2;
  font-family: var(--font-ui);
  font-size: .78rem;
  letter-spacing: .01em;
}
.util .wrap { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; align-items: center; justify-content: space-between; min-height: 2.2rem; padding-top: .35rem; padding-bottom: .35rem; }
.util strong { color: #fff; font-weight: 600; }
.util a { color: #cfd9e2; }

.masthead { border-bottom: 3px solid var(--navy); background: var(--paper); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.15rem; padding-bottom: 1.15rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: inherit; }
.brand-mark { flex: 0 0 auto; width: 42px; height: 42px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-family: var(--font-ui); font-size: .7rem; text-transform: uppercase; letter-spacing: .16em; color: var(--ink-muted); }
.masthead-actions { display: flex; align-items: center; gap: .6rem; font-family: var(--font-ui); font-size: .82rem; }
.masthead-note { color: var(--ink-muted); max-width: 22ch; line-height: 1.35; }

/* ---------- Primary navigation ---------- */

.nav {
  background: var(--navy);
  color: #e8eef4;
  font-family: var(--font-ui);
  font-size: .84rem;
}
.nav .wrap { display: flex; align-items: stretch; gap: .1rem; overflow-x: auto; scrollbar-width: thin; }
.nav a {
  color: #dbe5ee;
  text-decoration: none;
  padding: .72rem .85rem;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  display: inline-flex;
  align-items: center;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: #f0b429; background: rgba(255, 255, 255, .06); }
.nav .nav-secondary { margin-left: auto; display: flex; align-items: center; }

.breadcrumb { font-family: var(--font-ui); font-size: .78rem; color: var(--ink-muted); padding: .9rem 0 0; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "/"; margin-right: .4rem; color: var(--rule-strong); }
.breadcrumb a { color: var(--ink-muted); }

/* ---------- Typography blocks ---------- */

h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.22; color: var(--ink); margin: 0 0 .6em; }
h1 { font-size: clamp(1.85rem, 1.2rem + 2.2vw, 2.85rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.35rem, 1.05rem + 1.1vw, 1.85rem); margin-top: 2.2rem; letter-spacing: -.01em; }
h3 { font-size: 1.18rem; margin-top: 1.7rem; }
h4 { font-size: 1rem; margin-top: 1.3rem; }
p { margin: 0 0 1.05em; }
.lede { font-size: 1.2rem; color: var(--ink-soft); line-height: 1.6; }
.eyebrow {
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0 0 .75rem;
}
.meta-line { font-family: var(--font-ui); font-size: .78rem; color: var(--ink-muted); }
.small { font-size: .92rem; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.35rem; }
li { margin-bottom: .45em; }
li > ul, li > ol { margin-top: .45em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }
blockquote {
  margin: 1.6rem 0;
  padding: .1rem 0 .1rem 1.2rem;
  border-left: 3px solid var(--navy);
  color: var(--ink-soft);
  font-size: 1.06rem;
}
code, kbd { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .88em; background: var(--panel-2); padding: .1em .35em; border-radius: 2px; }

/* ---------- Hero (data-led) ---------- */

.hero { border-bottom: 1px solid var(--rule); background: linear-gradient(180deg, var(--panel) 0%, var(--paper) 100%); }
.hero .wrap { padding-top: 2.6rem; padding-bottom: 2.2rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 2.4rem; align-items: start; }
.hero h1 { margin-bottom: .5rem; }
.hero .lede { max-width: 46ch; }
.hero-role {
  font-family: var(--font-ui);
  font-size: .88rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--signal);
  padding: .9rem 1.05rem;
  color: var(--ink-soft);
}
.hero-role strong { color: var(--ink); }

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-top: 1.8rem; }
.stat { background: var(--paper); padding: .95rem 1.05rem; }
.stat b { display: block; font-family: var(--font-serif); font-size: 1.7rem; line-height: 1.1; }
.stat span { font-family: var(--font-ui); font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-muted); }

/* ---------- Quick filter bar ---------- */

.quickfilter { background: var(--navy-deep); color: #e8eef4; padding: 1.1rem 0; }
.quickfilter form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: .6rem; align-items: end; }
.field { display: flex; flex-direction: column; gap: .3rem; font-family: var(--font-ui); }
.field label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: #a9bccd; }
.field select, .field input, .field textarea {
  font-family: var(--font-ui);
  font-size: .88rem;
  padding: .55rem .6rem;
  border: 1px solid #2c4a68;
  border-radius: var(--radius);
  background: #0a1c2c;
  color: #fff;
  min-width: 0;
}
.field textarea { min-height: 8rem; resize: vertical; }
.field select option { color: #111820; background: #fff; }

/* ---------- Buttons ---------- */

.btn {
  font-family: var(--font-ui);
  font-size: .85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--navy-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--navy-tint); color: var(--navy-deep); }
.btn-light { background: var(--paper); color: var(--navy); border-color: #cbd6e0; }
.btn-light:hover { background: #eef3f7; color: var(--navy-deep); }
.btn-sm { padding: .4rem .7rem; font-size: .78rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- Sections & cards ---------- */

section { padding: 2.4rem 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; border-bottom: 1px solid var(--rule); padding-bottom: .5rem; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.section-head .section-note { font-family: var(--font-ui); font-size: .8rem; color: var(--ink-muted); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1rem; }
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--navy);
  padding: 1.1rem 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; font-size: .95rem; color: var(--ink-soft); }
.card .card-kicker { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.card-foot { margin-top: auto; padding-top: .6rem; font-family: var(--font-ui); font-size: .82rem; }
.card ul { font-size: .94rem; margin-bottom: 0; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.4rem; }

.notice { border: 1px solid var(--rule); border-left: 3px solid var(--navy); background: var(--panel); padding: 1rem 1.15rem; font-size: .95rem; color: var(--ink-soft); }
.notice-flag { border-left-color: var(--warn-rule); background: var(--warn-tint); }
.notice-ok { border-left-color: var(--signal); background: var(--signal-tint); }
.notice p:last-child { margin-bottom: 0; }

/* ---------- Provider table ---------- */

.table-wrap { border: 1px solid var(--rule); background: var(--paper); overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; min-width: 1020px; font-size: .9rem; }
table.data caption { caption-side: top; text-align: left; font-family: var(--font-ui); font-size: .82rem; color: var(--ink-muted); padding: .7rem .8rem; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: .7rem .8rem; border-bottom: 1px solid var(--rule); }
table.data thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  font-family: var(--font-ui);
  font-size: .74rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--rule-strong);
  z-index: 1;
}
table.data tbody tr:nth-child(even) { background: #fbfcfc; }
table.data tbody tr:target { background: #fff6e2; }
table.data tbody tr:hover { background: var(--navy-tint); }
table.data td[data-cell="provider"] { min-width: 220px; }
table.data .p-name { font-family: var(--font-serif); font-size: 1rem; font-weight: 700; display: block; }
table.data .p-meta { font-family: var(--font-ui); font-size: .76rem; color: var(--ink-muted); }
.chip {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .72rem;
  padding: .12rem .45rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink-soft);
  margin: 0 .2rem .2rem 0;
  white-space: nowrap;
}
.chip-accent { background: var(--navy-tint); border-color: #adc3d6; color: var(--navy); }
.chip-signal { background: var(--signal-tint); border-color: #a7cdbc; color: #155e46; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ---------- Filters ---------- */

.filters { border: 1px solid var(--rule); background: var(--panel); padding: 1.1rem; font-family: var(--font-ui); }
.filters fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
.filters legend { font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); font-weight: 700; margin-bottom: .45rem; }
.filters .checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .3rem .8rem; }
.filters label.check { display: flex; gap: .45rem; align-items: flex-start; font-size: .86rem; color: var(--ink-soft); line-height: 1.35; }
.filters input[type="search"], .filters select {
  width: 100%;
  font-family: var(--font-ui);
  font-size: .88rem;
  padding: .5rem .55rem;
  border: 1px solid var(--rule-strong);
  background: #fff;
  border-radius: var(--radius);
}
.filter-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; border-top: 1px solid var(--rule); padding-top: .9rem; }
.result-count { font-family: var(--font-ui); font-size: .88rem; color: var(--ink-soft); }
.result-count b { color: var(--ink); }

.filter-toggle { display: none; }

/* ---------- Provider detail ---------- */

.profile-head { border-bottom: 1px solid var(--rule); padding-bottom: 1.2rem; margin-bottom: 1.4rem; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2.2rem; align-items: start; }
.fact-list { display: grid; grid-template-columns: minmax(140px, 190px) minmax(0, 1fr); gap: 0; border-top: 1px solid var(--rule); font-size: .95rem; }
.fact-list dt { font-family: var(--font-ui); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); padding: .65rem .8rem .65rem 0; border-bottom: 1px solid var(--rule); }
.fact-list dd { margin: 0; padding: .65rem 0; border-bottom: 1px solid var(--rule); }
.rail { border: 1px solid var(--rule); background: var(--panel); padding: 1.1rem; font-family: var(--font-ui); font-size: .86rem; }
.rail h2 { font-family: var(--font-ui); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 .6rem; }
.rail dl { margin: 0; }
.rail dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); margin-top: .7rem; }
.rail dd { margin: .1rem 0 0; word-break: break-word; }
.rail ul { padding-left: 1.1rem; }

.disclaimer-inline { border: 1px solid var(--warn-rule); background: var(--warn-tint); font-family: var(--font-ui); font-size: .82rem; color: #6b5316; padding: .75rem .9rem; }

/* ---------- Shortlist ---------- */

.shortlist-panel { border: 1px solid var(--rule-strong); background: var(--paper); }
.shortlist-panel header { background: var(--navy); color: #fff; padding: .7rem 1rem; font-family: var(--font-ui); font-size: .88rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.shortlist-items { list-style: none; margin: 0; padding: .5rem .9rem; font-family: var(--font-ui); font-size: .86rem; }
.shortlist-items li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--rule); margin: 0; }
.shortlist-items li:last-child { border-bottom: 0; }
.shortlist-empty { padding: .9rem; font-family: var(--font-ui); font-size: .86rem; color: var(--ink-muted); margin: 0; }

/* ---------- Article layout ---------- */

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 2.6rem; align-items: start; }
.prose > * { max-width: 68ch; }
.prose h2 { margin-top: 2.4rem; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 3rem; margin-bottom: 1.3rem; }
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: .1rem;
  font-family: var(--font-ui);
  font-size: .8rem;
  font-weight: 700;
  color: var(--navy);
  border: 1px solid var(--rule-strong);
  padding: .2rem .45rem;
  background: var(--panel);
}
.qlist { list-style: none; padding: 0; }
.qlist li { border-left: 3px solid var(--rule-strong); padding: .1rem 0 .1rem 1rem; margin-bottom: .9rem; }
.qlist li strong { display: block; font-family: var(--font-ui); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }

.sidebar { position: sticky; top: 1rem; font-family: var(--font-ui); font-size: .86rem; }
.sidebar .rail + .rail { margin-top: 1rem; }

.toc { border: 1px solid var(--rule); background: var(--panel); padding: 1rem 1.1rem; font-family: var(--font-ui); font-size: .86rem; }
.toc h2 { font-family: var(--font-ui); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 .5rem; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ---------- Country index ---------- */

.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.country-cell { background: var(--paper); padding: 1rem 1.05rem; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .35rem; }
.country-cell:hover { background: var(--navy-tint); }
.country-cell .cc { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .16em; color: var(--ink-muted); }
.country-cell .cn { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; }
.country-cell .cm { font-family: var(--font-ui); font-size: .78rem; color: var(--ink-muted); }

/* ---------- FAQ ---------- */

.faq-item { border-bottom: 1px solid var(--rule); padding: 1rem 0; }
.faq-item h3 { margin: 0 0 .4rem; font-size: 1.08rem; }
.faq-item p { margin: 0; color: var(--ink-soft); }

/* ---------- Footer ---------- */

.site-footer { background: var(--navy-deep); color: #b9c8d6; margin-top: 3rem; padding: 2.6rem 0 1.4rem; font-family: var(--font-ui); font-size: .85rem; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 2rem; }
.site-footer h2 { font-family: var(--font-ui); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: #fff; margin: 0 0 .7rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .35rem; }
.site-footer a { color: #b9c8d6; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-brand { display: flex; gap: .7rem; align-items: center; margin-bottom: .7rem; }
.footer-brand .brand-title { color: #fff; font-size: 1.05rem; }
.footer-note { color: #8b9db0; font-size: .8rem; line-height: 1.5; }
.footer-legal { border-top: 1px solid #27415c; margin-top: 2rem; padding-top: 1.1rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; color: #8b9db0; font-size: .78rem; }
.footer-legal p { margin: 0; max-width: 70ch; }

/* ---------- Misc ---------- */

.pill-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1rem; }
.pill-list li { margin: 0; }
.tag-coverage { font-family: var(--font-ui); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; padding: .15rem .45rem; border: 1px solid var(--rule-strong); background: var(--panel); }
.src-note { font-family: var(--font-ui); font-size: .78rem; color: var(--ink-muted); }
.src-note a { color: var(--link); }
.updated { font-family: var(--font-ui); font-size: .76rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .08em; }
.empty-state { border: 1px dashed var(--rule-strong); padding: 1.4rem; text-align: center; font-family: var(--font-ui); color: var(--ink-muted); background: var(--panel); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }

/* ---------- Responsive ---------- */

@media (max-width: 940px) {
  .hero-grid, .profile-grid, .article-layout { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quickfilter form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { position: static; }
}

@media (max-width: 700px) {
  body { font-size: 1rem; }
  .stat-row { grid-template-columns: minmax(0, 1fr); }
  .masthead .wrap { align-items: flex-start; }
  .filter-toggle { display: inline-flex; }
  .filters { display: none; }
  .filters.is-open { display: block; }
  .fact-list { grid-template-columns: minmax(0, 1fr); }
  .fact-list dt { padding-bottom: 0; border-bottom: 0; }
  .fact-list dd { padding-top: 0; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .quickfilter form { grid-template-columns: minmax(0, 1fr); }
  .section-head { flex-direction: column; align-items: flex-start; }
}

@media print {
  .nav, .util, .quickfilter, .site-footer, .masthead-actions, .filter-toggle { display: none; }
  body { font-size: 10.5pt; }
  a::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
