/* ============================================================
   Карточный Дом — design tokens
   ============================================================ */
:root {
  --noir: #170608;
  --bordeaux: #3B0F14;
  --bordeaux-2: #2A0B10;
  --garnet: #7B0F1A;
  --brass: #C8A86D;
  --brass-dim: #9C8558;
  --ivory: #F2E8D9;
  --ash: #9C8E7C;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  --section-pad: clamp(40px, 5vw, 88px);
  --content-w: 720px;
  --content-w-wide: 960px;
  --rule: 1px solid rgba(200, 168, 109, 0.35);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--noir);
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul, figure { margin: 0; }
h1, h2, h3 { text-transform: uppercase; }

.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;
}
ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 1.5px solid var(--brass);
  outline-offset: 3px;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brass);
  text-align: center;
  margin-bottom: 20px;
}

.crest { width: 26px; height: 45px; overflow: visible; }
.crest--small { width: 23px; height: 40px; }
.crest--hero { width: 46px; height: 80px; margin: 0 auto 28px; }

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 16px 40px;
  border: 1px solid var(--brass);
  color: var(--ivory);
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}
.btn--ghost:hover, .btn--ghost:focus-visible { background: var(--brass); color: var(--noir); }

/* ============================================================
   GATE
   ============================================================ */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 38%, var(--bordeaux-2) 0%, var(--noir) 72%);
  transition: opacity 0.9s var(--ease), visibility 0.9s var(--ease);
}
.gate[data-open="true"] { opacity: 0; visibility: hidden; pointer-events: none; }

.gate__inner {
  text-align: center;
  padding: 24px;
}

.gate__eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 28px;
}

.gate__keyhole {
  position: relative;
  width: min(56vw, 260px);
  height: min(78vw, 364px);
  display: block;
  margin: 0 auto;
}
.gate__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.gate__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.92);
  clip-path: url(#keyhole-clip-frac);
  background: var(--noir);
}
.gate__frame {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.4;
}
.gate__frame rect { fill: var(--brass); stroke: none; }
.gate__frame circle, .gate__frame path { filter: drop-shadow(0 0 6px rgba(200, 168, 109, 0.25)); }

.gate__keyhole {
  animation: gate-breathe 5s ease-in-out infinite;
}
@keyframes gate-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}
@media (prefers-reduced-motion: reduce) {
  .gate__keyhole { animation: none; }
}

.gate__arrow {
  display: block;
  margin: 22px auto 0;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--brass);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: gate-arrow-bounce 1.8s ease-in-out infinite;
}
@keyframes gate-arrow-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-5px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .gate__arrow { animation: none; opacity: 0.85; }
}

.gate__whisper {
  margin-top: 12px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(16px, 2.4vw, 20px);
  color: var(--ivory);
}
.gate__hint {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ash);
}

