:root{
    --bg:#0A0A0F;
    --fg:#F4F4F4;
    --muted:#B9B9C0;
    --accent:#FF003C;
    --accent-2:#FF5500;
    --glass-bg: rgba(255,255,255,0.06);
    --glass-brd: rgba(255,0,60,0.35);
    --radius: 18px;
    --blur: 18px;
  }
  
  *{ box-sizing: border-box; }
  html,body{ height:100%; scroll-behavior:smooth; }
  body{
    margin:0;
    background: var(--bg);
    color: var(--fg);
    font: 500 16px/1.6 "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    overflow-x:hidden;
  }
  
  /* Background */
  .bg{ position:fixed; inset:0; z-index:-2; overflow:hidden; }
  #bg-grid{ position:absolute; inset:0; }
  .bg-glow{
    position:absolute; inset:-30%;
    background:
      radial-gradient(60% 60% at 70% 30%, rgba(255,85,0,0.12) 0%, transparent 55%),
      radial-gradient(50% 50% at 30% 70%, rgba(255,0,60,0.10) 0%, transparent 60%);
    filter: blur(50px);
    animation: glow 12s ease-in-out infinite alternate;
  }
  @keyframes glow{
    to{ transform: translate3d(0,-20px,0) scale(1.02); }
  }
  
  /* Sections */
  .section, .hero{ min-height:100svh; display:flex; align-items:center; }
  .wrap{ width:min(1120px, 92vw); margin:0 auto; }
  h1,h2,h3{ margin:0 0 .6rem; line-height:1.15; }
  h1{ font-size: clamp(40px, 7vw, 80px); letter-spacing:.02em; }
  h2{ font-size: clamp(28px, 4vw, 42px); }
  h3{ font-size: 22px; }
  .lead{ margin:.8rem 0 1.6rem; color:var(--muted); font-size:1.05rem; }
  .accent{ color:var(--accent); }
  
  /* Hero */
  .hero{ position:relative; }
  .logo{
    font-weight:800;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip:text; background-clip:text; color:transparent;
    text-shadow: 0 0 24px rgba(255,0,60,.25);
  }
  .cta-row{ display:flex; gap:12px; flex-wrap:wrap; }
/* Unified Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  transition: all .28s ease;
  position: relative;
  overflow: hidden;
}

.btn.glass {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--fg);
  box-shadow:
    0 4px 14px rgba(255,0,60,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.07);
}

.btn.glass:hover {
  border-color: rgba(255,0,60,0.65);
  box-shadow:
    0 0 32px rgba(255,0,60,0.45),
    0 0 12px rgba(255,85,0,0.35),
    inset 0 0 0 1px rgba(255,85,0,0.4);
  transform: translateY(-2px);
}

/* Hover ripple */
.btn.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(255,85,0,0.25), transparent 65%);
  opacity: 0;
  transition: opacity .35s ease;
}

