/* Научная школа О.С. Гребенюка — редизайн */

:root {
  --ink:            #0d0c0a;
  --ink-60:         rgba(13, 12, 10, 0.58);
  --ink-30:         rgba(13, 12, 10, 0.28);
  --ink-12:         rgba(13, 12, 10, 0.10);
  --paper:          #f5f2eb;
  --paper-mid:      #ede9df;
  --paper-dark:     #e4dfd2;
  --gold:           #8a6c3a;
  --gold-hover:     #6e5429;
  --gold-soft:      rgba(138, 108, 58, 0.10);
  --white:          #ffffff;

  --serif:  'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans:   'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --max-w:        1000px;
  --max-w-narrow: 600px;
  --header-h:     60px;
  --space:        1.5rem;
  --space-lg:     4rem;
  --radius:       2px;
  --transition:   0.22s ease;
}

/* ─── RESET ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.72;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--gold-hover); }

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

/* ─── HEADER ───────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(245, 242, 235, 0.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-12);
  transition: box-shadow var(--transition);
}

.header.scrolled {
  box-shadow: 0 2px 20px rgba(13, 12, 10, 0.07);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  line-height: 1.3;
  max-width: 260px;
}
.logo:hover { color: var(--gold); }

.nav {
  display: flex;
  gap: 2rem;
}

.nav a {
  font-size: 0.73rem;
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-60);
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  width: 0; height: 1px;
  background: var(--gold);
  transition: width var(--transition);
}

.nav a:hover { color: var(--ink); }
.nav a:hover::after { width: 100%; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  display: block;
  transition: transform var(--transition);
}

@media (max-width: 720px) {
  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--ink-12);
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1rem;
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    box-shadow: 0 8px 24px rgba(13,12,10,0.07);
  }
  .nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav a::after { display: none; }
  .nav-toggle { display: flex; }
}

/* ─── HERO ──────────────────────────────────── */
.hero {
  padding-top: var(--header-h);
  height: 100vh;
  max-height: 720px;
  min-height: 500px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.hero-inner {
  width: 100%;
  max-width: var(--max-w);
  padding: 0 2rem;
  height: 100%;
}

.hero-content {
  display: grid;
  grid-template-columns: 55% 45%;
  height: 100%;
  align-items: stretch;
}

.hero-text {
  padding: 4rem 3.5rem 3.5rem 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--ink-12);
}

.hero-eyebrow {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2rem;
}

.hero-text h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 4.5vw, 4rem);
  font-weight: 400;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 2rem;
}

.hero-lead {
  font-size: 0.97rem;
  color: var(--ink-60);
  line-height: 1.8;
  max-width: 400px;
  margin-bottom: 3rem;
}

.hero-dates {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-30);
  padding-top: 2rem;
  border-top: 1px solid var(--ink-12);
  width: fit-content;
}

.hero-image-wrap {
  position: relative;  /* якорь для абсолютной картинки */
  overflow: hidden;
  background: radial-gradient(ellipse 80% 90% at 60% 100%, var(--paper-dark) 0%, var(--paper) 70%);
  /* align-items: stretch выше даст этой ячейке 100% высоты грида */
}

.hero-image {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  /* Высота = высота враппера (который теперь = высоте грида) */
  height: 100%;
  width: auto;
  max-width: none;
  display: block;
  filter: sepia(4%) contrast(1.03) brightness(1.01);
  transition: transform 0.6s ease;
}

.hero-image-wrap:hover .hero-image {
  transform: translateX(-50%) translateY(-6px) scale(1.02);
}

/* Вигнет: плавный переход слева и сверху */
.hero-image-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right,  var(--paper) 0%, transparent 14%),
    linear-gradient(to bottom, var(--paper) 0%, transparent 10%);
  z-index: 1;
  pointer-events: none;
}

/* Декоративная вертикальная линия по левому краю колонки */
.hero-image-wrap::after {
  content: '';
  position: absolute;
  left: 0; top: 15%; bottom: 15%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--ink-12) 30%, var(--ink-12) 70%, transparent);
  pointer-events: none;
}

@media (max-width: 720px) {
  .hero {
    height: auto;
    max-height: none;
    min-height: auto;
  }
  .hero-content {
    grid-template-columns: 1fr;
  }
  .hero-text {
    padding: 4rem 1.75rem 3rem;
    border-right: none;
    border-bottom: 1px solid var(--ink-12);
  }
  .hero-image-wrap {
    height: 340px;  /* явная высота на мобиле — абсолютная картинка от неё */
  }
  .hero-lead { max-width: 100%; }
}

/* ─── STATS STRIP ───────────────────────────── */
.stats-strip {
  background: var(--ink);
  display: flex;
  justify-content: center;
}

.stats-inner {
  width: 100%;
  max-width: var(--max-w);
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stat-item {
  padding: 1.5rem 1.5rem;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}
.stat-item:last-child { border-right: none; }

.stat-number {
  font-family: var(--serif);
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 400;
  line-height: 1;
  color: #dfc99a;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .stats-inner {
    grid-template-columns: 1fr;
    padding: 0;
  }
  .stat-item {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .stat-item:last-child { border-bottom: none; }
}

/* ─── SECTIONS ──────────────────────────────── */
.section {
  padding: var(--space-lg) var(--space);
}

.section-alt {
  background: var(--paper-mid);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

.container-narrow {
  max-width: var(--max-w-narrow);
}

.section-eyebrow {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-eyebrow::after {
  content: '';
  width: 32px;
  height: 1px;
  background: var(--gold);
  opacity: 0.4;
}

.section-title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 2.8vw, 2.4rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 2.5rem;
}

/* ─── PREFACE ───────────────────────────────── */
.preface-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  align-items: start;
}

.preface-pull {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--gold);
  padding-left: 1.5rem;
  border-left: 2px solid var(--gold);
  position: sticky;
  top: calc(var(--header-h) + 2rem);
}

