/* ============================================================================
   aca-cms — additions to the prototype's base.css for content that editors
   type or paste (and 1,000+ articles imported from the old site, pasted from
   Word). base.css stays byte-identical to the approved prototype; anything
   the live content needs goes here.
   ============================================================================ */

/* Word tables and pictures must never widen the page: measured 1,077 px wide
   inside a 760 px column on "Открытый бюджет". The table scrolls inside its
   own box instead, like the prototype's .table-wrap. */
.prose table{display:block; max-width:100%; overflow-x:auto; border-collapse:collapse;
  margin:var(--space-5) 0; -webkit-overflow-scrolling:touch}
.prose td,.prose th{border:1px solid var(--border); padding:var(--space-2) var(--space-3);
  vertical-align:top; min-width:6rem}
.prose img{max-width:100%; height:auto}
.prose iframe,.prose video,.prose embed,.prose object{max-width:100%}
/* Inline widths from Word ("width: 623.8pt") lose to the column. */
.prose [style*="width"]{max-width:100%}
/* Long unbroken strings (links, file names) wrap instead of overflowing. */
.prose p,.prose li,.prose td{overflow-wrap:anywhere}

/* Useful resources: the organisation's own emblem instead of one generic
   icon for all (the old site kept a logo per link). */
.res-mark.res-logo{width:44px; height:44px; background:transparent; padding:0}
.res-mark.res-logo img{width:44px; height:44px; object-fit:contain}

/* Text shown in another language because this one has none yet. */
.lang-note{margin:0 0 var(--space-5); padding:var(--space-2) var(--space-4); display:inline-block;
  font-size:var(--text-sm); color:var(--muted-fg); background:var(--muted); border-radius:var(--radius)}

/* Blocks built from old page content (App\Support\ContentNormalizer). */
.prose .table-wrap{margin:var(--space-5) 0 var(--space-6); max-width:none}
.prose .table-wrap table{display:table; margin:0; min-width:0}
.prose .table-wrap td,.prose .table-wrap th{border:0; border-bottom:1px solid var(--border);
  padding:var(--space-3) var(--space-4); min-width:0}
.prose .table-wrap thead th{background:var(--muted); color:var(--navy); font-weight:600; text-align:left}
table.doc-files td:last-child{width:1%; white-space:nowrap; text-align:right}
.prose table.doc-files .doc-title{display:inline; margin-right:var(--space-2)}
.prose .grid-3,.prose .res-grid{margin:var(--space-5) 0 var(--space-6)}
.prose .grid-3{max-width:none}
.prose a.tile,.prose a.res{text-decoration:none}
.prose .res-mark{font-size:var(--text-base); font-weight:700}
.prose .gallery-grid img{aspect-ratio:auto; object-fit:contain; background:transparent}
.prose figure img{display:block; border-radius:var(--radius)}
.prose .player-frame{margin:var(--space-6) 0; aspect-ratio:16/9}
.prose .player-frame iframe{position:absolute; inset:0; width:100%; height:100%; border:0}
@media (max-width: 720px){
  table.doc-files td:last-child{width:auto; text-align:left}
}

/* People lists from membership tables (councils, commissions). */
.prose .people{display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:var(--space-4);
  margin:var(--space-4) 0 var(--space-6); max-width:none}
.prose .people .person{margin:0}
.prose .people .person h3{margin:0 0 var(--space-2)}
.prose .people .person .role{font-weight:500; color:var(--slate); margin-bottom:var(--space-2)}
.prose .people .person dd{overflow-wrap:anywhere}
/* Cells wrap between words, never inside them ("ОТАХОНО / В"): a wide table scrolls instead. */
.prose .table-wrap td,.prose .table-wrap th{overflow-wrap:normal; word-break:normal; min-width:7rem}
.prose .table-wrap td:first-child,.prose .table-wrap th:first-child{min-width:2.5rem}
.prose .people .person .contacts{margin:var(--space-2) 0 0; font-size:var(--text-sm); overflow-wrap:anywhere}

/* ------------------------------------------------------------ Leadership
   The director featured with the career beside; deputies in a grid; each
   career is the design system's timeline. */
.leadership > * + *{margin-top:var(--space-6)}
.leader{background:var(--card); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:var(--space-5); display:flex; flex-direction:column; gap:var(--space-4)}
.leader-main{display:flex; gap:var(--space-5); align-items:flex-start}
.leader-photo{flex:0 0 auto; width:112px; aspect-ratio:4/5; border-radius:var(--radius);
  overflow:hidden; background:var(--accent-light); display:grid; place-items:center}
