/* Поруч — гуманітарний довідник */
:root {
  --bg-main: #F6F4EF;
  --bg-article: #FFFFFF;
  --text-primary: #202B32;
  --text-secondary: #52616B;
  --link: #24536B;
  --link-hover: #1a3f52;
  --border: #D6DBDA;
  --accent: #C4A566;
  --notice-bg: #EEE9DD;
  --font-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1180px;
  --radius: 4px;
  --line-height: 1.62;
  --focus-ring: 2px solid #24536B;
  --focus-offset: 2px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: var(--line-height);
  color: var(--text-primary);
  background: var(--bg-main);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--link-hover); }

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--bg-article);
  color: var(--link);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

/* Demo banner */
.demo-banner {
  background: var(--notice-bg);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  text-align: center;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}

.urgency-banner {
  background: #faf3e8;
  color: var(--text-primary);
  padding: 0.65rem 1.25rem;
  text-align: center;
  font-size: 0.925rem;
  line-height: 1.45;
  border-bottom: 1px solid #dcc9a8;
}

/* Partner logos (EU / MFA) in header */
.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  min-width: 0;
}

.partner-logos-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.partner-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  line-height: 1;
}

.partner-logo-link:hover {
  opacity: 0.85;
}

.partner-logo {
  display: block;
  width: auto;
  height: auto;
}

.partner-logo-eu {
  width: 54px;
  height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

.partner-logo-mfa-icon {
  width: 26px;
  height: 36px;
}

.partner-logo-mfa-text {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #005bbb;
  text-transform: uppercase;
  line-height: 1.15;
}

@media (max-width: 479px) {
  .header-brand { gap: 0.65rem; }
  .partner-logos-header { gap: 0.5rem; padding-left: 0.5rem; }
  .partner-logo-eu { width: 45px; height: 30px; }
  .partner-logo-mfa-icon { width: 22px; height: 30px; }
  .partner-logo-mfa-text { font-size: 0.55rem; }
}

/* Header */
.site-header {
  background: var(--bg-article);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-link {
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
}

.logo-name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  display: block;
}

.logo-tagline {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 0.15rem;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.nav-desktop a,
.nav-desktop .nav-cta {
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: var(--radius);
  white-space: nowrap;
}

.nav-desktop a:hover,
.nav-desktop a[aria-current="page"] {
  background: var(--bg-main);
}

.nav-cta {
  background: var(--link);
  color: #fff !important;
  text-decoration: none;
  margin-left: 0.5rem;
}

.nav-cta:hover {
  background: var(--link-hover);
  color: #fff !important;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.menu-toggle[aria-expanded="true"] {
  background: var(--bg-main);
}

.nav-mobile {
  display: none;
  flex-direction: column;
  padding: 0 1.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-article);
}

.nav-mobile.is-open { display: flex; }

.nav-mobile a {
  padding: 0.85rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-mobile .nav-cta {
  margin-top: 0.75rem;
  text-align: center;
  justify-content: center;
  padding: 0.75rem;
  border: none;
}

@media (min-width: 900px) {
  .nav-desktop { display: flex; }
  .menu-toggle, .nav-mobile { display: none !important; }
}

/* Layout */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 480px) {
  .container { padding: 0 1.25rem; }
  body { font-size: 16px; }
}

/* Hero */
.hero {
  padding: 2.5rem 0 3rem;
}

.hero-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

.hero-overline {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.875rem, 5vw, 3.25rem);
  line-height: 1.15;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.hero-lead {
  font-size: 1.125rem;
  margin: 0 0 1.5rem;
  max-width: 38em;
}

.hero-support {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
  max-width: 38em;
}

.notice-box.notice-guarantee {
  background: #e8f4ea;
  border-left-color: #2d6a3e;
}

.notice-box.notice-travel {
  background: #eef3f7;
  border-left-color: var(--link);
}

.notice-box.notice-limitation {
  background: #f5efe6;
  border-left-color: #8a6d3b;
}

.section-lead {
  font-size: 1.05rem;
  max-width: 42em;
  margin: 0 0 1.25rem;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
}

.contact-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.contact-list li:last-child {
  border-bottom: none;
}

.contact-list strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.contact-list a {
  font-size: 1.125rem;
  word-break: break-word;
}

.notice-box {
  background: var(--notice-bg);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.975rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
}

.hero-contact {
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 28em;
  line-height: 1.45;
}

.hero-contact-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.hero-contact-email {
  font-size: 1rem;
  font-weight: 500;
  word-break: break-word;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  background: var(--link);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
}

.btn-primary:hover {
  background: var(--link-hover);
  color: #fff;
}

.btn-secondary {
  color: var(--link);
  text-decoration: underline;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.hero-image figure {
  margin: 0;
}

.hero-image img {
  border-radius: var(--radius);
  width: 100%;
}

.hero-image figcaption {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.4;
}

.hero-image .photo-credit {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Sections */
.section {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.section-alt {
  background: var(--bg-article);
}

.section h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 1.5rem;
  font-weight: 600;
}

.section h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
  font-weight: 600;
}

/* Start rows */
.start-rows {
  list-style: none;
  padding: 0;
  margin: 0;
}

.start-row {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.start-row:first-child { padding-top: 0; }

.start-row h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-family: var(--font-sans);
  font-weight: 600;
}

.start-row p {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
}

/* Steps */
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}

.step-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.step-item:first-child { padding-top: 0; }

.step-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--link);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.step-content h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-family: var(--font-sans);
  font-weight: 600;
}

