/* taxlawli.com — Law Office of Tongzhou Li
   Palette: 粉墙黛瓦 (#5), IRS-blue buttons. Dark mode is the current default. */

:root,
[data-theme="light"] {
  --bg: #F5F6F4;
  --ink: #23282E;
  --header: #FFFFFF;
  --header-ink: #23282E;
  --hero: #F5F6F4;
  --muted: #5C6B73;
  --body2: #3F4A52;
  --rule: #DDE1E1;
  --strong-rule: #23282E;
  --accent: #A33A22;
  --link: #00599C;
  --btn: #00599C;
  --btn-edge: #00599C;
  --band: #23282E;
  --band-ink: #FFFFFF;
  --band-accent: #E8836B;
  --band-body: #B9C2C8;
  --panel: #E6E9E8;
  --card: #FFFFFF;
  --footer: #23282E;
  --footer-ink: #9AA5AD;
  --ph1: #E3E6E5;
  --ph2: #D8DDDC;
  --ph3: #CBD2D2;
  --tag: rgba(255, 255, 255, 0.9);
  --field: #FFFFFF;
  --map-land: #DCE1E0;
  --error: #C0392B;
  --inv-bg: #23282E;
  --inv-ink: #FFFFFF;
  --inv-accent: #E8836B;
  --alt: #E2E6E5;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #1D2126;
  --ink: #EEF1F2;
  --header: #1D2126;
  --header-ink: #FFFFFF;
  --hero: #23282E;
  --muted: #9AA5AD;
  --body2: #B9C2C8;
  --rule: #343B42;
  --strong-rule: #5C6B73;
  --accent: #E8836B;
  --link: #5AA9E0;
  --btn: #00599C;
  --btn-edge: #5AA9E0;
  --band: #2B3138;
  --band-ink: #FFFFFF;
  --band-accent: #E8836B;
  --band-body: #B9C2C8;
  --panel: #262B31;
  --card: #23282E;
  --footer: #16191D;
  --footer-ink: #9AA5AD;
  --ph1: #3A4148;
  --ph2: #333A41;
  --ph3: #2C3238;
  --tag: rgba(29, 33, 38, 0.82);
  --field: #1D2126;
  --map-land: #3A424A;
  --error: #FF7A6B;
  --inv-bg: #F5F6F4;
  --inv-ink: #23282E;
  --inv-accent: #A33A22;
  --alt: #2B3138;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 4px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.serif { font-family: "Source Serif 4", "Noto Serif SC", Georgia, "Songti SC", serif; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--btn); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 16px; top: 16px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header);
  color: var(--header-ink);
  border-bottom: 1px solid var(--rule);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 18px; padding-bottom: 18px;
}
.brand {
  text-decoration: none;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 22px; letter-spacing: .01em; white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 24px; }
.nav { display: flex; align-items: center; gap: 24px; font-size: 15px; font-weight: 500; }
.nav a { text-decoration: none; padding: 10px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--rule); }
.nav a[aria-current="page"] { border-bottom-color: var(--accent); }

.lang { display: inline-flex; gap: 2px; font-size: 14px; }
.lang a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent;
}
.lang a[aria-current="true"] { color: var(--header-ink); font-weight: 600; border-bottom-color: var(--accent); }

.tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  background: transparent; color: var(--header-ink);
  border: 1px solid var(--rule); border-radius: 999px; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
/* Sun / moon: the current sky is shown. Switching sets one below the
   horizon (bottom of the button) while the other rises into view. */
[data-theme-toggle] { position: relative; overflow: hidden; }
[data-theme-toggle] .icon-sun,
[data-theme-toggle] .icon-moon {
  position: absolute; left: 50%; top: 50%; margin: -10px 0 0 -10px;
  transition: transform .8s cubic-bezier(.45, 0, .2, 1), opacity .6s ease;
}
[data-theme="light"] .icon-sun { transform: translateY(0) rotate(0deg); opacity: 1; }
[data-theme="light"] .icon-moon { transform: translateY(30px) rotate(-40deg); opacity: 0; }
[data-theme="dark"] .icon-moon { transform: translateY(0) rotate(0deg); opacity: 1; }
[data-theme="dark"] .icon-sun { transform: translateY(30px) rotate(90deg); opacity: 0; }
.menu-btn { display: none; }
.menu-btn .icon-close { display: none; }
.menu-open .menu-btn .icon-close { display: block; }
.menu-open .menu-btn .icon-menu { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  background: var(--btn); color: #FFFFFF;
  border: 1px solid var(--btn-edge); border-radius: 999px;
  font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn-sm { min-height: 44px; padding: 0 20px; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }

.mobile-nav { display: none; border-top: 1px solid var(--rule); padding: 8px 20px 24px; }
.mobile-nav a.m-link {
  display: block; padding: 14px 0; border-bottom: 1px solid var(--rule);
  text-decoration: none; font-size: 18px; font-weight: 500;
}
.mobile-nav .m-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; flex-wrap: wrap; }

