:root {
  --milk: #f7f4ee;
  --mist: #edf4ef;
  --sage: #2f6f4e;
  --moss: #214b36;
  --graphite: #202522;
  --muted: rgba(32, 37, 34, 0.68);
  --line: rgba(32, 37, 34, 0.1);
  --shadow: 0 22px 65px rgba(32, 37, 34, 0.12);
  color: var(--graphite);
  background: var(--milk);
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--graphite);
  background: var(--milk);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(247, 244, 238, 0.96), rgba(237, 244, 239, 0.72) 54%, rgba(247, 244, 238, 1)),
    radial-gradient(circle at 18% 12%, rgba(47, 111, 78, 0.08), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(255, 255, 255, 0.72), transparent 30%);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(47, 111, 78, 0.26);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: 999px;
  background: var(--graphite);
  color: white;
  padding: 0.75rem 1rem;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(32, 37, 34, 0.08);
  background: rgba(247, 244, 238, 0.82);
  box-shadow: 0 1px 24px rgba(32, 37, 34, 0.06);
  backdrop-filter: blur(18px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
}

.brand {
  border-radius: 1rem;
}

.brand span {
  display: flex;
  align-items: center;
  width: 10rem;
  height: 3rem;
  border: 1px solid rgba(32, 37, 34, 0.08);
  border-radius: 1rem;
  background: white;
  padding: 0 0.75rem;
  box-shadow: 0 8px 22px rgba(32, 37, 34, 0.06);
}

.brand img {
  width: 100%;
  height: 2.25rem;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px solid rgba(32, 37, 34, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(32, 37, 34, 0.66);
  font-size: 0.95rem;
  font-weight: 650;
  padding: 0.25rem;
  box-shadow: 0 8px 24px rgba(32, 37, 34, 0.05);
}

.nav a {
  border-radius: 999px;
  padding: 0.62rem 0.95rem;
}

.nav a:hover,
.footer a:hover {
  background: var(--mist);
  color: var(--sage);
}

.header-cta,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  min-height: 3rem;
  padding: 0.95rem 1.35rem;
}

.header-cta,
.btn.primary {
  background: var(--graphite);
  color: white;
  box-shadow: 0 12px 28px rgba(32, 37, 34, 0.16);
}

.btn.primary {
  background: var(--sage);
}

.btn.secondary {
  border: 1px solid rgba(32, 37, 34, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--graphite);
}

.btn.center {
  margin: 2rem auto 0;
  width: fit-content;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  max-width: none;
  min-height: calc(100vh - 73px);
  margin: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #f7f4ee 0%, #edf4ef 100%);
  padding: 0;
}

.hero > .hero-copy,
.hero > .hero-media {
  position: relative;
  z-index: 1;
}

.hero > .hero-copy {
  justify-self: end;
  width: min(100%, 640px);
  padding: clamp(3rem, 7vw, 5rem) 0 clamp(3rem, 7vw, 5rem) clamp(1rem, 4vw, 3rem);
}

.hero > .hero-media {
  justify-self: start;
  width: min(100%, 650px);
  margin-right: clamp(1rem, 4vw, 3rem);
}

.hero-top-line {
  pointer-events: none;
  position: absolute;
  inset: 0 0 auto;
  height: 6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.32);
}

.hero-copy h1 {
  margin: 0;
  max-width: 1280px;
  color: var(--graphite);
  font-size: clamp(3.25rem, 6vw, 5rem);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.65;
}

