:root {
    --brand-blue: #063d72;
    --brand-active: #3476b7;
    --brand-card: #3e6892;
    --text: #1d2b38;
    --border: #dbe1e8;
    --page-gutter: clamp(10px, 1.3vw, 24px);
    color: var(--text);
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand-blue); }
:focus-visible { outline: 3px solid #e79c3a; outline-offset: 3px; }
img { max-width: 100%; height: auto; }

.skip-link {
    position: absolute;
    z-index: 2;
    margin: 8px;
    padding: 8px 16px;
    background: #fff;
    transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.masthead { background: #f2f5f7; text-align: center; }
.masthead :is(p, figure) { margin: 0; }
.masthead img { display: block; width: 100%; }
.site-name {
    display: inline-block;
    padding: 20px var(--page-gutter);
    font: bold clamp(1.6rem, 5vw, 2.8rem) Georgia, serif;
    text-decoration: none;
}

.top-menu { background: var(--brand-blue); padding-inline: var(--page-gutter); }
.top-menu .mod-menu, .catalog-sidebar .mod-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}
.top-menu .mod-menu { display: flex; flex-wrap: wrap; }
.top-menu .mod-menu > li > a, .catalog-sidebar .mod-menu > li > a {
    display: block;
    color: #fff;
    text-decoration: none;
}
.top-menu .mod-menu > li > a {
    padding: 16px 18px;
    font: bold 1.02rem/1.4 Georgia, serif;
}
.top-menu .mod-menu > .current > a,
.top-menu .mod-menu > li > a:hover,
.top-menu .mod-menu > .active > a {
    background: var(--brand-active);
}

.site-body {
    display: grid;
    align-items: start;
    align-content: start;
    flex: 1;
    gap: clamp(14px, 2vw, 30px);
    padding: 14px var(--page-gutter) 32px;
}
.site-body--with-catalog { grid-template-columns: clamp(210px, 22vw, 276px) minmax(0, 1fr); }
.site-content { min-width: 0; overflow-wrap: anywhere; }
.site-content iframe { max-width: 100%; }
.catalog-category img, .site-content .com-content-article img { max-width: 100%; height: auto; }
.catalog-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.catalog-card {
    height: 100%;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.catalog-card__link {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100%;
    color: #fff;
    text-decoration: none;
}
.catalog-card__link:focus-visible { outline: 3px solid #003f7f; outline-offset: -4px; }
.catalog-card__photo { position: relative; }
.catalog-card__photo img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: contain;
}
.catalog-card__title {
    grid-row: 2;
    margin: 0;
    min-block-size: 70px;
    padding: 16px 13px;
    background: rgb(0 63 127 / 75%);
    color: #fff;
    font: bold 16px/24px Georgia, "Times New Roman", serif;
    text-transform: uppercase;
}
.catalog-card__hover {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 10px;
    background: rgb(0 63 127 / 75%);
    color: #fff;
    font: 400 16px/20px Georgia, "Times New Roman", serif;
    text-align: center;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity .4s cubic-bezier(.47, 0, .745, .715);
}
@media (hover: hover) {
    .catalog-card__link:hover .catalog-card__hover { opacity: 1; }
}
.catalog-card__link:focus-visible .catalog-card__hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .catalog-card__hover { transition: none; }
}
@media (max-width: 1199px) {
    .catalog-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
    .catalog-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 369px) {
    .catalog-cards { grid-template-columns: minmax(0, 1fr); }
}
.catalog-gallery { display: flex; flex-wrap: wrap; align-items: start; gap: 16px; }
.catalog-sidebar {
    position: sticky;
    top: 12px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #a2b7c9 transparent;
    background: #fff;
    border: 1px solid #d5dfe6;
    border-radius: 7px;
}
.catalog-sidebar .mod-menu > li + li { border-top: 1px solid #e5ebef; }
.catalog-sidebar .mod-menu > li > a {
    color: #173b5b;
    border-left: 3px solid transparent;
    padding: 11px 13px;
    font: 600 15px/1.35 Arial, sans-serif;
}
.catalog-sidebar .mod-menu > li > a:hover { background: #f0f6fa; }
.catalog-sidebar .mod-menu > :is(.active,.current) > a {
    color: #063e71;
    background: #e0eef8;
    border-left-color: #1475bc;
}
.menu-toggle {
    display: none;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: white;
    color: #123e64;
    padding: 10px 13px;
    font: 600 16px Arial, sans-serif;
    cursor: pointer;
}
.top-menu .menu-toggle { background: var(--brand-blue); color: white; }
.menu-bars {
    width: 22px;
    height: 16px;
    border-block: 2px solid currentColor;
    display: grid;
    align-items: center;
}
.menu-bars::after { content: ""; border-top: 2px solid currentColor; }
.menu-toggle[aria-expanded="true"] { box-shadow: inset 0 -2px var(--brand-active); }
.site-footer { background: #2d353d; color: white; padding: 24px clamp(16px,3vw,50px); font-size: 14px; }
.footer-links { display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; gap:20px; }
.footer-links address { display:grid; gap:3px; font-style:normal; }
.site-footer a { color:#e9f5ff; text-underline-offset:3px; }
.footer-social { display:flex; flex-wrap:wrap; gap:6px; }
.footer-social a { padding:5px 9px; border-radius:5px; color:white; text-decoration:none; font-weight:bold; }
.footer-social a:hover { text-decoration:underline; }
.footer-social .max {background:#2857bc} .footer-social .vk {background:#0869c1}
.footer-social .ok {background:#984600} .footer-social .youtube {background:#b61e25}
.footer-social .rutube {background:#253b57} .footer-social .dzen {background:#171c24}

.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project-card {
    display: block;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
    text-decoration: none;
}
.project-card:hover { border-color: var(--brand-active); }
.project-card__images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #f2f5f7; }
.project-card__images img { display: block; width: 100%; height: 110px; object-fit: contain; background: #fff; }
.project-card__images img:not(:first-child) { object-fit: cover; }
.project-card__body { display: block; padding: 14px 16px 16px; }
.project-card__title { display: block; margin: 0 0 6px; color: var(--brand-blue); font-size: 1.15rem; }
.project-dialog {
    width: min(880px, calc(100% - 20px));
    max-height: calc(100dvh - 20px);
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
}
.project-dialog::backdrop { background: #0b2636a8; }
.project-dialog__header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.project-dialog__header h2 { margin-top: 0; }
.project-dialog__logo { max-width: min(180px, 45vw); }
.project-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.project-gallery img { display: block; width: 100%; height: auto; }
.project-photo-trigger {
    display: inline-block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}
.project-photo-trigger img { display: block; max-width: 100%; height: auto; }
.project-photo {
    overflow: visible;
    padding: 0;
    border: 0;
    background: #172430;
}
.project-photo::backdrop { background: rgb(5 14 22 / 80%); }
.project-photo img {
    display: block;
    width: auto;
    max-width: 52vw;
    max-height: 84dvh;
    object-fit: contain;
    touch-action: pinch-zoom;
}
.project-close,
.project-photo :is(.project-photo__previous, .project-photo__next) {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 50%;
    background: #12334b;
    color: white;
    font-size: 24px;
    cursor: pointer;
}
.project-photo button {
    position: absolute;
    top: 8px;
    right: 8px;
}
.project-photo :is(.project-photo__previous, .project-photo__next) {
    top: 50%;
    transform: translateY(-50%);
    background: rgb(18 51 75 / 90%);
}
.project-photo .project-photo__previous { right: auto; left: 8px; }
.project-photo__count {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px;
    padding: 4px 10px;
    background: rgb(18 51 75 / 90%);
    color: white;
    font-size: 14px;
    pointer-events: none;
}

@media (max-width: 700px) {
    .js .menu-toggle { display: flex; }
    .js .menu-toggle[aria-expanded="false"] + :is(#site-navigation, #catalog-menu) { display: none; }
    .project-photo img { max-width: 94vw; }
    .site-body { display:block; }
    .catalog-sidebar { z-index:3; top:0; max-height:none; margin-bottom:12px; }
    #catalog-menu { max-height:calc(75dvh - 46px); overflow:auto; }
    .footer-links { align-items:flex-start; flex-direction:column; }
    .catalog-card__title { font-size:14px; min-block-size:54px; padding:10px; }
    .top-menu .mod-menu { flex-direction:column; }
    .site-body--with-catalog { grid-template-columns: minmax(0, 1fr); }
    .top-menu .mod-menu > li > a { padding: 12px 13px; font: 600 .9375rem/1.4 Arial, sans-serif; }
    .projects-grid { grid-template-columns: minmax(0, 1fr); }
}
