/* Ipak — портал. Язык вёрстки — как у презентации «Процесс»: тёплая бумага, чернила, синий,
   сверхкрупный знак, черта 2px над разделом, текст в две колонки, подпись у каждой картинки.
   Шрифты — свои: интерфейс Ipak Davlat, знак IPAK — Ipak Bannai. */
@font-face { font-family: "Ipak Davlat"; font-weight: 400; src: url("fonts/IpakDavlat-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Ipak Davlat"; font-weight: 700; src: url("fonts/IpakDavlat-Bold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Ipak Bannai"; src: url("fonts/IpakBannai-Regular.woff2") format("woff2"); font-display: block; }

:root {
  --paper: #F3EFE6; --ink: #1A1814; --muted: #5E5850; --rule: #B9AE9E; --blue: #1F3F8F; --sand: #E7DCCB; --field: #FBF8F2;
  --ui: "Ipak Davlat", "Helvetica Neue", Arial, sans-serif;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #121419; --ink: #EEE8DC; --muted: #A9A296; --rule: #3B3F47; --blue: #8EA8F2; --sand: #23262E; --field: #191C22; color-scheme: dark } }
:root[data-theme="dark"] {
  --paper: #121419; --ink: #EEE8DC; --muted: #A9A296; --rule: #3B3F47; --blue: #8EA8F2; --sand: #23262E; --field: #191C22; color-scheme: dark }

* { box-sizing: border-box }
[hidden] { display: none !important }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--ui); font-size: 18px; line-height: 1.5 }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px }
a:hover { text-decoration-thickness: 2px }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px }
img { max-width: 100%; display: block }
p { margin: 0; max-width: 62ch }

.wrap { max-width: 1240px; margin: 0 auto; padding-left: var(--gutter); padding-right: max(20px, env(safe-area-inset-right, 0px)) }

/* шапка */
header.top .wrap { display: flex; flex-wrap: wrap; gap: 10px 32px; align-items: center; padding-block: 18px; border-bottom: 2px solid var(--ink) }
.mark { font-family: "Ipak Bannai", var(--ui); font-weight: 400; font-synthesis: none; font-size: 34px; line-height: 1; color: var(--blue); text-decoration: none; letter-spacing: .02em }
nav.main { display: flex; flex-wrap: wrap; gap: 4px 26px; font-size: 16px; font-weight: 700; margin-right: auto }
nav.main a { text-decoration: none } nav.main a[aria-current="page"] { color: var(--blue); text-decoration: underline; text-decoration-thickness: 2px }
.langs { display: inline-flex; flex-wrap: wrap; gap: 2px; font-size: 15px }
.langs a { padding: 10px 6px; min-height: 24px }
.langs button { font: inherit; font-weight: 700; padding: 6px 10px; min-height: 40px; border: 0; background: transparent; color: var(--muted); cursor: pointer }
.langs button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px }

/* языки: прячутся только переключаемые тексты, образцы шрифтов — никогда */
html[data-lang="uz"] .i18n[lang="ru"], html[data-lang="ru"] .i18n[lang="uz"] { display: none !important }

main { padding-bottom: 96px }
.label { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted) }
.section { display: flex; flex-direction: column; gap: 22px; border-top: 2px solid var(--ink); padding-top: 18px; margin-top: 56px }
.section > .head h2 { font-size: clamp(30px, 4.2vw, 52px); line-height: 1; font-weight: 700; letter-spacing: -.025em; max-width: 24ch }
.section > .head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px }
h1, h2, h3 { margin: 0; text-wrap: balance }
h2 { font-size: clamp(30px, 4.2vw, 52px); line-height: 1.02; font-weight: 700; letter-spacing: -.02em }
h3 { font-size: 22px; line-height: 1.2 }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 40px }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 40px }
.cols > *, .cols3 > * { min-width: 0 }
.cols3 b { display: block; font-size: 18px; margin-bottom: 4px }
.muted { color: var(--muted) }
@media (max-width: 760px) { .cols, .cols3 { grid-template-columns: minmax(0, 1fr) } }

