/* Styles for what sits below the first screen. Loaded without blocking the first paint (src/layouts/Base.astro),
   so the inline CSS of every page keeps the head and hero within the first ~13 KB (scripts/check-dist.mjs).
   Uses the custom properties of src/styles/global.css. Change the ?v= in Base.astro when this file changes. */

/* Numbers band */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts__item { background: var(--paper); padding: 22px 24px; }
.facts__value { display: block; color: var(--ink); font-size: clamp(1.6rem, 1.3rem + 1vw, 2.15rem); font-weight: 680; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.facts__label { display: block; margin-top: 6px; color: var(--muted); font-size: 0.94rem; line-height: 1.35; }

/* Cards */
.card { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 2.5vw, 28px); }
.card h3 { margin-bottom: 8px; }
.section--sand .card { border-color: var(--line); }
.card--link { position: relative; color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.card--link:hover { border-color: var(--ink); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.card__icon { width: 52px; height: 52px; margin-bottom: 18px; padding: 11px; border-radius: 12px; background: var(--blue-soft); color: var(--blue-ink); }
.card__more { margin-top: auto; padding-top: 16px; color: var(--blue-ink); font-weight: 600; font-size: 0.95rem; }
.card--link:hover .card__more { color: var(--blue-ink); }
.card p { color: var(--text); }
.card--accent { background: var(--blue-soft); border-color: var(--blue-tint2); }
.card--night { background: var(--night); border-color: var(--night); color: var(--on-night); }
.card--night h3 { color: #fff; }
.card--night p { color: var(--on-night-muted); }
.card--night .btn { margin-top: auto; align-self: flex-start; }
.btn--light { background: #fff; color: var(--ink); border-color: #fff; }
.btn--light:hover { background: var(--blue-soft); border-color: var(--blue-soft); color: var(--ink); }
.check-list { display: grid; gap: 9px; list-style: none; }
.check-list li { position: relative; padding-left: 24px; line-height: 1.45; }
.check-list li::before { content: ''; position: absolute; left: 2px; top: 0.42em; width: 11px; height: 6px; border-left: 2px solid var(--blue-ink); border-bottom: 2px solid var(--blue-ink); transform: rotate(-45deg); }
.phone-list { display: grid; gap: 10px; list-style: none; line-height: 1.35; }
.cross-list li::before { width: 11px; height: 2px; top: 0.62em; border: 0; background: var(--muted); transform: none; }
.section-head--row { max-width: none; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.section-head--row a { font-weight: 600; }
.section--night .section-head h2::after { background: var(--blue-ondark); }
.section--night .section-head p { color: var(--on-night-muted); }

/* Pillars, clients as plates, team (home) */
.pillar h3 { font-size: 1.25rem; }
.pillar__n { display: block; margin-bottom: 14px; color: var(--blue-ink); font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 32px; }
.pillars .pillar { padding-top: 18px; border-top: 2px solid var(--ink); }
.pillars .pillar h3 { margin-bottom: 8px; }
.plates { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); }
.plates__title { color: var(--muted); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.04em; }
.plates ul { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; }
.plates li { padding: 8px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-weight: 600; font-size: 0.95rem; }
.team { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(28px, 4vw, 48px); align-items: center; }
.team__text h2::after { content: ''; display: block; width: 56px; height: 3px; margin-top: 14px; background: var(--blue); }
.team__text p { margin-top: 14px; color: var(--muted); font-size: 1.06rem; }
.team__more { font-weight: 600; }
.team__photos { margin: 0; }
.team__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px; aspect-ratio: 16 / 9; }
.team__grid img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.team__grid .team__big { grid-column: span 2; grid-row: span 2; }
.team__photos figcaption { margin-top: 10px; color: var(--muted); font-size: 0.9rem; }
@media (max-width: 860px) { .team { grid-template-columns: minmax(0, 1fr); } }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 22px; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; padding-top: 16px; border-top: 2px solid var(--ink); }
.steps li::before { content: counter(step, decimal-leading-zero); display: block; margin-bottom: 10px; color: var(--blue-ink); font-weight: 700; font-size: 0.9rem; }
.steps h3 { margin-bottom: 6px; }

/* Prices */
.price-tables { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); align-items: start; }
.price-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
.price-table caption { caption-side: top; text-align: left; font-weight: 640; color: var(--ink); padding: 0 2px 10px; }
.price-table th, .price-table td { padding: 11px 18px; text-align: left; border-bottom: 1px solid var(--line); font-weight: 400; vertical-align: baseline; }
.price-table tr:last-child th, .price-table tr:last-child td { border-bottom: 0; }
.price-table td { text-align: right; white-space: nowrap; color: var(--ink); font-weight: 620; }
.price-notes { margin-top: 18px; display: grid; gap: 6px; color: var(--muted); font-size: 0.93rem; list-style: none; }
/* Price tables on narrow phones: rows stack, nothing scrolls sideways (CRM 93845) */
@media (max-width: 480px) {
  .price-table tbody, .price-table tr { display: block; }
  .price-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .price-table tr:last-child { border-bottom: 0; }
  .price-table th, .price-table td { display: block; padding: 2px 14px; border-bottom: 0; text-align: left; white-space: normal; }
}

/* FAQ: answers stay open, so nobody has to find out that they can be clicked */
.faq { border-top: 1px solid var(--line); }
.faq__item { padding: 20px 2px; border-bottom: 1px solid var(--line); }
.faq__item h3 { margin-bottom: 8px; font-size: 1.1rem; }
.faq__item p { max-width: 72ch; }

/* Reviews */
.review { display: flex; flex-direction: column; gap: 16px; }
.review blockquote { margin: 0; color: var(--text); }
.review footer { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.review__avatar { flex: none; width: 46px; height: 46px; border-radius: 12px; object-fit: cover; background: var(--sand); border: 1px solid var(--line); }
.review__mono { display: grid; place-items: center; color: var(--blue-ink); font-weight: 700; }
.review__who { line-height: 1.3; }
.review__who strong { display: block; color: var(--ink); font-weight: 640; }
.review__who span { color: var(--muted); font-size: 0.9rem; }
.review__tag { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

/* Cases */
.case-card img { width: calc(100% + 2 * clamp(20px, 2.5vw, 28px)); max-width: none; margin: calc(-1 * clamp(20px, 2.5vw, 28px)) calc(-1 * clamp(20px, 2.5vw, 28px)) 18px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; background: var(--sand-deep); }
.badge { display: inline-block; align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--sand-deep); color: var(--text); font-size: 0.9rem; font-weight: 600; margin-bottom: 10px; }
.badge--live { background: var(--blue-soft); color: var(--blue-ink); }

/* Instruction videos and screenshots (ModulSoft:ERP) */
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 18px; }
.video { display: flex; flex-direction: column; gap: 10px; min-height: 180px; padding: 18px; border: 1px solid var(--night-2); border-radius: 12px; background: #2e3339; color: #fff; text-decoration: none; }
.video:hover { border-color: var(--blue-ondark); color: #fff; }
.video__label { color: var(--blue-ondark); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.04em; }
.video__title { font-family: var(--f-display); font-size: 1.12rem; font-weight: 700; line-height: 1.25; }
.video__foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.video__play { width: 44px; height: 44px; }
.video__dur { padding: 2px 8px; border-radius: 6px; background: var(--ink); font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.videos-more { margin-top: 24px; }
/* One screenshot per row: the forms are full of small text, so they need the whole page width; a click opens the
   picture at full size (Оля's note, 2026-11-11). */
.shots { display: grid; gap: 40px; }
.shot__link { display: block; cursor: zoom-in; }
.shot { margin: 0; }
.shot img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.shot figcaption { margin-top: 10px; font-size: 0.95rem; }
.shots-note { margin-top: 14px; color: var(--muted); font-size: 0.9rem; }

/* Lead form section at the bottom of a page */
.lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(26px, 5vw, 64px); align-items: start; }
.lead__contacts { display: grid; gap: 8px; margin-top: 22px; }
.lead__contacts a { font-weight: 600; color: inherit; }
.section--night .lead__contacts a:hover { color: var(--blue-ondark); }
.section--night .lead > div p { color: var(--on-night); }
.section--night .lead > div .muted { color: var(--on-night-muted); }
@media (max-width: 860px) { .lead { grid-template-columns: minmax(0, 1fr); } }

/* Long text */
.prose { max-width: 72ch; }
/* Text pages line up with their heading: the wrapper keeps the page width, the lines stay readable. */
.wrap.prose { max-width: calc(var(--wrap) + 2 * var(--gutter)); }
.wrap.prose > * { max-width: 72ch; }
.prose h2 { margin: 1.7em 0 0.55em; font-size: clamp(1.28rem, 1.15rem + 0.6vw, 1.6rem); }
.prose h3 { margin: 1.4em 0 0.4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 1em; display: grid; gap: 5px; }
.prose li { padding-left: 2px; }

/* Legal details */
.legal { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.legal dl { margin: 12px 0 0; display: grid; gap: 6px; font-size: 0.97rem; }
.legal dl > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; }
.legal dt { color: var(--muted); }
.legal dd { margin: 0; color: var(--ink); }
@media (max-width: 480px) { .legal dl > div { grid-template-columns: minmax(0, 1fr); gap: 0; margin-bottom: 6px; } }

.photo { border-radius: var(--radius); overflow: hidden; background: var(--sand-deep); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.photos .photo { aspect-ratio: 3 / 2; }

/* Footer */
.site-footer { background: var(--night); color: var(--on-night-muted); font-size: 0.95rem; padding-block: clamp(40px, 6vw, 64px) 28px; }
.site-footer a { color: var(--on-night); text-decoration: none; }
.site-footer a:hover { color: var(--blue-ondark); text-decoration: underline; }
.site-footer__grid { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(auto-fit, minmax(170px, 1fr)); gap: 30px; }
.site-footer h3 { color: #fff; font-size: 0.92rem; margin-bottom: 12px; }
.site-footer ul { display: grid; gap: 8px; list-style: none; }
.site-footer .logo { color: #fff; margin-bottom: 14px; }
.site-footer .logo path { fill: #fff; }
.site-footer__legal { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--night-2); display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; font-size: 0.9rem; }
.footer-ru { margin-top: 12px; color: var(--on-night); font-weight: 560; }

/* Kept pages */
/* Columns fill top to bottom, so 7 links stand 3 + 2 + 2 instead of a row of one (CRM 93856). */
.related-list { columns: 3 300px; column-gap: 28px; list-style: none; }
.related-list li { break-inside: avoid; margin-bottom: 10px; }
.related-list a { font-weight: 500; }
.related-parent { margin-top: 2em; gap: 10px; align-items: flex-start; }

/* Lead form in a window (CRM 93842) */
.lead-modal { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: var(--radius); background: var(--paper); color: var(--text); box-shadow: 0 24px 60px -12px rgb(34 34 34 / 45%); overflow: auto; }
.lead-modal::backdrop { background: rgb(34 34 34 / 55%); }
.lead-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.lead-modal__head h2 { font-size: 1.35rem; }
.lead-modal__close { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--blue-ink); cursor: pointer; }
.lead-modal__call { padding: 8px 24px 0; color: var(--muted); font-size: 0.95rem; }
.lead-modal__call a { font-weight: 700; }
.lead-modal .form { padding: 18px 24px 24px; }
html.is-locked { overflow: hidden; }
@media (max-width: 767px) { .lead-modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; } }

/* Bottom bar on phones (CRM 93845). `html .sticky-contact` outweighs `.sticky-contact { display: none }` of the inline
   global.css, which comes later in the page than this file. */
@media (max-width: 767px) {
  html .sticky-contact { position: fixed; z-index: 80; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -12px rgb(34 34 34 / 30%); transform: translateY(110%); transition: transform 0.2s; }
  html .sticky-contact.is-on { transform: none; }
  .sticky-contact .btn { min-height: 48px; padding: 6px 10px; }
  .site-footer { padding-bottom: calc(28px + 72px); }
}

/* Mobile menu: phone and the action first, short list (CRM 93845) */
.menu-toggle__panel .menu-toggle__call { color: var(--blue-ink); font-size: 1.25rem; font-weight: 700; border-bottom: 0; }
.menu-toggle__panel .btn { margin: 4px 0 8px; }
.menu-toggle__extra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 18px; }
.menu-toggle__panel .menu-toggle__extra a { display: inline-block; padding: 4px 10px; border-bottom: 0; font-size: 0.95rem; }
.menu-toggle__panel .menu-toggle__extra .lang-switch [aria-current='true'] { color: #fff; }

/* Grids without holes (CRM 93856). A wide row holds three cards; when their number doesn't divide by three, the last
   two or four take half a row each, so no row ends in an empty slot. `.grid.grid--3` outweighs the inline global.css. */
@media (min-width: 1000px) {
  .grid.grid--3 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .grid--3 > * { grid-column: span 2; }
  .grid--3:has(> :last-child:nth-child(3n+2)) > :nth-last-child(-n+2),
  .grid--3:has(> :last-child:nth-child(3n+4)) > :nth-last-child(-n+4) { grid-column: span 3; }
}
@media (min-width: 680px) and (max-width: 999px) {
  .grid.grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  .grid--2 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Steps and the history line up by their number (CRM 93856): 4 and 8 in fours, 3 and 6 in threes, 5 as 3 + 2 (five in
   a row from 1200 px), 7 as 4 + 3; narrower screens use two columns, an odd last one across. */
@media (min-width: 1000px) {
  .steps:has(> li:nth-child(3):last-child), .steps:has(> li:nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps:has(> li:nth-child(4):last-child), .steps:has(> li:nth-child(8):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .steps:has(> li:nth-child(5):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .steps:has(> li:nth-child(5):last-child) > li { grid-column: span 2; }
  .steps:has(> li:nth-child(5):last-child) > li:nth-last-child(-n+2) { grid-column: span 3; }
  .steps:has(> li:nth-child(7):last-child) { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .steps:has(> li:nth-child(7):last-child) > li { grid-column: span 3; }
  .steps:has(> li:nth-child(7):last-child) > li:nth-last-child(-n+3) { grid-column: span 4; }
}
@media (min-width: 1200px) {
  .steps:has(> li:nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .steps:has(> li:nth-child(5):last-child) > li, .steps:has(> li:nth-child(5):last-child) > li:nth-last-child(-n+2) { grid-column: auto; }
}
/* The same on tablets for the other grids (CRM 93856, Ілля's check at 680–1024 px). */
@media (min-width: 768px) {
  .pillars:has(> :nth-child(3):last-child), .photos:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
}
@media (min-width: 760px) and (max-width: 1179px) {
  .price-tables > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (min-width: 600px) and (max-width: 999px) {
  .videos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .videos:has(> :nth-child(4n):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 600px) and (max-width: 999px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .steps:has(> li:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps:has(> li:nth-child(3):last-child) > li:last-child { grid-column: auto; }
}
