/* =========================================================
   Русские спарринги — оформление сайта
   Палитра: тёплая нейтральная + терракота
   ========================================================= */

/* ---------- Шрифты (self-hosted Manrope) ---------- */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/manrope-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/static/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */

:root {
  --bg: #faf8f5;
  --bg-elevated: #ffffff;
  --panel: #f2ede6;
  --panel-strong: #eae3d9;
  --text: #2b2622;
  --muted: #6b6258;
  --accent: #b0563a;
  --accent-dark: #96452e;
  --accent-soft: #f0e2db;
  --border: #e3dacc;
  --border-strong: #d5cabc;

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;

  --shadow-sm:
    0 1px 2px rgba(43, 38, 34, 0.04),
    0 6px 18px -8px rgba(43, 38, 34, 0.1);
  --shadow-md:
    0 2px 6px rgba(43, 38, 34, 0.05),
    0 20px 44px -20px rgba(43, 38, 34, 0.22);

  --max-width: 68rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  --font-sans:
    "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

/* ---------- База ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

img {
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 50;
  padding: 0.6rem 1rem;
  color: #fff;
  background: var(--accent-dark);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.18s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Типографика ---------- */

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 1.35rem + 2.2vw, 2.9rem);
  margin: 0 0 1.1rem;
}

h2 {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.55rem);
  margin: 2.25rem 0 0.85rem;
}

h3 {
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
}

p {
  margin: 0 0 1rem;
}

.content {
  max-width: 46rem;
}

.content > :last-child {
  margin-bottom: 0;
}

.content img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.content blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: var(--panel);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}

.content code {
  padding: 0.15em 0.4em;
  background: var(--panel-strong);
  border-radius: 6px;
  font-size: 0.9em;
}

.lead {
  max-width: 46rem;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  color: var(--muted);
}

.meta,
.hint {
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Шапка ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 248, 245, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.75rem;
  padding-block: 0.9rem 0.7rem;
}

.org-name {
  max-width: 40rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.main-nav a:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.main-nav a.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(176, 86, 58, 0.25);
}

/* ---------- Основной контент ---------- */

.public main {
  padding-block: clamp(1.75rem, 4vw, 3rem) clamp(2.5rem, 5vw, 4rem);
}

.page-header {
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.page-header h1 {
  margin-bottom: 0.5rem;
}

/* Главная: hero-блок */

.hero {
  position: relative;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
  padding: clamp(1.75rem, 5vw, 3.25rem);
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(176, 86, 58, 0.1), transparent 70%),
    linear-gradient(160deg, var(--bg-elevated), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  max-width: 38rem;
  margin-bottom: 1rem;
  font-size: clamp(1.55rem, 1.15rem + 1.6vw, 2.2rem);
}

.hero .content {
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.05rem;
}

/* ---------- Ссылки-разделы на главной ---------- */

.section-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.85rem;
  margin: clamp(1.75rem, 3vw, 2.5rem) 0 0;
  padding: 0;
  list-style: none;
}

.section-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.section-links a::after {
  content: "→";
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform 0.18s ease;
}

.section-links a:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.section-links a:hover::after {
  transform: translateX(3px);
}

/* ---------- Список проектов ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
  padding: 1.35rem 1.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.project-card h3 {
  margin: 0;
}

.project-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.project-card h3 a:hover {
  color: var(--accent-dark);
}

.project-card p {
  margin: 0;
}

.project-card .meta {
  margin-top: auto;
  padding-top: 0.6rem;
}

.project-card .status-badge {
  align-self: flex-start;
  padding: 0.15rem 0.6rem;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: capitalize;
}

/* ---------- Галерея и видео ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery img:hover {
  transform: scale(1.015);
  box-shadow: var(--shadow-md);
}

.video {
  margin: 0 0 1.5rem;
}

.video video {
  width: 100%;
  max-width: 100%;
  height: auto;
  background: #000;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.video figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Контакты ---------- */

.contacts {
  display: grid;
  gap: 0.75rem;
  max-width: 40rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contacts li {
  padding: 0.95rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------- Подвал ---------- */

.site-footer {
  margin-top: auto;
  padding-block: 1.5rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

/* ---------- Админ-панель ---------- */

body.admin main {
  max-width: 52rem;
  padding-block: clamp(1.75rem, 4vw, 3rem) clamp(2.5rem, 5vw, 4rem);
}

.admin .site-header {
  position: static;
}

.admin .container {
  max-width: 52rem;
}

.admin h1 {
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2rem);
}

.admin form p {
  margin: 0 0 0.9rem;
}

.admin label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin input,
.admin select,
.admin textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.admin input:focus,
.admin select:focus,
.admin textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 86, 58, 0.18);
}

.admin button,
.admin .button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  color: #fff;
  background: var(--accent-dark);
  border: 1px solid var(--accent-dark);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.admin button:hover,
.admin .button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.admin button:active,
.admin .button:active {
  transform: translateY(1px);
}

.admin table {
  width: 100%;
  margin-top: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-scroll {
  margin-top: 1rem;
  overflow-x: auto;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 34rem;
}

.admin th,
.admin td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin th {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel);
}

.admin tbody tr:last-child td {
  border-bottom: 0;
}

.admin tbody tr:hover {
  background: rgba(176, 86, 58, 0.04);
}

.admin ul {
  padding-left: 1.2rem;
}

.error {
  padding: 0.6rem 0.9rem;
  color: #8a1c1c;
  background: #fbeaea;
  border: 1px solid #d9a5a5;
  border-radius: var(--radius-sm);
}

.saved {
  padding: 0.6rem 0.9rem;
  color: #1c5d2f;
  background: #eaf6ee;
  border: 1px solid #a5d9b8;
  border-radius: var(--radius-sm);
}

/* ---------- Страница 404 ---------- */

body:not(.admin) main > h1:only-of-type {
  text-wrap: balance;
}

/* ---------- Служебное ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding-block: 0.7rem;
  }

  .org-name {
    font-size: 0.78rem;
  }

  .main-nav {
    gap: 0.1rem 0.15rem;
  }

  .main-nav a {
    padding: 0.3rem 0.45rem;
    font-size: 0.85rem;
  }
}