.leader-photo img{width:100%; height:100%; object-fit:cover; object-position:top center; display:block}
.leader-initials{font-size:var(--text-2xl); font-weight:700; color:var(--accent-dark)}
.leader-info h2,.leader-info h3{margin:0 0 var(--space-2); color:var(--navy); line-height:var(--lh-tight)}
.leader-info h3{font-size:var(--text-md)}
.leader-info .eyebrow{margin:0 0 var(--space-3)}
.leader-role{margin:0; color:var(--accent-dark); font-weight:600; font-size:var(--text-sm); line-height:var(--lh-snug)}
.leader-contacts{list-style:none; margin:0; padding:0; display:grid; gap:var(--space-3)}
.leader-contacts li{display:flex; gap:var(--space-3); align-items:flex-start; font-size:var(--text-sm); color:var(--slate)}
.leader-ico{flex:0 0 auto; width:34px; height:34px; border-radius:var(--radius); display:grid; place-items:center;
  background:var(--accent-light); color:var(--accent-dark)}
.leader-label{display:block; font-size:var(--text-xs); color:var(--muted-fg); text-transform:uppercase; letter-spacing:.04em; margin-bottom:2px}
.leader-book{align-self:flex-start; color:#fff}
.leader-book:hover{color:#fff}
.leader-career{border-top:1px solid var(--border); padding-top:var(--space-4)}
.leader-career-h{margin:0; font-size:var(--text-base); color:var(--navy)}
.leader-career .timeline{margin-top:var(--space-3)}
.leader-career .timeline li{padding-bottom:var(--space-4)}
.leader-career .tl-date{margin:0 0 2px; font-weight:600; color:var(--accent-dark); font-variant-numeric:tabular-nums}
.leader-career .tl-title{font-weight:500; font-size:var(--text-sm); line-height:var(--lh-body)}

/* The director: photo and contacts side by side, the career folded across the bottom
   (it used to fill a column of its own, which the fold left empty). */
.leader-lead{padding:var(--space-6); gap:var(--space-5);
  background:linear-gradient(135deg, var(--card) 55%, var(--accent-light));}
.leader-lead .leader-main{gap:var(--space-6)}
.leader-lead .leader-photo{width:180px}
.leader-lead .leader-info h2{font-size:var(--text-2xl)}
.leader-lead .leader-contacts{margin-top:var(--space-5)}
.leader-lead .leader-book{margin-top:var(--space-5)}

.leader-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:var(--space-5)}
.leader-vacant{display:flex; gap:var(--space-4); align-items:center; padding:var(--space-4) var(--space-5);
  border:1px dashed var(--border); border-radius:var(--radius-lg); background:var(--bg)}
.leader-vacant-icon{width:44px; height:44px; border-radius:50%; display:grid; place-items:center; background:var(--muted); color:var(--muted-fg)}
.leader-vacant-title{margin:0 0 var(--space-2); font-weight:600; color:var(--navy)}
@media (max-width: 520px){ .leader-main{flex-direction:column} }

/* Open data passport: the grey note inside the blue download button was unreadable. */
.dl-list .btn-primary small{color:rgba(255,255,255,.85)}

/* ------------------------------------------------------------ Article
   From the prototype's aca-article page, where these rules live in the page
   itself (not base.css): the hero picture and the share bar. */
.article-hero{width:100%; height:auto; aspect-ratio:21/9; object-fit:cover;
  display:block; border-radius:var(--radius-lg); margin-bottom:var(--space-6);
  background:var(--aca-ink-100)}
.share{display:flex; gap:var(--space-2); align-items:center; flex-wrap:wrap;
  padding:var(--space-5) 0; border-top:1px solid var(--border);
  border-bottom:1px solid var(--border); margin:var(--space-7) 0}
.share > span{font-size:var(--text-sm); font-weight:600; color:var(--muted-fg); margin-right:var(--space-2)}
.share a:not(.btn-link),.share button{width:44px; padding:0; background:var(--card); font:inherit; cursor:pointer; height:44px;
  display:grid; place-items:center; border:1px solid var(--border); border-radius:var(--radius); color:var(--slate)}
.share a:not(.btn-link):hover,.share button:hover{border-color:var(--accent); color:var(--accent-dark); background:var(--accent-light)}
.share .btn-link{margin-left:auto; font-size:var(--text-sm); font-weight:600}
/* From the prototype's aca-opendata page. */
.fmt{display:inline-flex; gap:var(--space-2); flex-wrap:wrap}
/* The press office's signature under a news text. */
.prose .signature{margin-top:var(--space-6); padding-top:var(--space-4); border-top:1px solid var(--border);
  font-size:var(--text-sm); font-weight:600; color:var(--muted-fg); line-height:var(--lh-body)}
.contacts-map{width:100%; height:380px; border:0; border-radius:var(--radius-lg); display:block; background:var(--aca-ink-100)}

/* Dataset passport: the download row and the following sections were 96px apart. */
[data-page="aca-opendata-item"] .dl-list{margin-bottom:var(--space-6)}
[data-page="aca-opendata-item"] .with-aside .section-sm{padding:var(--space-6) 0 0}

/* Contacts, reception table: the post under the name is a quiet second line, not a second name. */
.reception-role{display:block; margin-top:var(--space-1); font-size:var(--text-sm); font-weight:400; line-height:1.45; color:var(--muted-fg)}

/* ---------- Page builder blocks (App\Filament\PageBuilder, resources/views/blocks) ---------- */
.block-lead{font-size:var(--text-lg); line-height:var(--lh-body); color:var(--slate)}
.block-lead > :first-child{margin-top:0}
.block-stats{display:grid; grid-template-columns:repeat(var(--cols,4),minmax(0,1fr)); gap:var(--space-4)}
.block-stats .stat-num{font-variant-numeric:tabular-nums}
@media (max-width:1100px){ .block-stats{grid-template-columns:repeat(min(var(--cols,4),2),minmax(0,1fr))} }
@media (max-width:480px){ .block-stats{grid-template-columns:1fr} }
.designed table caption{text-align:left}
.designed table .n{font-variant-numeric:tabular-nums}
.block-table th[scope="row"]{min-width:11rem}
.block-fold summary{font-weight:600}
.block-fold details > .table-wrap{margin:0 var(--space-5) var(--space-5)}
.designed .people{display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:var(--space-4)}
.designed .person{margin:0}
.designed .person h3{margin:0 0 var(--space-2)}
.block-cards{list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-3)}
.block-cards li{display:flex; flex-direction:column; gap:var(--space-1); padding:var(--space-4);
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius); color:var(--slate); line-height:var(--lh-snug)}
.block-card-label{font-size:var(--text-xs); font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted-fg)}
@media (max-width:600px){ .block-cards{grid-template-columns:1fr} }
.designed .block-facts{margin:0}
.designed .block-timeline{margin-top:0}
.designed .block-text > :first-child{margin-top:0}
.designed .block-text > :last-child{margin-bottom:0}