.btn.glass:hover::after {
  opacity: 1;
}
  
  /* Pulses */
  .pulse{
    position:relative;
    overflow:hidden;
  }
  .pulse::after{
    content:""; position:absolute; inset: -120% -60%;
    background: radial-gradient(160px 160px at var(--mx,50%) var(--my,50%), rgba(255,85,0,.28), transparent 60%),
                radial-gradient(240px 240px at var(--mx,50%) var(--my,50%), rgba(255,0,60,.20), transparent 70%);
    opacity:0; transition: opacity .25s ease;
  }
  .pulse:hover::after{ opacity:1; }
  
  /* Grid & Cards */
  .grid{ display:grid; gap:16px; grid-template-columns: repeat(12, 1fr); margin-top: 1.2rem; }
  .card h3{ margin-bottom:.35rem; }
  .card p{ margin:0 0 .8rem; color:var(--muted); }
  .link{
    display:inline-flex; gap:8px; align-items:center; color:var(--fg);
    text-decoration:none; font-weight:700;
    border-bottom:1px dashed rgba(255,85,0,.45);
  }
  .link:hover{ color:#fff; border-color: rgba(255,0,60,.75); }
  
  .projects .tile{ grid-column: span 4; position:relative; }
  .tile .tag{
    position:absolute; top:10px; right:10px; font-size:12px; padding:4px 8px; border-radius:999px;
    background: linear-gradient(90deg, rgba(255,0,60,.75), rgba(255,85,0,.75));
    border:1px solid rgba(255,255,255,.12);
  }
  
  /* Right dots nav */
  .dots{
    position:fixed; right:22px; top:50%; translate:0 -50%;
    display:flex; flex-direction:column; gap:14px; z-index:10;
  }
  .dot{
    width:10px; height:10px; border-radius:50%;
    background: rgba(255,255,255,.22);
    box-shadow: 0 0 0 2px rgba(255,0,60,.0);
    position:relative; display:block;
  }
  .dot.active{
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 0 4px rgba(255,0,60,.22), 0 0 16px rgba(255,85,0,.5);
  }
  .dot::before{
    content: attr(data-label);
    position:absolute; right:16px; top:50%; translate:0 -50%;
    background: rgba(10,10,15,.8); color:#fff; padding:6px 10px; border-radius:10px;
    font-size:12px; opacity:0; pointer-events:none; border:1px solid rgba(255,255,255,.12);
    transition: opacity .2s ease; white-space:nowrap;
  }
  .dot:hover::before{ opacity:1; }
  
  /* Contact laser line */
  .laser{
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0; /* 🔥 фиксируем строго снизу */
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,0,60,.6), rgba(255,85,0,.6), transparent);
    animation: sweep 4s linear infinite;
    pointer-events: none;
    overflow: hidden;
  }
  @keyframes sweep{ to{ transform: translateX(100%); } }
  
  /* Responsive */
  @media (max-width: 960px){
    .grid{ grid-template-columns: repeat(6, 1fr); }
    .card, .tile{ grid-column: span 6; }
  }
  @media (max-width: 560px){
    .dots{ right:14px; }
    .cta-row{ gap:10px; }
  }
  
  /* Accessibility tweaks */
  a:focus-visible, .dot:focus-visible, .btn:focus-visible{
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* Main Hero layout */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem 5%;
  overflow: hidden;
}

/* Two-column */
.hero-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  width: 100%;
}

/* Title */
.hero-title {
  font-size: 5.5rem;
  font-weight: 800;
  line-height: 1.05;
}

.gradient {
  background: linear-gradient(90deg, #ff003c, #ff5500);
  -webkit-background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 1.45rem;
  margin: 2rem 0 3rem;
  opacity: .9;
}

/* CTA buttons proper placement */
.cta-row {
  display: flex;
  gap: 1.5rem;
}

/* 3D Phone */
.hero-phone {
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone {
  width: 300px;
  height: 600px;
  background: #111;
  border-radius: 40px;
  border: 2px solid rgba(255,255,255,.1);
  transform: rotateY(-8deg);
  animation: phone-tilt 4s ease-in-out infinite alternate;
  box-shadow: 0 0 40px rgba(255,20,20,0.35);
}

.phone-screen {
  width: 90%;
  height: 85%;
  margin: 7% auto;
  background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Placeholder for future logo */
.logo-placeholder {
  font-size: 2rem;
  font-weight: 700;
  opacity: .55;
  color: #ff003c;
  text-transform: uppercase;
  letter-spacing: .15em;
}

@keyframes phone-tilt {
  0% { transform: rotateY(-5deg);}
  100% { transform: rotateY(5deg);}
}

/* Red scanning line */
.scanline {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #ff003c 0%, #ff5500 100%);
  animation: scan-move 3.5s linear infinite;
}

@keyframes scan-move {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.phone-logo {
  width: 100%;
  height: auto;
  object-fit: contain;
  animation: logo-breath 4s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(255, 20, 20, 0.55));
}

/* breathing animation */
@keyframes logo-breath {
  0%, 100% {
    transform: scale(1.05);
    opacity: .95;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}
/* === SERVICES GRID :: 4 in a row === */
.services-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

#services h2 {
  text-align: center;
  width: 100%;
  margin-bottom: 2.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .services-grid {
    grid-template-columns: 1fr;
  }
}

/* === CARD: Mouse Glow Hover like HERO === */
.services-grid .card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 260px;
  padding: 28px;
  position: relative;
  overflow: hidden; /* ✅ ограничиваем подсветку */
  border-radius: 24px; /* мягче визу */
}

.services-grid .card:hover {
  box-shadow:
    0 0 32px rgba(255, 0, 60, 0.35),
    0 0 12px rgba(255, 85, 0, 0.25),
    0 0 4px rgba(255, 15, 15, .3) inset;
  transform: translateY(-6px);
}

.services-grid .card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 30, 60, 0.45) 0%,
    transparent 55%
  );
  transition: opacity .25s ease;
}

