/* Newspaper Arena: light, calm, card based. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #0f1a2e;
  --ink-2: #364152;
  --muted: #6b7484;
  --line: #e4e7ec;
  --line-2: #eef0f3;
  --accent: #e8553f;
  --accent-ink: #b8371f;
  --accent-soft: #fdeee9;
  --navy: #13284b;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-h: 0 4px 16px rgba(16, 24, 40, .08);
  --side: 232px;
  --top: 64px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; margin: 0; }
.ic { flex: none; }
.skip { position: absolute; inset-inline-start: 8px; top: 8px; transform: translateY(-300%); background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { height: var(--top); display: flex; align-items: center; gap: 16px; padding: 0 20px; max-width: 1480px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; width: calc(var(--side) - 20px); }
.brand-name { font-size: 19px; font-weight: 500; letter-spacing: -.02em; color: var(--navy); }
.brand-name b { font-weight: 750; color: var(--accent); margin-left: 1px; }
.search { flex: 1; max-width: 680px; display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid transparent; border-radius: 999px; padding: 0 16px; height: 44px; color: var(--muted); transition: background .15s, border-color .15s, box-shadow .15s; }
.search:focus-within { background: #fff; border-color: var(--line); box-shadow: var(--shadow-h); }
.search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); outline: none; min-width: 0; height: 100%; }
.edpick { position: relative; margin-left: auto; flex: none; }
.edpick summary { list-style: none; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: #fff; font-weight: 550; color: var(--ink-2); max-width: 240px; }
.edpick summary::-webkit-details-marker { display: none; }
.edpick summary:hover { border-color: #cdd2da; }
.edname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* «Увійти» / «Мій кабінет» (app.js swaps it when signed in) */
.signin { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; }
.signin:hover { background: var(--accent-ink); color: #fff; }
.signin.in { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.signin.in:hover { border-color: #cdd2da; background: #fff; color: var(--ink); }
.sec-block.mine .sec-title a::after { content: "★"; color: var(--c); font-size: .8em; margin-inline-start: 6px; }
.flag { flex: none; display: inline-grid; place-items: center; min-width: 28px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 11px; font-weight: 750; letter-spacing: .04em; line-height: 1; }
.flag-img { flex: none; width: 20px; height: 15px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(16, 24, 40, .12); background: var(--line-2); }
/* edition menu: every edition visible at once, 3 columns on desktop, 2 on phones, no inner scroll */
.edmenu { position: absolute; right: 0; top: calc(100% + 8px); width: min(740px, calc(100vw - 32px)); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(16, 24, 40, .16); z-index: 60; max-height: calc(100vh - var(--top) - 12px); overflow: auto; }
.edmenu-head { padding: 10px 12px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; }
.edmenu-head input { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; font: inherit; }
.edmenu ul { list-style: none; margin: 0; padding: 6px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 4px; }
.edmenu li { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; min-width: 0; }
.edmenu li[hidden] { display: none; }
.edmenu .edc { flex: 1 1 0; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; font-size: 13.5px; line-height: 1.25; min-width: 0; }
.edmenu .edc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edmenu .edl { display: flex; flex-wrap: wrap; gap: 2px; max-width: 100%; }
.edmenu .edl a { padding: 1px 4px; border-radius: 5px; font-size: 10.5px; font-weight: 650; letter-spacing: .02em; color: var(--ink-3, #667085); border: 1px solid var(--line); line-height: 1.4; }
.edmenu .edc:hover, .edmenu .edc[aria-current] { background: var(--accent-soft); color: var(--accent-ink); }
.edmenu .edl a:hover, .edmenu .edl a[aria-current] { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.burger { display: none; width: 40px; height: 40px; border: 0; background: none; padding: 10px; cursor: pointer; flex-direction: column; justify-content: center; gap: 4px; }
.burger span { display: block; height: 2px; background: var(--ink-2); border-radius: 2px; }

/* layout */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); max-width: 1480px; margin: 0 auto; }
.side { position: sticky; top: var(--top); align-self: start; height: calc(100vh - var(--top)); overflow-y: auto; padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 2px; }
.side a { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px; border-radius: 0 999px 999px 0; margin-left: -12px; padding-left: 26px; color: var(--ink-2); font-weight: 520; }
.side a .ic { color: var(--c, var(--muted)); }
.side a:hover { background: #eceef2; color: var(--ink); }
.side a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.side a.on .ic { color: var(--accent); }
.side-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.main { padding: 24px 28px 48px; min-width: 0; }

/* headings */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; font-weight: 720; }
.page-head .wx { flex: 0 1 320px; min-width: 0; } /* same width as the right column of .home-grid */
.page-head .wx .ukwx-weather { display: block; width: 100%; }
@media (max-width: 640px) { .page-head { flex-wrap: wrap; align-items: flex-start; } .page-head .wx { flex-basis: 100%; } }
.with-ic { display: flex; align-items: center; gap: 10px; }
.with-ic .ic { color: var(--c); }
.sub { margin: 4px 0 0; color: var(--muted); }
.rss-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }

/* grids */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.col-main { display: grid; gap: 14px; }
.col-side { display: grid; gap: 16px; position: sticky; top: calc(var(--top) + 20px); }
.list { display: grid; gap: 14px; max-width: 860px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow-h); border-color: #d9dde4; }
.card.has-thumb { grid-template-columns: minmax(0, 1fr) 180px; }
.card .thumb { order: 2; width: 100%; height: 100%; min-height: 140px; object-fit: cover; background: var(--line-2); }
.card-body { padding: 16px 18px 12px; display: grid; gap: 8px; min-width: 0; }
.card-meta { display: flex; gap: 8px; align-items: center; min-height: 0; }
.card-meta:empty { display: none; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); }
.geo { font-size: 12px; color: var(--muted); }
.card-title { font-size: 17px; font-weight: 650; }
.card.big .card-title { font-size: 20px; font-weight: 700; }
.card-title a:hover, .more-title:hover, .row-title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.teaser { margin: 0; color: var(--ink-2); }
.src { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.src .pub { color: var(--ink-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.src time::before { content: "·"; margin-right: 8px; }
.av { --h: 210; flex: none; width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 750; color: hsl(var(--h) 55% 30%); background: hsl(var(--h) 70% 92%); }
.more { list-style: none; margin: 4px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
.more li { display: grid; gap: 2px; }
.more-title { font-weight: 560; color: var(--ink); font-size: 15px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 10px; flex-wrap: wrap; }
.full { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; font-size: 13.5px; }
.full:hover { background: #fbdcd3; color: var(--accent-ink); }
.counts { font-size: 12.5px; color: var(--muted); }
.counts b { color: var(--ink); }

/* side panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.panel p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.rank { list-style: none; counter-reset: r; margin: 0; padding: 0; display: grid; gap: 12px; }
.rank li { counter-increment: r; display: grid; grid-template-columns: 26px 1fr; column-gap: 6px; }
.rank li::before { content: counter(r); grid-row: span 2; font-weight: 750; color: var(--accent); font-size: 17px; line-height: 1.3; }
.rank a { font-weight: 600; font-size: 14px; }
.row-meta { font-size: 12.5px; color: var(--muted); }
.row-meta a:hover { color: var(--accent-ink); }
.api-panel { background: linear-gradient(160deg, #fff 40%, #fff4f0); }

/* section blocks on home */
.sec-block { margin-top: 34px; }
.sec-title { font-size: 20px; margin-bottom: 12px; }
.sec-title a { display: inline-flex; align-items: center; gap: 9px; }
.sec-title .ic:first-child { color: var(--c); }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.sec-grid .card-title { font-size: 16px; }

/* story page */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--accent-ink); }
.story-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); display: grid; gap: 12px; max-width: 980px; }
.story-head h1 { font-size: 30px; font-weight: 750; }
.story-sum { margin: 0; font-size: 16.5px; color: var(--ink-2); }
.attrib { color: var(--muted); font-size: 14px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 0; }
.stats div { background: var(--bg); border-radius: var(--radius-s); padding: 8px 14px; min-width: 110px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; }
.stats dd.hl { color: var(--accent); }
.indep-note { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.indep-note .ic { margin-top: 2px; color: var(--accent); }
.story-sec { margin-top: 28px; max-width: 980px; }
.story-sec h2 { font-size: 19px; font-weight: 720; margin-bottom: 12px; }
.cov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cov { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.cov h3 { font-size: 16px; font-weight: 650; }
.cov p { margin: 0; color: var(--ink-2); font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tl-day { position: sticky; top: var(--top); background: #fafbfc; border-bottom: 1px solid var(--line-2); padding: 8px 18px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
.tl-day:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.tl-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line-2); position: relative; }
.tl-item:last-child { border-bottom: 0; }
.tl-item time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; padding-top: 1px; }
.tl-item > div { display: grid; gap: 2px; min-width: 0; }
.tl-title { font-weight: 560; overflow-wrap: anywhere; }
.tl-item.copy .tl-title { color: var(--ink-2); font-weight: 450; }
.tag { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.loose { margin-top: 12px; }
.loose summary { cursor: pointer; color: var(--ink-2); font-weight: 600; padding: 8px 0; }
.loose .src-list { margin-top: 6px; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; }
.group-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.group-pubs { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--ink-2); }
.group-pubs a { display: inline-flex; align-items: center; gap: 6px; }

/* FNA box */
.fna { margin-top: 32px; max-width: 980px; border-radius: var(--radius); border: 1px solid #f3cfc5; background: linear-gradient(135deg, #fff 30%, #fff3ee); padding: 20px 22px; display: grid; gap: 10px; }
.fna-head { display: flex; align-items: center; gap: 10px; }
.fna-head h2 { font-size: 18px; }
.fna-badge { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: #fff; background: var(--accent); padding: 3px 8px; border-radius: 6px; }
.fna p { margin: 0; color: var(--ink-2); }
.code { margin: 0; background: #0f1a2e; color: #e6edf7; border-radius: 10px; padding: 14px 16px; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 18px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 650; border: 0; cursor: pointer; font: inherit; font-weight: 650; justify-self: start; }
.btn:hover { background: var(--accent-ink); color: #fff; }
.btn.small { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: #c9ced6; color: var(--ink); }

/* source page */
.src-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.src-head .av { width: 52px; height: 52px; border-radius: 14px; font-size: 24px; }
.src-head h1 { font-size: 26px; }
.src-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.src-list li { padding: 12px 18px; border-bottom: 1px solid var(--line-2); display: grid; gap: 3px; }
.src-list li:last-child { border-bottom: 0; }

/* search */
.search-big { display: flex; gap: 10px; margin-bottom: 20px; max-width: 860px; flex-wrap: wrap; }
.search-big input, .search-big select { height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; font: inherit; background: #fff; }
.search-big input { flex: 1; min-width: 200px; }

/* editions + rss */
.ed-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ed-grid a { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px; }
.ed-grid a:hover { border-color: #f0b8aa; }
.ed-grid span:nth-child(2) { display: grid; flex: 1; font-weight: 600; }
.ed-grid small { color: var(--muted); font-weight: 400; }
.ed-grid em { font-style: normal; font-size: 12px; color: var(--muted); }
.rss-table { display: grid; gap: 6px; }
.rss-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 9px 14px; font-size: 14px; }
.rss-row b { min-width: 180px; }
.rss-row a { color: var(--accent-ink); }
.pager { display: flex; gap: 10px; margin-top: 18px; }

/* prose + empty */
.prose { max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; font-size: 16px; line-height: 1.65; }
.prose h1 { font-size: 30px; margin-bottom: 10px; }
.prose h2 { font-size: 20px; margin: 28px 0 8px; }
.prose .lead { font-size: 18px; color: var(--ink-2); }
.prose a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.prose li { margin: 6px 0; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--ink-2); }
.empty h1 { font-size: 26px; margin-bottom: 8px; }

/* footer */
.foot { border-top: 1px solid var(--line); background: #fff; }
.foot-in { max-width: 1480px; margin: 0 auto; padding: 26px 28px 34px; display: grid; gap: 10px; }
.foot-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--navy); }
.foot-note { margin: 0; color: var(--muted); font-size: 13px; max-width: 760px; }
.foot-note a { text-decoration: underline; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-2); }

/* responsive */
@media (max-width: 1180px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 900px) {
  :root { --top: 58px; }
  .burger { display: flex; }
  .brand { width: auto; }
  .brand-name { font-size: 17px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: var(--top); bottom: 0; width: 270px; height: auto; background: #fff; z-index: 25; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 10px 40px rgba(16, 24, 40, .18); }
  body.nav-open .side { transform: none; }
  .main { padding: 18px 16px 40px; }
  .search { order: 3; }
  .top-in { padding: 0 12px; gap: 8px; }
  .edname { display: none; }
  .edpick summary { padding: 0 10px; }
  .signin { padding: 0 12px; }
}
@media (max-width: 480px) { .signin span { display: none; } .signin { width: 40px; padding: 0; justify-content: center; } }
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .search { flex-basis: 100%; height: 40px; max-width: none; }
  :root { --top: 106px; }
  .card.has-thumb { grid-template-columns: minmax(0, 1fr); }
  .card .thumb { order: 0; max-height: 190px; }
  .card.big .card-title { font-size: 18px; }
  .story-head { padding: 18px; }
  .story-head h1 { font-size: 24px; }
  .page-head h1 { font-size: 24px; }
  .stats div { min-width: calc(50% - 5px); }
  .prose { padding: 20px; }
  .edmenu { position: fixed; left: 12px; right: 12px; top: calc(var(--top) - 4px); width: auto; }
  .edmenu ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edmenu ul { padding: 4px; }
  .edmenu .edc { padding: 3px 5px; gap: 6px; font-size: 13px; }
  .edmenu-head { padding: 8px; }
  .edmenu-head strong { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
[dir=rtl] .edpick { margin-left: 0; margin-right: auto; }
@media (min-width: 641px) { [dir=rtl] .edmenu { right: auto; left: 0; } }
[dir=rtl] .side a { border-radius: 999px 0 0 999px; margin-left: 0; margin-right: -12px; padding-left: 14px; padding-right: 26px; }
@media (max-width: 900px) { [dir=rtl] .side { left: auto; right: 0; transform: translateX(102%); } [dir=rtl] body.nav-open .side { transform: none; } }