.hero .eyebrow {
  display: inline-flex;
  border: 1px solid rgba(47, 111, 78, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(32, 37, 34, 0.05);
  margin-bottom: 1.25rem;
  padding: 0.62rem 1rem;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0;
  color: var(--sage);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.actions,
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.badges span,
.benefits span,
.project-tags span,
.project-meta span,
.card-kicker {
  border-radius: 1rem;
  background: var(--mist);
  color: var(--sage);
  font-weight: 750;
  padding: 0.7rem 1rem;
}

.hero-media {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 2.35rem;
  background: rgba(255, 255, 255, 0.35);
  min-height: auto;
  padding: 0.75rem;
  box-shadow: var(--shadow);
}

.hero-media img {
  overflow: hidden;
  border-radius: 2rem;
  height: clamp(420px, 54vw, 560px);
  background: white;
  box-shadow: 0 18px 60px rgba(32, 37, 34, 0.09);
}

.hero-media img,
.project-image img,
.person-card img,
.featured-article img,
.article-card img,
.article-hero,
.map-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(3.2rem, 7vw, 6rem) clamp(1rem, 4vw, 3rem);
}

.section.muted {
  max-width: none;
  border-block: 1px solid rgba(32, 37, 34, 0.05);
  background: linear-gradient(180deg, rgba(237, 244, 239, 0.92), rgba(237, 244, 239, 0.72));
}

.section.muted > * {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

.section h2,
.contacts h2,
.page h1,
.article-page h1 {
  margin: 1rem 0 1.25rem;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  font-weight: 650;
  line-height: 1;
}

.lead {
  max-width: 780px;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.8;
}

.benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.cards {
  display: grid;
  gap: 1.35rem;
  margin-top: 2.5rem;
}

.cards.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.project-card,
.person-card,
.article-card,
.featured-article,
.contact-panel,
.lead-form,
.map-card,
.admin-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.75rem;
  background: white;
  box-shadow: 0 12px 34px rgba(32, 37, 34, 0.07);
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.card:hover,
.project-card:hover,
.person-card:hover,
.article-card:hover,
.featured-article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card {
  min-height: 250px;
  padding: 2rem;
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  min-height: 3.25rem;
  border-radius: 1rem;
  background: var(--sage);
  color: white;
}

.card h3,
.person-card h3,
.project-card h3,
.article-card h2,
.featured-article h3 {
  margin: 1rem 0 0.6rem;
  font-size: 1.45rem;
  line-height: 1.18;
}

.card p,
.person-card p,
.project-card p,
.article-card p,
.featured-article p {
  color: var(--muted);
  line-height: 1.7;
}

.person-card {
  display: flex;
  flex-direction: column;
}

.person-media {
  overflow: hidden;
  aspect-ratio: 795 / 720;
  border-bottom: 1px solid rgba(32, 37, 34, 0.08);
  background: var(--mist);
}

.person-card img {
  background: var(--mist);
}

.person-card > div:not(.person-media),
.project-card > div:not(.project-image),
.article-card > div,
.featured-article > div {
  padding: 1.6rem;
}

.person-card > div:not(.person-media) {
  padding: 1.25rem 1.35rem 1.45rem;
}

.person-card h3 {
  font-size: 1.25rem;
}

.person-card p {
  font-size: 0.98rem;
}

.role {
  color: var(--sage) !important;
  font-weight: 750;
}

.project-image {
  position: relative;
  aspect-ratio: 3 / 2;
}

.project-tags {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: flex;
  gap: 0.5rem;
}

.project-tags span {
  background: rgba(255, 255, 255, 0.86);
  color: var(--graphite);
  backdrop-filter: blur(12px);
}

.project-tags span:first-child {
  color: var(--sage);
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  margin: 1.2rem 0;
  padding-top: 1.2rem;
}

.project-meta strong {
  color: var(--sage);
  font-size: 1.65rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 0.75rem;
  margin-top: 2rem;
}

.filters label {
  display: grid;
  gap: 0.45rem;
}

.filters span {
  color: rgba(32, 37, 34, 0.62);
  font-size: 0.82rem;
  font-weight: 800;
}

.filters input,
.filters select,
.admin-card input,
.admin-card textarea,
.admin-card select,
.lead-form input,
.lead-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(247, 244, 238, 0.55);
  color: var(--graphite);
  padding: 0.95rem 1rem;
}

.featured-article {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  margin-top: 2.5rem;
}

.featured-article img,
.article-card img {
  min-height: 320px;
}

.contacts {
  display: grid;
  grid-template-columns: 0.9fr 0.7fr 0.8fr;
  gap: 1.2rem;
  background: linear-gradient(180deg, var(--mist), var(--graphite));
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 4vw, 3rem);
}

.contact-panel,
.lead-form {
  padding: 2rem;
}

.lead-form {
  display: grid;
  gap: 1rem;
}

.lead-form label,
.admin-card label {
  display: grid;
  gap: 0.45rem;
  color: rgba(32, 37, 34, 0.8);
  font-weight: 700;
}

.hp {
  position: absolute;
  left: -9999px;
}

.map-card {
  position: relative;
  min-height: 420px;
  background: white;
}

.map-card span {
  position: absolute;
  left: 1.2rem;
  bottom: 1.2rem;
  border-radius: 999px;
  background: white;
  color: var(--sage);
  font-weight: 800;
  padding: 0.9rem 1.2rem;
}

.footer {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr;
  gap: 2rem;
  border-top: 1px solid var(--line);
  background: var(--milk);
  padding: 3rem clamp(1rem, 4vw, 3rem);
}

.footer p {
  color: var(--muted);
  line-height: 1.7;
}

.footer-nav {
  display: grid;
  gap: 0.7rem;
}

.page,
.article-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem clamp(1rem, 4vw, 3rem);
}

.back-link {
  color: var(--sage);
  font-weight: 800;
}

.article-body {
  max-width: 760px;
  margin: 2.5rem auto 0;
}

.article-body p {
  color: rgba(32, 37, 34, 0.78);
  font-size: 1.12rem;
  line-height: 1.9;
}

.article-body h2 {
  margin-top: 2.4rem;
  font-size: 2rem;
}