.services-grid .card:hover::after {
  opacity: .9;
}

.services-grid .card .link {
  margin-top: auto;
  display: inline-flex;
  gap: 6px;
  font-weight: 700;
}

.services-grid .card::before {
  border-radius: inherit; /* ✅ следуем форме */
}

/* === Lightline under Services block === */
#services {
  position: relative;
  padding-bottom: 120px;
}

/* === PROJECTS PHONE BLOCK === */
.projects-section {
  position: relative;
  padding-bottom: 140px;
  text-align: center;
}

.projects-phone {
  margin-top: 3.5rem;
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Корпус телефона — наследуем основу из .phone */
.phone.project-phone {
  width: 100%;
  max-width: 1400px;
  aspect-ratio: 2.2 / 1;
  background: #111;
  border-radius: 46px;
  border: 2px solid rgba(255,255,255,.08);
  box-shadow: 0 0 55px rgba(255,25,25,.25);
  overflow: hidden;
  transform: none; /* ❌ убираем 3D наклон */
  animation: none; /* ❌ без качания */
}

/* Экран */
.phone.project-phone .phone-screen {
  position: absolute;
  inset: 0;
  margin: auto;
  width: calc(100% - 48px); /* рамка по бокам */
  height: calc(100% - 48px); /* рамка сверху/снизу */
  background: #000;
  border-radius: 32px;
  overflow: hidden;
}

/* Fallback logo пока нет слайда */
.phone.project-phone .placeholder {
  position: absolute;
  inset: 0;
  width: 65%;
  height: auto;
  object-fit: contain;
  margin: auto;
  opacity: .15;
  filter: drop-shadow(0 0 8px rgba(255,25,25,.4));
  pointer-events: none;
}

/* Carousel inside */
.carousel-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.carousel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Fade slide */
.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.07);
  transition: opacity .6s ease, transform .6s ease;
}

.slide.active {
  opacity: 1;
  transform: scale(1);
}

/* Arrows */
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  z-index: 10;
  transition: .25s ease;
}

.nav:hover {
  background: rgba(255,0,60,.65);
  box-shadow: 0 0 25px rgba(255,0,50,.6);
}

.prev { left: 22px; }
.next { right: 22px; }

/* Scanline */
.projects-scanline {
  bottom: 0;
  height: 3px;
  animation: scan-move 4s linear infinite;
}

/* CONTACT FORM */
.contact-form {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--fg);
  resize: none;
  outline: none;
  transition: 0.25s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.08);
}

.contact-form button {
  width: 100%;
  justify-content: center;
}
#contact h2,
#contact .contact-line {
  text-align: center;
  width: 100%;
}

/* SUCCESS POPUP */
.popup {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
}

.popup.show {
  display: flex;
  animation: fadeIn .35s ease forwards;
}

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

.popup-content {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 2.2rem 2.5rem;
  width: min(360px, 90vw);
  text-align: center;
  box-shadow:
    0 0 35px rgba(255,0,60,.45),
    0 0 15px rgba(255,85,0,.35),
    inset 0 0 0 1px rgba(255,255,255,.1);
  transform: scale(.9);
  animation: popupScale .35s ease forwards;
}

@keyframes popupScale {
  to { transform: scale(1); }
}

#close-popup {
  margin-top: 1.2rem;
  width: 100%;
  justify-content: center;
}

#contact.section {
  position: relative;
}

.contact-scanline {
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff003c 0%, #ff5500 100%);
  animation: scan-move 3.5s linear infinite;
  position: absolute;
  width: 100%;
  left: 0;
}

.footer {
  width: 100%;
  padding: 2rem 0;
  background: rgba(0,0,0,0.92);
  border-top: 1px solid rgba(255,0,60,0.18);
  backdrop-filter: blur(10px);
}

