/* Notion page grammar on Solarized. Accent inks and tints are pre-mixed from the
   Solarized accents so every pill and link clears 4.8:1 in both themes. */

:root {
  --ground: #fdf6e3;      /* base3 */
  --raised: #eee8d5;      /* base2 */
  --rule: #e2dbc6;
  --rule-strong: #cfc8b2;
  --text: #073642;        /* base02 */
  --text-2: #506870;      /* base01 nudged toward base02: 5.48:1 on ground, 4.82:1 on base2 */
  --link: #19699b;
  --link-rule: #a9c4cf;
  --focus: #268bd2;
  --select: #cfe1e7;

  --red-ink: #ac3031;     --red-tint: #f8d7c6;
  --orange-ink: #9c441d;  --orange-tint: #f5dbc2;
  --magenta-ink: #a03370; --magenta-tint: #f6d7d3;
  --yellow-ink: #6d6316;  --yellow-tint: #f1e5bf;
  --violet-ink: #4e5d9c;  --violet-tint: #e6e1de;
  --green-ink: #4d6b17;   --green-tint: #eae7bf;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground: #002b36;      /* base03 */
  --raised: #073642;      /* base02 */
  --rule: #0d3d4a;
  --rule-strong: #1f4f5b;
  --text: #eee8d5;        /* base2 */
  --text-2: #80a8b2;      /* tinted from the ground's teal, not gray: 5.83:1, 5.05:1 on base02 */
  --link: #66abd7;
  --link-rule: #2e6380;
  --focus: #66abd7;
  --select: #164a5e;

  --red-ink: #e97c73;     --red-tint: #352d34;
  --orange-ink: #de8a62;  --orange-tint: #31332e;
  --magenta-ink: #e37fa7; --magenta-tint: #332e48;
  --yellow-ink: #caa942;  --yellow-tint: #2b4229;
  --violet-ink: #a5a5d0;  --violet-tint: #1a3c58;
  --green-ink: #a9b544;   --green-tint: #204529;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #002b36; --raised: #073642; --rule: #0d3d4a; --rule-strong: #1f4f5b;
    --text: #eee8d5; --text-2: #80a8b2; --link: #66abd7; --link-rule: #2e6380;
    --focus: #66abd7; --select: #164a5e;
    --red-ink: #e97c73; --red-tint: #352d34; --orange-ink: #de8a62; --orange-tint: #31332e;
    --magenta-ink: #e37fa7; --magenta-tint: #332e48; --yellow-ink: #caa942; --yellow-tint: #2b4229;
    --violet-ink: #a5a5d0; --violet-tint: #1a3c58; --green-ink: #a9b544; --green-tint: #204529;
    color-scheme: dark;
  }
}

/* ---- base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
/* Layout rules below set display on rows; hidden must still win (filters rely on it) */
[hidden] { display: none !important; }

html {
  background: var(--ground);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--rule-strong) var(--ground);
}

body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
/* Flex children default to min-width: auto, which lets a wide table stretch the whole page */
body > * { min-width: 0; }

/* The one moment of motion: the page changes theme in a soft fade, not a flash */
html.theme-fading, html.theme-fading * {
  transition: background-color 220ms cubic-bezier(0.16, 1, 0.3, 1), color 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
  html.theme-fading, html.theme-fading * { transition: none; }
}

::selection { background: var(--select); color: var(--text); }

a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-rule); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { line-height: 1.25; text-wrap: balance; color: var(--text); }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem); font-weight: 700; letter-spacing: -0.015em; margin: 2.75rem 0 0.5rem; }
h2 { font-size: 1.4rem; font-weight: 650; letter-spacing: -0.01em; margin: 2.5rem 0 0.75rem; }
p { margin: 0 0 0.9rem; }

.lead { color: var(--text-2); font-size: 1.05rem; max-width: 68ch; margin-bottom: 1.5rem; }
.muted { color: var(--text-2); }
.num, table { font-variant-numeric: tabular-nums; }
.code { font-family: var(--mono); font-size: 0.84em; background: var(--raised); border-radius: 3px; padding: 0.1em 0.35em; white-space: nowrap; }

.icon { flex: none; vertical-align: -0.15em; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 0.5rem; top: -3rem; background: var(--raised); color: var(--text); padding: 0.4rem 0.7rem; border-radius: 4px; z-index: 10; }
.skip:focus { top: 0.5rem; }

/* ---- top bar ------------------------------------------------------------------ */