/* ---------- Common type ---------- */
.eyebrow {
  margin: 0; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
}
h1, h2, h3 { font-family: "Source Serif 4", "Noto Serif SC", Georgia, serif; font-weight: 400; margin: 0; }
.h1 { font-weight: 300; font-size: clamp(40px, 6.4vw, 84px); line-height: 1.04; letter-spacing: -.02em; max-width: 13em; }
.h1-page { font-weight: 300; font-size: clamp(38px, 5vw, 68px); line-height: 1.06; letter-spacing: -.02em; max-width: 15em; }
.h2 { font-size: clamp(32px, 3.4vw, 44px); line-height: 1.14; letter-spacing: -.01em; }
.h3 { font-size: clamp(24px, 2.3vw, 30px); line-height: 1.18; }
.lead { font-size: 19px; color: var(--body2); max-width: 38em; margin: 0; }
.muted { color: var(--muted); }
.link { color: var(--link); font-weight: 500; }
.prose { max-width: 44em; }
.prose p, .prose li { color: var(--body2); }
.prose h2 { margin-top: 48px; margin-bottom: 12px; }
.prose h3 { margin-top: 32px; margin-bottom: 8px; font-size: 24px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 6px; }

.section { padding-top: 120px; padding-bottom: 120px; }
.section-tight { padding-top: 0; padding-bottom: 120px; }
.section-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 16px;
  padding-bottom: 20px; border-bottom: 1px solid var(--strong-rule); margin-bottom: 0;
}

/* ---------- Hero ---------- */
.hero { background: var(--hero); }
.hero-inner { display: flex; flex-direction: column; gap: 28px; padding-top: 88px; padding-bottom: 72px; }
.page-hero .hero-inner { padding-bottom: 88px; }
.creds { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; max-width: 980px; margin-top: 8px; }
.cred { border-top: 1px solid var(--strong-rule); padding-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.cred b { font-family: "Source Serif 4", Georgia, serif; font-weight: 400; font-size: clamp(22px, 2.2vw, 26px); }
.cred span { font-size: 15px; color: var(--muted); }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }

.photo {
  background: var(--ph1); display: flex; align-items: flex-end; position: relative; overflow: hidden;
}
.photo img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo .tag { position: relative; margin: 20px; padding: 6px 12px; background: var(--tag); color: var(--ink); font-size: 14px; }
.photo-hero { height: clamp(260px, 42vw, 600px); }
.photo-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 4px; }
.photo-pair .photo { height: clamp(240px, 32vw, 460px); }
.photo-pair .photo:nth-child(1) { background: var(--ph2); }
.photo-pair .photo:nth-child(2) { background: var(--ph3); }

/* ---------- Blocks ---------- */
.statement { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px 72px; }
.statement p.big { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-weight: 300; font-size: clamp(26px, 3vw, 40px); line-height: 1.28; letter-spacing: -.01em; }

.areas { list-style: none; margin: 0; padding: 0; }
.area {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); gap: 6px 24px; align-items: baseline;
  padding: 28px 0; border-bottom: 1px solid var(--rule); text-decoration: none;
}
.area .n { font-size: 14px; color: var(--accent); }
.area .t { font-family: "Source Serif 4", Georgia, serif; font-size: clamp(22px, 2.2vw, 28px); line-height: 1.25; }
.area .d { color: var(--muted); }
a.area:hover .t { text-decoration: underline; text-decoration-thickness: 1px; }

.band { background: var(--band); color: var(--band-ink); }
.band .eyebrow { color: var(--band-accent); }
.band-inner { padding-top: 104px; padding-bottom: 104px; display: flex; flex-direction: column; gap: 40px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 36px 40px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 32px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 40px 64px; }
.point { display: flex; flex-direction: column; gap: 10px; }
.point p { margin: 0; color: var(--band-body); }

