/* --------------------------------------------------------------------------
   PSM design system
   -------------------------------------------------------------------------- */
:root {
  --bg: #07111f;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --text: #edf4ff;
  --muted: #bdcbe2;
  --accent: #f97316;
  --accent-2: #facc15;
  --shadow: rgba(0, 0, 0, 0.28);
  --nav: rgba(4, 12, 24, 0.78);
  font-family: Inter, system-ui, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  scroll-behavior: smooth;
}

:root[data-theme='light'] {
  --bg: #f5f7fb;
  --surface: rgba(7, 17, 31, 0.06);
  --surface-strong: rgba(7, 17, 31, 0.12);
  --text: #0b1423;
  --muted: #4b5b72;
  --accent: #ea580c;
  --accent-2: #d97706;
  --shadow: rgba(15, 23, 42, 0.14);
  --nav: rgba(255, 255, 255, 0.82);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

img {
  display: block;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Header and navigation
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 6vw;
  background: var(--nav);
  border-bottom: 1px solid var(--surface-strong);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: transparent;
  font-size: 24px;
  font-weight: 900;
}

.main-nav,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-nav button,
.theme-toggle,
.contacts button,
.card button,
.work button,
.adminItem button,
.admin section > button,
.adminActions button {
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--surface-strong);
  border-radius: 999px;
  transition: 0.25s ease;
}

.main-nav button:hover,
.card:hover button,
.work:hover button,
.theme-toggle:hover {
  color: #fff;
  background: var(--accent);
  transform: translateY(-2px);
}

.adminLink {
  background: #123763 !important;
}

.burger {
  display: none;
  color: var(--text);
  background: transparent;
  font-size: 26px;
}

/* --------------------------------------------------------------------------
   Hero and common sections
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  margin-top: -78px;              /* подтягиваем герой под шапку */
  padding-top: calc(9vw + 78px);  /* чтобы текст не прятался под меню */
  align-items: center;
  padding: 9vw 6vw;
  overflow: hidden;
  background-position: center;
  background-size: cover;
}

.hero::after {
  position: absolute;
  inset: auto -10% -35% 35%;
  height: 55%;
  content: '';
  background: radial-gradient(circle, rgba(249, 115, 22, 0.45), transparent 65%);
  filter: blur(18px);
  animation: pulse 4s ease-in-out infinite;
}


.heroText {
  position: relative;
  max-width: 1200px;
  animation: rise 0.9s ease both;
}

.eyebrow,
.card span,
.work span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 12px 0;
  font-size: clamp(40px, 7vw, 97px);
  line-height: 1.05;
  color: transparent;
  background: linear-gradient(90deg, #fff, #ffd6b6);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero p:not(.eyebrow) {
  max-width: 780px;
  color: #dbe7ff;
  font-size: clamp(20px, 3vw, 32px);
}

.primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  color: #07111f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(249, 115, 22, 0.27);
  font-weight: 900;
  transition: 0.25s ease;
}

.primary:hover {
  transform: translateY(-4px) scale(1.02);
}

.section,
.page,
.admin {
  padding: 86px 6vw;
}

.dark {
  background: linear-gradient(135deg, rgba(13, 26, 45, 0.95), rgba(16, 24, 39, 0.95));
}

:root[data-theme='light'] .dark {
  background: linear-gradient(135deg, #e9eef8, #ffffff);
}

.sectionTitle {
  margin-bottom: 34px;
}

.sectionTitle p {
  color: var(--accent);
  font-weight: 900;
  text-transform: uppercase;
}

.sectionTitle h2,
.about h2,
.contacts h2,
.admin h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
}

.grid {
  display: grid;
  gap: 24px;
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* --------------------------------------------------------------------------
   Cards, project pages and contacts
   -------------------------------------------------------------------------- */
.card,
.work,
.person,
.admin section {
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--surface-strong);
  border-radius: 28px;
  box-shadow: 0 25px 80px var(--shadow);
  transition: 0.3s ease;
}

.card:hover,
.work:hover,
.person:hover {
  border-color: rgba(249, 115, 22, 0.54);
  transform: translateY(-8px);
}

.card img,
.work img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.card div,
.work div,
.person {
  padding: 24px;
}

.card h3,
.work h3,
.person h3 {
  margin: 12px 0;
  font-size: 26px;
}

.card p,
.work p,
.person p,
.about p,
.detail p,
.admin p {
  color: var(--muted);
  line-height: 1.7;
}

.center {
  margin-top: 34px;
  text-align: center;
}

.about {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 34px;
  align-items: center;
}

.facts {
  display: grid;
  gap: 16px;
}

.facts strong {
  padding: 28px;
  color: #07111f;
  background: var(--accent);
  border-radius: 24px;
  font-size: 24px;
}

