:root {
  --accent: #0057b7;
  --accent-2: #ffd700;
  --bg: #f7f9fc;
  --text: #1b1f23;

  /* брейкпоінти */
  --bp-lg: 1200px;
  --bp-md: 960px;
  --bp-sm: 768px;
  --bp-xs: 480px;
}
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
    "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

header,
footer,
nav,
main,
aside,
article {
  padding: 12px;
}

/* ===== Header ===== */
header {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #000;
  display: flex;
  align-items: center;
  gap: 16px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
body {
  padding-top: 96px;
}

header img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
header h1 {
  margin: 0;
  font-size: 1.4rem;
}

/* ===== Global nav ===== */
nav {
  background: #fff;
  border-bottom: 1px solid #e7eaf0;
  position: sticky;
  top: 0;
  z-index: 10;
}
nav ul {
  margin: 0;
  padding: 0;
  display: flex;
  gap: 16px;
  list-style: none;
  flex-wrap: wrap;
}
nav a.btn {
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #d7dbe3;
  display: inline-block;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 18px;
}

.card {
  background: #fff;
  border: 1px solid #e7eaf0;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 16px;
}

h2 {
  margin-top: 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}
caption {
  caption-side: top;
  padding: 8px;
  font-weight: 600;
}
thead,
tfoot {
  background: #f0f4fb;
}
th,
td {
  border: 1px solid #dfe3ea;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

aside .list {
  padding-left: 18px;
}

footer {
  background: #0f172a;
  color: #e5e7eb;
}
footer a {
  color: #e5e7eb;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.highlight-sentence {
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  background: #fff;
  border-radius: 8px;
  margin: 8px 0;
}
#mission .highlight-sentence::before {
  content: "👋 Вітаємо! ";
  font-weight: 600;
  margin-right: 4px;
}

figure {
  margin: 0;
}
figure img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #e7eaf0;
}
figure figcaption {
  font-size: 0.9rem;
  color: #475569;
  margin-top: 6px;
}

.form-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

fieldset {
  border: 1px solid #94a3b8;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
legend {
  padding: 0 6px;
}

.buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

hr.section {
  border: none;
  border-top: 2px dashed #cbd5e1;
  margin: 16px 0;
}
.small {
  font-size: 0.9rem;
  color: #475569;
}

.contact-item {
  display: inline-block;
  padding: 2px 4px;
  border-radius: 6px;
  outline: none;
}
.contact-item:focus {
  animation: delayedDoubleBorder 0s linear 3s forwards;
}
@keyframes delayedDoubleBorder {
  to {
    outline: 3px double #000;
    outline-offset: 2px;
  }
}

a[target="_blank"] {
  text-decoration-style: wavy;
}
img[alt*="логотип" i] {
  filter: contrast(1.05);
}

/* combinators demo */
nav > ul > li {
}
.card + .card {
  margin-top: 14px;
}
.grid .card ~ .card {
  opacity: 0.99;
}

.badge {
  background: hsl(230 100% 97%);
  border-color: #c7d2fe;
  color: rgb(17, 24, 39);
}

/* ===== Dropdown in main nav ===== */
.main-nav .menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-left: 0;
  list-style: none;
}
.main-nav .menu__item {
  position: relative;
}
.main-nav .menu__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.main-nav .menu__chevron {
  font-size: 0.9em;
  transition: transform 0.2s ease;
}
.main-nav .menu__item--open .menu__chevron {
  transform: rotate(180deg);
}

.main-nav .submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: #fff;
  border: 1px solid #dfe3ea;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  padding: 8px;
  margin-top: 6px;
  display: none;
  z-index: 1000;
}
.main-nav .menu__item--open > .submenu {
  display: block;
}
.main-nav .submenu__item {
  list-style: none;
}
.main-nav .submenu__link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: #0f172a;
  white-space: nowrap;
}
.main-nav .submenu__link:hover,
.main-nav .submenu__link:focus {
  background: #f4f6fa;
  outline: none;
}
@media (max-width: var(--bp-sm)) {
  .main-nav .submenu {
    left: auto;
    right: 0;
    min-width: 210px;
  }
}

/* ===== ЛР2: сторінка "Напрями діяльності" ===== */
body.page-directions header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

body.page-directions .grid > section.card {
  border: 0;
  --maroon: #5a001f;
  background: #fff;
  border-left: 6px solid var(--maroon);
  border-top: 2px dashed var(--maroon);
  border-right: 2px dashed var(--maroon);
  border-bottom: 2px dashed var(--maroon);
}
body.page-directions p.small:has(.badge) {
  font-weight: 300;
  font-style: italic;
  font-size: 0.95em;
  line-height: 1.35;
}

body.page-directions figure img {
  transition: filter 0.25s ease;
  will-change: filter;
}
body.page-directions figure img:hover {
  filter: brightness(0.75);
}

body.page-directions .grid > section.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform, box-shadow;
}
body.page-directions .grid > section.card:hover,
body.page-directions .grid > section.card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