.step-content p {
  margin: 0;
  color: var(--text-secondary);
}

.model-note {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 1.5rem;
}

/* Checklist */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist li {
  padding: 0.75rem 0 0.75rem 1.75rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.checklist li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--link);
}

/* FAQ preview */
.faq-preview details {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

.faq-preview summary {
  cursor: pointer;
  font-weight: 500;
  padding: 0.25rem 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  min-height: 44px;
}

.faq-preview summary::-webkit-details-marker { display: none; }

.faq-preview summary::after {
  content: "+";
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
}

.faq-preview details[open] summary::after { content: "−"; }

.faq-preview .faq-answer {
  padding: 0.5rem 0 0.75rem;
  color: var(--text-secondary);
}

/* Sources block */
.sources-inline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sources-inline li {
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

/* Next steps */
.next-steps {
  display: grid;
  gap: 1rem;
}

@media (min-width: 600px) {
  .next-steps { grid-template-columns: repeat(3, 1fr); }
}

.next-step-link {
  display: block;
  padding: 1.25rem;
  background: var(--bg-article);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  min-height: 44px;
}

.next-step-link:hover {
  border-color: var(--link);
  color: var(--link);
}

.next-step-link strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--link);
}

.next-step-link span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Article layout with TOC */
.article-layout {
  display: grid;
  gap: 2rem;
  padding: 2rem 0 3rem;
}

@media (min-width: 1024px) {
  .article-layout.has-toc {
    grid-template-columns: 220px 1fr;
    align-items: start;
  }
}

.toc-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .toc-sidebar {
    display: block;
    position: sticky;
    top: 5rem;
    font-size: 0.875rem;
  }
}

.toc-sidebar nav {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
}

.toc-sidebar h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
  font-family: var(--font-sans);
  font-weight: 600;
}

.toc-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-sidebar li { margin-bottom: 0.35rem; }

.toc-sidebar a {
  text-decoration: none;
  color: var(--text-secondary);
  display: block;
  padding: 0.2rem 0;
}

.toc-sidebar a:hover,
.toc-sidebar a.is-active {
  color: var(--link);
}

.toc-mobile {
  background: var(--bg-article);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
  .toc-mobile { display: none; }
}

.toc-mobile summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.toc-mobile nav {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.toc-mobile ul {
  list-style: none;
  padding: 0.75rem 0 0;
  margin: 0;
}

.toc-mobile li { margin-bottom: 0.35rem; }

.toc-mobile a {
  text-decoration: none;
  color: var(--link);
  display: block;
  padding: 0.35rem 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Article content */
.article {
  background: var(--bg-article);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 75ch;
}

@media (max-width: 600px) {
  .article { padding: 1.25rem; }
}

.article h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 1rem;
  font-weight: 600;
}

.article-lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0 0 2rem;
  line-height: 1.55;
}