.person img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border: 5px solid var(--accent);
  border-radius: 50%;
}

.person b {
  color: var(--accent);
}

.contacts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 70px 6vw;
  background: #030812;
}

:root[data-theme='light'] .contacts {
  background: #e9eef8;
}

.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 42px;
  align-items: center;
  padding: 72px 6vw;
}

.detail > img {
  width: 100%;
  height: 70vh;
  object-fit: cover;
  border-radius: 34px;
}

.detail h1 {
  margin: 10px 0;
  font-size: clamp(36px, 5vw, 72px);
}

/* --------------------------------------------------------------------------
   Admin panel
   -------------------------------------------------------------------------- */
.admin {
  max-width: 1180px;
  margin: auto;
}

.admin section {
  padding: 24px;
  margin: 22px 0;
}

.admin label {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: var(--accent);
  font-weight: 800;
}

.admin input,
.admin textarea {
  width: 100%;
  padding: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--surface-strong);
  border-radius: 14px;
}

.admin textarea {
  min-height: 110px;
}

.adminItem {
  margin: 16px 0;
  overflow: hidden;
  border: 1px dashed var(--surface-strong);
  border-radius: 22px;
}
.adminItem summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 800;
  transition: 0.25s ease;
}
.adminItem summary::-webkit-details-marker {
  display: none;
}
.adminItem summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adminItem summary::after {
  content: '▾';
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 18px;
  transition: transform 0.25s ease;
}
.adminItem[open] summary::after {
  transform: rotate(180deg);
}
.adminItem[open] summary {
  color: var(--accent);
}
.adminItem summary:hover {
  background: var(--surface);
}
.adminItemBody {
  padding: 4px 18px 18px;
  border-top: 1px dashed var(--surface-strong);
}

.adminActions {
  position: sticky;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
  background: var(--nav);
  border-radius: 22px;
  backdrop-filter: blur(12px);
}

.toast {
  position: fixed;
  top: 90px;
  right: 24px;
  z-index: 30;
  padding: 14px 18px;
  color: white;
  background: #16a34a;
  border-radius: 14px;
}

.toast.error {
  background: #dc2626;
}

