/* Design tokens. Palette inherited from the old site: green, yellow, cream. */
:root {
  --c-green: #61aa3d;
  --c-green-dark: #4a8a2c;
  --c-green-deep: #2f5e1c;
  --c-green-tint: #eef6e8;
  --c-yellow: #f5d058;
  --c-yellow-dark: #e9b92b;
  --c-cream: #fdf6dc;
  --c-text: #1d1d1b;
  --c-text-muted: #5f6460;
  --c-line: #e3e6e1;
  --c-bg: #ffffff;
  --c-bg-soft: #f6f8f4;
  --page-width: 1440px;
  --gutter: clamp(16px, 2vw, 32px);
  --sidebar-width: clamp(300px, 22vw, 360px);
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --fs-base: clamp(17px, 0.85rem + 0.4vw, 21px);
  --fs-h1: clamp(1.7rem, 1.3rem + 1.2vw, 2.6rem);
  --fs-h2: clamp(1.35rem, 1.15rem + 0.6vw, 1.8rem);
  --fs-h3: 1.25rem;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(47, 94, 28, 0.08);
}

@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/roboto-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/roboto-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/roboto-cyrillic-400-italic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Roboto'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/roboto-latin-400-italic.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/roboto-cyrillic-500-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/roboto-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/roboto-cyrillic-700-normal.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/roboto-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: italic; font-weight: 700; font-display: swap; src: url(/fonts/roboto-cyrillic-700-italic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Roboto'; font-style: italic; font-weight: 700; font-display: swap; src: url(/fonts/roboto-latin-700-italic.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: var(--fs-base)/1.7 var(--font); color: var(--c-text); background: var(--c-bg); }
img { max-width: 100%; height: auto; }
a { color: var(--c-green-dark); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--c-yellow); outline-offset: 2px; }
h1 { font-size: var(--fs-h1); line-height: 1.25; margin: 0 0 1rem; color: var(--c-green-deep); }
h2 { font-size: var(--fs-h2); line-height: 1.3; margin: 1.75em 0 0.6em; color: var(--c-green-deep); }
h3 { font-size: var(--fs-h3); margin: 1.5em 0 0.5em; }
p, li { text-align: left; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--c-yellow); padding: 0.5rem 1rem; z-index: 200; }
.skip-link:focus { left: 1rem; top: 1rem; }
.wrap { max-width: var(--page-width); margin: 0 auto; padding: 0 var(--gutter); }

