/* Base layer: typography, page frame, header, footer and the reserved area. */

/* Only on body: on html it would stop Bootstrap modals from locking the page scroll */
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: inherit;
  margin: 0 0 var(--space-2);
}
h1, .h1 { font-size: clamp(28px, 3.9vw, 56px); line-height: 1; letter-spacing: -0.035em; }
h2, .h2 { font-size: clamp(24px, 2.64vw, 38px); letter-spacing: -0.03em; }
h3, .h3 { font-size: 23px; letter-spacing: -0.02em; }
h4, .h4 { font-size: 20px; }
h5, .h5 { font-size: 16px; }
h6, .h6 { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }

p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent-700); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--color-accent-800); }
img { max-width: 100%; }
hr { border: 0; height: 1px; background: var(--color-divider); opacity: 1; margin: var(--space-6) 0; }
strong, b { font-weight: 700; }
small, .small { font-size: 13px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: rgba(21, 137, 126, 0.3); }
input::placeholder, textarea::placeholder { color: rgba(35, 31, 27, 0.45); }

.text-muted { color: var(--color-muted) !important; }
.text-danger { color: var(--color-danger) !important; }

.kicker {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-accent-700);
}
.kicker--muted { color: var(--color-muted); }
.kicker--plain { color: inherit; }

.link-arrow { font-size: 14px; font-weight: 600; color: var(--color-accent-700); white-space: nowrap; }
.link-arrow::after { content: " \2192"; }
.link-back::before { content: "\2190 "; }
.link-back { font-size: 14px; font-weight: 600; }

.h-display { font-size: clamp(34px, 4.9vw, 82px); line-height: 0.98; letter-spacing: -0.035em; margin: 0 0 var(--space-6); }
.h-page { font-size: clamp(32px, 4.44vw, 64px); line-height: 1; letter-spacing: -0.035em; margin: 0 0 var(--space-3); }
.h-title { font-size: clamp(27px, 3.75vw, 54px); line-height: 1; letter-spacing: -0.035em; margin: 0; }
.h-area { font-size: clamp(26px, 3.33vw, 48px); line-height: 1; letter-spacing: -0.035em; margin: 0; }
.h-block { font-size: 24px; letter-spacing: -0.02em; margin: 0; }
.lead { font-size: 17px; line-height: 1.5; max-width: 640px; margin: 0; font-weight: 400; }
.lead--lg { font-size: clamp(16px, 1.3vw, 19px); max-width: 620px; }
.prose { font-size: 17px; line-height: 1.6; max-width: 780px; }
.prose > :last-child { margin-bottom: 0; }

/* Page frame */
.page { max-width: var(--page-max); margin: 0 auto; }
.section { padding: var(--space-8); border-bottom: 2px solid var(--color-divider); }
.section--last { border-bottom: 0; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.section-head h2 { margin: 0; }
.section-head__rule { flex: 1; height: 2px; background: var(--color-divider); min-width: 40px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}
.page-head > div:first-child { min-width: 0; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-8);
  font-size: 13px;
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-muted);
}
.crumbs a { color: var(--color-muted); }
.crumbs a:hover { color: var(--color-accent-700); }
.crumbs li + li::before { content: "/"; margin-right: var(--space-2); }
.crumbs ol { display: contents; list-style: none; }
.crumbs li { display: inline; }
.crumbs [aria-current] { color: var(--color-text); font-weight: 600; }

/* Utility bar */
.site-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-6);
  padding: var(--space-2) var(--space-8);
  border-bottom: 1px solid var(--color-divider);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}
.site-top a { color: var(--color-muted); }
.site-top a:hover { color: var(--color-text); }
.site-top__sep { width: 1px; height: 12px; background: var(--color-divider); }

.lang-switch { display: flex; gap: var(--space-2); margin: 0; }
.lang-switch button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--color-muted);
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { color: var(--color-text); font-weight: 600; }

/* Header */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  height: var(--header-height);
  padding: 0 var(--space-8);
  gap: clamp(12px, 2.2vw, 32px);
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-bg);
}
.site-logo { justify-self: start; display: block; line-height: 0; }
.site-logo img { height: 56px; width: 115px; object-fit: contain; }
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: 14px;
  padding-right: var(--space-4);
  margin-right: var(--space-2);
  border-right: 1px solid var(--color-divider);
}
.site-nav a {
  color: var(--color-text);
  font-weight: 600;
  padding: 4px 0 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--color-accent-700); }