/* ---------- Blocks inside news and page text (App\Filament\NewsBlocks, resources/views/news-blocks) ---------- */
.prose .nb-photo img{width:100%; border-radius:var(--radius-lg)}
.prose .nb-credit{display:block; margin-top:var(--space-1); font-size:var(--text-xs); color:var(--muted-fg)}
@media (min-width:1000px){ .prose .nb-wide{margin-left:calc(-1 * var(--space-8)); margin-right:calc(-1 * var(--space-8))} }
.prose .nb-gallery .gallery-grid{margin:0}
.prose .nb-gallery .gallery-grid figure{margin:0}
.prose .nb-gallery .gallery-grid img{aspect-ratio:4/3; object-fit:cover; width:100%; height:auto}
.prose .nb-quote{margin:var(--space-7) 0; padding:var(--space-5) var(--space-6); border-left:4px solid var(--accent);
  background:var(--card); border-radius:0 var(--radius-lg) var(--radius-lg) 0}
.prose .nb-quote p{margin:0; font-size:var(--text-lg); line-height:var(--lh-body); color:var(--navy); font-weight:500}
.prose .nb-quote footer{margin-top:var(--space-3); font-size:var(--text-sm); color:var(--muted-fg)}
.prose .nb-quote cite{font-style:normal; font-weight:600; color:var(--slate)}
.prose .nb-player{aspect-ratio:16/9}
.prose .nb-player :is(iframe,video){position:absolute; inset:0; width:100%; height:100%; border:0}
.prose .nb-file{display:flex; gap:var(--space-4); align-items:center; margin:var(--space-6) 0; padding:var(--space-4) var(--space-5);
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius-lg); text-decoration:none; color:inherit}
.prose .nb-file:hover{border-color:var(--accent)}
.prose .nb-file-icon{display:grid; place-items:center; width:44px; height:44px; flex:none; border-radius:var(--radius); background:var(--accent-light); color:var(--accent)}
.prose .nb-file-text{display:flex; flex-direction:column; gap:var(--space-1)}
.prose .nb-file-title{font-weight:600; color:var(--navy)}
.prose .nb-file-meta{font-size:var(--text-sm); color:var(--muted-fg)}
.prose .block-stats{margin:var(--space-6) 0}
.prose .table-wrap{margin:var(--space-6) 0}
.prose .notice{margin:var(--space-6) 0}

