/* Main Code — «Сайт в разработке» (Night Impulse) */

@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --mc-background: #0e1112;
  --mc-text: #f4eee5;
  --mc-text-soft: #e9e0d4;
  --mc-text-muted: #cabdaf;
  --mc-copper: #d9a16c;
  --mc-action: #e6a458;
  --mc-action-hover: #f0b572;
  --mc-action-text: #161311;
  --mc-border: #6b5847;
  --mc-focus: #f4eee5;
  --mc-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mc-size-heading: clamp(2.5rem, 5.85vw, 6rem);
  --mc-size-body: clamp(1rem, 1.55vw, 1.5rem);
  --mc-size-contact: clamp(0.9375rem, 1.1vw, 1.125rem);
  --mc-page-gutter: clamp(1.5rem, 4.5vw, 4.5rem);
  --mc-duration: 180ms;
  --mc-ease: cubic-bezier(.2, .7, .2, 1);
  --mc-ease-out: cubic-bezier(.16, 1, .3, 1);
}

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

html {
  background: var(--mc-background);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--mc-background);
  color: var(--mc-text);
  font-family: var(--mc-font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

/* ---------- Page & background ---------- */

.page {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

.night-background {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  pointer-events: none;
  animation: bg-in 1.6s var(--mc-ease-out) both;
}

.night-background img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 62%;
}

/* Keeps the header and contacts readable wherever cover-cropping lands the threads. */
.night-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgb(14 17 18 / 0.6) 0%, rgb(14 17 18 / 0) 14%),
    linear-gradient(to top, rgb(14 17 18 / 0.92) 0%, rgb(14 17 18 / 0.55) 9%, rgb(14 17 18 / 0) 22%);
}

/* ---------- Header ---------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.5rem, 4.6vh, 3rem) var(--mc-page-gutter) 0;
  padding-top: max(clamp(1.5rem, 4.6vh, 3rem), env(safe-area-inset-top));
}

.brand {
  display: block;
  border-radius: 4px;
}

.brand img {
  display: block;
  width: clamp(158px, 13.6vw, 216px);
  height: auto;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  font-size: clamp(0.9375rem, 1.3vw, 1.3125rem);
  white-space: nowrap;
}

.status-dot {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--mc-copper);
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: -0.3rem;
  border: 1px solid var(--mc-copper);
  border-radius: 50%;
  opacity: 0;
  animation: status-ring 2.8s var(--mc-ease-out) 1.2s infinite;
}

/* ---------- Intro ---------- */

.intro {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(3rem, 12.5vh, 9.5rem) var(--mc-page-gutter) clamp(4rem, 14vh, 11rem);
}

.intro-title {
  margin: 0;
  font-size: var(--mc-size-heading);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
  animation: rise 0.9s var(--mc-ease-out) 0.1s both;
}

.intro-lead {
  max-width: 40em;
  margin: clamp(1.1rem, 2.8vh, 1.9rem) 0 0;
  color: var(--mc-text-soft);
  font-size: var(--mc-size-body);
  line-height: 1.55;
  text-wrap: balance;
  animation: rise 0.9s var(--mc-ease-out) 0.22s both;
}

.nowrap {
  white-space: nowrap;
}

.intro-action {
  margin-top: clamp(1.75rem, 5.4vh, 3.25rem);
  animation: rise 0.9s var(--mc-ease-out) 0.34s both;
}

/* ---------- CTA ---------- */

.mc-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2vw, 2rem);
  min-height: clamp(3.5rem, 4.15vw, 4.25rem);
  padding: 0.85rem clamp(1.4rem, 2.3vw, 2.25rem) 0.85rem clamp(1.75rem, 2.75vw, 2.75rem);
  border: 0;
  border-radius: 999px;
  background: var(--mc-action);
  color: var(--mc-action-text);
  font: 600 clamp(1.0625rem, 1.45vw, 1.4375rem)/1.2 var(--mc-font);
  text-decoration: none;
  transition:
    background-color var(--mc-duration) var(--mc-ease),
    transform var(--mc-duration) var(--mc-ease);
}

.mc-action:hover {
  background: var(--mc-action-hover);
  transform: translateY(-1px);
}

.mc-action:active {
  transform: translateY(0) scale(0.985);
}

.mc-action .mc-icon {
  transition: transform var(--mc-duration) var(--mc-ease);
}

.mc-action:hover .mc-icon {
  transform: translate(2px, -2px);
}

.mc-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--mc-focus);
  outline-offset: 4px;
}

/* ---------- Contacts ---------- */

.contacts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding: 0 var(--mc-page-gutter) clamp(1.5rem, 5.4vh, 3.25rem);
  padding-bottom: max(clamp(1.5rem, 5.4vh, 3.25rem), env(safe-area-inset-bottom));
  font-size: var(--mc-size-contact);
  animation: fade 1.2s var(--mc-ease-out) 0.5s both;
}

.contact {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 2.75rem;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--mc-duration) var(--mc-ease);
}

.contact .mc-icon {
  width: 1.375rem;
  height: 1.375rem;
}

.contact:hover {
  color: var(--mc-copper);
}

.copyright {
  margin: 0;
  white-space: nowrap;
}

/* ---------- Portrait art direction (matches the <source> media query) ---------- */

@media (max-aspect-ratio: 4/5) {
  .night-background img {
    object-position: 50% 58%;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
  /* The mobile artwork is composed for one screen: text on top, threads in the lower third,
     contacts on its clean dark bottom edge. Short screens scroll onto the plain dark field. */
  .night-background {
    bottom: auto;
    height: 100vh;
    height: 100svh;
  }

  .night-background img {
    object-position: 50% 100%;
  }

  .night-background::after {
    background:
      linear-gradient(to bottom, rgb(14 17 18 / 0.5) 0%, rgb(14 17 18 / 0) 12%),
      linear-gradient(to top, rgb(14 17 18) 0%, rgb(14 17 18 / 0) 14%);
  }

  .topbar {
    gap: 1rem;
  }

  .intro {
    padding-top: clamp(2.75rem, 10vh, 5rem);
    padding-bottom: 3rem;
  }

  .intro-title {
    font-size: clamp(2.5rem, 11.5vw, 3.25rem);
  }

  .intro-lead {
    font-size: 1.0625rem;
  }

  .br-wide {
    display: none;
  }

  .intro-action {
    width: 100%;
    max-width: 22rem;
  }

  .contacts {
    gap: 0 1.25rem;
    font-size: 0.9375rem;
  }

  .contact {
    gap: 0.6rem;
  }

  .copyright {
    color: var(--mc-text-muted);
    font-size: 0.875rem;
  }
}

@media (max-width: 767px) and (max-height: 700px) {
  .intro {
    padding-top: 2rem;
  }

  .intro-lead {
    margin-top: 0.9rem;
  }

  .intro-action {
    margin-top: 1.5rem;
  }
}

@media (max-width: 359px) {
  .status {
    font-size: 0.875rem;
  }

  .brand img {
    width: 140px;
  }
}

/* ---------- Motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@keyframes bg-in {
  from {
    opacity: 0;
    transform: scale(1.03);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes status-ring {
  0% {
    opacity: 0.7;
    transform: scale(0.5);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .mc-action:hover,
  .mc-action:hover .mc-icon {
    transform: none;
  }
}