.prose p {
  color: var(--ink-60);
  margin-bottom: 1.1rem;
  font-size: 0.97rem;
}
.prose p:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .preface-grid { grid-template-columns: 1fr; gap: 2rem; }
  .preface-pull { position: static; }
}

/* ─── TABS ──────────────────────────────────── */
.tabs-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--ink-12);
  overflow-x: auto;
}

.tab-btn {
  padding: 0.7rem 1.4rem;
  font-family: var(--sans);
  font-size: 0.73rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-60);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.tab-pane {
  display: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tab-pane.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: tabIn 0.3s ease forwards;
}

@keyframes tabIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── CARDS ─────────────────────────────────── */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--ink-12);
  padding: 1.75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: rgba(138, 108, 58, 0.28);
  box-shadow: 0 6px 28px rgba(13, 12, 10, 0.06);
}

.card h4 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--ink-60);
  line-height: 1.65;
  margin-bottom: 1.4rem;
}

.btn-card {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: border-color var(--transition), color var(--transition);
}

.btn-card:hover {
  color: var(--gold-hover);
  border-bottom-color: var(--gold-hover);
}

.btn-card-icon {
  font-size: 0.85rem;
  opacity: 0.8;
  line-height: 1;
}

/* ─── TABLES ────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--ink-12);
}

.table-wrap table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-wrap th {
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.42);
  white-space: nowrap;
}

.table-wrap td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--ink-12);
  color: var(--ink-60);
  vertical-align: top;
}

.table-wrap tbody tr:last-child td {
  border-bottom: none;
}

.table-wrap tbody tr:hover td {
  background: var(--gold-soft);
  color: var(--ink);
}

.table-wrap td a {
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 400;
  white-space: nowrap;
}

.table-wrap td a:hover {
  color: var(--gold-hover);
  text-decoration: underline;
}

.table-scroll {
  max-height: 65vh;
  overflow-y: auto;
}

.mt { margin-top: var(--space); }

.link {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.link:hover { color: var(--gold-hover); text-decoration: underline; }

.muted { color: var(--ink-60); font-size: 0.9rem; margin-bottom: 1.25rem; }

/* ─── GALLERY ───────────────────────────────── */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-60);
  background: transparent;
  border: 1px solid var(--ink-12);
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  color: var(--ink);
  border-color: var(--ink-30);
}

.filter-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 3px;
}

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--paper-dark);
  position: relative;
  display: block;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(6%) contrast(1.04);
  transition: transform 0.45s ease, filter 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.07);
  filter: sepia(0%) contrast(1.05);
}

.gallery-item.hidden {
  display: none;
}

.gallery-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 0.7rem 0.85rem;
  background: linear-gradient(transparent, rgba(13, 12, 10, 0.78));
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gallery-item:hover .gallery-label {
  opacity: 1;
}

/* ─── CONTACT ───────────────────────────────── */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 5rem;
  align-items: start;
}

.contact-info-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.6rem;
}

.contact-email {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0;
  display: inline-block;
}

.contact-email:hover {
  color: var(--gold);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-12);
  padding: 0.9rem 0;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: var(--ink-30);
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-bottom-color: var(--gold);
}

.contact-form textarea {
  resize: vertical;
  min-height: 110px;
  margin-top: 1.5rem;
}

.contact-form .btn {
  margin-top: 2rem;
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: none;
  padding: 0.9rem 2.5rem;
  cursor: pointer;
  width: fit-content;
  transition: background var(--transition);
}

.contact-form .btn:hover {
  background: var(--gold);
}

.form-message {
  margin-top: 1rem;
  font-size: 0.88rem;
}

.form-success { color: var(--gold); }
.form-error   { color: #a33; }
.form-message[hidden] { display: none; }

@media (max-width: 620px) {
  .contact-layout { grid-template-columns: 1fr; gap: 3rem; }
  .form-row { grid-template-columns: 1fr; }
}

/* ─── FOOTER ────────────────────────────────── */
.footer {
  background: var(--ink);
  padding: 2.5rem var(--space);
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer p {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.28);
}

/* ─── LIGHTBOX ──────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(13, 12, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space);
  animation: lightboxIn 0.2s ease;
}

@keyframes lightboxIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox[hidden] { display: none; }

.lightbox-close {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  width: 40px; height: 40px;
  font-size: 1.6rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color var(--transition), background var(--transition);
}

.lightbox-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  animation: lightboxScale 0.25s ease;
}

@keyframes lightboxScale {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
}

.lightbox-content video {
  max-width: 90vw;
  max-height: 90vh;
}

#lightbox-video { display: none; }

.lightbox.is-video #lightbox-img   { display: none; }
.lightbox.is-video #lightbox-video { display: block; }

/* ─── SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--ink-12); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-30); }
