:root {
  --bg: #070b12;
  --bg-2: #0e1522;
  --fg: #f2f5fa;
  --muted: #8b95a8;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #3de0c5;
  --accent-2: #5b8cff;
  --accent-ink: #04120f;
  --card: rgba(14, 21, 34, 0.92);
  --radius: 14px;
  --font: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --display: "Syne", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --page-x: clamp(1rem, 4vw, 1.5rem);
  --page-max: 52rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

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

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Earth trial — откат: убрать url("/earth-bg.jpg") и тёмный linear-gradient над ним */
  background:
    linear-gradient(180deg, rgba(7, 11, 18, 0.78) 0%, rgba(7, 11, 18, 0.52) 48%, rgba(6, 9, 16, 0.88) 100%),
    url("/earth-bg.jpg") center 82% / cover no-repeat,
    linear-gradient(180deg, var(--bg), var(--bg-2) 45%, #060910);
  color: var(--fg);
  font-family: var(--font);
}

body.modal-open {
  overflow: hidden;
  touch-action: none;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.top,
main,
.foot {
  position: relative;
  z-index: 1;
}

main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  padding:
    calc(0.85rem + var(--safe-top))
    calc(var(--page-x) + var(--safe-right))
    0
    calc(var(--page-x) + var(--safe-left));
}

.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  color: var(--fg);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.logo span {
  color: var(--accent);
}

.top-link,
.linkish {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.65rem 0.35rem;
  min-height: 44px;
  transition: color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.top-link:hover,
.linkish:hover {
  color: var(--fg);
}

.hero {
  flex: 1 1 auto;
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  padding:
    1rem
    calc(var(--page-x) + var(--safe-right))
    1rem
    calc(var(--page-x) + var(--safe-left));
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.25rem;
  min-height: 1.4rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.eyebrow .prompt {
  opacity: 0.7;
}

.caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  margin-left: 1px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

h1 {
  margin: 0 0 1.25rem;
  font-family: var(--display);
  font-size: clamp(2.15rem, 7vw, 4.2rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.045em;
  overflow-wrap: break-word;
}

h1 .line {
  display: block;
}

h1 .word {
  display: inline-block;
  margin-right: 0.28em;
}

h1 .word:last-child {
  margin-right: 0;
}

.accent-line {
  display: block;
}

.mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  max-width: 100%;
}

.mask-inner {
  display: inline-block;
  background: linear-gradient(105deg, var(--accent) 0%, #9af0e2 45%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin: 0 0 2rem;
  max-width: 34rem;
  color: var(--fg);
  font-size: clamp(1.02rem, 2.2vw, 1.2rem);
  line-height: 1.65;
}

.rotate {
  display: inline-grid;
  font-weight: 600;
  color: var(--accent);
}

.rotate > span {
  grid-area: 1 / 1;
  color: inherit;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 1.35rem;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  background: #62ebcf;
}

.btn.primary:active {
  background: #2bc9b0;
}

.btn-arrow {
  display: inline-block;
  transition: transform 0.2s var(--ease);
}

.btn.primary:hover .btn-arrow {
  transform: translateX(3px);
}

.hero-aside {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.aside-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  line-height: 1.25;
}

.aside-main {
  color: var(--fg);
}

.aside-note {
  font-size: 0.78em;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.status-dot {
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.35em;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55);
  animation: status-pulse 2.2s ease-out infinite;
}

@keyframes status-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45);
  }
  70% {
    box-shadow: 0 0 0 0.55rem rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.foot {
  display: block;
  flex: 0 0 auto;
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  padding:
    0.5rem
    calc(var(--page-x) + var(--safe-right))
    calc(1rem + var(--safe-bottom))
    calc(var(--page-x) + var(--safe-left));
  color: var(--muted);
  font-size: 0.85rem;
}

.foot-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin: 0;
  width: 100%;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.foot-line::-webkit-scrollbar {
  display: none;
}

.foot-name {
  color: var(--fg);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.foot-copy {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--muted);
}

.foot-sep {
  opacity: 0.45;
  flex-shrink: 0;
}

.foot-legal {
  margin: 0;
  line-height: 1.4;
  color: var(--muted);
  font-size: 0.82rem;
}

.foot-legal-link {
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  flex-shrink: 0;
}

.foot-legal-link:hover {
  color: var(--fg);
}

/* Modal — cosmic, no borders */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding:
    calc(0.85rem + var(--safe-top))
    calc(0.85rem + var(--safe-right))
    calc(0.85rem + var(--safe-bottom))
    calc(0.85rem + var(--safe-left));
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 120%, rgba(61, 224, 197, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(91, 140, 255, 0.2), transparent 50%),
    radial-gradient(ellipse 50% 35% at 90% 20%, rgba(167, 139, 250, 0.12), transparent 45%),
    rgba(2, 4, 10, 0.78);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  animation: backdrop-in 0.45s var(--ease);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(30rem, 100%);
  max-height: min(92dvh, 42rem);
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: transparent;
  isolation: isolate;
  animation: panel-in 0.55s var(--ease);
}

.modal-cosmos {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 20% 0%, rgba(61, 224, 197, 0.22), transparent 50%),
    radial-gradient(ellipse 80% 60% at 100% 30%, rgba(91, 140, 255, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 50% at 40% 100%, rgba(120, 80, 220, 0.18), transparent 50%),
    linear-gradient(165deg, rgba(10, 16, 28, 0.92), rgba(6, 10, 18, 0.88));
}

.modal-cosmos::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 28%, transparent 70%, rgba(0, 0, 0, 0.25));
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.7;
  animation: orb-drift 10s ease-in-out infinite alternate;
}