/* Directions: hero-carousel */
.page-directions .carousel__viewport {
  --carousel-h: min(20vh, 220px);
  position: relative;
  height: var(--carousel-h);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e7eaf0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.page-directions .carousel__track {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease;
  will-change: transform;
}
.page-directions .carousel__slide {
  min-width: 100%;
  height: 100%;
  position: relative;
}
.page-directions .carousel__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.page-directions .carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d7dbe3;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.page-directions .carousel__btn:hover {
  background: #f8fafc;
}
.page-directions .carousel__btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.page-directions .carousel__btn--prev {
  left: 8px;
}
.page-directions .carousel__btn--next {
  right: 8px;
}
.page-directions .carousel__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 0;
}
.page-directions .carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}
.page-directions .carousel__dot.is-active {
  background: var(--accent);
  border-color: var(--accent);
}
@media (max-width: var(--bp-sm)) {
  .page-directions .carousel {
    margin-top: 86px;
  }
  .page-directions .carousel__viewport {
    --carousel-h: min(20vh, 180px);
  }
}

/* Directions: пошук у nav */
.page-directions nav .nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.page-directions nav .nav-row__menu {
  display: flex;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.page-directions .dir-search--nav {
  margin-left: auto;
}
.page-directions .dir-search--nav .dir-search__field {
  position: relative;
  width: clamp(240px, 34vw, 420px);
}
.page-directions .dir-search--nav .dir-search__input {
  height: 40px;
  width: 100%;
  padding: 9px 80px 9px 12px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.page-directions .dir-search--nav .dir-search__input:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.page-directions .dir-search--nav .dir-search__btn,
.page-directions .dir-search--nav .dir-search__clear {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #d7dbe3;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.page-directions .dir-search--nav .dir-search__btn {
  right: 6px;
}
.page-directions .dir-search--nav .dir-search__clear {
  right: 42px;
  font-size: 18px;
  line-height: 1;
}
.page-directions .dir-search--nav .dir-search__btn:hover,
.page-directions .dir-search--nav .dir-search__clear:hover {
  background: #f8fafc;
}

.page-directions .dir-search__empty {
  text-align: center;
  margin: 8px 0 20px;
  color: #475569;
  font-weight: 700;
}

.page-directions .grid > .card.is-hidden {
  display: none !important;
}

.page-directions .dir-search__input::-webkit-search-decoration,
.page-directions .dir-search__input::-webkit-search-cancel-button,
.page-directions .dir-search__input::-webkit-search-results-button,
.page-directions .dir-search__input::-webkit-search-results-decoration {
  display: none;
}
.page-directions .dir-search__input::-ms-clear,
.page-directions .dir-search__input::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}
.page-directions .dir-search__input {
  -webkit-appearance: none;
  appearance: none;
}
.page-directions .dir-search__field .dir-search__clear {
  display: none;
}
.page-directions .dir-search__field.has-text .dir-search__clear {
  display: inline-flex;
}

@media (max-width: var(--bp-sm)) {
  .page-directions nav .nav-row {
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
  }
  .page-directions nav .nav-row__menu {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .page-directions .dir-search--nav {
    width: 100%;
    order: 2;
  }
  .page-directions .dir-search--nav .dir-search__field {
    width: 100%;
  }
  .page-directions .dir-search--nav .dir-search__input {
    height: 38px;
    padding-right: 76px;
  }
}

/* ===== Feedback: textarea hover + tooltip ===== */
.form-control--details {
  position: relative;
}
#details {
  transition: background-color 0.2s ease, box-shadow 0.2s ease,
    border-color 0.2s ease;
}
#details:hover,
#details:focus {
  background: #fffef6;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 87, 183, 0.25), 0 10px 22px rgba(0, 0, 0, 0.08);
  outline: none;
}
.tooltip--details {
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  transform: translateY(-50%) translateX(6px);
  max-width: min(36vw, 340px);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  border: 1px solid #d7dbe3;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 20;
  line-height: 1.35;
  font-size: 0.95rem;
}
.tooltip--details::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  border-width: 8px;
  border-style: solid;
  border-color: transparent #d7dbe3 transparent transparent;
}
.tooltip--details::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%) translateX(1px);
  border-width: 7px;
  border-style: solid;
  border-color: transparent #fff transparent transparent;
}
.form-control--details #details:hover + .tooltip--details,
.form-control--details #details:focus + .tooltip--details {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}
@media (max-width: 960px) {
  .tooltip--details {
    top: calc(100% + 8px);
    left: 0;
    transform: translateY(0);
    max-width: 100%;
  }
  .tooltip--details::before,
  .tooltip--details::after {
    display: none;
  }
}

