@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");
@import "./tokens.css";

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 130% 85% at 50% -20%, rgba(90, 148, 180, 0.36), transparent 58%),
    radial-gradient(ellipse 90% 55% at 100% 0%, rgba(168, 136, 68, 0.1), transparent 50%),
    radial-gradient(ellipse 70% 40% at 0% 30%, rgba(168, 136, 104, 0.08), transparent 45%),
    linear-gradient(180deg, #c5d6e4 0%, var(--bg) 40%, #d8d4cc 100%);
  background-attachment: scroll;
  -webkit-font-smoothing: antialiased;
}

/* fixed-фон на десктопе; на iOS/Android fixed часто лагает */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  body {
    background-attachment: fixed;
  }
}

/* Контент поверх облаков */
main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* Облака только в верхней зоне страницы — при скролле вниз уходят */
.sky-clouds {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: min(720px, 85vh);
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
}

.sky-clouds span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 1;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 255, 255, 0.7) 32%,
    rgba(255, 255, 255, 0.28) 52%,
    rgba(255, 255, 255, 0) 70%
  );
}

.sky-clouds span:nth-child(1) {
  width: min(760px, 82vw);
  height: min(300px, 36vw);
  top: 1%;
  left: -8%;
  filter: blur(30px);
}

.sky-clouds span:nth-child(2) {
  width: min(600px, 68vw);
  height: min(240px, 30vw);
  top: 8%;
  right: -10%;
  filter: blur(28px);
  background: radial-gradient(
    ellipse at 45% 55%,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(230, 243, 250, 0.65) 36%,
    rgba(255, 255, 255, 0) 68%
  );
}

.sky-clouds span:nth-child(3) {
  width: min(680px, 74vw);
  height: min(250px, 32vw);
  top: 32%;
  left: 14%;
  filter: blur(34px);
  opacity: 0.85;
}

/* Нижние облака убраны — не мешают при прокрутке */
.sky-clouds span:nth-child(4),
.sky-clouds span:nth-child(5) {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .sky-clouds span:nth-child(1) {
    animation: cloudDriftA 42s ease-in-out infinite alternate;
  }
  .sky-clouds span:nth-child(2) {
    animation: cloudDriftB 50s ease-in-out infinite alternate;
  }
  .sky-clouds span:nth-child(3) {
    animation: cloudDriftC 58s ease-in-out infinite alternate;
  }
}

@keyframes cloudDriftA {
  from { transform: translate(0, 0); }
  to { transform: translate(3vw, 1.2vh); }
}

@keyframes cloudDriftB {
  from { transform: translate(0, 0); }
  to { transform: translate(-2.8vw, 1.6vh); }
}

@keyframes cloudDriftC {
  from { transform: translate(0, 0); }
  to { transform: translate(2.2vw, -1vh); }
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--space-3);
}

h1 {
  font-size: var(--fs-h1);
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0;
}

p {
  margin: 0 0 var(--space-4);
  color: var(--ink-soft);
}

p:last-child {
  margin-bottom: 0;
}

.lead {
  font-size: 1.2rem;
  color: var(--ink-soft);
}

.muted {
  color: var(--ink-muted);
}

.micro {
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2rem, var(--max-narrow));
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  background: rgba(228, 235, 241, 0.88);
  border-bottom: 1px solid var(--stroke);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--ink);
}

.brand__mark {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__mark span {
  color: var(--gold);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--stroke-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

.nav a:not(.btn) {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: var(--fs-small);
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
}

.nav a:not(.btn):hover {
  background: var(--bg-muted);
  color: var(--ink);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--stroke-strong);
}

.btn--secondary:hover {
  background: var(--bg-elevated);
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  padding-inline: 0.75rem;
}

.btn--ghost:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.btn--bronze,
.btn--gold {
  background: var(--gold);
  color: #fff;
}

.btn--bronze:hover,
.btn--gold:hover {
  background: var(--gold-hover);
  color: #fff;
}

.btn--sand {
  background: var(--sand);
  color: #fff;
}

.btn--sand:hover {
  background: var(--sand-hover);
  color: #fff;
}

.btn--sky {
  background: var(--sky-deep);
  color: #fff;
}

.btn--sky:hover {
  background: #3d7699;
  color: #fff;
}

.btn--block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Surfaces */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-soft);
}

.panel--deep {
  background: var(--bg-elevated);
  color: var(--ink);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-soft);
}

.panel--deep h2,
.panel--deep h3,
.panel--deep .display {
  color: var(--ink);
}

.panel--deep p,
.panel--deep .muted {
  color: var(--ink-soft);
}

.section {
  padding: var(--space-7) 0;
}

.section--tight {
  padding: var(--space-6) 0;
}

.divider {
  height: 1px;
  background: var(--stroke);
  border: 0;
  margin: var(--space-5) 0;
}

/* Forms */
label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.field {
  margin-bottom: var(--space-4);
}

.field hint,
.hint {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--fs-small);
  color: var(--ink-muted);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--stroke-strong);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--sky-deep);
  box-shadow: 0 0 0 3px rgba(126, 182, 217, 0.28);
}

.grid-2 {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--stroke);
  padding: var(--space-6) 0 var(--space-7);
  margin-top: var(--space-7);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  color: var(--ink-muted);
  font-size: var(--fs-small);
}

.site-footer__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.footer-social__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
  background: var(--bg-elevated);
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease,
    transform 0.15s ease;
}

.footer-social__link--dzen {
  width: auto;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.65rem;
  gap: 0.35rem;
  border-radius: 999px;
}

.footer-social__name {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1;
}

.footer-social__link:hover {
  transform: translateY(-1px);
}

.footer-social__link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.footer-social__link svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  flex-shrink: 0;
}

.footer-social__link--dzen svg {
  width: 1.05rem;
  height: 1.05rem;
}

.footer-social__link--tg:hover {
  color: #2aabee;
  border-color: rgba(42, 171, 238, 0.45);
  background: #eef8fd;
}

.footer-social__link--vk:hover {
  color: #0077ff;
  border-color: rgba(0, 119, 255, 0.4);
  background: #eef5ff;
}

.footer-social__link--dzen:hover {
  color: #1a1a1a;
  border-color: rgba(26, 26, 26, 0.35);
  background: #f3f3f3;
}

/* Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack--sm {
  gap: var(--space-2);
}

.hide-mobile {
  display: none;
}

@media (min-width: 800px) {
  .hide-mobile {
    display: inline-flex;
  }
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .fade-up {
    animation: fadeUp 0.7s var(--ease) both;
  }

  .fade-up-delay {
    animation: fadeUp 0.8s var(--ease) 0.12s both;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