/* Photos in article text keep their own shape (nobody's head is cut off), but a tall portrait photo
   never runs longer than a screen: capped and centred. Galleries and slots elsewhere have fixed shapes. */
.prose figure:not(.gallery-grid figure) > img,.prose > p > img{max-height:min(75vh,640px); width:auto; max-width:100%; margin-left:auto; margin-right:auto}
.prose .nb-photo img{width:auto; max-width:100%}
.prose .nb-photo.nb-wide img{width:100%; max-height:none}

/* The Agency's logo in the footer, on the dark background. */
.footer-logo{display:block; height:52px; width:auto; max-width:100%; margin-bottom:var(--space-4)}
@media (max-width:640px){ .footer-logo{height:44px} }

/* A main-menu item without a dropdown ("Контакты"): a link that looks like the others. */
.mtop-link,.mtop-link:hover{text-decoration:none}

/* Leadership: the career opens on click instead of filling the card. */
.career-fold > summary{display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); cursor:pointer;
  list-style:none; font-weight:600; font-size:var(--text-base); color:var(--navy); padding:var(--space-2) 0}
.career-fold > summary::-webkit-details-marker{display:none}
.career-fold > summary::after{content:'+'; font-size:var(--text-xl); font-weight:400; color:var(--accent); line-height:1}
.career-fold[open] > summary::after{content:'−'}
.career-fold > summary:hover{color:var(--accent-dark)}
.career-fold[open] > summary{margin-bottom:var(--space-2)}
/* A card whose cover is a link (infographics). */
.card-cover{display:block}