@media (max-width: 768px) {
  .page-home {
    display: grid;
    grid-template-columns: 1fr min(42vw, 260px);
    grid-template-areas:
      "header header"
      "main   nav"
      "footer footer";
    column-gap: 12px;
  }
  .page-home header {
    grid-area: header;
  }
  .page-home main.container {
    grid-area: main;
  }
  .page-home footer {
    grid-area: footer;
  }

  .page-home nav.main-nav {
    grid-area: nav;
    position: static;
    margin: 0;
    max-width: none;
    width: 100%;
    padding: 8px;
    background: #fff;
    border: 1px solid #e7eaf0;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  }
  .page-home nav.main-nav .menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .page-home nav.main-nav .menu__item {
    width: 100%;
  }
  .page-home nav.main-nav .btn {
    display: block;
    width: 100%;
    text-align: left;
  }

  .page-home nav.main-nav .submenu {
    position: static;
    display: none;
    border: 0;
    box-shadow: none;
    padding: 6px 0 0 10px;
    margin: 4px 0 0;
  }
  .page-home nav.main-nav .menu__item--open > .submenu {
    display: block;
  }

  .page-home main.container .grid {
    grid-template-columns: 1fr;
  }
  .page-home main.container aside.card {
    display: none;
  }
}

/* ===== ГОЛОВНА (>768px): звичне горизонтальне меню зверху ===== */
@media (min-width: 769px) {
  .page-home .main-nav .menu {
    flex-direction: row;
  }
  .page-home .main-nav .submenu {
    position: absolute;
    display: none;
    border: 1px solid #dfe3ea;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    padding: 8px;
    margin-top: 6px;
    background: #fff;
  }
  .page-home .main-nav .menu__item--open > .submenu {
    display: block;
  }
}

@media (min-width: var(--bp-lg)) {
  .container {
    max-width: 1200px;
  }
  header h1 {
    font-size: 1.5rem;
  }
  .card {
    padding: 18px;
  }
}
/* ≤960px */
@media (max-width: var(--bp-md)) {
  .container {
    padding: 10px;
  }
  nav ul {
    gap: 12px;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  header h1 {
    font-size: 1.2rem;
  }
  header img {
    width: 52px;
    height: 52px;
  }
  .card {
    padding: 14px;
  }
  table th,
  table td {
    padding: 7px;
  }
}
/* ≤768px */
@media (max-width: var(--bp-sm)) {
  header,
  footer,
  nav,
  main,
  aside,
  article {
    padding: 10px;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  nav ul::-webkit-scrollbar {
    height: 6px;
  }
  nav a.btn {
    padding: 10px 14px;
    border-radius: 12px;
    white-space: nowrap;
  }

  header h1 {
    font-size: 1.1rem;
  }
  header img {
    width: 48px;
    height: 48px;
  }

  .table-wrap {
    margin: 0 -10px;
    padding: 0 10px;
  }
  table {
    font-size: 0.95rem;
  }
  th,
  td {
    padding: 7px;
  }

  input[type="text"],
  input[type="email"],
  input[type="number"],
  select,
  textarea {
    padding: 10px;
    font-size: 1rem;
  }
  aside .buttons .btn {
    flex: 1 1 auto;
    text-align: center;
  }
  .small {
    line-height: 1.5;
  }
}
/* ≤480px */
@media (max-width: var(--bp-xs)) {
  .container {
    padding: 8px;
  }
  header,
  footer,
  nav,
  main,
  aside,
  article {
    padding: 8px;
  }
  header h1 {
    font-size: 1rem;
  }
  header img {
    width: 44px;
    height: 44px;
  }
  .card {
    padding: 12px;
    border-radius: 12px;
  }
  figure img {
    border-radius: 8px;
  }
  table {
    font-size: 0.9rem;
  }
  th,
  td {
    padding: 6px;
  }
  .buttons {
    gap: 8px;
  }
  nav ul {
    gap: 10px;
  }
  nav a.btn {
    padding: 10px 12px;
  }
}

/* ===== Додаткова адаптивність для "Напрями діяльності" ===== */
@media (max-width: var(--bp-md)) {
  body.page-directions .grid {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 961px) {
  body.page-directions .grid {
    grid-template-columns: 3fr 1fr;
  }
}
@media (max-width: var(--bp-sm)) {
  body.page-directions .grid > section.card {
    border-left-width: 5px;
    border-top-width: 2px;
    border-right-width: 2px;
    border-bottom-width: 2px;
    padding: 14px;
  }
  body.page-directions figure img {
    border-radius: 8px;
  }
}
@media (max-width: 768px) {
  aside .buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  aside .buttons .btn {
    width: 100%;
    text-align: center;
  }
}
@media (max-width: 768px) {
  body.page-directions .grid > article {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  body.page-directions .grid {
    grid-template-columns: 1fr !important;
  }
  body.page-directions .grid > section.card,
  body.page-directions .grid > article > section.card {
    width: 100%;
  }
}
@media (max-width: 768px) {
  body.page-contact aside .buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  body.page-contact aside .buttons .btn {
    width: 100%;
    text-align: center;
  }
  body.page-contact aside nav ul {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 8px;
  }
  body.page-contact aside nav ul li {
    width: 100%;
  }
  body.page-contact aside nav a.btn {
    display: block;
    width: 100%;
    text-align: center;
  }
  body.page-contact .grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ===== Footer layout ===== */
footer .container {
  display: grid;
  align-items: start;
  gap: 12px;
}
@media (min-width: 961px) {
  footer .container {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 960px) {
  footer .container {
    grid-template-columns: 1fr;
    text-align: center;
  }
  footer p {
    margin: 6px 0;
  }
}