.about { align-items: start; }
.headshot { aspect-ratio: 4 / 5; max-height: 560px; background: var(--panel); color: var(--body2); display: flex; align-items: center; justify-content: center; font-family: "Source Serif 4", Georgia, serif; font-size: 20px; overflow: hidden; }
.headshot img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0 24px; border-top: 1px solid var(--rule); }
.facts div { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.facts .k { font-size: 14px; color: var(--muted); }

.card-link { text-decoration: none; display: flex; flex-direction: column; gap: 12px; }
.card-link .img { aspect-ratio: 3 / 2; background: var(--ph1); }
.card-link:nth-child(2) .img { background: var(--ph2); }
.card-link:nth-child(3) .img { background: var(--ph3); }
.card-link .meta { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.card-link .title { font-family: "Source Serif 4", Georgia, serif; font-size: clamp(22px, 2vw, 26px); line-height: 1.22; }
.soon { display: inline-block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); padding: 1px 8px; border-radius: 999px; }

.box { background: var(--card); border: 1px solid var(--rule); padding: 36px; }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 28px 56px; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li { border-bottom: 1px solid var(--rule); }
.note-list a, .note-list .item { display: flex; flex-direction: column; padding: 14px 0; text-decoration: none; }
.note-list .k { font-size: 13px; color: var(--muted); }
.note-list .v { font-size: 18px; }

.panel { background: var(--panel); }
.panel-inner { padding-top: 96px; padding-bottom: 96px; }
.map { aspect-ratio: 4 / 3; background: var(--ph2); color: var(--body2); display: flex; align-items: center; justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Practice area detail ---------- */
.pa { padding: 72px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px 72px; }
.pa:first-child { padding-top: 24px; }
.pa .num { font-size: 14px; color: var(--accent); margin-bottom: 8px; display: block; }
.pa .forms { font-size: 14px; color: var(--muted); margin-top: 10px; }
.pa h3 { font-size: 20px; margin: 28px 0 8px; font-family: Inter, system-ui, sans-serif; font-weight: 600; }
.pa h3:first-child { margin-top: 0; }
.pa p, .pa li { color: var(--body2); }
.pa ul { margin: 0; padding-left: 1.2em; }
.pa li { margin-bottom: 6px; }

.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.toc a { text-decoration: none; font-size: 14px; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px; color: var(--body2); }
.toc a:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Timeline (About) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--strong-rule); }
.timeline li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px 48px; padding: 28px 0; border-bottom: 1px solid var(--rule); }
.timeline .role { font-family: "Source Serif 4", Georgia, serif; font-size: 24px; line-height: 1.25; }
.timeline .org { color: var(--muted); font-size: 15px; margin-top: 4px; }
.timeline p { margin: 0; color: var(--body2); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 20px; }
.form .row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 15px; font-weight: 500; }
.field .hint { font-size: 14px; color: var(--muted); }
.field input, .field textarea, .field select {
  font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--strong-rule); border-radius: 4px; padding: 12px 14px; min-height: 48px; width: 100%;
}
.field textarea { min-height: 140px; resize: vertical; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--body2); }
.check input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--btn); }
.notice { border-left: 3px solid var(--accent); padding: 14px 18px; background: var(--panel); color: var(--body2); font-size: 15px; }
.notice strong { color: var(--ink); }
.contact-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.contact-list li { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.contact-list .k { font-size: 14px; color: var(--muted); display: block; }
.contact-list .v { font-size: 20px; }

.pay-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 24px; }
.pay-card { background: var(--card); border: 1px solid var(--rule); padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.pay-card p { margin: 0; color: var(--body2); }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer); color: var(--footer-ink); font-size: 15px; }
.footer-inner { padding-top: 72px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 36px; }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px; }
.footer-brand { font-family: "Source Serif 4", Georgia, serif; font-size: 24px; color: #FFFFFF; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 28px 48px; }
.footer-cols div { display: flex; flex-direction: column; gap: 6px; }
.site-footer a { color: #FFFFFF; }
.fine { border-top: 1px solid #3A4148; padding-top: 24px; font-size: 14px; line-height: 1.6; }
.fine p { margin: 0 0 8px; }

/* ---------- Phone & tablet ---------- */
@media (max-width: 900px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .header-row { padding-top: 12px; padding-bottom: 12px; gap: 12px; }
  .brand { font-size: clamp(18px, 4.6vw, 22px); }
  .nav, .header-right > .lang, .header-cta { display: none; }
  .menu-btn { display: inline-flex; }
  .menu-open .mobile-nav { display: block; }
  .hero-inner { padding-top: 48px; padding-bottom: 48px; }
  .page-hero .hero-inner { padding-bottom: 56px; }
  .section { padding-top: 72px; padding-bottom: 72px; }
  .section-tight { padding-bottom: 80px; }
  .statement, .pa, .timeline li { grid-template-columns: minmax(0, 1fr); }
  .area { grid-template-columns: 32px minmax(0, 1fr); padding: 22px 0; }
  .area .d { grid-column: 2; }
  .band-inner { padding-top: 72px; padding-bottom: 72px; }
  .panel-inner { padding-top: 72px; padding-bottom: 72px; }
  .box, .pay-card { padding: 24px; }
  .pa { padding: 48px 0; }
  .footer-inner { padding-top: 56px; padding-bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}

/* ---------- Dropdown menus (desktop: hover or keyboard focus) ---------- */
.has-sub { position: relative; }
.has-sub > a { display: inline-flex; align-items: center; gap: 4px; }
.caret { width: 12px; height: 12px; transition: transform .2s; }
.has-sub:hover .caret, .has-sub:focus-within .caret { transform: rotate(180deg); }
.sub {
  position: absolute; top: 100%; left: -16px; z-index: 60;
  min-width: 300px; padding: 10px 0;
  background: var(--header); border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.sub::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.has-sub:hover .sub, .has-sub:focus-within .sub { opacity: 1; visibility: visible; transform: translateY(0); }
.nav .sub a {
  display: block; padding: 10px 20px; border-bottom: 0; white-space: nowrap;
  font-weight: 400; color: var(--header-ink);
}
.nav .sub a:hover, .nav .sub a:focus-visible { background: var(--panel); border-bottom: 0; }

/* Phone menu: sub-links listed under their section */
.m-sub { display: flex; flex-direction: column; padding: 4px 0 10px 16px; border-bottom: 1px solid var(--rule); }
.m-sub a { padding: 8px 0; font-size: 16px; color: var(--muted); text-decoration: none; }
.mobile-nav a.m-link:has(+ .m-sub) { border-bottom: 0; }

@media (prefers-reduced-motion: reduce) { .sub, .caret { transition: none; } }
/* Long phone menu scrolls inside the sticky header */
.mobile-nav { max-height: calc(100vh - 70px); max-height: calc(100dvh - 70px); overflow-y: auto; overscroll-behavior: contain; }

/* ---------- Theme change ----------
   site.js blends every color token from the old theme to the new one in the
   same animation frames, so backgrounds, text, borders and buttons always
   change together. No per-element CSS transitions are involved. */

@media (prefers-reduced-motion: reduce) {
  [data-theme-toggle] .icon-sun, [data-theme-toggle] .icon-moon { transition: none; }
}

/* Keep the desktop menu on one line; switch to the ☰ menu on narrower laptops */
.nav a, .lang a { white-space: nowrap; }
@media (max-width: 1240px) {
  .header-right { gap: 18px; }
  .nav { gap: 18px; }
}
@media (max-width: 1220px) {
  .nav, .header-right > .lang, .header-cta { display: none; }
  .menu-btn { display: inline-flex; }
  .menu-open .mobile-nav { display: block; }
}

/* ----- TFRP circuit survey ----- */
.circuit-map { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 32px 40px; padding: 32px; align-items: start; }
.map-hint { margin: 8px 0 12px; color: var(--body2); font-size: 15px; }
.usmap { display: block; width: 100%; height: auto; }
.usmap .st { cursor: pointer; }
.usmap path.st { fill: var(--map-land); stroke: var(--card); stroke-width: .9; stroke-linejoin: round; transition: fill .15s ease, opacity .15s ease; }
.usmap .cb { fill: none; stroke: var(--strong-rule); stroke-width: 1.4; stroke-linejoin: round; pointer-events: none; opacity: .7; }
.usmap .co line { stroke: var(--muted); stroke-width: .8; pointer-events: none; }
.usmap .co rect { fill: var(--map-land); stroke: var(--card); transition: fill .15s ease; }
.usmap .co text, .usmap .cnum text { font: 600 13px/1 Inter, system-ui, sans-serif; fill: var(--ink); text-anchor: middle; pointer-events: none; }
.usmap .cnum { pointer-events: none; }
.usmap .cnum circle { fill: var(--card); stroke: var(--strong-rule); stroke-width: 1; opacity: .92; }
.usmap.has-active path.st, .usmap.has-active .co { opacity: .45; }
.usmap.has-active .cnum g { opacity: .35; }
.usmap path.st.on, .usmap .co.on { opacity: 1; }
.usmap path.st.on, .usmap .co.on rect { fill: color-mix(in srgb, var(--link) 42%, var(--map-land)); }
.usmap path.st.on.cur, .usmap .co.on.cur rect { fill: color-mix(in srgb, var(--link) 75%, var(--map-land)); }
.usmap .cb.on { stroke: var(--accent); stroke-width: 2.6; opacity: 1; }
.usmap.has-active .cnum g.on { opacity: 1; }
.usmap .cnum g.on circle { stroke: var(--accent); }
.map-alt { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.map-jump { font-size: 15px; white-space: nowrap; }
.back-to-map { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--btn); color: #fff; text-decoration: none; font-size: 15px; font-weight: 500; padding: 12px 22px; border-radius: 999px; box-shadow: 0 6px 24px rgba(0,0,0,.25); border: 1px solid var(--btn-edge); }
.back-to-map:hover { filter: brightness(1.08); }
.back-to-map[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.map-alt select { font: inherit; font-size: 15px; color: var(--ink); background: var(--field); border: 1px solid var(--rule); padding: 8px 10px; border-radius: 0; }
.map-info { border-left: 1px solid var(--rule); padding-left: 32px; min-height: 420px; }
.map-info h3 { margin: 8px 0 4px; font-size: 28px; }
.map-info .states { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.map-info p { color: var(--body2); }
.info-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.info-list li { padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 14px; line-height: 1.45; color: var(--body2); }
.info-list .k { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); font-weight: 600; margin-bottom: 5px; }
.info-links { display: flex; gap: 20px; margin: 16px 0 0; font-size: 15px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border: 1px solid currentColor; border-radius: 999px; margin-right: 4px; white-space: nowrap; vertical-align: 1px; }
.b-yes { color: var(--link); }
.b-no { color: var(--accent); }
.b-conditional { color: var(--ink); border-style: dashed; }
.b-unclear, .b-na { color: var(--muted); }
.matrix-wrap { overflow-x: auto; border-top: 2px solid var(--strong-rule); }
.matrix { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.matrix th, .matrix td { text-align: left; vertical-align: top; padding: 16px 14px; border-bottom: 1px solid var(--rule); color: var(--body2); }
.matrix thead th { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); font-weight: 600; }
.matrix thead th span[title] { cursor: help; border-bottom: 1px dotted var(--muted); }
.matrix tbody th { color: var(--ink); font-weight: 600; width: 17%; min-width: 150px; }
.matrix tbody th a { color: var(--ink); text-decoration: none; }
.matrix tbody th a:hover { color: var(--link); }
.matrix .states { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 4px; }
.matrix td { width: 20.75%; }
.matrix-2 td { width: 41.5%; }
.matrix tr.is-mine th, .matrix tr.is-mine td { background: var(--panel); }
.matrix tr.is-mine th { box-shadow: inset 3px 0 0 var(--accent); }
.circuit-list { border-top: 1px solid var(--rule); }
.circuit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px 48px; padding: 28px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 16px; }
.circuit h3 { margin: 0; font-size: 22px; }
.circuit .states { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.circuit p { margin: 0 0 10px; color: var(--body2); }
.circuit ul { margin: 0; padding-left: 1.1em; color: var(--body2); font-size: 15px; }
.circuit li { margin-bottom: 4px; }
.circuit a { color: var(--link); }
#matrix tr { scroll-margin-top: 24px; }
#find { scroll-margin-top: 0; }
@media (max-width: 900px) {
  .circuit-map { grid-template-columns: 1fr; padding: 22px 16px; }
  .map-info { border-left: 0; border-top: 1px solid var(--rule); padding: 20px 0 0; min-height: 0; }
  .map-alt { flex-wrap: wrap; }
  .matrix-wrap { overflow: visible; }
  .matrix thead { display: none; }
  .matrix, .matrix tbody, .matrix tr, .matrix th, .matrix td { display: block; width: auto !important; }
  .matrix tr { border-bottom: 1px solid var(--strong-rule); padding: 14px 0; }
  .matrix tbody th { padding: 6px 0 10px; border: 0; }
  .matrix td { padding: 8px 0; border: 0; }
  .matrix td::before { content: attr(data-label); display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
  .matrix tr.is-mine { background: var(--panel); padding-left: 12px; padding-right: 12px; }
  .circuit { grid-template-columns: 1fr; }
}

/* ----- FBAR survey ----- */
.rules { border-top: 1px solid var(--rule); }
.rule { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px 48px; padding: 32px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.rule h3 { margin: 0 0 10px; font-size: 24px; }
.rule p { margin: 0 0 12px; color: var(--body2); }
.lead-cases { margin: 0; padding-left: 1.1em; font-size: 14px; color: var(--body2); }
.lead-cases li { margin-bottom: 4px; }
.lead-cases a { color: var(--link); }
.dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.dot { display: inline-flex; align-items: center; justify-content: center; height: 34px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1.5px solid var(--strong-rule); color: var(--muted); }
.dot.d-yes { background: var(--link); border-color: var(--link); color: #fff; }
.dot.d-no { background: var(--accent); border-color: var(--accent); color: #fff; }
.dot.d-cond { border-style: dashed; color: var(--ink); }
.dot.d-none { opacity: .55; }
.dot-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.dot-legend .dot { height: 26px; min-width: 44px; padding: 0 8px; }
.legend .key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; background: var(--map-land); border: 1px solid var(--rule); vertical-align: -2px; margin: 0 4px 0 10px; }
.legend .key:first-child { margin-left: 0; }
.legend { align-items: center; font-size: 14px; color: var(--muted); }
.legend .k-yes { background: color-mix(in srgb, var(--link) 55%, var(--map-land)); }
.legend .k-no { background: color-mix(in srgb, var(--accent) 55%, var(--map-land)); }
.legend .k-cond { background: color-mix(in srgb, var(--muted) 45%, var(--map-land)); }
.usmap.ef path.st[style], .usmap.ef .co[style] rect { fill: color-mix(in srgb, var(--efc) 50%, var(--map-land)); }
.usmap.ef path.st.on { fill: color-mix(in srgb, var(--link) 18%, var(--map-land)); }
.usmap.ef path.st[style].on, .usmap.ef .co[style].on rect { fill: color-mix(in srgb, var(--efc) 72%, var(--map-land)); }
.usmap.ef path.st.on.cur { fill: color-mix(in srgb, var(--link) 35%, var(--map-land)); }
.usmap.ef path.st[style].on.cur { fill: color-mix(in srgb, var(--efc) 88%, var(--map-land)); }
.usmap .fed rect { fill: var(--card); stroke: var(--strong-rule); }
.usmap .fed.on rect { fill: color-mix(in srgb, var(--link) 25%, var(--card)); stroke: var(--accent); stroke-width: 2; }
.info-lead { font-size: 15px; margin: 0 0 14px; }
.matrix-fbar td { width: auto; }
.matrix-fbar td:nth-child(2) { width: 38%; }
.matrix.case-table { font-size: 14px; }
.matrix.case-table td { width: auto; white-space: nowrap; }
.matrix.case-table th[scope="row"] { min-width: 260px; width: 34%; }
.matrix.case-table th[scope="row"] a { color: var(--ink); }
.matrix.case-table th[scope="row"] a:hover { color: var(--link); }
.matrix.case-table .res { display: block; font-weight: 400; font-size: 13px; color: var(--body2); margin-top: 6px; line-height: 1.45; }
.matrix .num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix th.sortable { cursor: pointer; }
.matrix th.sortable::after { content: " ↕"; color: var(--muted); }
.matrix th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }
.matrix th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--body2); cursor: pointer; }
.chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (max-width: 900px) {
  .rule { grid-template-columns: 1fr; }
  .matrix.case-table td { white-space: normal; }
  .matrix .num { text-align: left; }
  .matrix.case-table th[scope="row"] { min-width: 0; }
}

/* ----- FBAR mini maps (settled rules) ----- */
.mm-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.minimap-wrap { margin: 0; }
.minimap { display: block; width: 100%; height: auto; }
.minimap .mm-land use { fill: var(--map-land); stroke: var(--bg); stroke-width: 1.2; stroke-linejoin: round; }
.minimap .mm-land use.m-yes { fill: color-mix(in srgb, var(--link) 78%, var(--map-land)); }
.minimap .mm-land use.m-cond { fill: color-mix(in srgb, var(--link) 38%, var(--map-land)); }
.minimap .mm-land use.m-no { fill: color-mix(in srgb, var(--accent) 70%, var(--map-land)); }
.minimap .mm-borders use { fill: none; stroke: var(--ink); stroke-opacity: .55; stroke-width: 2.4; stroke-linejoin: round; }
.minimap .mm-labels circle, .minimap .mm-labels rect { fill: var(--bg); stroke: var(--strong-rule); stroke-width: 2; }
.minimap .mm-labels line { stroke: var(--muted); stroke-width: 1.5; }
.minimap .mm-labels text { font: 700 24px/1 Inter, system-ui, sans-serif; fill: var(--muted); text-anchor: middle; }
.minimap .mm-labels .m-yes circle, .minimap .mm-labels .m-yes rect { fill: var(--link); stroke: var(--bg); }
.minimap .mm-labels .m-yes text { fill: #fff; }
.minimap .mm-labels .m-cond circle, .minimap .mm-labels .m-cond rect { stroke: var(--link); stroke-dasharray: 5 4; }
.minimap .mm-labels .m-cond text { fill: var(--ink); }
.dot-legend .key { display: inline-block; width: 16px; height: 16px; border-radius: 3px; vertical-align: -3px; margin-right: 2px; }
.dot-legend .k-dec { background: color-mix(in srgb, var(--link) 78%, var(--map-land)); }
.dot-legend .k-none { background: var(--map-land); margin-left: 12px; }
.rule-viz { display: flex; flex-direction: column; gap: 14px; }
.rule-viz .dots { gap: 6px; }
.rule-viz .dot { height: 30px; }

/* ----- Sticky table header rows: stay under the site header while the table scrolls past ----- */
@media (min-width: 901px) {
  .matrix-wrap { overflow: visible; overflow-x: clip; }
  .matrix thead th { position: sticky; top: var(--hdr-h, 84px); z-index: 3; background: var(--bg); box-shadow: inset 0 -1px 0 var(--strong-rule); }
}
/* Case filters stay pinned with the table's title row, and release at the end of the table */
.case-block .filters { position: sticky; top: var(--hdr-h, 84px); z-index: 4; background: var(--bg); margin: 0; padding: 12px 0 14px; }
@media (min-width: 901px) {
  .case-block .matrix thead th { top: calc(var(--hdr-h, 84px) + var(--flt-h, 66px)); }
}
.map-embed { position: relative; overflow: hidden; padding: 0; }
.map-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.form-consent { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); max-width: 46em; }
.form-consent a { color: var(--link); }

/* ---------- Survey intro ("What is…") ---------- */
.intro-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px 56px; align-items: start; }
.intro-grid .prose { max-width: none; }
.intro-grid .prose p:last-child { margin-bottom: 0; }
.example { background: var(--panel); border-left: 3px solid var(--link); padding: 22px 24px; }
.example .eyebrow { color: var(--link); margin-bottom: 10px; }
.example p { margin: 0 0 12px; color: var(--body2); font-size: 15px; line-height: 1.55; }
.example p:last-child { margin-bottom: 0; }
.example strong { color: var(--ink); }
.keyfacts { margin: 36px 0 0; border-top: 1px solid var(--strong-rule); }
.keyfacts > div { display: grid; grid-template-columns: 13em minmax(0, 1fr); gap: 4px 24px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.keyfacts dt { font-weight: 600; color: var(--ink); font-size: 15px; }
.keyfacts dd { margin: 0; color: var(--body2); font-size: 15px; line-height: 1.55; }

/* ---------- Case briefs ---------- */
.brief-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.brief-nav a { font-size: 13px; font-weight: 500; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; color: var(--body2); }
.brief-nav a:hover, .brief-nav a:focus-visible { border-color: var(--link); color: var(--link); }
.briefs { border-top: 1px solid var(--strong-rule); }
.brief { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: 20px 56px; padding: 40px 0; border-bottom: 1px solid var(--rule); }
.brief-states { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.brief h3 { margin: 14px 0 0; font-size: 26px; line-height: 1.2; }
.brief h3 a { color: var(--ink); text-decoration: none; }
.brief h3 a:hover, .brief h3 a:focus-visible { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.brief-cite { margin: 6px 0 0; font-size: 15px; color: var(--body2); }
.brief-meta { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.brief-meta span { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 2px 10px; }
.brief-note { margin: 16px 0 0; font-size: 14px; color: var(--body2); background: var(--panel); padding: 10px 14px; }
.brief-bottom { margin: 22px 0 0; font-family: "Source Serif 4", "Noto Serif SC", Georgia, serif; font-size: 19px; line-height: 1.45; color: var(--ink); }
.brief .k { display: block; font-family: Inter, system-ui, sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.brief-quote { margin: 22px 0 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--link); }
.brief-quote p { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-style: italic; font-size: 16px; line-height: 1.5; color: var(--body2); }
.brief-quote footer { margin-top: 8px; font-size: 13px; }
.brief-quote a, .brief-also a { color: var(--link); }
.brief-body { margin: 0; }
.brief-body > div { padding: 0 0 18px; }
.brief-body dt { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.brief-body dd { margin: 0; color: var(--body2); line-height: 1.6; }
.brief-body ul { margin: 0; padding-left: 1.1em; }
.brief-body li { margin-bottom: 8px; }
.brief-flag { margin: 0 0 18px; font-size: 14px; color: var(--body2); background: var(--panel); border-left: 3px solid var(--accent); padding: 10px 14px; }
.brief-also { border-top: 1px solid var(--rule); padding-top: 14px; }
.brief-also .k { color: var(--muted); }
.brief-also ul { margin: 0; padding-left: 1.1em; font-size: 14px; color: var(--body2); }
.brief-also li { margin-bottom: 6px; line-height: 1.5; }
.brief-none h3 { color: var(--muted); }
.brief-none .brief-main p { margin: 14px 0 0; color: var(--body2); }

@media (max-width: 900px) {
  .intro-grid, .brief { grid-template-columns: 1fr; }
  .keyfacts > div { grid-template-columns: 1fr; }
  .brief { padding: 32px 0; gap: 18px; }
  .brief h3 { font-size: 23px; }
  .brief-none .brief-main p { margin-top: 0; }
}

/* Map hover label */
.map-col { position: relative; }
.map-tip { position: absolute; z-index: 6; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); white-space: nowrap;
  background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.2; padding: 6px 10px; border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.map-tip b { font-weight: 600; }
.map-tip span { margin-left: 8px; opacity: .75; }
.map-tip[hidden] { display: none; }
@media (hover: none) { .map-tip { display: none; } }

/* Dropdown section headings (Insights: Articles / Surveys) */
.nav .sub .sub-h { display: block; padding: 12px 20px 4px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.nav .sub .sub-h:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--rule); padding-top: 14px; }
.nav .sub .sub-h + a { padding-top: 6px; }
.m-sub .sub-h { padding: 10px 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.m-sub .sub-h:first-child { padding-top: 4px; }

/* Contact form: required marks and inline validation */
.req { color: var(--error); margin-left: 3px; font-weight: 600; }
.form-required-note { margin: 0; font-size: 14px; color: var(--muted); }
.form-alert { margin: 0; padding: 12px 16px; border-left: 3px solid var(--error); background: color-mix(in srgb, var(--error) 10%, var(--field)); color: var(--ink); font-size: 15px; }
.field-error { margin: 0; font-size: 14px; color: var(--error); font-weight: 500; }
.field .is-invalid, .field [aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.field .is-invalid:focus, .field [aria-invalid="true"]:focus { outline: 2px solid var(--error); outline-offset: 1px; }
.form button[disabled] { opacity: .65; cursor: progress; }

/* Photos */
.headshot { background: transparent; aspect-ratio: 8 / 9; }
.footer-lang { color: var(--footer-ink); }
.footer-lang a { display: inline; }

/* Home page section tones */
.tone-bg { background: var(--bg); }
.tone-alt { background: var(--alt); }
/* hCaptcha */
.captcha-field .h-captcha { min-height: 78px; position: relative; }
.cap-slot { transition: opacity .5s ease; }
.cap-slot.cap-next { position: absolute; top: 0; left: 0; opacity: 0; }
.cap-slot.cap-next.cap-in { opacity: 1; }
.cap-slot.cap-out { opacity: 0; }
.captcha-field .h-captcha.is-invalid iframe { outline: 2px solid var(--error); outline-offset: 2px; border-radius: 4px; }
.captcha-field .h-captcha.is-invalid { box-shadow: none; border: 0; }