.orb-a {
  width: 180px;
  height: 180px;
  top: -40px;
  left: -30px;
  background: rgba(61, 224, 197, 0.45);
}

.orb-b {
  width: 220px;
  height: 220px;
  right: -60px;
  top: 30%;
  background: rgba(91, 140, 255, 0.4);
  animation-duration: 14s;
  animation-delay: -2s;
}

.orb-c {
  width: 160px;
  height: 160px;
  left: 30%;
  bottom: -50px;
  background: rgba(180, 120, 255, 0.28);
  animation-duration: 12s;
  animation-delay: -4s;
}

.starfield {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 28% 62%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 48% 22%, #fff, transparent),
    radial-gradient(1px 1px at 66% 44%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 82% 16%, #fff, transparent),
    radial-gradient(1px 1px at 88% 72%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 18% 84%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1.5px 1.5px at 55% 78%, #fff, transparent),
    radial-gradient(1px 1px at 73% 88%, rgba(255, 255, 255, 0.65), transparent);
  animation: stars-twinkle 4.5s ease-in-out infinite alternate;
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes orb-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(14px, -10px) scale(1.08); }
}

@keyframes stars-twinkle {
  from { opacity: 0.35; }
  to { opacity: 0.65; }
}

.modal-body {
  position: relative;
  z-index: 1;
  padding: 1.75rem 1.5rem 1.5rem;
  max-height: min(92dvh, 42rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.12);
}

.contact-head {
  margin-bottom: 1.35rem;
  padding-right: 1.75rem;
}

.contact-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

#contact-form {
  display: grid;
  gap: 0.75rem;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field {
  position: relative;
}

.field input,
.field textarea {
  width: 100%;
  padding: 1.25rem 0.95rem 0.55rem;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font: inherit;
  font-size: 16px; /* iOS zoom fix */
  outline: none;
  transition: background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field textarea {
  resize: vertical;
  min-height: 5.5rem;
  line-height: 1.5;
}

.field label {
  position: absolute;
  left: 0.95rem;
  top: 0.95rem;
  color: var(--muted);
  font-size: 0.92rem;
  pointer-events: none;
  transition: transform 0.2s var(--ease), font-size 0.2s var(--ease), color 0.2s var(--ease);
  transform-origin: left top;
}

.field input:focus,
.field textarea:focus,
.field input:not(:placeholder-shown),
.field textarea:not(:placeholder-shown) {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 -1px 0 rgba(61, 224, 197, 0.55);
}

.field input:focus + label,
.field textarea:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:not(:placeholder-shown) + label {
  transform: translateY(-0.5rem);
  font-size: 0.68rem;
  color: var(--accent);
}

.field.is-invalid input,
.field.is-invalid textarea {
  box-shadow: inset 0 -1px 0 rgba(251, 113, 133, 0.85);
  background: rgba(251, 113, 133, 0.06);
}

.field.is-invalid input:focus,
.field.is-invalid textarea:focus {
  box-shadow: inset 0 -1px 0 rgba(251, 113, 133, 0.95);
}

.field-error {
  margin: 0.35rem 0.15rem 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #fb7185;
}

.field-area .counter {
  position: absolute;
  right: 0.75rem;
  bottom: 0.55rem;
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.55;
}

.field-area.is-invalid .counter {
  bottom: 1.55rem;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  cursor: pointer;
}

.consent input {
  margin-top: 0.2rem;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.consent a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent a:hover {
  color: #9af0e2;
}

.consent-error {
  margin-top: 0;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.35rem;
}

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

.form-note[data-ok="1"] {
  color: #4ade80;
}

.form-note[data-ok="0"] {
  color: #fb7185;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.logo,
.eyebrow,
h1 .word,
.mask-inner,
.lead,
.hero-actions,
.foot {
  will-change: transform, opacity;
}

/* —— Tablet —— */
@media (max-width: 1023px) {
  h1 {
    font-size: clamp(2.1rem, 5.5vw, 3.2rem);
  }

  .modal-panel {
    width: min(32rem, 100%);
  }
}

/* —— Mobile —— */
@media (max-width: 639px) {
  :root {
    --page-x: 1.1rem;
  }

  .top {
    padding-top: calc(0.75rem + var(--safe-top));
  }

  .logo {
    font-size: 1.2rem;
  }

  html,
  body {
    min-height: 100dvh;
    height: auto;
    overflow: auto;
  }

  .hero {
    justify-content: center;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
  }

  .eyebrow {
    font-size: 0.82rem;
    margin-bottom: 0.85rem;
  }

  h1 {
    font-size: clamp(1.9rem, 9vw, 2.45rem);
    margin-bottom: 0.85rem;
    letter-spacing: -0.035em;
  }

  .lead {
    margin-bottom: 1.85rem;
    font-size: 1.02rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hero-aside {
    justify-content: center;
    text-align: center;
    font-size: 0.86rem;
  }

  .foot {
    padding-top: 0.5rem;
    padding-bottom: calc(1rem + var(--safe-bottom));
  }

  .foot-line {
    font-size: 0.78rem;
    gap: 0.3rem 0.4rem;
  }

  .foot-legal {
    font-size: 0.76rem;
  }

  .modal {
    align-items: end;
    padding-left: calc(0.65rem + var(--safe-left));
    padding-right: calc(0.65rem + var(--safe-right));
    padding-bottom: calc(0.65rem + var(--safe-bottom));
  }

  .modal-panel {
    width: 100%;
    max-height: min(88dvh, 100%);
    border-radius: 20px 20px 16px 16px;
    animation-name: panel-in-mobile;
  }

  @keyframes panel-in-mobile {
    from {
      opacity: 0;
      transform: translateY(24px);
      filter: blur(4px);
    }
    to {
      opacity: 1;
      transform: none;
      filter: none;
    }
  }

  .modal-body {
    padding: 1.35rem 1.15rem 1.15rem;
    max-height: min(88dvh, 100%);
  }

  .contact-head h2 {
    font-size: 1.35rem;
  }

  .form-row .btn {
    width: 100%;
  }

  .orb {
    opacity: 0.45;
    filter: blur(22px);
  }
}

/* —— Small phones —— */
@media (max-width: 379px) {
  h1 {
    font-size: 1.75rem;
  }

  .eyebrow {
    font-size: 0.76rem;
  }
}

/* —— Desktop: one viewport, no page scroll —— */
@media (min-width: 1024px) {
  html,
  body {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  h1 {
    margin-bottom: 0.85rem;
    font-size: clamp(2.4rem, 4.5vw, 3.75rem);
  }

  .lead {
    margin-bottom: 1.25rem;
  }

  .eyebrow {
    margin-bottom: 0.85rem;
  }

  .hero {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #bg,
  .noise {
    display: none;
  }

  .caret,
  .status-dot {
    animation: none;
  }

  .modal-panel,
  .modal-backdrop,
  .orb,
  .starfield {
    animation: none;
  }

  .btn,
  .btn-arrow,
  .field label {
    transition: none;
  }
}

html.no-gsap .mask-inner,
html.no-gsap h1 .word,
html.no-gsap .logo,
html.no-gsap .eyebrow,
html.no-gsap .lead,
html.no-gsap .hero-actions,
html.no-gsap .foot,
html.no-gsap .top-link {
  opacity: 1 !important;
  transform: none !important;
}
