:root {
  color-scheme: light dark;
  --bg: #f3f5f1;
  --surface: #fbfcf9;
  --surface-2: #e7efeb;
  --text: #17302d;
  --muted: #5d706d;
  --line: #cad7d2;
  --accent: #0d655d;
  --accent-strong: #084840;
  --accent-soft: #dcebe6;
  --danger: #974c3d;
  --warning: #886313;
  --shadow: 0 18px 48px rgba(13, 54, 49, .10);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif; line-height: 1.7; }
button, input { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #5fa99e; outline-offset: 3px; }
.skip-link { position: fixed; top: 10px; right: 10px; z-index: 100; padding: 10px 14px; background: var(--surface); transform: translateY(-150%); border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }

.site-header { position: absolute; inset: 0 0 auto; z-index: 10; color: #f5faf8; }
.nav-shell { max-width: 1220px; height: 74px; margin: auto; padding: 0 24px; display: flex; align-items: center; gap: 38px; }
.brand { display: flex; align-items: center; text-decoration: none; margin-left: auto; }
.brand img { width: 230px; height: auto; display: block; }
nav { display: flex; gap: 26px; align-items: center; }
nav a { text-decoration: none; font-size: 14px; color: rgba(255,255,255,.82); }
nav a:hover { color: #fff; }
.language-button, .menu-button { color: #fff; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.4); border-radius: 9px; padding: 8px 13px; cursor: pointer; }
.language-button { min-width: 46px; direction: ltr; font-weight: 700; }
.menu-button { display: none; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.4); border-radius: 9px; padding: 8px 13px; }
.mobile-menu { margin: 0 16px; padding: 12px; background: rgba(8,48,44,.97); border-radius: 12px; }
.mobile-menu a { display: block; padding: 10px; text-decoration: none; }

.hero { min-height: min(780px, 100dvh); position: relative; display: grid; align-items: center; overflow: hidden; color: #f6faf9; }
.hero-media, .hero-scrim { position: absolute; inset: 0; }
.hero-media { background: url("assets/gulf-coast-hero.jpg") center 42% / cover no-repeat; transform: scale(1.01); }
.hero-scrim { background: linear-gradient(90deg, rgba(5,39,36,.20), rgba(5,39,36,.62) 58%, rgba(4,31,29,.94)); }
.hero-content { position: relative; width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 102px 0 54px; }
.eyebrow { color: #b9ddd6; font-size: 13px; font-weight: 700; margin: 0 0 16px; }
h1 { max-width: 760px; margin: 0; font-size: clamp(42px, 6vw, 76px); line-height: 1.16; letter-spacing: -.035em; }
.hero-copy { max-width: 590px; margin: 20px 0 30px; color: #d7e8e4; font-size: clamp(17px, 2vw, 20px); }
.hero-search { max-width: 690px; }
.hero-search label { display: block; font-size: 13px; margin-bottom: 8px; color: #d9ebe7; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 7px; border: 1px solid rgba(255,255,255,.32); background: rgba(247,251,249,.94); border-radius: var(--radius); box-shadow: var(--shadow); }
.search-row input { min-width: 0; padding: 10px 13px; border: 0; background: transparent; color: #17302d; outline: 0; }
.search-row input::placeholder { color: #60716e; opacity: 1; }
.search-row button { padding: 10px 24px; color: #f7fbfa; background: var(--accent-strong); border: 0; border-radius: 9px; cursor: pointer; }
.search-row button:active { transform: scale(.98); }

.facts { width: min(1120px, calc(100% - 48px)); margin: -48px auto 0; position: relative; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.facts div { padding: 22px 26px; border-left: 1px solid var(--line); }
.facts div:last-child { border-left: 0; }
.facts strong, .facts span { display: block; }
.facts strong { color: var(--accent); font-size: 29px; line-height: 1.2; }
.facts span { color: var(--muted); font-size: 13px; margin-top: 4px; }

.section { max-width: 1220px; margin: 0 auto; padding: 110px 24px; }
.section-heading { max-width: 700px; }
.section h2 { font-size: clamp(31px, 4vw, 50px); line-height: 1.25; letter-spacing: -.025em; margin: 0; }
.section-heading p, .states-copy p { color: var(--muted); margin: 16px 0 0; max-width: 64ch; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 34px 0 24px; }
.filter { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 999px; cursor: pointer; }
.filter.active { background: var(--accent); color: #f6fbf9; border-color: var(--accent); }
.instrument-grid { display: grid; grid-template-columns: 1.22fr .78fr; gap: 15px; }
.instrument-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; min-height: 270px; display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease; }
.instrument-card:first-child { grid-row: span 2; min-height: 555px; background: var(--accent-strong); color: #eff8f5; border-color: var(--accent-strong); }
.instrument-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.instrument-card:first-child .card-meta, .instrument-card:first-child .instrument-body { color: #c8ded9; }
.status { border: 1px solid currentColor; border-radius: 999px; padding: 3px 8px; }
.instrument-card h3 { margin: 20px 0 8px; font-size: clamp(20px, 2.3vw, 28px); line-height: 1.45; }
.instrument-body { color: var(--muted); font-size: 14px; }
.instrument-footer { margin-top: auto; padding-top: 22px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; font-size: 13px; }
.instrument-footer a { color: var(--accent); font-weight: 700; text-decoration: none; }
.instrument-card:first-child .instrument-footer a { color: #b9ddd6; }
.empty-state { border: 1px dashed var(--line); border-radius: var(--radius); padding: 38px; text-align: center; background: var(--surface); }
.empty-state h3 { margin: 0; }
.empty-state p { color: var(--muted); margin-bottom: 0; }

.comparison-section { max-width: none; background: var(--surface-2); padding-inline: max(24px, calc((100vw - 1172px)/2)); }
.comparison-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; margin-top: 42px; }
.topic-list { display: flex; flex-direction: column; gap: 7px; }
.topic-button { text-align: right; border: 1px solid transparent; background: transparent; color: var(--muted); padding: 13px 16px; border-radius: 10px; cursor: pointer; }
.topic-button[aria-selected="true"] { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: 0 8px 24px rgba(13,54,49,.06); }
.comparison-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 4vw, 44px); min-height: 550px; }
.relation { display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: 12px; color: var(--accent-strong); background: var(--accent-soft); }
.relation.gap { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.relation.exceeds { color: #315b91; background: color-mix(in srgb, #315b91 12%, transparent); }
.comparison-panel h3 { font-size: clamp(25px, 3vw, 38px); line-height: 1.3; margin: 18px 0 30px; }
.compare-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.compare-column { padding: 22px; background: var(--bg); border-radius: 11px; }
.compare-column small { color: var(--muted); }
.compare-column h4 { font-size: 18px; line-height: 1.5; margin: 8px 0; }
.compare-column p { color: var(--muted); font-size: 14px; }
.compare-column a { color: var(--accent); font-size: 13px; font-weight: 700; }
.analysis-note { margin: 24px 0 0; padding: 18px 20px; border-right: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; color: var(--text); }

.states { display: grid; grid-template-columns: .85fr 1.15fr; gap: 90px; align-items: start; }
.text-link { display: inline-block; margin-top: 24px; color: var(--accent); font-weight: 700; text-underline-offset: 5px; }
.state-list { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.state-list span { padding: 16px 2px; border-bottom: 1px solid var(--line); color: var(--muted); }
.source-grid { margin-top: 38px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.source-card { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.source-card:hover { border-color: var(--accent); }
.source-card b, .source-card small { display: block; }
.source-card small { color: var(--muted); margin-top: 3px; }
.source-card span { color: var(--accent); font-size: 20px; }
.legal-note { margin: 36px 0 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); background: var(--surface-2); }

.matrix-section { padding-top: 40px; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 28px 0 18px; color: var(--muted); font-size: 13px; }
.matrix-legend span { display: inline-flex; gap: 7px; align-items: center; }
.matrix-legend i { width: 10px; height: 10px; border-radius: 50%; }
.legend-party { background: #3e8f67; }.legend-pending { background: #b18b35; }.legend-na { background: #82918e; }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.party-table { width: 100%; min-width: 1040px; border-collapse: collapse; font-size: 13px; }
.party-table th, .party-table td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: center; }
.party-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 700; }
.party-table th:first-child, .party-table td:first-child { position: sticky; inset-inline-start: 0; z-index: 2; min-width: 190px; text-align: start; background: var(--surface); font-weight: 700; }
.party-table th:first-child { background: var(--surface-2); }
.party-table tr:last-child td { border-bottom: 0; }
.matrix-status { display: inline-block; max-width: 115px; padding: 4px 8px; border-radius: 999px; font-size: 11px; line-height: 1.4; }
.matrix-status.party { background: color-mix(in srgb, #3e8f67 16%, transparent); color: #3e8f67; }
.matrix-status.pending { background: color-mix(in srgb, #b18b35 16%, transparent); color: #9a741e; }
.matrix-status.na { background: var(--surface-2); color: var(--muted); }

.gaps-section { max-width: none; padding-inline: max(24px, calc((100vw - 1172px)/2)); background: var(--surface-2); }
.gaps-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 38px; }
.gap-card { min-height: 260px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; }
.gap-card:first-child { grid-row: span 2; min-height: 534px; background: #532f29; color: #f5e9e6; border-color: #532f29; }
.gap-card h3 { margin: 14px 0 10px; font-size: clamp(20px, 2.4vw, 30px); line-height: 1.35; }
.gap-card p { margin: 0; color: var(--muted); }
.gap-card:first-child p { color: #d7bbb4; }
.gap-card a { margin-top: auto; padding-top: 22px; color: var(--accent); font-weight: 700; font-size: 13px; }
.gap-card:first-child a { color: #efc2b8; }
.gap-kicker { font-size: 12px; color: var(--danger); font-weight: 700; }

.national-toolbar { display: grid; grid-template-columns: .8fr 1fr 1.5fr; gap: 12px; margin-top: 36px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.national-toolbar label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.national-toolbar select, .national-toolbar input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--bg); }
.result-count { color: var(--muted); font-size: 13px; margin: 16px 2px; }
.national-list { display: grid; gap: 10px; }
.national-item { display: grid; grid-template-columns: 100px minmax(0,1fr) auto; gap: 22px; align-items: start; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.law-year { color: var(--accent); font-size: 24px; font-weight: 800; line-height: 1; }
.law-year small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-top: 8px; }
.law-content { min-width: 0; }
.law-content h3 { margin: 0; font-size: 17px; line-height: 1.6; }
.law-content p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.law-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.law-country, .law-category { font-size: 11px; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.law-link { color: var(--accent); font-size: 13px; font-weight: 700; white-space: nowrap; }

.evidence-section { padding-top: 50px; }
.evidence-list { margin-top: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.evidence-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.evidence-card header { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.claim-id { font-family: ui-monospace, monospace; color: var(--accent); font-weight: 800; }
.verification { color: var(--muted); font-size: 11px; }
.evidence-card h3 { margin: 16px 0 8px; font-size: 18px; line-height: 1.5; }
.evidence-card p { margin: 0; color: var(--muted); font-size: 13px; }
.evidence-meta { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 14px; font-size: 12px; }
.evidence-meta a { color: var(--accent); font-weight: 700; }
.admin-link { color: #a9c9c3 !important; font-size: 13px; }

footer { background: #092f2c; color: #d8e8e4; padding: 38px 24px; }
.footer-inner { max-width: 1172px; margin: auto; display: flex; justify-content: space-between; gap: 30px; align-items: center; }
.footer-inner p { margin: 5px 0 0; color: #a9c9c3; font-size: 13px; }
.footer-inner a { color: #d8e8e4; }
.footer-brand img { width: 230px; height: auto; display: block; margin-bottom: 12px; }

html[dir="ltr"] body { font-family: "Aptos", "Segoe UI", Arial, sans-serif; }
html[dir="ltr"] .brand { margin-left: 0; margin-right: auto; }
html[dir="ltr"] .topic-button { text-align: left; }
html[dir="ltr"] .analysis-note { border-right: 0; border-left: 4px solid var(--accent); }
html[dir="ltr"] .instrument-footer { text-align: left; }

@media (prefers-color-scheme: dark) {
  :root { --bg:#10211f; --surface:#152a27; --surface-2:#19312e; --text:#e4eeeb; --muted:#a6b9b5; --line:#34504b; --accent:#63b8aa; --accent-strong:#0d514b; --accent-soft:#21433e; --shadow:0 18px 48px rgba(0,0,0,.23); }
  .hero-scrim { background: linear-gradient(90deg, rgba(5,28,26,.25), rgba(5,34,31,.68) 58%, rgba(3,24,22,.95)); }
  .relation.exceeds { color: #90b4df; }
}

@media (max-width: 800px) {
  .nav-shell { height: 66px; padding: 0 16px; }
  .nav-shell { gap: 8px; }
  .brand img { width: 176px; }
  .nav-shell nav { display: none; }
  .menu-button { display: block; }
  .hero { min-height: 720px; }
  .hero-content { width: calc(100% - 32px); padding-top: 100px; }
  .hero-scrim { background: linear-gradient(180deg, rgba(4,30,28,.45), rgba(4,30,28,.9) 72%); }
  h1 { font-size: clamp(39px, 11vw, 57px); }
  .search-row { grid-template-columns: 1fr; }
  .search-row button { width: 100%; }
  .facts { width: calc(100% - 32px); grid-template-columns: 1fr 1fr; margin-top: -36px; }
  .facts div:nth-child(2) { border-left: 0; }
  .facts div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .section { padding: 76px 16px; }
  .instrument-grid, .comparison-layout, .states, .compare-columns { grid-template-columns: 1fr; }
  .instrument-card:first-child { grid-row: auto; min-height: 360px; }
  .topic-list { flex-direction: row; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
  .topic-button { flex: 0 0 210px; scroll-snap-align: start; }
  .comparison-panel { min-height: auto; }
  .states { gap: 40px; }
  .source-grid { grid-template-columns: 1fr; }
  .gaps-grid, .national-toolbar, .evidence-list { grid-template-columns: 1fr; }
  .gap-card:first-child { grid-row: auto; min-height: 360px; }
  .national-item { grid-template-columns: 74px minmax(0,1fr); gap: 14px; }
  .law-side { grid-column: 1 / -1; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  .site-header, .hero-search, .filters, footer { display: none !important; }
  .hero { min-height: 280px; }
  .section { padding: 36px 0; }
  .instrument-card, .comparison-panel { break-inside: avoid; box-shadow: none; }
}
