/* ==========================================================
   Asilbek Muxtorov — Portfolio
   Fully custom design system (no framework)
   ========================================================== */

:root {
  --bg: #06070d;
  --bg-alt: #0a0c16;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-border: rgba(255, 255, 255, 0.08);
  --text: #eef0f7;
  --text-dim: #9497ab;
  --accent: #6ee7ff;
  --accent-2: #a78bfa;
  --accent-grad: linear-gradient(120deg, #6ee7ff 0%, #a78bfa 100%);
  --radius: 18px;
  --max-width: 1180px;
  --nav-h: 76px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: #06070d; }

.grad-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 3D background canvas ---------- */
#bg-3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at top, rgba(110, 231, 255, 0.06), transparent 55%),
              radial-gradient(ellipse at bottom right, rgba(167, 139, 250, 0.08), transparent 55%);
}

/* ---------- Top navigation ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6vw;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(6, 7, 13, 0.55);
  border-bottom: 1px solid var(--surface-border);
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 700;
}

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

.menu {
  display: flex;
  gap: 2.2rem;
}

.menu-link {
  font-size: 14.5px;
  color: var(--text-dim);
  position: relative;
  padding: 6px 0;
  transition: color 0.25s ease;
}

.menu-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 2px;
  background: var(--accent-grad);
  transition: width 0.3s ease;
}

.menu-link:hover,
.menu-link.active {
  color: var(--text);
}

.menu-link.active::after,
.menu-link:hover::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  position: fixed;
  top: 20px;
  right: 6vw;
  z-index: 110;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.05);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Section shell ---------- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 130px 6vw 60px;
}

.section-alt {
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.015) 15%, rgba(255, 255, 255, 0.015) 85%, transparent);
}

.section-head {
  margin-bottom: 3.2rem;
  text-align: center;
}

.tag {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
  font-weight: 600;
}

.section-head h2 {
  font-size: clamp(28px, 4vw, 42px);
}

.section-sub {
  margin-top: 0.8rem;
  color: var(--text-dim);
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 140px 6vw 60px;
  position: relative;
}

.hero-inner { max-width: 780px; }

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.8rem;
}

.hero h1 {
  font-size: clamp(40px, 8vw, 74px);
  line-height: 1.05;
  margin-bottom: 1.1rem;
}

.hero-role {
  font-size: clamp(18px, 2.4vw, 24px);
  color: var(--text-dim);
  min-height: 32px;
  margin-bottom: 1.4rem;
  font-family: "Space Grotesk", sans-serif;
}

.caret {
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

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

.hero-desc {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto 2.2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.4rem;
}

.btn {
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.btn-primary {
  background: var(--accent-grad);
  color: #06070d;
  box-shadow: 0 10px 30px rgba(110, 231, 255, 0.18);
}

.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(110, 231, 255, 0.3); }

.btn-ghost {
  border: 1px solid var(--surface-border);
  background: var(--surface);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-3px); }

.hero-socials {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.hero-socials a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.25s ease;
}

.hero-socials a:hover {
  color: #06070d;
  background: var(--accent-grad);
  transform: translateY(-3px);
  border-color: transparent;
}

.scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.05em;
}

.scroll-hint span {
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--accent), transparent);
  animation: scrollDown 1.8s ease-in-out infinite;
}

@keyframes scrollDown {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40% { transform: scaleY(1); transform-origin: top; opacity: 1; }
  60% { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 4rem;
  align-items: center;
}

.photo-frame {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  padding: 10px;
}

.photo-frame img { border-radius: 18px; }

.about-copy h3 {
  font-size: 26px;
  margin-bottom: 1rem;
}

.about-copy p {
  color: var(--text-dim);
  margin-bottom: 1rem;
  font-size: 15.5px;
}

.facts {
  margin-top: 1.8rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.fact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
}

.fact i {
  font-size: 20px;
  color: var(--accent);
}

.fact-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
}

.fact-value {
  display: block;
  font-size: 14px;
  font-weight: 500;
  word-break: break-word;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4rem;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.8rem 1rem;
  text-align: center;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.skill-card:hover {
  border-color: rgba(110, 231, 255, 0.35);
}

.skill-card h4 {
  margin-top: 1rem;
  font-size: 15px;
  font-weight: 500;
}

.skill-ring {
  --pct: 0;
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 15px;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.08) 0);
  position: relative;
}

.skill-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #0a0c16;
}

.skill-ring span { position: relative; z-index: 1; }

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.4rem;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 2rem 1.6rem;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.service-card:hover { border-color: rgba(167, 139, 250, 0.4); }

.service-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #06070d;
  margin-bottom: 1.2rem;
}

.service-card h4 { font-size: 17px; margin-bottom: 0.6rem; }

.service-card p {
  color: var(--text-dim);
  font-size: 14.5px;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  max-width: 900px;
  margin: 0 auto;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.4rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  font-weight: 500;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.contact-card i { font-size: 22px; color: var(--accent); }

.contact-card:hover {
  transform: translateY(-4px);
  border-color: rgba(110, 231, 255, 0.4);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 2.4rem 6vw 3rem;
  color: var(--text-dim);
  font-size: 13.5px;
  border-top: 1px solid var(--surface-border);
}

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #06070d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 90;
}

.to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ---------- Reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-reveal].in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .about-grid { grid-template-columns: 1fr; }
  .photo-frame { max-width: 280px; margin: 0 auto; }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .menu {
    position: fixed;
    top: var(--nav-h);
    right: 0;
    height: calc(100vh - var(--nav-h));
    width: min(78vw, 320px);
    background: rgba(6, 7, 13, 0.97);
    backdrop-filter: blur(16px);
    flex-direction: column;
    align-items: flex-start;
    padding: 2.4rem 8vw;
    gap: 1.6rem;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    border-left: 1px solid var(--surface-border);
  }

  .menu.open { transform: translateX(0); }

  .nav-toggle { display: flex; }

  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
}