/* обложка главной */
.cover { display: flex; flex-direction: column; gap: 28px; padding-top: 48px }
.bricks { display: grid; grid-template-columns: repeat(26, minmax(0, 1fr)); gap: 3px; background: var(--sand); padding: 4px }
.bricks i { aspect-ratio: 2 / 1; background: var(--paper) } .bricks i.b { background: var(--blue) } .bricks i.t { background: #C9845F }
.giant { font-family: "Ipak Bannai", var(--ui); font-weight: 400; font-synthesis: none; font-size: clamp(110px, 24vw, 300px); line-height: .82; color: var(--blue); letter-spacing: .01em }
.claim { font-size: clamp(26px, 3.6vw, 44px); line-height: 1.12; font-weight: 700; max-width: 22ch; letter-spacing: -.01em }

/* полосы шрифтов */
.bands { display: flex; flex-direction: column; margin-top: 18px }
.band { display: block; text-decoration: none; color: var(--fg); background: var(--bg) }
.band .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: end; padding-block: 34px 22px }
.band .sample { grid-column: 1 / -1; font-size: clamp(54px, 10.5vw, 150px); line-height: 1; overflow-wrap: anywhere }
.band .meta { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; font-size: 16px }
.band .meta b { font-size: 20px }
.band .go { font-size: 28px; font-weight: 700 }
@media (prefers-reduced-motion: no-preference) { .band .go { transition: transform .15s } .band:hover .go { transform: translateX(4px) } }

/* страница шрифта */
.fonthero { color: var(--fg); background: var(--bg) }
.fonthero .wrap { display: flex; flex-direction: column; gap: 18px; padding-block: 44px 34px }
.fonthero .name { font-size: clamp(64px, 13vw, 190px); line-height: .95; overflow-wrap: anywhere }
.fonthero .kind { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .85 }
.fonthero p { font-size: 20px; max-width: 54ch }

.controls { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; font-size: 15px }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap }
.seg button { font: inherit; font-size: 15px; font-weight: 700; padding: 8px 12px; min-height: 42px; border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper) }
.ctl { display: inline-flex; gap: 10px; align-items: center; font-weight: 700 }
.ctl input[type=range] { width: 160px; accent-color: var(--blue) }
.tester { min-height: 1.4em; line-height: 1.12; overflow-wrap: break-word; outline: none; border-bottom: 2px solid var(--rule); padding-bottom: 12px }
.tester:focus { border-bottom-color: var(--blue) }
@media (max-width: 600px) { .tester { font-size: 44px !important } }

.wf { display: flex; flex-direction: column; gap: 10px }
.wf div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; align-items: baseline }
.wf span:first-child { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums }
.wf span:last-child { white-space: nowrap; overflow: hidden; text-overflow: clip }

.scenes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 24px; counter-reset: fig }
.scenes figure:first-child { grid-column: 1 / -1 }
.scenes figcaption::before { counter-increment: fig; content: counter(fig) ". "; font-weight: 700; color: var(--ink) }
@media (max-width: 760px) { .scenes { grid-template-columns: minmax(0, 1fr) } }
figure { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0 }
figure img { width: 100%; height: auto }
figcaption { font-size: 14px; color: var(--muted) }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule) }
.grid span { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 32px }
.grid span.uz { color: var(--blue) }
.gset { display: flex; flex-direction: column; gap: 8px }

.dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 40px; align-items: start }
.dl table { border-collapse: collapse; width: 100%; font-size: 16px }
.dl td { border-bottom: 1px solid var(--rule); padding: 8px 12px 8px 0; vertical-align: top }
.dl td:first-child { color: var(--muted); width: 38% }
@media (max-width: 760px) { .dl { grid-template-columns: minmax(0, 1fr) } }
.btn { display: inline-flex; align-items: center; gap: 10px; font: inherit; font-size: 20px; font-weight: 700; padding: 16px 22px; min-height: 52px; background: var(--blue); color: #FFF; text-decoration: none; width: max-content; max-width: 100% }
.btn:hover { filter: brightness(1.12) }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: #121419 } }
:root[data-theme="dark"] .btn { color: #121419 }

/* гид */
.signs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px }
.sign { border-top: 2px solid var(--ink); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0 }
.sign .glyph { font-size: clamp(120px, 18vw, 220px); line-height: .9; color: var(--blue) }
.sign .code { font-size: 15px; color: var(--muted) }
.sign .ex { font-size: 26px }
.copy { font: inherit; font-size: 16px; font-weight: 700; padding: 10px 14px; min-height: 44px; border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; width: max-content }
@media (max-width: 600px) { .signs { grid-template-columns: minmax(0, 1fr) } }

footer .wrap { border-top: 2px solid var(--ink); padding-block: 18px 40px; display: flex; flex-wrap: wrap; gap: 8px 32px; font-size: 14px; color: var(--muted) }

/* дети колонок-флексов не шире экрана: широкая таблица прокручивается внутри своего блока */
.section > *, .cover > * { min-width: 0; max-width: 100% }
.switch { max-width: 100% }

/* разметка по протоколу: язык — ссылкой на ту же страницу на другом языке */
.lang { font-size: 14px; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; padding: 8px 4px }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
h2.label, h3.label { margin: 0; font-size: 13px; line-height: 1.4 }
.giant.small { font-size: clamp(90px, 18vw, 220px) }
.ruled { border-top: 2px solid var(--ink); padding-top: 16px }
.lede, .big { font-size: clamp(26px, 3.4vw, 42px); line-height: 1.08; font-weight: 700; letter-spacing: -.01em; max-width: 20ch }
.cols3 h3 { font-size: 18px; margin-bottom: 4px }
.switch { overflow-x: auto }
.switch table { border-collapse: collapse; width: 100%; font-weight: 700; font-size: clamp(18px, 2.6vw, 34px) }
.switch th { text-align: left; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0 16px 10px 0 }
.switch td { padding: 10px 16px 10px 0; border-top: 1px solid var(--rule); white-space: nowrap }

/* гид: таблицы, пункты правил, источники */
.tablebox { overflow-x: auto }
table.data { border-collapse: collapse; width: 100%; font-size: 17px }
table.data th { text-align: left; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0 16px 10px 0; vertical-align: bottom }
table.data td { border-top: 1px solid var(--rule); padding: 10px 16px 10px 0; vertical-align: top }
table.data td.bad { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px }
table.data td.good { font-weight: 700 }
.rule { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px; border-top: 1px solid var(--rule); padding-top: 16px }
.rule .num { font-size: 34px; font-weight: 700; line-height: 1; color: var(--blue); font-variant-numeric: tabular-nums }
.rule h3 { margin: 0 0 8px; font-size: 18px }
.rule blockquote { margin: 0; font-size: 19px; line-height: 1.45; max-width: 70ch }
.rule .trans { margin: 10px 0 0; color: var(--muted); max-width: 70ch }
.tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--rule); padding: 2px 6px; margin-right: 6px; color: var(--muted) }
.src { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere }
@media (max-width: 600px) { .rule { grid-template-columns: minmax(0, 1fr); gap: 6px } table.data { font-size: 15px } }