.article h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  margin: 2.5rem 0 1rem;
  padding-top: 0.5rem;
  font-weight: 600;
  scroll-margin-top: 5rem;
}

.article h2:first-of-type { margin-top: 0; }

.article h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
  scroll-margin-top: 5rem;
}

.article p {
  margin: 0 0 1rem;
}

.article ul, .article ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.article li { margin-bottom: 0.35rem; }

.article a { word-break: break-word; }

/* Table */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
  min-width: 560px;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--bg-main);
  font-weight: 600;
}

.data-table .pending {
  color: var(--text-secondary);
  font-style: italic;
}

/* FAQ page */
.faq-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.faq-controls button {
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: var(--bg-article);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  cursor: pointer;
  color: var(--text-primary);
}

.faq-controls button:hover {
  border-color: var(--link);
  color: var(--link);
}

.faq-group {
  margin-bottom: 2.5rem;
}

.faq-group h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.faq-list details {
  border-bottom: 1px solid var(--border);
}

.faq-list summary {
  cursor: pointer;
  font-weight: 500;
  padding: 1rem 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
  align-items: center;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list summary::after {
  content: "+";
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 1.25rem;
}

.faq-list details[open] summary::after { content: "−"; }

.faq-list .faq-answer {
  padding: 0 0 1.25rem;
  color: var(--text-secondary);
}

.faq-list .faq-answer p:last-child { margin-bottom: 0; }

/* Situation blocks */
.situation-block {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.situation-block h3 {
  margin-top: 0;
}

.situation-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.situation-item {
  padding: 0.75rem 0;
}

.situation-item strong {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

/* Footer */
.site-footer {
  background: var(--text-primary);
  color: #c8d0d5;
  padding: 2.5rem 0 2rem;
  margin-top: 2rem;
}

.footer-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-brand .logo-name {
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1.25rem;
}

.footer-brand p {
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  line-height: 1.5;
}

.footer-nav h3 {
  color: #fff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.footer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li { margin-bottom: 0.4rem; }

.footer-nav a {
  color: #c8d0d5;
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover { color: #fff; text-decoration: underline; }

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.footer-partnership {
  flex: 1 1 100%;
  color: #c8d0d5;
  font-size: 0.75rem;
}

.footer-bottom a { color: #c8d0d5; }

.quick-exit {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #c8d0d5;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.quick-exit:hover {
  border-color: #fff;
  color: #fff;
}

.quick-exit-note {
  font-size: 0.75rem;
  color: #8a959c;
  margin-top: 0.5rem;
  max-width: 28em;
}

/* 404 */
.error-page {
  text-align: center;
  padding: 4rem 0;
}

.error-page h1 {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  margin: 0 0 1rem;
}

/* Photo in article */
.article-figure {
  margin: 2rem 0;
}

.article-figure img {
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
}

.article-figure figcaption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.photo-attribution-page dl {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0;
}

.photo-attribution-page dt {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.photo-attribution-page dd {
  margin: 0 0 1rem;
}

/* Config placeholder */
.placeholder-field {
  background: var(--notice-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  font-style: italic;
  font-size: 0.95em;
}

/* Print */
@media print {
  .demo-banner, .site-header, .toc-sidebar, .toc-mobile,
  .faq-controls, .menu-toggle, .nav-mobile, .quick-exit, .skip-link {
    display: none !important;
  }
  body { background: #fff; font-size: 12pt; }
  .article { border: none; padding: 0; max-width: none; }
  .site-footer { background: none; color: #000; }
  .footer-nav a, .footer-bottom a { color: #000; }
  details { open: open; }
  details .faq-answer { display: block !important; }
  .faq-list details { break-inside: avoid; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
  a[href^="/"]::after, a[href^="#"]::after { content: ""; }
}