/* --------------------------------------------------------------------------
   Animations and responsiveness
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(38px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(35px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.12);
  }
}

@media (max-width: 850px) {
  .burger {
    display: block;
  }

  .main-nav {
    position: absolute;
    top: 72px;
    right: 4vw;
    left: 4vw;
    display: none;
    flex-direction: column;
    padding: 18px;
    background: var(--bg);
    border-radius: 22px;
  }

  .main-nav.open {
    display: flex;
  }

  .three,
  .two,
  .about,
  .detail {
    grid-template-columns: 1fr;
  }

  .contacts {
    display: block;
  }

  .hero {
    min-height: 100vh;
  }

  .section,
  .page,
  .admin {
    padding: 58px 5vw;
  }

  .detail > img {
    height: 340px;
  }
}
/* --------------------------------------------------------------------------
   Стильная загрузка изображений в админке
-------------------------------------------------------------------------- */
.imgField {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}
.imgLabel {
  color: var(--accent);
  font-weight: 800;
}
.imgDrop {
  position: relative;
  height: 170px;
  border: 2px dashed var(--surface-strong);
  border-radius: 18px;
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  overflow: hidden;
  transition: 0.25s ease;
}
.imgDrop:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.imgDrop.drag {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.25);
}
.imgDropOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  text-align: center;
  color: #fff;
  font-weight: 700;
  background: rgba(7, 17, 31, 0.62);
  opacity: 0;
  transition: 0.25s ease;
}
.imgDrop:hover .imgDropOverlay,
.imgDrop.drag .imgDropOverlay {
  opacity: 1;
}
.imgDrop:not(.has-img) .imgDropOverlay {
  opacity: 1;
  background: transparent;
  color: var(--muted);
}
.imgDropIcon {
  font-size: 26px;
}
.imgDrop small {
  font-weight: 500;
  opacity: 0.8;
}
/* --------------------------------------------------------------------------
   Галерея на странице новости и карусель работ
-------------------------------------------------------------------------- */
.gallery {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
}
.gallery > img {
  width: 100%;
  height: 70vh;
  object-fit: cover;
  transition: opacity 0.2s ease;
}
.galleryBtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(7, 17, 31, 0.55);
  color: #fff;
  font-size: 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  transition: 0.25s ease;
}
.galleryBtn:hover {
  background: var(--accent);
  transform: translateY(-50%) scale(1.06);
}
.galleryBtn.prev { left: 16px; }
.galleryBtn.next { right: 16px; }
.galleryDots,
.carouselDots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 8px;
}
.galleryDots .dot,
.carouselDots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: 0.25s ease;
}
.galleryDots .dot.active,
.carouselDots .dot.active {
  background: var(--accent);
  transform: scale(1.3);
}
.galleryCounter {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
}
.carouselTrack {
  display: flex;
  transition: transform 0.6s ease;
}
.carouselSlide {
  flex: 0 0 100%;
  min-width: 100%;
  padding: 6px;
}
.carouselSlide .work:hover { transform: none; }
/* Доп. фото в админке */
.galleryAdmin {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.galleryThumb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--surface-strong);
}
.galleryThumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(7, 17, 31, 0.75);
  color: #fff;
  font-size: 11px;
}
.imgDrop.add-more {
  width: 92px;
  height: 92px;
  border-radius: 14px;
}
.imgDrop.add-more .imgDropOverlay {
  opacity: 1;
  background: transparent;
  color: var(--muted);
}
@media (max-width: 850px) {
  .gallery > img { height: 340px; }
  .galleryBtn { width: 42px; height: 42px; font-size: 16px; }
}
/* --------------------------------------------------------------------------
   Фиксы: картинка новости сверху, карусель без рамочки
-------------------------------------------------------------------------- */
.detail {
  grid-template-columns: 1fr;
  gap: 34px;
  align-items: start;
}
.gallery {
  grid-column: 1 / -1;
}
.carouselSlide {
  padding: 0;
}
.carouselSlide .work {
  box-shadow: none;
}
/* --------------------------------------------------------------------------
   Контакты: заголовок поменьше + карточка QR-кода
-------------------------------------------------------------------------- */
.contacts h2 {
  margin: 0 0 16px;
  font-size: clamp(24px, 3vw, 36px);
}
.qrBox {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  background: #fff;               /* белая подложка — QR должен сканироваться */
  border-radius: 22px;
  box-shadow: 0 25px 80px var(--shadow);
}
.qrBox img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}
.qrBox small {
  max-width: 170px;
  color: #0b1423;
  font-weight: 600;
  text-align: center;
}
@media (max-width: 850px) {
  .qrBox {
    margin-top: 26px;
  }
}
.contactsInfoText {
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
/* Переносы строк из админки видны на сайте */
.card p,
.work p,
.person p,
.about p,
.detail p,
.contactsInfoText {
  white-space: pre-line;
}
/* --------------------------------------------------------------------------
   Более прозрачная шапка
-------------------------------------------------------------------------- */
.topbar {
  background: rgba(4, 12, 24, 0.55);      /* было 0.78 — чем меньше число, тем прозрачнее */
  backdrop-filter: blur(50px);            /* чуть слабее размытие, чтобы картинка читалась */
}
:root[data-theme='light'] .topbar {
  background: rgba(255, 255, 255, 0.25);  /* было 0.82 */
}
/* --------------------------------------------------------------------------
   Кнопки шапки светлее + кнопки карточек по нижней границе
-------------------------------------------------------------------------- */
.main-nav button,
.theme-toggle {
  background: rgba(255, 255, 255, 0.16);   /* было 0.08 — стало заметно белее фона */
  border-color: rgba(255, 255, 255, 0.25);
}
:root[data-theme='light'] .main-nav button,
:root[data-theme='light'] .theme-toggle {
  background: rgba(255, 255, 255, 0.75);   /* в светлой теме — белёсые на сером фоне */
  border-color: rgba(7, 17, 31, 0.14);
}

/* Карточки: кнопка всегда у нижнего края, как у самой длинной карточки */
.card,
.work {
  display: flex;
  flex-direction: column;
}
.card > div,
.work > div {
  flex: 1;                 /* внутренний блок растягивается на всю высоту карточки */
  display: flex;
  flex-direction: column;
}
.card > div button,
.work > div button {
  align-self: flex-start;  /* кнопка остаётся «пилюлей», не растягивается на всю ширину */
  margin-top: auto;        /* прижимается к низу */
}
/* --------------------------------------------------------------------------
   Порядок карточек в админке: стрелки в заголовке + выбор места при добавлении
-------------------------------------------------------------------------- */
.adminItem summary > span:first-child {
  flex: 1;
  min-width: 0;
}
.adminItemControls {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.adminItem .adminItemControls button {
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1;
}
.adminItem .adminItemControls button:not(:disabled):hover {
  color: #fff;
  background: var(--accent);
}
.adminItem .adminItemControls button:disabled {
  opacity: 0.35;
  cursor: default;
}
.adminAddRow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.adminAddRow button {
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--surface-strong);
  border-radius: 999px;
  transition: 0.25s ease;
}
.adminAddRow button:hover {
  color: #fff;
  background: var(--accent);
  transform: translateY(-2px);
}
.admin .adminPosLabel {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.admin .adminPosLabel input {
  width: 90px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--surface-strong);
  border-radius: 12px;
}
.adminPosHint {
  color: var(--muted);
  font-size: 13px;
}