.site-nav a[aria-current="page"] { color: var(--color-accent-700); border-bottom-color: var(--color-accent); }
.site-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  grid-column: 3;
  min-width: 190px;
}
.site-actions__login { font-size: 14px; font-weight: 600; color: var(--color-text); }
.site-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
}
.site-user::after { display: none; }
.site-user__head { display: flex; flex-direction: column; gap: 2px; padding: var(--space-4); border-bottom: 1px solid var(--color-divider); color: var(--color-text); white-space: normal; }
.site-user__name { font-weight: 800; font-size: 15px; overflow-wrap: anywhere; }
.site-user__role { font-size: 12px; color: var(--color-muted); }
.dropdown-item.site-user__logout { border-top: 1px solid var(--color-divider); color: var(--color-muted); }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px; font-weight: 800; }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 12px 4px;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--color-text); }
.site-mobile { display: none; }
.site-mobile__inner {
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-8) var(--space-4);
  border-bottom: 2px solid var(--color-divider);
}
.site-mobile__inner > a {
  padding: 14px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-divider);
}
.site-mobile__inner > a[aria-current="page"] { color: var(--color-accent-700); }
.site-mobile__inner .lang-switch { padding-top: var(--space-4); font-size: 13px; }

/* Footer */
.site-footer { border-top: 2px solid var(--color-divider); }
.site-footer__cols {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: var(--space-8);
  padding: var(--space-8);
}
.site-footer__logo { height: 36px; width: 74px; object-fit: contain; margin-bottom: var(--space-4); }
.site-footer__info { margin: 0; font-size: 13px; line-height: 1.6; max-width: 300px; color: var(--color-muted); }
.site-footer__info a { color: var(--color-muted); }
.site-footer__col { display: flex; flex-direction: column; gap: var(--space-2); font-size: 13px; }
.site-footer__col a { color: var(--color-muted); }
.site-footer__col a:hover { color: var(--color-text); }
.site-footer__title { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; margin-bottom: var(--space-1); }
.site-footer__bottom {
  padding: var(--space-3) var(--space-8);
  border-top: 2px solid var(--color-divider);
  font-size: 12px;
  color: var(--color-muted);
}
.site-footer__bottom a { color: var(--color-muted); }

/* Messages */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast-stack .alert {
  margin: 0;
  padding: 14px 22px;
  border: 0;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 14px;
  font-weight: 600;
}
.toast-stack .alert-danger { background: var(--color-danger); }
.toast-stack .alert-warning { background: var(--color-warning); }

/* Reserved area */
.area {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 720px;
  border-bottom: 2px solid var(--color-divider);
}
.area-side {
  display: flex;
  flex-direction: column;
  padding: var(--space-8) var(--space-4);
  border-right: 1px solid var(--color-divider);
}
.area-menu { display: flex; flex-direction: column; }
.area-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  border-left: 3px solid transparent;
}
.area-menu a:hover { background: var(--color-hover); }
.area-menu a[aria-current] {
  border-left-color: var(--color-accent);
  background: var(--color-accent-100);
  color: var(--color-accent-800);
}
.area-menu__badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: 12px;
  font-weight: 700;
}
.area-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8);
  min-width: 0;
}
.area-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
}
.area-head__tools { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.area-head__note { margin: 0; font-size: 13px; color: var(--color-muted); }
.area-crumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: 13px; color: var(--color-muted); }
.area-crumbs a { font-weight: 600; color: var(--color-accent-700); }
.area-crumbs + .area-head { margin-top: calc(-1 * var(--space-4)); }
.area-head__note strong { color: var(--color-text); }
.area-note { padding: 10px 14px; background: var(--color-surface); font-size: 13px; }

@media (max-width: 900px) {
  .site-top { display: none; }
  .site-header { grid-template-columns: auto 1fr auto; }
  .site-nav, .site-actions__login { display: none; }
  .site-user__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .site-actions { min-width: 0; }
  .nav-toggle { display: inline-flex; }
  .site-mobile.show, .site-mobile.collapsing { display: block; }
  .site-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .area { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .area-side { padding: var(--space-3) var(--space-8) 0; border-right: 0; border-bottom: 1px solid var(--color-divider); }
  .area-menu { flex-direction: row; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .area-menu a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .area-menu a[aria-current] { border-bottom-color: var(--color-accent); }
}

@media (max-width: 560px) {
  .site-footer__cols { grid-template-columns: minmax(0, 1fr); }
}