/* помощник */
.ask-open { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 20; font: inherit; font-weight: 700; font-size: 16px; padding: 14px 18px; min-height: 48px; background: var(--ink); color: var(--paper); border: 0; cursor: pointer }
.ask { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 21; width: min(420px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 32px)); display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink) }
.ask[hidden], .ask-open[hidden], .ask [hidden] { display: none }
.ask-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 8px }
.ask-x { font: inherit; font-size: 26px; line-height: 1; min-width: 44px; min-height: 44px; background: transparent; color: var(--ink); border: 0; cursor: pointer }
.ask-note { margin: 0; font-size: 13px; color: var(--muted) }
.ask-log { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 80px; flex: 1 1 auto }
.ask-msg p { margin: 0; white-space: pre-line; font-size: 16px; line-height: 1.4 }
.ask-msg.user { align-self: flex-end; max-width: 85%; background: var(--ink); color: var(--paper); padding: 8px 12px }
.ask-msg.assistant { max-width: 95% }
.ask-msg.wait p { color: var(--muted) }
.ask-links { margin: 6px 0 0; padding-left: 18px; font-size: 15px }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px }
.ask-chips button, .ask-write { font: inherit; font-size: 14px; padding: 8px 10px; min-height: 40px; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; text-align: left }
.ask-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px }
.ask textarea, .ask input { font: inherit; font-size: 16px; padding: 8px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); width: 100%; box-sizing: border-box; resize: vertical }
.ask-form button, .ask-contact button { font: inherit; font-weight: 700; padding: 10px 14px; min-height: 44px; background: var(--blue); color: #FFF; border: 0; cursor: pointer }
.ask-contact { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--rule); padding-top: 10px; overflow-y: auto }
.ask-contact label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700 }
.ask-status { margin: 0; font-size: 15px }

/* раздел «Процесс»: статья */
.prose { max-width: 72ch; display: flex; flex-direction: column; gap: 0; font-size: 19px; line-height: 1.55; padding-block: 8px 40px }
.prose h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.1; margin: 48px 0 12px; letter-spacing: -.01em }
.prose h3 { font-size: 22px; margin: 32px 0 8px }
.prose p, .prose ul, .prose ol { margin: 0 0 16px }
.prose figure { margin: 16px 0 28px; max-width: min(100%, 1000px) }
.prose figure img { border: 1px solid var(--rule) }
.prose .credit { display: block; font-size: 12px; margin-top: 2px }
.prose .note { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 12px 0 4px; margin: 8px 0 24px; font-size: 17px }
.prose .tablebox { margin: 8px 0 24px }
.prose code { font-size: .9em; background: color-mix(in srgb, var(--rule) 30%, transparent); padding: 0 4px }
.lead-img { width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; object-position: center; border: 1px solid var(--rule) }
.next { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; border-top: 2px solid var(--ink); padding-block: 18px 48px; font-weight: 700 }

/* главная: IPAK как предмет — кирпичная надпись в песочной раме, с подписью, как на обложке презентации */
.cover-obj { margin: 0; background: var(--sand); padding: clamp(14px, 2.4vw, 28px); border: 2px solid var(--ink) }
.cover-obj .giant { display: block; text-align: center }
.cover-obj figcaption { margin-top: 12px; color: var(--ink); font-size: 14px }

/* гид: ответ в словах */
.inword { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px }
.inword > div { border-top: 2px solid var(--ink); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0 }
.inword .words { font-size: clamp(40px, 6vw, 76px); font-weight: 700; line-height: 1.05; letter-spacing: -.01em }
.inword .words mark { background: none; color: var(--blue) }
.inword .rulebig { font-size: 21px; font-weight: 700; line-height: 1.3; margin: 0 }
.inword .wrong { margin: 0; color: var(--muted) } .inword .wrong s { text-decoration-thickness: 2px }
@media (max-width: 600px) { .inword { grid-template-columns: minmax(0, 1fr) } }
details.more { border-top: 1px solid var(--rule); padding-top: 12px }
details.more > summary { cursor: pointer; font-weight: 700; font-size: 18px; min-height: 44px; display: flex; align-items: center }
details.more[open] > summary { margin-bottom: 12px }
/* образцы шрифтов с одним начертанием никогда не жирнят синтетически: в Bannai пропадали швы кладки */
.band .sample, .fonthero [style*="font-family"], .grid, .tester { font-synthesis: none }
/* статья на телефоне: широкие таблицы и длинные адреса не раздвигают страницу */
.prose > * { min-width: 0; max-width: 100% }
.prose { overflow-wrap: anywhere }
.prose table.data td, .prose table.data th { overflow-wrap: normal; min-width: 6em }
