:root {
  --bg: #f4f6fb; --surface: #ffffff; --ink: #0f172a; --muted: #586176; --line: #e2e6ef; --accent: #2747d6;
  --accent-soft: #e8edff; --chip: #eceff7; --flagbg: #f1f3f8; --radius: 16px;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 10px 30px rgb(15 23 42 / .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1d; --surface: #121a2d; --ink: #e9edf7; --muted: #a2abc0; --line: #243150; --accent: #8aa2ff;
    --accent-soft: #1d2a55; --chip: #1a2340; --flagbg: #0e1526; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2747d6, #00b3a4); color: #fff; font-size: 20px; }
.top-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.top-nav a { color: var(--ink); text-decoration: none; padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.top-nav a:hover { background: var(--chip); }
button { font: inherit; color: inherit; }
.btn-random { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); font-weight: 600; cursor: pointer; }
.btn-random:hover { opacity: .9; }

.hero { padding: 32px 0 8px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.08; margin: 0 0 10px; letter-spacing: -.02em; }
.lead { max-width: 760px; color: var(--muted); font-size: 1.1rem; margin: 0 0 20px; }
.search input { width: 100%; max-width: 640px; min-height: 52px; padding: 12px 18px; font-size: 1.05rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.filters { display: grid; gap: 12px; margin: 16px 0 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-b, .chip { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--chip); border-color: transparent; }
.seg-b[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.count { color: var(--muted); margin: 8px 0 14px; }

.grid { list-style: none; margin: 0 0 40px; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 236px), 1fr)); }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.card[hidden] { display: none; }
.card a { display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
.card a:hover { transform: translateY(-2px); border-color: var(--accent); }
.flagbox { display: grid; place-items: center; aspect-ratio: 3 / 2; background: var(--flagbg); padding: 12px; }
.flagbox img { max-height: 100%; width: auto; max-width: 100%; object-fit: contain; box-shadow: 0 0 0 1px rgb(0 0 0 / .12); }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.cname { font-size: 1.05rem; line-height: 1.25; }
.cmeta { color: var(--muted); font-size: .88rem; }
.cfact { font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
@media (max-width: 520px) { .cfact { display: none; } .card-body { padding: 10px; } .cname { font-size: .98rem; } }
.empty { padding: 24px; text-align: center; color: var(--muted); }

.crumbs { margin: 20px 0 8px; color: var(--muted); font-size: .95rem; }
.passport { margin-bottom: 48px; }
.pp-head { display: grid; gap: 24px; grid-template-columns: minmax(0, 420px) 1fr; align-items: center; margin: 8px 0 24px; }
@media (max-width: 760px) { .pp-head { grid-template-columns: 1fr; } }
.pp-flag { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.pp-flag img { display: block; margin: 0 auto; max-height: 280px; width: auto; max-width: 100%; object-fit: contain; box-shadow: 0 0 0 1px rgb(0 0 0 / .12); }
.pp-flag figcaption { margin-top: 12px; font-size: .92rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }
.kicker { margin: 0 0 6px; color: var(--muted); font-weight: 600; }
.pp-title h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.05; margin: 0 0 14px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.names { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.names div { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 6px; }
.names dt { margin: 0; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 4px 8px; }
.names dt abbr { text-decoration: none; }
.names dd { margin: 0; font-size: 1.05rem; }
.pp-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-bottom: 28px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile h2 { margin: 0 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.val { margin: 0; font-size: 1.12rem; font-weight: 600; }
.vals { margin: 0; padding-left: 18px; font-weight: 600; }
.role { display: inline-block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.code { font-size: .8rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }
.note { margin: 10px 0 0; font-size: .92rem; color: var(--muted); }
.pp-facts h2 { font-size: 1.5rem; margin: 0 0 12px; }
.facts { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: f; }
.facts li { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px 58px; }
.facts li::before { counter-increment: f; content: counter(f); position: absolute; left: 16px; top: 16px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem; }
.facts p { margin: 0; font-size: 1.08rem; }
.facts .src { margin-top: 8px; font-size: .86rem; color: var(--muted); overflow-wrap: anywhere; }
.pp-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.pn { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.pn:hover { border-color: var(--accent); }

.prose { max-width: 780px; margin: 28px 0 48px; }
.prose h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1; }
.prose li { margin-bottom: 8px; }
.foot { border-top: 1px solid var(--line); padding: 20px 0 36px; font-size: .95rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