.article-body img,
.article-hero {
  overflow: hidden;
  border-radius: 1.8rem;
  box-shadow: var(--shadow);
}

.article-hero {
  aspect-ratio: 16 / 9;
  margin-top: 2rem;
}

.setup-error {
  max-width: 760px;
  margin: 6rem auto;
  border-radius: 2rem;
  background: white;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.setup-error pre {
  overflow: auto;
  border-radius: 1rem;
  background: #f2f2f2;
  padding: 1rem;
}

.admin-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--graphite);
  color: white;
  padding: 1.5rem;
}

.admin-sidebar h1 {
  margin: 0 0 1.5rem;
}

.admin-sidebar a,
.admin-list a {
  display: block;
  border-radius: 1rem;
  color: inherit;
  padding: 0.85rem 1rem;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.admin-content {
  position: relative;
  padding: 1.5rem;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-toast {
  position: fixed;
  z-index: 20;
  top: 1rem;
  right: 1rem;
  max-width: min(360px, calc(100vw - 2rem));
  transform: translateY(-0.5rem);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  background: var(--graphite);
  color: white;
  opacity: 0;
  padding: 0.85rem 1rem;
  pointer-events: none;
  box-shadow: 0 18px 50px rgba(32, 37, 34, 0.16);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.admin-toast.active {
  transform: translateY(0);
  opacity: 1;
}

.admin-toast.error {
  background: #963f35;
}

.admin-toast.loading {
  background: var(--sage);
}

.admin-card {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.4rem;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-card-header h2,
.admin-card-header h3 {
  margin: 0;
}

.admin-save-state {
  min-height: 1.3rem;
  border-radius: 999px;
  color: rgba(32, 37, 34, 0.62);
  font-size: 0.9rem;
  font-weight: 800;
}

.admin-save-state.success {
  color: var(--sage);
}

.admin-save-state.error {
  color: #a33232;
}

.admin-save-state.loading {
  color: rgba(32, 37, 34, 0.72);
}

.admin-card-toggle {
  width: 100%;
  border: 0;
  border-radius: 1rem;
  background: var(--mist);
  color: var(--graphite);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0.9rem 1rem;
  text-align: left;
}

.admin-card-toggle::after {
  content: "Відкрити / згорнути";
  float: right;
  color: rgba(32, 37, 34, 0.54);
  font-size: 0.85rem;
  font-weight: 700;
}

.admin-card-body {
  display: grid;
  gap: 1rem;
}

.collapsible-card.collapsed .admin-card-body {
  display: none;
}

.admin-card.narrow {
  width: min(100%, 460px);
}

.admin-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

.admin-list {
  align-self: start;
  border-radius: 1.5rem;
  background: white;
  padding: 0.75rem;
  box-shadow: 0 12px 34px rgba(32, 37, 34, 0.07);
}

.admin-list a.active {
  background: var(--mist);
  color: var(--sage);
  font-weight: 800;
}

.btn.small {
  min-height: auto;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
}

.image-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 156px;
  align-items: end;
  gap: 0.75rem;
}

.image-field img {
  width: 156px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--soft);
  object-fit: cover;
}

.image-field img[src=""],
.image-field img[hidden] {
  display: none;
}

.dropzone {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 2px dashed rgba(47, 121, 83, 0.35);
  border-radius: 1.4rem;
  background: var(--mist);
  cursor: pointer;
  padding: 2rem;
  text-align: center;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.dropzone strong,
.dropzone span {
  display: block;
}

.dropzone span {
  margin-top: 0.4rem;
  color: rgba(32, 37, 34, 0.64);
}

.dropzone input {
  margin-top: 1rem;
}

.dropzone.dragging {
  transform: translateY(-2px);
  border-color: var(--sage);
  background: #e3f1e9;
}

.check {
  display: flex !important;
  align-items: center;
  grid-template-columns: auto 1fr;
}

.check input {
  width: auto;
}

.notice {
  border-radius: 1rem;
  padding: 1rem;
  font-weight: 700;
}

.notice.success {
  background: var(--mist);
  color: var(--sage);
}

.notice.error {
  background: #fff0f0;
  color: #a33232;
}

.block-editor {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.block-editor textarea,
.block-editor input:not(:first-child) {
  grid-column: 2;
}

.lead-row {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
}

@media (max-width: 980px) {
  .nav {
    display: none;
  }

  .hero,
  .featured-article,
  .contacts,
  .footer,
  .admin-shell,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero-media {
    min-height: 420px;
  }

  .cards.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .image-field {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
  }

  .header-cta {
    min-height: 2.6rem;
    padding: 0.8rem 1rem;
  }

  .hero-copy h1 {
    font-size: clamp(2.7rem, 15vw, 4.5rem);
  }

  .cards.three,
  .filters {
    grid-template-columns: 1fr;
  }

  .section,
  .page,
  .article-page {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .project-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}