.footer-inner {
  width: min(1000px, 90vw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .6rem;
}

.footer-copy {
  font-size: .9rem;
  opacity: .85;
}

.footer-policy {
  font-size: .9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255,0,60,0.35);
  transition: .25s ease;
}

.footer-policy:hover {
  color: #fff;
  border-bottom-color: rgba(255,0,60,0.7);
}

.footer-address {
  font-size: .85rem;
  opacity: .7;
  line-height: 1.4;
  max-width: 80%;
}

/* === MOBILE ADAPTATION FIXES === */

/* Hide dots on mobile */
@media (max-width: 768px) {
  .dots {
    display: none;
  }
}

/*** HERO MOBILE ***/
@media (max-width: 900px) {
  .hero {
    padding: 4rem 6%;
  }
  
  .hero-wrap {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 3rem;
  }

  .hero-phone {
    order: 2;
  }

  .hero-content {
    order: 1;
  }

  .hero-title {
    font-size: clamp(2.2rem, 8vw, 3.4rem);
    line-height: 1.1;
  }

  .hero-sub {
    font-size: 1.05rem;
    margin: 1.5rem 0 2.5rem;
  }

  .cta-row {
    justify-content: center;
  }

  .phone {
    width: 220px;
    height: 440px;
    transform: none;
  }
}

/*** PROJECTS PHONE MOBILE ***/
@media (max-width: 900px) {
  .phone.project-phone {
    width: 100vw;
    border-radius: 30px;
  }

  .phone.project-phone .phone-screen {
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    border-radius: 20px;
  }

  .nav {
    width: 38px;
    height: 38px;
    font-size: 1.4rem;
  }

  .prev { left: 10px; }
  .next { right: 10px; }
}

/*** SERVICES MOBILE ***/
@media (max-width: 600px) {
  .services-grid .card {
    min-height: auto;
    padding: 20px;
  }

  #services {
    padding-bottom: 80px;
  }
}

/*** CONTACT MOBILE ***/
@media (max-width: 540px) {
  .contact-form {
    gap: 1rem;
  }
  .contact-form input,
  .contact-form textarea {
    padding: 14px 16px;
    font-size: .95rem;
  }
}

/*** FOOTER MOBILE ***/
@media (max-width: 480px) {
  .footer-inner {
    gap: .4rem;
  }
  .footer-address {
    max-width: 95%;
    font-size: .8rem;
  }
}

/*** POPUP MOBILE ***/
@media (max-width: 400px) {
  .popup-content {
    padding: 1.6rem 1.4rem;
  }
}

.btn-top {
  position: fixed;
  right: 18px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  background: rgba(255, 0, 60, 0.65);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  font-size: 1.4rem;
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(8px);
  transition: .25s ease;
}
.btn-top:hover {
  background: rgba(255,0,60,0.85);
  box-shadow: 0 0 20px rgba(255,0,60,0.5);
}

/* ✅ Mobile refinements pack */

/* Dynamic viewport safe fix */
.section, .hero {
  min-height: 100dvh;
}

/* Improve readability and spacing */
.wrap {
  width: min(1280px, 92vw);
}

/* iPhone SE/Mini fine tuning */
@media (max-width: 390px) {
  .hero-title {
    font-size: clamp(1.8rem, 9vw, 2.4rem);
  }
  .hero-sub {
    font-size: .92rem;
  }
}

/* Projects aspect ratio protection */
@media (max-aspect-ratio: 17/10) {
  .phone.project-phone {
    aspect-ratio: 1.6 / 1;
  }
  .carousel .slide {
    object-position: center;
  }
}

/* Back to top button smooth visibility */
.btn-top {
  opacity: 0;
  transform: scale(.7);
  pointer-events: none;
}
.btn-top.show {
  display: flex;
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Safe area for iPhone notch */
.footer,
.btn-top {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

/* iOS touch UX—disable hover on touch */
@media (hover: none) {
  .btn.glass:hover,
  .services-grid .card:hover {
    transform: none;
    box-shadow: none;
  }
  .btn.glass:hover::after,
  .services-grid .card:hover::after {
    opacity: 0;
  }
}

/* Projects swipe CTA for mobile */
@media (max-width: 540px) {
  .nav {
    background: rgba(0,0,0,.65);
  }
}

/* Performance */
img {
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Text center smoothing */
h2 {
  text-wrap: balance;
}