.topbar { position: sticky; top: 0; z-index: 5; background: var(--ground); border-bottom: 1px solid var(--rule); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 0 1rem; min-height: 46px; display: flex; align-items: center; gap: 1rem; }
.brand { font-weight: 650; font-size: 0.95rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 0.15rem; margin-left: auto; }
.nav a { color: var(--text-2); text-decoration: none; font-size: 0.9rem; padding: 0.3rem 0.55rem; border-radius: 4px; white-space: nowrap; }
.nav a:hover { background: var(--raised); color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 550; }
.nav-short { display: none; }

.theme-toggle { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 4px; background: transparent; color: var(--text-2); cursor: pointer; }
.theme-toggle:hover { background: var(--raised); color: var(--text); }
.theme-toggle .icon { width: 18px; height: 18px; grid-area: 1 / 1; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---- page ------------------------------------------------------------------ */

.page { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 1rem 4rem; }
.page.page-read { max-width: 720px; }

.crumbs { margin-top: 1.75rem; font-size: 0.88rem; color: var(--text-2); display: flex; gap: 0.45rem; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); }
.crumbs + h1 { margin-top: 0.6rem; }

/* ---- views, toolbar --------------------------------------------------------- */

.views { display: flex; gap: 1.1rem; border-bottom: 1px solid var(--rule); margin-top: 1.5rem; }
.view-tab { color: var(--text-2); text-decoration: none; font-size: 0.95rem; padding: 0.45rem 0 0.55rem; margin-bottom: -1px; border-bottom: 2px solid transparent; white-space: nowrap; }
.view-tab:hover { color: var(--text); }
.view-tab[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.view-tab .count { color: var(--text-2); font-weight: 400; margin-left: 0.15rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin: 1rem 0 0.75rem; }
.search { flex: 1 1 280px; display: flex; align-items: center; gap: 0.5rem; background: var(--raised); border-radius: 6px; padding: 0 0.7rem; color: var(--text-2); }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.95rem; padding: 0.55rem 0; outline: none; }
.search input::placeholder { color: var(--text-2); opacity: 1; }
.toggle { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.92rem; cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 16px; height: 16px; margin: 0; border: 1.5px solid var(--rule-strong); border-radius: 3px; background: var(--ground) center / 12px no-repeat; cursor: pointer; }
.toggle input:checked { background-color: var(--link); border-color: var(--link); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23fdf6e3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .toggle input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23002b36' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toggle input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23002b36' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---- tables (a Notion database) --------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -1rem; padding: 0 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
thead th { text-align: left; font-weight: 500; font-size: 0.82rem; color: var(--text-2); padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
tbody th, tbody td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody th { font-weight: 500; }
tbody tr:hover { background: var(--raised); }
.num { text-align: right; white-space: nowrap; }
td.num { text-align: right; }
thead th.num { text-align: right; }
.banks tbody th a { color: var(--text); text-decoration: none; }
.banks tbody th a:hover { text-decoration: underline; text-decoration-color: var(--text-2); }
.banks tbody td { white-space: nowrap; }
.banks thead th { position: sticky; top: 46px; background: var(--ground); z-index: 1; box-shadow: inset 0 -1px 0 var(--rule-strong); }
.banks tbody tr { scroll-margin-top: 92px; }  /* a #bank link lands below the bar and the header */
@media (min-width: 641px) {
  .table-wrap:has(> .banks) { overflow: visible; }  /* an overflow wrapper would stop the header sticking */
}
.empty-row td { color: var(--text-2); padding: 1.5rem 0.6rem; }

/* ---- pills and tags (Notion select properties) ------------------------------ */

.pill { display: inline-block; font-size: 0.82rem; line-height: 1.5; padding: 0 0.45rem; border-radius: 3px; white-space: nowrap; font-weight: 500; }
.pill-blokirovka { color: var(--red-ink); background: var(--red-tint); }
.pill-zapret-operatsiy { color: var(--orange-ink); background: var(--orange-tint); }
.pill-korschyota { color: var(--magenta-ink); background: var(--magenta-tint); }
.pill-sektoralnye { color: var(--yellow-ink); background: var(--yellow-tint); }
.pill-prochie { color: var(--violet-ink); background: var(--violet-tint); }
.pill-none { color: var(--green-ink); background: var(--green-tint); }
h2 .pill { font-size: 1.1rem; padding: 0.1rem 0.5rem; }

.tag { display: inline-block; font-size: 0.75rem; line-height: 1.5; padding: 0 0.35rem; border-radius: 3px; background: var(--raised); color: var(--text-2); font-weight: 500; margin-left: 0.35rem; vertical-align: 0.1em; }
/* Licence status is not a sanctions measure: keep it off the pill colours */
.tag-warn { color: var(--text); background: transparent; box-shadow: inset 0 0 0 1px var(--rule-strong); }
.props .tag { margin-left: 0; }

/* The jurisdiction strip, the site's signature: one pill per jurisdiction */
.strip { display: inline-flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.strip-cell { display: inline-flex; align-items: center; gap: 0.45rem; }
.strip-label { font-size: 0.88rem; color: var(--text-2); }
.strip-block { margin: 0.25rem 0 1.5rem; }
.strip-block .pill { font-size: 0.9rem; padding: 0.05rem 0.5rem; }

/* ---- bank page --------------------------------------------------------------- */

.props { margin: 0 0 1rem; display: grid; gap: 0.1rem; }
.props > div { display: grid; grid-template-columns: minmax(9rem, 13rem) 1fr; gap: 1rem; padding: 0.3rem 0; }
.props dt { color: var(--text-2); font-size: 0.92rem; }
.props dd { margin: 0; overflow-wrap: anywhere; }
.props dd.num { text-align: left; }
a.pill { text-decoration: none; }
a.pill:hover { text-decoration: underline; text-decoration-color: currentColor; }
.measures tbody td:nth-child(4) { white-space: normal; min-width: 14rem; }
.source { white-space: nowrap; font-size: 0.9rem; }
.source .icon { width: 13px; height: 13px; margin-left: 0.2rem; vertical-align: -0.05em; }
.timeline { padding-left: 1.2rem; }
.timeline li { margin-bottom: 0.4rem; }
.checked { margin-top: 2.5rem; font-size: 0.88rem; color: var(--text-2); }

/* ---- callouts, notes, empty states ------------------------------------------ */

.callout { display: flex; gap: 0.7rem; align-items: flex-start; background: var(--raised); border-radius: 4px; padding: 0.9rem 1rem; margin: 1.5rem 0; }
.callout .icon { width: 20px; height: 20px; margin-top: 0.1rem; color: var(--text-2); }
.callout p { margin: 0; }
.callout-ok { background: var(--green-tint); }
.callout-ok .icon { color: var(--green-ink); }

.notes { padding-left: 1.3rem; }
.notes li { margin-bottom: 0.5rem; max-width: 68ch; }
section p { max-width: 68ch; }

.empty { background: var(--raised); border-radius: 4px; padding: 1.25rem 1.25rem 0.5rem; margin-top: 1.5rem; }
.empty h2 { margin-top: 0; font-size: 1.15rem; }

/* ---- footer --------------------------------------------------------------- */

.footer { border-top: 1px solid var(--rule); color: var(--text-2); font-size: 0.85rem; }
.footer-inner { max-width: 760px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.footer.page-read .footer-inner { max-width: 720px; }
.footer p { margin: 0 0 0.35rem; max-width: 80ch; }

/* ---- small screens -------------------------------------------------------------- */

@media (max-width: 640px) {
  .topbar { position: static; }
  .topbar-inner { flex-wrap: wrap; gap: 0 0.5rem; padding-top: 0.35rem; }
  .theme-toggle { margin-left: auto; }
  .nav { order: 3; width: 100%; margin: 0 -0.4rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.3rem; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .banks thead th { position: static; }
  .nav a { padding: 0.25rem 0.4rem; }
  .props > div { grid-template-columns: 1fr; gap: 0; }
  h1 { margin-top: 2rem; }

  /* On a phone a row becomes a block: the name, then "label — value" lines */
  .table-wrap { margin: 0; padding: 0; overflow: visible; }
  .reflow, .reflow tbody { display: block; width: 100%; }  /* a table box sizes to its content */
  .reflow thead { display: none; }
  .reflow tbody tr { display: block; padding: 0.65rem 0; border-bottom: 1px solid var(--rule); }
  .reflow tbody tr:hover { background: transparent; }
  .reflow tbody th { display: block; padding: 0 0 0.3rem; border: 0; }
  .reflow tbody td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.15rem 0; border: 0; white-space: normal; text-align: right; }
  .reflow tbody td::before { content: attr(data-label); color: var(--text-2); font-size: 0.85rem; text-align: left; flex: none; }
  .reflow tbody td .cell { min-width: 0; overflow-wrap: anywhere; }
  /* The bank list keeps its strip shape: "США [pill] ЕС [pill] ..." wrapping under the name */
  .banks.reflow tbody td { display: inline-flex; gap: 0.35rem; margin-right: 1rem; padding: 0.1rem 0; text-align: left; }
  .reflow .empty-row td { display: block; text-align: left; }
  .reflow .empty-row td::before { content: none; }
}