/* ---- Close: the gate darkens to black, then fades out to reveal the site ---- */
.gate__veil {
  position: absolute;
  inset: 0;
  background: var(--noir);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.gate[data-stage="closing"] .gate__veil {
  opacity: 1;
}

/* ============================================================
   Site reveal
   ============================================================ */
.site { opacity: 0; transition: opacity 0.6s var(--ease) 0.15s; }
.site[data-visible="true"] { opacity: 1; }

/* ============================================================
   Header / Nav
   ============================================================ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 61;
  padding: 22px 32px;
  background: linear-gradient(to bottom, rgba(23,6,8,0.85), transparent);
  transition: background-color 0.4s var(--ease), padding 0.4s var(--ease), border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.header[data-scrolled="true"] {
  background: rgba(23, 6, 8, 0.92);
  backdrop-filter: blur(6px);
  padding: 14px 32px;
  border-bottom-color: rgba(200, 168, 109, 0.2);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 4vw, 56px);
  max-width: 1100px;
  margin: 0 auto;
}
.nav__link {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ash);
  transition: color 0.25s var(--ease);
}
.nav__link:hover, .nav__link:focus-visible { color: var(--ivory); }
.nav__mark { color: var(--brass); flex-shrink: 0; }
.nav__cta {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--brass);
  padding: 10px 22px;
  color: var(--ivory);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.nav__cta:hover, .nav__cta:focus-visible { background: var(--brass); color: var(--noir); }

.nav__burger {
  display: none;
  position: fixed;
  top: 22px; right: 24px;
  z-index: 60;
  width: 32px; height: 24px;
  flex-direction: column;
  justify-content: space-between;
}
.nav__burger span {
  display: block;
  height: 1px;
  background: var(--brass);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(11.5px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-11.5px) rotate(-45deg); }

.nav__mobile {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--noir);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transform: translateY(-100%);
  transition: transform 0.45s var(--ease);
}
.nav__mobile[data-open="true"] { transform: translateY(0); }
.nav__mobile a { font-family: var(--font-display); font-size: 22px; color: var(--ivory); }
.nav__cta--mobile { border: 1px solid var(--brass); padding: 12px 28px; font-family: var(--font-body); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 88svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 60px;
}
.hero__word { line-height: 0; }
.hero__wordmark {
  width: min(88vw, 620px);
  height: auto;
  display: block;
  margin: 0 auto;
}
.hero__tagline {
  margin-top: 22px;
  font-size: 13px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass);
}
.hero__sub {
  margin-top: 18px;
  max-width: 34ch;
  font-size: 16px;
  color: var(--ash);
}
.hero .btn { margin-top: 44px; }

/* ---- Hero entrance (bloom out of the gate's darkness) ---- */
.hero__wordmark,
.crest--hero {
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease), filter 1.1s var(--ease);
}
.hero__tagline,
.hero__sub {
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.hero .btn {
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.hero--enter .hero__wordmark,
.hero--enter .crest--hero {
  opacity: 0;
  transform: scale(0.82);
  filter: blur(10px);
}
.hero--enter .hero__tagline,
.hero--enter .hero__sub,
.hero--enter .btn {
  opacity: 0;
  transform: translateY(14px);
}
.hero--enter.hero--enter-active .hero__wordmark,
.hero--enter.hero--enter-active .crest--hero {
  opacity: 1;
  transform: none;
  filter: blur(0);
}
.hero--enter.hero--enter-active .hero__tagline,
.hero--enter.hero--enter-active .hero__sub,
.hero--enter.hero--enter-active .btn {
  opacity: 1;
  transform: none;
}
.hero--enter-active .hero__tagline { transition-delay: 0.3s; }
.hero--enter-active .hero__sub { transition-delay: 0.45s; }
.hero--enter-active .btn { transition-delay: 0.6s; }

/* ============================================================
   Reveal-on-scroll
   ============================================================ */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   Manifesto
   ============================================================ */
.manifesto {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: var(--section-pad) 24px;
  text-align: center;
}
.manifesto__rule { height: 1px; background: rgba(200,168,109,0.35); width: 64px; margin: 0 auto 40px; }
.manifesto__rule:last-child { margin: 40px auto 0; }
.manifesto__quote {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ivory);
}
.manifesto__quote em { font-style: italic; color: var(--brass); }
.manifesto__body {
  margin: 28px auto 0;
  max-width: 52ch;
  color: var(--ash);
  font-size: 16px;
}
.manifesto__figure {
  margin: 48px auto 0;
  width: min(280px, 60vw);
  aspect-ratio: 4 / 5;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(200,168,109,0.4);
  box-shadow: 0 0 0 8px var(--noir), 0 0 0 9px rgba(200,168,109,0.18);
}
.manifesto__figure .ambient-media { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   Panels (shared framing system)
   ============================================================ */
.panel {
  position: relative;
  border: var(--rule);
  padding: 40px 32px;
  text-align: center;
}
.panel::before, .panel::after,
.frame-corners::before, .frame-corners::after {
  content: '';
  position: absolute;
  width: 7px; height: 7px;
  border: 1px solid var(--brass);
  transform: rotate(45deg);
}
.panel::before { top: -4px; left: -4px; }
.panel::after { bottom: -4px; right: -4px; }
.panel__mark { display: block; color: var(--garnet); font-size: 20px; margin-bottom: 18px; }
.panel h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--ivory); margin-bottom: 12px; }
.panel p { color: var(--ash); font-size: 14.5px; }

/* ============================================================
   Values
   ============================================================ */
.values { max-width: var(--content-w-wide); margin: 0 auto; padding: var(--section-pad) 24px; }
.values__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: rgba(200,168,109,0.35);
  border: var(--rule);
}
.values__grid .panel { border: none; background: var(--noir); }

/* ============================================================
   Format
   ============================================================ */
.format {
  max-width: var(--content-w-wide);
  margin: 0 auto;
  padding: var(--section-pad) 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: center;
}
.format__text h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 600;
  margin: 16px 0 20px;
  color: var(--ivory);
}
.format__text p { color: var(--ash); max-width: 46ch; }
.format__text .eyebrow { text-align: left; margin-bottom: 0; }
/* ============================================================
   Arch figure (reusable arched image with ornament)
   ============================================================ */
.arch-figure {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  aspect-ratio: 4 / 5;
  border-radius: 140px 140px 8px 8px;
  overflow: hidden;
  border: 1px solid rgba(200,168,109,0.4);
}
.arch-figure .ambient-media { width: 100%; height: 100%; object-fit: cover; }
.arch-figure__ring {
  position: absolute;
  width: 90px; height: 90px;
  bottom: -22px; left: -22px;
  color: var(--brass);
  opacity: 0.7;
  pointer-events: none;
}
.arch-figure__arc {
  position: absolute;
  top: -18px; left: 50%;
  transform: translateX(-50%);
  width: 78%;
  color: var(--brass);
  opacity: 0.75;
  pointer-events: none;
}
.arch-figure--sm { max-width: 220px; }
.arch-figure--xs { max-width: 150px; }