/* Карта сайта: the menu laid open — a column per group, then the pages the menu does not name. */
.sitemap{display:grid; grid-template-columns:repeat(3,1fr); align-items:start; gap:var(--space-5); margin-top:var(--space-6)}
.sitemap-col{background:var(--card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:var(--space-5)}
.sitemap-col h2{margin:0 0 var(--space-3); font-size:var(--text-base); color:var(--navy)}
.sitemap-col h2 a{color:inherit; text-decoration:none}
.sitemap-col h2 a:hover{color:var(--accent)}
.sitemap-col ul{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--space-2)}
.sitemap-col li{padding-left:var(--space-4); position:relative; font-size:var(--text-sm); line-height:var(--lh-body)}
.sitemap-col li::before{content:''; position:absolute; left:0; top:.6em; width:6px; height:6px; border-radius:50%; background:var(--border)}
.sitemap-col a{color:var(--slate); text-decoration:none}
.sitemap-col a:hover{color:var(--accent); text-decoration:underline}
.sitemap-list{list-style:none; margin:0; padding:0; columns:3; column-gap:var(--space-6)}
.sitemap-list li{break-inside:avoid; margin-bottom:var(--space-3); font-size:var(--text-sm); line-height:var(--lh-body)}
.sitemap-list a{color:var(--slate); text-decoration:none}
.sitemap-list a:hover{color:var(--accent); text-decoration:underline}
.footer-sitemap{color:inherit; text-decoration:underline; margin-left:var(--space-3)}
.footer-sitemap:hover{color:#fff}
@media (max-width:1024px){ .sitemap{grid-template-columns:repeat(2,1fr)} .sitemap-list{columns:2} }
@media (max-width:640px){ .sitemap{grid-template-columns:1fr} .sitemap-list{columns:1} }

/* A notice had space below it but none above, so one dropped after a grid or a table
   (infographics, the open data list) touched the block before it. Same rhythm on both
   sides — except where the block before already provides it. */
.notice{margin-top:var(--space-6)}
/* A second paragraph in a notice — usually the button under the text — was flush against the first. */
.notice p + p{margin-top:var(--space-4)}
.notice:first-child,.page-head + .notice,.section-head + .notice,.prose .notice{margin-top:0}
.prose .notice{margin:var(--space-6) 0}

/* Leadership in one column (the Agency's list of 06.10.2026): every leader the same
   card, photo and contacts side by side; a vacant post keeps its place in the order. */
.leader-row{padding:var(--space-6); gap:var(--space-5)}
.leader-row .leader-main{gap:var(--space-6)}
.leader-row .leader-photo{width:150px}
.leader-row .leader-info h2{font-size:var(--text-xl)}
.leader-row .leader-contacts{margin-top:var(--space-5)}
.leader-row .leader-book{margin-top:var(--space-5)}
.leadership > .leader-vacant{padding:var(--space-5) var(--space-6)}
@media (max-width:520px){ .leader-row{padding:var(--space-5)} .leader-row .leader-photo{width:120px} }

/* Links one under another (councils: about, composition, news). */
.res-list{grid-template-columns:1fr}
.designed .res-grid{margin:var(--space-4) 0}

/* Structural units in one column: the unit, the head's post and name, the phone. */
.unit-list{list-style:none; margin:var(--space-5) 0; padding:0; display:flex; flex-direction:column; gap:var(--space-3)}
.unit{background:var(--card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:var(--space-4) var(--space-5)}
.unit h3{margin:0 0 var(--space-2); font-size:var(--text-base); line-height:var(--lh-snug); color:var(--navy)}
.unit p{margin:0; font-size:var(--text-sm); line-height:var(--lh-body); color:var(--slate)}
.unit .unit-role{color:var(--muted-fg)}
.unit .unit-name{font-weight:600; color:var(--navy)}
.unit .unit-phone{margin-top:var(--space-1)}

/* Language flag and accessibility eye side by side, as on the old site (16.10.2026). */
/* Above the nav bar (z-index 60) and its mega panels (70), so the open list is never under them. */
.utility{position:relative; z-index:80}
.utility .container{justify-content:flex-end}
.lang-pick{position:relative}
.lang-btn,.utility .util-btn{display:inline-flex; align-items:center; justify-content:center; gap:var(--space-1);
  min-height:44px; min-width:44px; padding:0 var(--space-2); border:0; border-radius:var(--radius);
  background:none; color:var(--aca-ink-200); cursor:pointer}
.lang-btn:hover,.lang-btn[aria-expanded="true"]{background:rgba(255,255,255,.12); color:#fff}
.utility .util-btn .util-label{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
.flag{display:inline-block; flex:0 0 auto; width:22px; height:22px; border-radius:50%; overflow:hidden;
  box-shadow:0 0 0 1px rgba(0,0,0,.12)}
.flag svg{display:block; width:100%; height:100%}
.lang-menu{position:absolute; right:0; top:calc(100% + 6px); z-index:60; min-width:220px; padding:var(--space-3);
  background:var(--card,#fff); color:var(--fg); border:1px solid var(--border); border-radius:var(--radius-lg,12px);
  box-shadow:var(--shadow-lg)}
.lang-menu-title{margin:0 0 var(--space-2); padding:0 var(--space-2); font-size:var(--text-sm); color:var(--muted-fg)}
.lang-menu .langs{display:flex; flex-direction:column; gap:2px}
.utility .lang-menu .langs a{display:flex; align-items:center; gap:var(--space-3); min-height:44px; padding:0 var(--space-2);
  border-radius:var(--radius); color:var(--fg); font-weight:500; background:none}
.utility .lang-menu .langs a:hover{background:var(--muted); color:var(--accent-dark)}
.utility .lang-menu .langs a[aria-current="true"]{background:none; color:var(--accent-dark); font-weight:600}
.lang-check{margin-left:auto; color:var(--accent)}
@media (max-width:860px){
  /* In the drawer the languages are listed outright: no flag button, no pop-up (nav.js unhides the list). */
  .nav-fold .lang-btn{display:none}
  .nav-fold .lang-menu{display:block; position:static; min-width:0; padding:0;
    border:0; box-shadow:none; background:none}
  .nav-fold .lang-menu-title{padding:0}
  .nav-fold .lang-menu .langs{flex-direction:row; flex-wrap:wrap}
  .nav-fold .langs a{gap:var(--space-2)}
  .nav-fold .lang-check{display:none}
  .nav-fold .util-btn{gap:var(--space-2)}
  .nav-fold .util-btn .util-label{position:static; width:auto; height:auto; clip:auto}
}

/* Home tiles: short, the icon beside the title, no description (16.10.2026); services and the
   Agency's platforms in one grid, three across, every tile as tall as the tallest. */
.tile-grid{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); grid-auto-rows:1fr; gap:var(--space-4)}
.tiles-compact .tile{flex-direction:row; align-items:center; gap:var(--space-3); padding:var(--space-4) var(--space-5)}
.tiles-compact .tile-icon{flex:0 0 auto}
.tiles-compact .tile h3{font-size:var(--text-base); line-height:1.35}
@media (max-width:860px){ .tile-grid{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width:600px){ .tile-grid{grid-template-columns:1fr; grid-auto-rows:auto} }