/* Buttons */
.btn { display: inline-block; padding: 0.8rem 1.4rem; font-size: 1.05rem; border-radius: var(--radius); font-weight: 500; line-height: 1.25; text-align: center; text-decoration: none; border: 2px solid transparent; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.btn-primary { background: var(--c-yellow); border-color: var(--c-yellow); color: var(--c-text); }
.btn-primary:hover { background: var(--c-yellow-dark); border-color: var(--c-yellow-dark); }
.btn-outline { background: transparent; border-color: var(--c-green); color: var(--c-green-deep); }
.btn-outline:hover { background: var(--c-green-tint); }
.btn-block { display: block; width: 100%; }

/* Top bar */
.topbar { background: var(--c-cream); font-size: 0.9rem; color: var(--c-text-muted); }
.topbar-inner { display: flex; justify-content: flex-end; gap: 1rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
.topbar-contacts { display: flex; gap: 1.25rem; white-space: nowrap; }
.topbar a { color: var(--c-green-deep); text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

/* Header */
.header { background: var(--c-bg); border-bottom: 1px solid var(--c-line); }
.header-inner { display: flex; align-items: center; gap: 2rem; padding-top: 1.75rem; padding-bottom: 1.75rem; }
.brand { display: flex; align-items: center; gap: 1.25rem; text-decoration: none; color: inherit; min-width: 0; margin-right: auto; }
.logo-mark { flex: none; width: 76px; height: 76px; }
.brand-text { display: flex; flex-direction: column; gap: 0.2rem; line-height: 1.25; }
.brand-title { font-weight: 700; font-size: 1.4rem; color: var(--c-green-deep); }
.brand-sub { font-size: 1rem; color: var(--c-text-muted); }
.header-cta { flex: none; }
.nav-toggle { display: none; }

/* Navigation */
.nav { background: var(--c-green); }
.nav-list { list-style: none; margin: 0 auto; display: flex; flex-wrap: wrap; }
.nav-item a { display: flex; flex-direction: column; justify-content: center; min-height: 3.6rem; padding: 0.45rem 1.2rem; color: #fff; font-size: 1.05rem; text-decoration: none; line-height: 1.2; border-bottom: 3px solid transparent; }
.nav-item a:hover { background: var(--c-green-dark); }
.nav-item.is-active a { background: var(--c-green-dark); border-bottom-color: var(--c-yellow); }
.nav-title { font-weight: 500; }
.nav-subtitle { font-size: 0.8rem; opacity: 0.85; }

/* Layout */
.columns { display: grid; grid-template-columns: minmax(0, 1fr) var(--sidebar-width); gap: clamp(2.5rem, 4vw, 5rem); padding-top: 2.5rem; padding-bottom: 3rem; }
.content { min-width: 0; max-width: 70ch; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.info-box { background: var(--c-bg-soft); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 1rem 0; }
.info-heading { margin: 0 1.25rem 0.5rem; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text-muted); }
.info-menu { list-style: none; margin: 0; padding: 0; }
.info-menu a { display: block; padding: 0.5rem 1.25rem; color: var(--c-text); text-decoration: none; border-left: 3px solid transparent; font-size: 1rem; line-height: 1.45; }
.info-menu a:hover { background: var(--c-green-tint); }
.info-menu .is-active a { border-left-color: var(--c-green); background: var(--c-green-tint); font-weight: 500; }

/* Content */
.content p a, .content li a { color: var(--c-green-dark); text-decoration: underline; text-underline-offset: 2px; }
.content p a:hover, .content li a:hover { color: var(--c-green-deep); }
.content ul, .content ol { padding-left: 1.4rem; }
.content li { margin: 0.4rem 0; }
.content .download { text-align: left; margin: 1.5rem 0; }
.content .download a { display: inline-block; background: var(--c-yellow); color: var(--c-text); padding: 0.65rem 1.1rem; border-radius: var(--radius); text-decoration: none; font-weight: 500; }
.content .download a:hover { background: var(--c-yellow-dark); }
.content .text-center { text-align: center; }
.content .lead { font-size: 1.1em; color: var(--c-text-muted); }
.content .contact-list { list-style: none; padding: 0; }
.content .contact-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--c-line); }
.content .contact-list li:last-child { border-bottom: 0; }
.content .muted { color: var(--c-text-muted); font-size: 0.95rem; }
.content table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.content td, .content th { border: 1px solid var(--c-line); padding: 0.45rem 0.6rem; vertical-align: top; }
.content th { background: var(--c-bg-soft); text-align: left; }
.content img { border-radius: var(--radius); }

/* Gallery: any thumbnail image in content becomes a tile; wrapper-independent so the admin
   editor can re-save the page without breaking the layout. */
.content img[src*="_thumb."] { display: inline-block; width: 150px; height: auto; margin: 0 12px 12px 0; padding: 4px; border: 1px solid var(--c-line); border-radius: var(--radius); background: #fff; cursor: zoom-in; vertical-align: top; transition: box-shadow 0.15s, border-color 0.15s; }
.content img[src*="_thumb."]:hover { border-color: var(--c-green); box-shadow: var(--shadow); }
@media (max-width: 720px) { .content img[src*="_thumb."] { width: calc(50% - 12px); } }

/* Footer */
.footer { background: var(--c-green-deep); color: #e8f0e2; margin-top: 1rem; font-size: 0.95rem; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; padding-top: 2.25rem; padding-bottom: 1.5rem; }
.footer p { margin: 0 0 0.4rem; }
.footer a { color: #fff; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-name { font-weight: 500; color: #fff; }
.footer .reg-authority { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; }
.footer-label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: #b9d3aa; margin-bottom: 0.6rem; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.15); padding-top: 1rem; padding-bottom: 1.25rem; font-size: 0.8rem; color: #b9d3aa; }

/* Off-canvas */
.lightbox[hidden], .offcanvas[hidden], .offcanvas-backdrop[hidden] { display: none; }
.offcanvas { position: fixed; top: 0; right: 0; bottom: 0; width: min(85vw, 320px); z-index: 50; background: #fff; padding: 4.5rem 0 1rem; overflow-y: auto; box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18); }
.offcanvas ul { list-style: none; margin: 0; padding: 0; }
.offcanvas a { display: block; padding: 0.85rem 1.25rem; font-size: 1.05rem; color: var(--c-text); text-decoration: none; border-bottom: 1px solid var(--c-line); }
.offcanvas-label { margin: 1.25rem 1.25rem 0.25rem; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text-muted); }
.offcanvas-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 40; }
body.menu-open { overflow: hidden; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.88); display: flex; align-items: center; justify-content: center; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 92vh; text-align: center; color: #fff; }
.lightbox img { max-width: 92vw; max-height: 84vh; width: auto; height: auto; border-radius: 4px; }
.lightbox figcaption { padding: 0.6rem; font-size: 0.9rem; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 2.5rem; line-height: 1; cursor: pointer; padding: 0.5rem 1rem; }
.lb-close { top: 0.5rem; right: 0.5rem; }
.lb-prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0.5rem; top: 50%; transform: translateY(-50%); }
body.lb-open { overflow: hidden; }

/* Tablet */
@media (max-width: 1000px) {
  .columns { grid-template-columns: 1fr; gap: 2rem; }
  .content { max-width: none; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 1.25rem; }
  .info-box { grid-column: 1 / -1; }
  .info-menu { display: grid; grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
}

/* Mobile */
@media (max-width: 720px) {
  .topbar-inner { justify-content: center; }
  .header-inner { gap: 0.75rem; padding-top: 1rem; padding-bottom: 1rem; }
  .brand { gap: 0.75rem; }
  .logo-mark { width: 52px; height: 52px; }
  .brand-title { font-size: 0.95rem; }
  .brand-sub { font-size: 0.72rem; }
  .header-cta { display: none; }
  .nav { display: none; }
  .nav-toggle { display: flex; flex-direction: column; justify-content: center; gap: 6px; width: 3rem; height: 3rem; padding: 0.6rem; background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); cursor: pointer; z-index: 60; flex: none; }
  .nav-toggle span { display: block; height: 2px; background: var(--c-text); border-radius: 2px; }
  .columns { padding-top: 1.25rem; }
  .sidebar { grid-template-columns: 1fr; }
  .info-menu { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .footer-inner { grid-template-columns: 1fr; gap: 1.25rem; }
  .content .download { text-align: left; }
}

/* Registry */
.content:has(.registry) { max-width: none; }
.cert-check { background: var(--c-cream); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 1.5rem 0; }
.cert-check h2, .registry-search h2 { margin-top: 0; }
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.form-inline label { font-weight: 500; }
input[type="text"], input[type="search"], select { font: inherit; padding: 0.6rem 0.8rem; border: 1px solid #cfd5cb; border-radius: var(--radius); background: #fff; min-width: 0; }
input:focus, select:focus { outline: 3px solid var(--c-yellow); outline-offset: 1px; border-color: var(--c-green); }
.check-result { margin: 1rem 0 0; padding: 0.9rem 1.1rem; border-radius: var(--radius); border-left: 5px solid; }
.check-result.ok { background: var(--c-green-tint); border-color: var(--c-green); }
.check-result.bad { background: #fdecea; border-color: #d9534f; }
.check-result.warn { background: var(--c-cream); border-color: var(--c-yellow-dark); }
.registry-search { margin: 1.5rem 0; }
.form-grid { display: grid; grid-template-columns: 2fr 1.5fr 2fr auto; gap: 1rem; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.95rem; color: var(--c-text-muted); }
.form-actions { display: flex; gap: 0.5rem; }
.results-count { color: var(--c-text-muted); }
.table-wrap { overflow-x: auto; }
.registry-table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.registry-table th { text-align: left; background: var(--c-bg-soft); border-bottom: 2px solid var(--c-line); padding: 0.6rem 0.75rem; position: sticky; top: 0; }
.registry-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--c-line); vertical-align: top; }
.registry-table .cert { white-space: nowrap; }
.registry-table .cert a { color: var(--c-green-deep); text-decoration: none; font-weight: 500; }
.registry-table .cert a:hover { text-decoration: underline; }
.registry-table .name { min-width: 14rem; }
.registry-table .name small { color: var(--c-text-muted); }
.registry-table .level { white-space: nowrap; }
.registry-table tr[hidden] { display: none; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .registry-table thead { display: none; }
  .registry-table tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--c-line); }
  .registry-table td { display: block; border: 0; padding: 0.15rem 0; }
  .registry-table .dirs { color: var(--c-text-muted); font-size: 0.9rem; }
}

/* Cookie banner */
.cookie-banner[hidden] { display: none; }
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 90; max-width: 720px; margin: 0 auto; background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18); padding: 1rem 1.25rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.cookie-banner p { margin: 0; flex: 1 1 320px; font-size: 0.95rem; }
.cookie-actions { display: flex; gap: 0.5rem; }
.cookie-actions .btn { padding: 0.55rem 1rem; font-size: 0.95rem; }