/* ============================================================
   Ornament & pattern dividers
   ============================================================ */
.ornament {
  max-width: var(--content-w-wide);
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  justify-content: center;
}
.ornament svg { width: 100%; max-width: 460px; height: 20px; }


/* ============================================================
   Admission / timeline
   ============================================================ */
.admission { max-width: var(--content-w-wide); margin: 0 auto; padding: var(--section-pad) 24px; text-align: center; }
.admission h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 600;
  margin-bottom: 64px;
  color: var(--ivory);
}
.timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}
.timeline__step {
  position: relative;
  padding-top: 28px;
  border-top: 1px solid var(--brass);
}
.timeline__num {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--brass);
  margin-bottom: 14px;
}
.timeline__step h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ivory); margin-bottom: 10px; }
.timeline__step p { color: var(--ash); font-size: 14.5px; }

/* ============================================================
   Philosophy
   ============================================================ */
.philosophy {
  max-width: var(--content-w-wide);
  margin: 0 auto;
  padding: var(--section-pad) 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.philosophy__line {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(19px, 2.6vw, 26px);
  max-width: 26ch;
  color: var(--ivory);
}
.philosophy__row {
  display: flex;
  align-items: flex-end;
  gap: 28px;
}
.philosophy__row--left { justify-content: flex-start; }
.philosophy__row--left .philosophy__line { text-align: left; }
.philosophy__row--right { justify-content: flex-end; }
.philosophy__row--right .philosophy__line { text-align: right; }
.philosophy__row .arch-figure { flex-shrink: 0; margin: 0; }
.philosophy__row .philosophy__line { margin-bottom: -10px; }

/* ============================================================
   Location
   ============================================================ */
.location { max-width: var(--content-w); margin: 0 auto; padding: var(--section-pad) 24px; text-align: center; }
.location__mark { width: 90px; height: 45px; margin: 0 auto 28px; color: var(--brass); opacity: 0.85; }
.location h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 3.6vw, 34px);
  letter-spacing: 0.04em;
  color: var(--ivory);
  margin-bottom: 16px;
}
.location p { color: var(--ash); }
.location__note {
  margin-top: 14px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(18px, 2.4vw, 22px);
  letter-spacing: 0.01em;
  color: var(--brass);
}

/* ============================================================
   Contact / form
   ============================================================ */
.contact { max-width: 560px; margin: 0 auto; padding: var(--section-pad) 24px; }
.contact__frame {
  position: relative;
  border: var(--rule);
  padding: 56px 40px;
  text-align: center;
}
.contact__frame::before, .contact__frame::after {
  content: '';
  position: absolute;
  width: 9px; height: 9px;
  border: 1px solid var(--brass);
  transform: rotate(45deg);
}
.contact__frame::before { top: -5px; left: -5px; }
.contact__frame::after { bottom: -5px; right: -5px; }
.contact h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 32px);
  font-weight: 600;
  color: var(--ivory);
  margin-bottom: 36px;
}
.form { display: flex; flex-direction: column; gap: 22px; text-align: left; }
.form__field { display: flex; flex-direction: column; gap: 8px; }
.form__field span { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass); }
.form__field input, .form__field textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(200,168,109,0.35);
  padding: 8px 2px;
  color: var(--ivory);
  transition: border-color 0.25s var(--ease);
  resize: vertical;
}
.form__field input:focus, .form__field textarea:focus { border-bottom-color: var(--brass); outline: none; }
.form .btn { align-self: center; margin-top: 12px; }
.form__note { text-align: center; font-size: 12.5px; color: var(--ash); margin-top: 4px; }
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  border-top: var(--rule);
  padding: 56px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}
.footer__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.footer__nav a { font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ash); }
.footer__nav a:hover { color: var(--ivory); }
.footer__telegram { font-size: 13px; color: var(--brass); border-bottom: 1px solid rgba(200,168,109,0.4); padding-bottom: 2px; }
.footer__legal { font-size: 11.5px; color: var(--ash); opacity: 0.7; max-width: 44ch; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .nav { display: none; }
  .nav__burger { display: flex; }
  .format { grid-template-columns: 1fr; text-align: center; }
  .format__text .eyebrow { text-align: center; }
  .format__text p { margin: 0 auto; }
  .philosophy__row { flex-direction: column; justify-content: center; align-items: center; gap: 20px; }
  .philosophy__row--right { flex-direction: column-reverse; }
  .philosophy__row .philosophy__line,
  .philosophy__row--right .philosophy__line { text-align: center; }
}
@media (max-width: 640px) {
  .values__grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; gap: 32px; }
  .header { padding: 18px 20px; }
}
