:root {
  --bg: #FFF9F2;
  --bg-alt: #FFFFFF;
  --text: #2B2B28;
  --text-muted: #6B6B63;
  --primary: #2E7D6B;
  --primary-dark: #1F5A4D;
  --accent: #E8A33D;
  --border: #EDE3D3;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(43, 43, 40, 0.08);
  --font-heading: 'Comfortaa', sans-serif;
  --font-body: 'Nunito', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

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

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--primary-dark);
  margin: 0 0 12px;
}

a { color: var(--primary-dark); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 249, 242, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary-dark);
  text-decoration: none;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.main-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.main-nav a:hover { color: var(--primary); }

.nav-cta {
  background: var(--primary);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: 999px;
}

.nav-cta:hover { background: var(--primary-dark); }

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
}

.burger span {
  display: block;
  height: 2px;
  background: var(--primary-dark);
  border-radius: 2px;
}

/* Hero */
.hero {
  padding: 72px 0 96px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: center;
}

.hero-photo {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  background: var(--border);
}

.hero-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 6px solid var(--bg-alt);
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  margin: 0 0 8px;
}

.hero-text {
  min-width: 0;
}

.hero-text h1 {
  font-size: 2.6rem;
  line-height: 1.15;
  margin-bottom: 18px;
  overflow-wrap: break-word;
}

.hero-tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 42ch;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
  border: 2px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-ghost {
  background: transparent;
  color: var(--primary-dark);
  border-color: var(--primary);
}

.btn-ghost:hover { background: var(--primary); color: #fff; }

/* Sections */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }

.section-title { font-size: 1.9rem; }

.section-sub {
  color: var(--text-muted);
  margin: -6px 0 32px;
  max-width: 60ch;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

.about-text p { margin: 0 0 16px; }

.about-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.about-facts li {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fact-num {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
}

.fact-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Cards */
.cards-grid {
  display: grid;
  gap: 24px;
}

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

/* Carousel */
.carousel-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.carousel {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel::-webkit-scrollbar { display: none; }

.carousel > * {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.cards-grid.carousel.three > .card { width: calc((100% - 2 * 24px) / 3); }
.cards-grid.carousel.four > .card { width: calc((100% - 3 * 24px) / 4); }

.class-photo-track { width: 100%; }
.class-photo-track > .lightbox-trigger { width: 100%; }

.class-photo-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.carousel-arrow {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.carousel-arrow:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.carousel-arrow[hidden] { display: none; }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.section-alt .card { background: var(--bg); }

.card h3 { font-size: 1.05rem; }

.card-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 6px;
}

.card-icon { font-size: 1.8rem; margin-bottom: 10px; }

.achievement-card {
  text-align: center;
}

.lightbox-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: 10px;
  margin-bottom: 10px;
}

.lightbox-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--primary);
}

.thumb-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  transition: transform 0.2s ease;
}

.lightbox-trigger:hover .thumb-image,
.lightbox-trigger:focus-visible .thumb-image {
  transform: scale(1.03);
}

.achievement-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 14, 0.85);
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-image {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: var(--bg-alt);
}

.lightbox-caption {
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-close {
  top: 20px;
  right: 20px;
}

.lightbox-nav.lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-nav.lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-nav[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .lightbox-close,
  .lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
  }
}

/* Class section */
.class-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
  align-items: center;
}

.class-photo {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: var(--shadow);
}

.class-text p { color: var(--text-muted); }

/* Materials */
.materials-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.material-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}

.material-icon { font-size: 1.3rem; }

.material-name { flex: 1; font-weight: 600; }

.material-download {
  text-decoration: none;
  font-weight: 700;
  color: var(--primary-dark);
  border: 2px solid var(--primary);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
}

.material-download:hover { background: var(--primary); color: #fff; }

/* News */
.news-trigger {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  transition: box-shadow 0.15s ease;
}

.news-trigger:hover,
.news-trigger:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
  outline: none;
}

.news-card h3 { font-size: 1.05rem; }
.news-card p:last-child { color: var(--text-muted); margin: 0; }

.news-more {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

.news-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 14, 0.65);
  padding: 24px;
}

.news-modal[hidden] { display: none; }

.news-modal-panel {
  position: relative;
  background: var(--bg-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  text-align: center;
}

.news-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-modal-close:hover { background: var(--border); }

.news-modal-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 6px;
}

.news-modal-title {
  margin: 0 0 16px;
  font-size: 1.3rem;
}

.news-modal-text {
  white-space: pre-line;
  line-height: 1.6;
  color: var(--text);
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
}

.contact-info {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  color: var(--text-muted);
}

.contact-info li { margin-bottom: 6px; }

.social-links { display: flex; gap: 10px; }

.social-links a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  text-decoration: none;
}

.social-links a:hover { background: var(--primary-dark); }

.social-icon {
  display: block;
  width: 20px;
  height: 20px;
  background-color: #fff;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.social-icon-vk {
  -webkit-mask-image: url("/static/img/social/vk.f92b14beaf0f.png");
  mask-image: url("/static/img/social/vk.f92b14beaf0f.png");
}

.social-icon-ok {
  -webkit-mask-image: url("/static/img/social/ok.7ff300a66178.png");
  mask-image: url("/static/img/social/ok.7ff300a66178.png");
}

.social-icon-max {
  -webkit-mask-image: url("/static/img/social/max.5288569bda63.png");
  mask-image: url("/static/img/social/max.5288569bda63.png");
}

.contact-form {
  display: grid;
  gap: 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.contact-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact-form input,
.contact-form textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.form-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.form-note-success { color: var(--primary); }
.form-note-error { color: #b3413e; }

/* Back to top */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: background 0.15s ease;
}

.back-to-top[hidden] { display: none; }

.back-to-top:hover { background: var(--primary-dark); }

@media (max-width: 640px) {
  .back-to-top { right: 16px; bottom: 16px; width: 42px; height: 42px; }
}

/* Footer */
.site-footer {
  padding: 28px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 1300px) {
  .main-nav { gap: 14px; }
  .main-nav a { font-size: 0.88rem; }
}

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-photo { width: 220px; margin: 0 auto; }
  .hero-actions { justify-content: center; }
  .about-grid { grid-template-columns: 1fr; }
  .class-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .cards-grid.three { grid-template-columns: repeat(2, 1fr); }
  .cards-grid.four { grid-template-columns: repeat(2, 1fr); }
  .cards-grid.carousel.three > .card,
  .cards-grid.carousel.four > .card { width: calc((100% - 24px) / 2); }
}

@media (max-width: 720px) {
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-alt);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    display: none;
  }

  .main-nav.open { display: flex; }
  .burger { display: flex; }
}

@media (max-width: 560px) {
  .cards-grid.three,
  .cards-grid.four { grid-template-columns: 1fr; }
  .cards-grid.carousel.three > .card,
  .cards-grid.carousel.four > .card { width: 100%; }
  .hero-text h1 { font-size: 2.1rem; }
}
