/* ===== 🎯 SCROLL PROGRESS BAR ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 9999;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px var(--accent);
}

/* ===== 🖱️ CUSTOM CURSOR ===== */
.custom-cursor {
  position: fixed;
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transition: transform 0.15s ease, width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
  mix-blend-mode: difference;
}

.cursor-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

.custom-cursor.cursor-hover {
  width: 60px;
  height: 60px;
  border-color: var(--accent-2);
}

.custom-cursor.cursor-hover .cursor-dot {
  width: 10px;
  height: 10px;
}

/* ===== ✨ PARTICLES ===== */
@keyframes particleFloat {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(var(--vx) * 80px), calc(var(--vy) * 80px)) scale(0);
    opacity: 0;
  }
}

.particle {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  animation: particleFloat 1s ease-out forwards;
  box-shadow: 0 0 10px var(--accent);
}

/* ===== 🔝 BACK TO TOP BUTTON ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--accent);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  transform: translateY(100px) scale(0);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 15px 40px rgba(122,162,255,0.4);
}

/* ===== 🎨 THEME TOGGLE ===== */
.theme-toggle {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.theme-toggle:hover {
  transform: rotate(180deg) scale(1.1);
  box-shadow: 0 15px 40px rgba(122,162,255,0.4);
}

/* ===== 🌞 LIGHT THEME - НОРМАЛЬНАЯ ===== */
html.light-theme {
  --bg: #f8f9fa;
  --text: #0a0e14;
  --muted: rgba(10,14,20,.75);
  --accent: #0066ff;
  --accent-2: #6b46ff;
  --glass: rgba(255,255,255,0.9);
  --glass-strong: rgba(255,255,255,0.98);
  --border: rgba(10,14,20,.15);
  --shadow: 0 30px 90px rgba(0,0,0,.1);
  --btn-bg: #ffffff;
  --btn-bg-2: #eaf1ff;
  --btn-border: rgba(0,102,255,.45);
  --btn-shadow: 0 18px 50px rgba(0,0,0,.10), 0 10px 28px rgba(0,102,255,.18);
}

html.light-theme body {
  background: #f8f9fa;
}

html.light-theme #bg {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0,102,255,.06), transparent 60%),
    radial-gradient(900px 520px at 80% 20%, rgba(107,70,255,.04), transparent 65%),
    linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

html.light-theme .block {
  background: #ffffff;
  border: 3px solid rgba(10,14,20,.25);
  box-shadow: 
    0 30px 100px rgba(0,0,0,.20),
    0 15px 50px rgba(0,0,0,.15),
    0 5px 20px rgba(0,102,255,.12);
  color: #000000;
}

html.light-theme .block h2,
html.light-theme .block h3 {
  color: #000000;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}

html.light-theme .block p {
  color: #000000;
  font-weight: 500;
}

html.light-theme .block:hover {
  background: #ffffff;
  border: 3px solid rgba(0,102,255,.4);
  box-shadow:
    0 40px 120px rgba(0,0,0,.25),
    0 20px 70px rgba(0,102,255,.2),
    inset 0 0 0 2px rgba(0,102,255,.2);
  transform: translateY(-15px) scale(1.02) !important;
}

html.light-theme .hero-card {
  background: #ffffff;
  border: 3px solid rgba(10,14,20,.25);
  box-shadow: 
    0 50px 150px rgba(0,0,0,.20),
    0 25px 80px rgba(0,0,0,.15),
    0 10px 40px rgba(0,102,255,.15);
  color: #000000;
}

html.light-theme .logo {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
}

html.light-theme .hero-sub {
  color: rgba(10,14,20,.7);
}

html.light-theme .topbar-inner {
  background: #ffffff;
  border: 3px solid rgba(10,14,20,.25);
  box-shadow: 
    0 20px 60px rgba(0,0,0,.15),
    0 10px 30px rgba(0,0,0,.10),
    0 5px 15px rgba(0,102,255,.08);
}

html.light-theme .topbar-logo a {
  color: #000000;
  font-weight: 900;
}

html.light-theme .card {
  background: #ffffff;
  border: 2px solid rgba(0,102,255,.25);
  color: #0a0e14;
  box-shadow:
    0 18px 45px rgba(0,0,0,.10),
    0 10px 28px rgba(0,102,255,.12);
}

html.light-theme .card h3 {
  color: #0a0e14;
}

html.light-theme .card p {
  color: rgba(10,14,20,.75);
}

html.light-theme .card:hover {
  background: #ffffff;
  border-color: rgba(0,102,255,.55);
  box-shadow:
    0 26px 70px rgba(0,0,0,.14),
    0 0 40px rgba(0,102,255,.20);
  transform: translateY(-10px) scale(1.02);
}

/* Light theme: contact buttons more contrast */
html.light-theme .contact-btn{
  color: #0a0e14;
  background: linear-gradient(135deg, var(--btn-bg), var(--btn-bg-2));
  border-color: var(--btn-border);
  box-shadow: var(--btn-shadow);
}

html.light-theme .contact-btn:hover{
  border-color: rgba(0,102,255,.75);
  box-shadow:
    0 26px 70px rgba(0,0,0,.14),
    0 0 40px rgba(0,102,255,.22);
}

html.light-theme .hero-hint {
  color: rgba(10,14,20,.5);
  background: transparent;
  border: none;
  border-radius: 999px;
}

html.light-theme .topbar-nav a {
  color: rgba(10,14,20,.75);
  font-weight: 600;
}

html.light-theme .topbar-nav a:hover,
html.light-theme .topbar-nav a.is-active {
  color: #000000;
  background: rgba(0,102,255,.18);
  border: 1px solid rgba(0,102,255,.3);
  font-weight: 700;
}

html.light-theme .back-to-top,
html.light-theme .theme-toggle {
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(10,14,20,.12);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  color: var(--accent);
}

html.light-theme .back-to-top:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

html.light-theme .theme-toggle:hover {
  background: rgba(255,255,255,1);
  box-shadow: 0 15px 40px rgba(0,102,255,.2);
}

html.light-theme .scroll-progress {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

html.light-theme .custom-cursor {
  border-color: var(--accent);
}

html.light-theme .custom-cursor-dot {
  background: var(--accent);
}

html.light-theme .particle {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

html.light-theme .footer {
  color: rgba(10,14,20,.5);
}

/* ===== 🎊 CONFETTI ===== */
@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 10001;
  animation: confettiFall 3s linear forwards;
  pointer-events: none;
}

/* ===== 3D CARD EFFECTS ===== */
.block {
  transform-style: preserve-3d;
  transition: transform 0.1s ease !important;
}

.card {
  transform-style: preserve-3d;
  transition: all 0.3s ease !important;
}

/* ===== GLITCH EFFECT ON HOVER ===== */
.block h2 {
  position: relative;
  display: inline-block;
}

.block:hover h2::before,
.block:hover h2::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.8;
  animation: glitch 0.3s infinite;
}

.block:hover h2::before {
  clip-path: inset(40% 0 25% 0);
  animation-delay: 0.1s;
}

.block:hover h2::after {
  clip-path: inset(65% 0 10% 0);
  animation-delay: 0.2s;
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

/* ===== RIPPLE EFFECT ===== */
.topbar-nav a {
  position: relative;
  overflow: hidden;
}

.topbar-nav a::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(158,240,255,0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.topbar-nav a:hover::after {
  width: 300px;
  height: 300px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .custom-cursor {
    display: none;
  }
  
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
  
  .theme-toggle {
    bottom: 80px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
}
/* ======================================================
   ROOT / PALETTE (winter night, not "just blue")
====================================================== */
:root{
  --bg:#0a0e14;                     
  --text:#eef2ff;
  --muted:rgba(238,242,255,.65);

  --accent:#9ef0ff;                 
  --accent-2:#c7b7ff;            

  --glass:rgba(24,28,40,.62);
  --glass-strong:rgba(28,34,52,.78);

  --border:rgba(180,190,255,.18);
  --shadow:0 30px 90px rgba(0,0,0,.55);

  --topbar-h:86px;
  --vh: 1vh; /* iOS stable vh */
}

/* ======================================================
   RESET / BASE
====================================================== */
*{ box-sizing:border-box; margin:0; padding:0; }

/* Prevent zoom on mobile */
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

html,body{
  height:100%;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  scroll-behavior:smooth;
  overscroll-behavior:none;
}
body{
  overflow-x:hidden;
  background:var(--bg);
}

/* ======================================================
   BACKGROUND CANVAS
====================================================== */
#bg{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  transform: translateZ(0);
  will-change: transform;
  background: var(--bg);
}

/* ======================================================
   TOPBAR
====================================================== */
.topbar{
  position:fixed;
  inset:14px 16px auto 16px;
  z-index:100;

  opacity:0;
  transform:translateY(-20px);
  transition:opacity .4s ease, transform .4s ease;
}
.topbar.is-on{
  opacity:1;
  transform:translateY(0);
}
.topbar.is-hidden{
  opacity:0 !important;
  pointer-events:none;
}

.topbar-inner{
  max-width:1200px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;

  background: rgba(10,14,20,0.95);
  border: 3px solid rgba(158,240,255,.25);
  border-radius:18px;
  padding:12px 18px;
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  box-shadow:
    0 20px 60px rgba(0,0,0,.40),
    0 10px 30px rgba(158,240,255,.08);
}

.topbar-logo a{
  font-weight:900;
  font-size:18px;
  letter-spacing:.08em;
  text-decoration:none;

  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.topbar-logo a:focus-visible{
  outline:2px solid rgba(158,240,255,.5);
  outline-offset:4px;
  border-radius:10px;
}

.topbar-nav{
  display:flex;
  gap:14px;
}
.topbar-nav a{
  color:var(--muted);
  text-decoration:none;
  font-size:14px;
  letter-spacing:.12em;
  text-transform:uppercase;
  padding:8px 12px;
  border-radius:12px;
  border: 1px solid transparent;
  transition:all .3s ease;
  font-weight: 600;
}
.topbar-nav a:hover,
.topbar-nav a.is-active{
  color:#fff;
  background:rgba(158,240,255,.18);
  border: 1px solid rgba(158,240,255,.3);
  font-weight: 700;
}

/* ======================================================
   HERO
====================================================== */
.hero{
  position:relative;
  z-index:2;
  min-height: calc(var(--vh) * 100);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:calc(24px + var(--topbar-h)) 16px 24px;
}

.hero-card{
  max-width:1000px;
  width:min(1000px, 92vw);
  padding:72px 56px;
  text-align:center;

  background: rgba(10,14,20,0.95);
  border: 3px solid rgba(158,240,255,.25);
  border-radius:34px;
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
  box-shadow:
    0 50px 150px rgba(0,0,0,.50),
    0 25px 80px rgba(158,240,255,.10),
    inset 0 0 0 1px rgba(158,240,255,.08);

  transform-origin:50% 30%;
  will-change:transform,opacity,filter;

  transition:
    transform .8s cubic-bezier(.2,.9,.2,1),
    opacity .8s cubic-bezier(.2,.9,.2,1),
    filter .8s cubic-bezier(.2,.9,.2,1);
}

.logo{
  font-size:clamp(3.5rem,7vw,7.5rem);
  font-weight:900;
  letter-spacing:-.04em;
  line-height:.9;

  background:linear-gradient(90deg,var(--accent),#ffffff,var(--accent-2));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
  margin-bottom:14px;
}

.hero-sub{
  font-size:14px;
  letter-spacing:.34em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:22px;
}

.hero-hint{
  font-size:12px;
  letter-spacing:.2em;
  text-transform:uppercase;
  color:rgba(255,255,255,.45);
}

/* ======================================================
   CONTENT / SECTIONS
====================================================== */
.content{
  position:relative;
  z-index:2;
}

.page{
  min-height: 60vh;
  padding:140px 16px 80px;
}

.block{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width:min(1100px,95%);
  margin: 0 auto;
  padding:56px;

  background: rgba(10,14,20,0.95);
  border: 3px solid rgba(158,240,255,.25);
  border-radius:28px;
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
  box-shadow:
    0 30px 100px rgba(0,0,0,.40),
    0 15px 50px rgba(158,240,255,.08),
    inset 0 0 0 1px rgba(158,240,255,.05);

  transition:
    transform .45s cubic-bezier(.2,.9,.2,1),
    background .45s ease,
    box-shadow .45s ease,
    opacity .65s cubic-bezier(.2,.9,.2,1),
    filter .65s cubic-bezier(.2,.9,.2,1);
}

.block:hover{
  transform:translateY(-15px) scale(1.02);
  background: rgba(10,14,20,0.98);
  border: 3px solid rgba(158,240,255,.4);
  box-shadow:
    0 40px 120px rgba(0,0,0,.50),
    0 20px 70px rgba(158,240,255,.15),
    inset 0 0 0 2px rgba(158,240,255,.15);
}

.block h2, .block h3{
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.block p{
  color:var(--muted);
  line-height:1.75;
  max-width:75ch;
}

/* Reveal animation - КРАСИВАЯ АНИМАЦИЯ ПОЯВЛЕНИЯ */
html.js.ready .block{ 
  opacity:0; 
  transform:translateY(18px); 
  filter:blur(1px); 
}
html.js.ready .block.is-in{ 
  opacity:1; 
  transform:translateY(0); 
  filter:blur(0); 
}

/* ======================================================
   GRID / CARDS
====================================================== */
.card{
  background: rgba(10,14,20,0.6);
  border: 2px solid rgba(158,240,255,.2);
  border-radius:22px;
  padding:32px;

  transition:
    transform .35s ease,
    background .35s ease,
    border-color .35s ease,
    box-shadow .35s ease;
}

.card:hover{
  transform:translateY(-12px) scale(1.02);
  background: rgba(10,14,20,0.85);
  border: 2px solid rgba(158,240,255,.35);
  box-shadow:
    0 20px 60px rgba(0,0,0,.40),
    0 10px 30px rgba(158,240,255,.12);
}

.card h3{
  color:#fff;
  margin-bottom:12px;
}

/* ======================================================
   FOOTER (only at bottom, not fixed)
====================================================== */
.footer{
  margin:80px auto 32px;
  text-align:center;
  font-size:12px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:rgba(238,242,255,.45);
  pointer-events:none;
}

/* ======================================================
   MOBILE
====================================================== */
@media (max-width:768px){
  .topbar-inner{ flex-direction:column; gap:10px; }
  .hero-card{ padding:56px 28px; }
  .block{ padding:40px 28px; }
  .logo{ font-size:clamp(3.2rem,12vw,6rem); }
  .topbar-nav{ gap:10px; }
  .page{ padding:120px 16px 60px; }
}

/* Better anchor alignment */
html{ scroll-padding-top: 120px; }

/* ===============================
   iOS SAFE AREA FIX
================================ */

/* Убираем "рамки" сверху/снизу */
html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  overscroll-behavior: none;
}

/* Canvas должен залезать под safe-area */
#bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;

  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.hero,
.topbar,
.content {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.topbar {
  top: calc(14px + env(safe-area-inset-top));
}

.footer,
.page {
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

body {
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

@supports (-webkit-touch-callout: none) {
  html:not(.light-theme) body::before{
    content:"";
    position:fixed;
    top:0; left:0; right:0;
    height: env(safe-area-inset-top);
    background: #0a0e14;
    z-index: 999999;
    pointer-events:none;
  }
}

:root{
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
}

.hero, .content, .topbar {
  padding-left: max(16px, var(--sal));
  padding-right: max(16px, var(--sar));
}

.content {
  padding-bottom: calc(24px + var(--sab));
}

.footer {
  padding-bottom: calc(24px + var(--sab));
  margin-bottom: calc(16px + var(--sab));
}

.back-to-top {
  bottom: calc(30px + var(--sab));
}
.theme-toggle {
  bottom: calc(100px + var(--sab));
}

.topbar {
  inset: calc(14px + var(--sat)) max(16px, var(--sar)) auto max(16px, var(--sal));
}

@supports (-webkit-touch-callout: none) {
  :root{
    --ios-bottom-ui: 80px;
  }

  .content{
    padding-bottom: calc(24px + env(safe-area-inset-bottom) + var(--ios-bottom-ui));
  }

  .footer{
    margin-bottom: calc(16px + env(safe-area-inset-bottom) + var(--ios-bottom-ui));
  }

  .back-to-top{
    bottom: calc(30px + env(safe-area-inset-bottom) + var(--ios-bottom-ui));
  }

  .theme-toggle{
    bottom: calc(100px + env(safe-area-inset-bottom) + var(--ios-bottom-ui));
  }
}

:root{
  --ios-bottom-ui: 0px; 
}

.page{
  padding-bottom: calc(80px + env(safe-area-inset-bottom) + var(--ios-bottom-ui));
}

.footer{
  margin-bottom: calc(16px + env(safe-area-inset-bottom) + var(--ios-bottom-ui));
}

html, body { background: var(--bg); }
html.light-theme, html.light-theme body { background: #f8f9fa; }

@media (max-width: 420px) {
  .topbar{
    left: 8px !important;
    right: 8px !important;
    inset: calc(10px + env(safe-area-inset-top)) 8px auto 8px !important;
  }

  .topbar-inner{
    width: 100%;
    border-radius: 18px;
    overflow: hidden;      
    padding: 10px 12px;
  }

  .topbar-nav{
    display: flex;
    flex: 1;
    justify-content: space-between; 
    gap: 10px;
    min-width: 0;                  
  }

  .topbar-nav a{
    flex: 1 1 0;
    text-align: center;
    padding: 10px 8px;
    font-size: 12px;
  }
}

.topbar-nav a{
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.topbar-nav a.is-active{
  padding-top: 9px;
  padding-bottom: 11px;
}

html, body {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  height: 100%;
  width: 100%;
  touch-action: manipulation;
}

#bg-wrap{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg);
  transform: translateZ(0);
}

#bg{
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

/* ======================================================
   FINAL OVERRIDES
====================================================== */
:root{ --ios-bottom-ui: 0px; }

@supports (-webkit-touch-callout: none) {
  .content{
    padding-bottom: calc(24px + env(safe-area-inset-bottom) + var(--ios-bottom-ui)) !important;
  }
  .footer{
    padding-bottom: calc(24px + env(safe-area-inset-bottom) + var(--ios-bottom-ui)) !important;
    margin-bottom: calc(16px + env(safe-area-inset-bottom) + var(--ios-bottom-ui)) !important;
  }
  .page{
    padding-bottom: calc(80px + env(safe-area-inset-bottom) + var(--ios-bottom-ui)) !important;
  }
  .back-to-top{
    bottom: calc(30px + env(safe-area-inset-bottom) + var(--ios-bottom-ui)) !important;
  }
  .theme-toggle{
    bottom: calc(100px + env(safe-area-inset-bottom) + var(--ios-bottom-ui)) !important;
  }
}

/* Cards grid: force centered flex layout */
.grid{
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  margin-top: 40px;
}
.grid .card{
  flex: 1 1 320px;
  max-width: 520px;
  width: 100%;
}

/* ===== CONTACT BUTTONS (TG + GH) ===== */
.contact-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.contact-btn {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 14px 24px;
  min-width: 170px;

  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;

  color: var(--text);
  text-decoration: none;

  background: linear-gradient(
    135deg,
    rgba(158,240,255,0.18),
    rgba(199,183,255,0.12)
  );

  border: 2px solid rgba(158,240,255,0.35);
  border-radius: 999px;

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow:
    0 12px 35px rgba(0,0,0,.35),
    inset 0 0 0 1px rgba(255,255,255,.08);

  position: relative;
  overflow: hidden;

  transition:
    transform .35s cubic-bezier(.2,.9,.2,1),
    box-shadow .35s ease,
    background .35s ease,
    border-color .35s ease;
}

.contact-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* hover */
.contact-btn:hover {
  transform: translateY(-6px) scale(1.04);
  background: linear-gradient(
    135deg,
    rgba(158,240,255,0.35),
    rgba(199,183,255,0.25)
  );
  border-color: rgba(158,240,255,.7);
  box-shadow:
    0 25px 60px rgba(0,0,0,.45),
    0 0 40px rgba(158,240,255,.35);
}

/* subtle brand tint */
.contact-btn.tg:hover {
  box-shadow:
    0 25px 60px rgba(0,0,0,.45),
    0 0 40px rgba(60,180,255,.45);
}

.contact-btn.ig:hover {
  box-shadow:
    0 25px 60px rgba(0,0,0,.45),
    0 0 40px rgba(255,90,150,.45);
}

.contact-btn.gh:hover {
  box-shadow:
    0 25px 60px rgba(0,0,0,.45),
    0 0 40px rgba(180,160,255,.45);
}

/* Shine line for buttons + email */
.contact-btn::before{
  content:"";
  position:absolute;
  top:-30%;
  left:-60%;
  width:50%;
  height:160%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255,255,255,.75) 45%,
    transparent 90%
  );
  transform: translateX(-140%) rotate(12deg);
  transition: transform .75s ease;
  pointer-events:none;
}

.contact-btn:hover::before{
  transform: translateX(240%) rotate(12deg);
}

.contact-email{
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;

  margin: 22px auto 0;
  padding: 14px 24px;
  border-radius: 999px;

  color: var(--text);
  background: transparent;
  border: 2px solid rgba(158,240,255,0.35);

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  box-shadow:
    0 12px 35px rgba(0,0,0,.25),
    inset 0 0 0 1px rgba(255,255,255,.06);

  transition:
    transform .35s cubic-bezier(.2,.9,.2,1),
    box-shadow .35s ease,
    border-color .35s ease,
    background .35s ease;
}

.contact-email:hover{
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(158,240,255,.7);
  background: rgba(158,240,255,.08);
  box-shadow:
    0 25px 60px rgba(0,0,0,.35),
    0 0 40px rgba(158,240,255,.20);
}

html.light-theme .contact-email{
  background: transparent;
  border: 2px solid rgba(0,102,255,.45);
  box-shadow:
    0 16px 40px rgba(0,0,0,.10),
    0 10px 28px rgba(0,102,255,.14);
  color: #0a0e14;
}

html.light-theme .contact-email:hover{
  border-color: rgba(0,102,255,.75);
  background: rgba(0,102,255,.08);
  box-shadow:
    0 26px 70px rgba(0,0,0,.14),
    0 0 40px rgba(0,102,255,.18);
}

.email-text{
  color: var(--accent);
  font-weight: 800;
}

.email-hint{
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .6;
}

.contact-email.copied .email-hint{
  opacity: 1;
}

/* mobile */
@media (max-width: 520px) {
  .contact-btn {
    min-width: 150px;
    padding: 13px 18px;
    font-size: 13px;
  }
}

/* ===== CONTACT MOBILE FIX ===== */
@media (max-width: 520px) {
  #contact .block{
    padding: 36px 18px;
  }

  #contact h2{
    font-size: 34px;
    letter-spacing: .08em;
    margin-bottom: 18px;
  }

  #contact .contact-buttons{
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
  }

  #contact .contact-btn{
    width: min(280px, 100%);
    min-width: 0;             
    justify-content: center;
    padding: 13px 16px;
    font-size: 13px;
    letter-spacing: .12em;
  }

  #contact .contact-btn svg{
    width: 18px;
    height: 18px;
  }

  #contact .contact-email{
    width: min(320px, 100%);
    margin: 18px auto 0;
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  #contact .email-hint{
    font-size: 10px;
    letter-spacing: .16em;
    opacity: .7;
  }
}

.contact-email{
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.contact-email:focus{
  outline: none;
}

/* === FIX: floating buttons visibility (light theme) === */
html.light-theme .back-to-top,
html.light-theme .theme-toggle {
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #f1f5ff 100%
  );

  border: 2px solid rgba(0,102,255,.35);

  box-shadow:
    0 18px 45px rgba(0,0,0,.18),
    0 0 0 1px rgba(0,102,255,.12);

  color: var(--accent);
}

html.light-theme .back-to-top:hover,
html.light-theme .theme-toggle:hover {
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #e7efff 100%
  );

  border-color: rgba(0,102,255,.65);

  box-shadow:
    0 28px 70px rgba(0,0,0,.22),
    0 0 40px rgba(0,102,255,.25);

  transform: translateY(-4px) scale(1.08);
}

html.light-theme .back-to-top:hover{
  color: var(--accent) !important; 
}

html.light-theme .back-to-top,
html.light-theme .theme-toggle{
  border: 2px solid rgba(0,102,255,.45) !important;

  box-shadow:
    0 24px 70px rgba(0,0,0,.22),
    0 10px 26px rgba(0,102,255,.20),
    0 0 0 1px rgba(0,102,255,.10) !important;
}

html.light-theme .back-to-top:hover,
html.light-theme .theme-toggle:hover{
  box-shadow:
    0 34px 90px rgba(0,0,0,.28),
    0 14px 34px rgba(0,102,255,.26),
    0 0 45px rgba(0,102,255,.22) !important;
}

/* TEMP: hide sections */
#about,
#projects {
  display: none !important;
}

.topbar-nav a[href="#about"],
.topbar-nav a[href="#projects"] {
  display: none;
}