/* ============================================================
   Rza Kangarli — Portfolio
   ============================================================ */

:root {
  --bg:        #05050a;
  --bg-soft:   #0b0b14;
  --surface:   #11111d;
  --line:      rgba(255,255,255,.08);
  --text:      #ececf2;
  --muted:     #8d8da3;
  --faint:     #5a5a72;

  --accent:    #7c5cff;   /* electric violet */
  --accent-2:  #14e0d6;   /* cyan */
  --accent-3:  #ff5d8f;   /* coral */

  --grad: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);

  --maxw: 1120px;
  --ease: cubic-bezier(.22,.61,.36,1);

  --font: 'Sora', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* subtle grain / vignette over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 120% at 50% 0%, transparent 55%, rgba(0,0,0,.55) 100%);
  z-index: 1;
}

a { color: inherit; text-decoration: none; }
em { font-style: normal; color: var(--accent-2); }
strong { color: #fff; font-weight: 600; }
.mono { font-family: var(--mono); font-size: .85em; color: var(--muted); }

/* ---------- Three.js canvas ---------- */
#bg-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  display: block;
}

main, .nav, .footer { position: relative; z-index: 2; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: grid; place-content: center; gap: 1.4rem;
  transition: opacity .6s var(--ease), visibility .6s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__mark {
  font-weight: 800; font-size: 2rem; letter-spacing: .1em;
  text-align: center;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.loader__bar {
  width: 160px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden;
}
.loader__bar span {
  display: block; height: 100%; width: 0;
  background: var(--grad);
  animation: load 1.1s var(--ease) forwards;
}
@keyframes load { to { width: 100%; } }

/* ---------- Cursor glow ---------- */
.cursor-glow {
  position: fixed; top: 0; left: 0;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,92,255,.16), transparent 65%);
  transform: translate(-50%, -50%);
  pointer-events: none; z-index: 1;
  transition: opacity .3s;
  will-change: transform;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4rem clamp(1.2rem, 5vw, 3.5rem);
  transition: background .4s, padding .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(5,5,10,.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--line);
  padding-top: 1rem; padding-bottom: 1rem;
}
.nav__logo {
  font-weight: 800; font-size: 1.25rem; letter-spacing: .04em;
}
.nav__logo span { color: var(--accent-2); }
.nav__links { display: flex; gap: 2rem; }
.nav__links a {
  font-size: .9rem; color: var(--muted);
  position: relative; transition: color .25s;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  width: 0; height: 1px; background: var(--accent-2); transition: width .3s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { width: 100%; }

.nav__burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 6px;
}
.nav__burger span {
  width: 24px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s;
}
.nav__burger.is-open span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

/* ---------- Layout helpers ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(5rem, 12vw, 9rem) clamp(1.2rem, 5vw, 2rem);
}
.section__head {
  display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem;
}
.section__num {
  font-family: var(--mono); font-size: .85rem; color: var(--accent);
}
.section__title {
  font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 700; letter-spacing: -.02em;
}
.section__lede {
  max-width: 620px; color: var(--muted); font-size: 1.05rem; margin-bottom: 3rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 clamp(1.2rem, 5vw, 2rem);
}
.hero__eyebrow {
  font-family: var(--mono); font-size: .85rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-2); margin-bottom: 1.2rem;
}
.hero__title {
  font-size: clamp(3rem, 13vw, 8.5rem);
  font-weight: 800; line-height: .92; letter-spacing: -.04em;
}
.hero__title span { display: block; }
.hero__title--accent {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lede {
  max-width: 540px; margin-top: 1.8rem;
  font-size: clamp(1rem, 2.4vw, 1.25rem); color: var(--muted);
}
.hero__cta { display: flex; gap: 1rem; margin-top: 2.4rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .85rem 1.7rem; border-radius: 100px;
  font-size: .95rem; font-weight: 600;
  transition: transform .25s var(--ease), box-shadow .3s, background .3s, color .3s;
}
.btn--primary {
  background: var(--grad); color: #07070d;
  box-shadow: 0 8px 30px rgba(124,92,255,.35);
}
.btn--primary:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(124,92,255,.5); }
.btn--ghost {
  border: 1px solid var(--line); color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent-2); color: var(--accent-2); transform: translateY(-3px); }

.hero__scroll {
  position: absolute; bottom: 2.2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  color: var(--faint);
}
.hero__scroll-line {
  width: 1px; height: 42px; background: linear-gradient(var(--accent-2), transparent);
  animation: scrollPulse 1.8s ease-in-out infinite;
}
.hero__scroll-text {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
}
@keyframes scrollPulse { 0%,100%{ transform: scaleY(.5); opacity:.4 } 50%{ transform: scaleY(1); opacity:1 } }

/* ---------- About ---------- */
.about__grid {
  display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.about__portrait {
  position: relative; border-radius: 18px; overflow: hidden;
  aspect-ratio: 3/4; border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface), var(--bg-soft));
}
.about__portrait img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(.35) contrast(1.05);
  transition: filter .6s, transform .6s var(--ease);
}
.about__portrait:hover img { filter: grayscale(0); transform: scale(1.04); }
.about__portrait--empty::before {
  content: "PHOTO"; position: absolute; inset: 0;
  display: grid; place-content: center;
  font-family: var(--mono); color: var(--faint); letter-spacing: .3em;
}
.about__portrait-tag {
  position: absolute; bottom: 10px; left: 10px;
  font-family: var(--mono); font-size: .7rem; color: var(--accent-2);
  background: rgba(5,5,10,.6); padding: 3px 8px; border-radius: 6px;
  backdrop-filter: blur(4px);
}
.about__text p { color: var(--muted); margin-bottom: 1.2rem; max-width: 60ch; }

.about__stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 2.2rem;
}
.stat {
  border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem;
  background: rgba(255,255,255,.015);
}
.stat__num {
  display: block; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat__label { font-size: .78rem; color: var(--faint); line-height: 1.35; }

/* ---------- Stack ---------- */
.stack__cols {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem;
}
.stack__col {
  border: 1px solid var(--line); border-radius: 16px; padding: 1.6rem;
  background: rgba(255,255,255,.015);
  transition: border-color .35s, transform .35s var(--ease);
}
.stack__col:hover { border-color: rgba(124,92,255,.4); transform: translateY(-4px); }
.stack__col h3 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .15em;
  color: var(--accent-2); margin-bottom: 1.1rem; font-weight: 600;
}
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .55rem; }
.chips li {
  font-size: .85rem; padding: .4rem .8rem; border-radius: 100px;
  border: 1px solid var(--line); color: var(--text);
  background: var(--surface);
}

/* ---------- Work / Project ---------- */
.project {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  background: linear-gradient(160deg, var(--surface), var(--bg-soft));
}
.project__media { position: relative; min-height: 320px; }
.project__media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(1.05);
}
.project__media--empty { background: linear-gradient(135deg, #1a1330, #0c1f24); }
.project__media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 55%, var(--bg-soft) 100%);
}
.project__badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  font-family: var(--mono); font-size: .72rem; color: var(--accent-2);
  background: rgba(5,5,10,.7); border: 1px solid var(--line);
  padding: .35rem .7rem; border-radius: 8px; backdrop-filter: blur(6px);
}
.project__body { padding: clamp(1.6rem, 4vw, 2.6rem) clamp(1.6rem, 4vw, 2.6rem) clamp(1.6rem,4vw,2.6rem) 0; }
.project__title {
  font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; line-height: 1;
}
.project__sub { color: var(--accent-3); font-size: .95rem; margin: .4rem 0 1.2rem; }
.project__desc { color: var(--muted); margin-bottom: 1rem; font-size: .97rem; }
.project__highlights {
  list-style: none; margin: 1.2rem 0; display: grid; gap: .6rem;
}
.project__highlights li {
  position: relative; padding-left: 1.5rem; color: var(--text); font-size: .92rem;
}
.project__highlights li::before {
  content: "▹"; position: absolute; left: 0; color: var(--accent-2);
}
.project__tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }
.project__tags li {
  font-family: var(--mono); font-size: .72rem; color: var(--faint);
  border: 1px solid var(--line); padding: .3rem .6rem; border-radius: 6px;
}

/* ---------- Contact ---------- */
.contact { text-align: left; }
.contact__lede { max-width: 560px; color: var(--muted); margin-bottom: 2.2rem; font-size: 1.05rem; }
.contact__mail {
  display: inline-block;
  font-size: clamp(1.5rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: -.02em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  transition: opacity .3s; word-break: break-word;
}
.contact__mail:hover { opacity: .8; }
.contact__links { display: flex; gap: 1.6rem; margin-top: 2rem; flex-wrap: wrap; }
.contact__links a {
  color: var(--muted); font-size: .95rem; transition: color .25s;
}
.contact__links a:hover { color: var(--accent-2); }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw); margin: 0 auto;
  padding: 2.5rem clamp(1.2rem, 5vw, 2rem);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--faint); font-size: .82rem;
}
.footer__note { font-family: var(--mono); }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav__links {
    position: fixed; inset: 0 0 0 auto; width: min(74vw, 320px);
    flex-direction: column; justify-content: center; gap: 2rem;
    background: rgba(8,8,15,.96); backdrop-filter: blur(16px);
    padding: 2rem; transform: translateX(100%);
    transition: transform .4s var(--ease); border-left: 1px solid var(--line);
  }
  .nav__links.is-open { transform: translateX(0); }
  .nav__links a { font-size: 1.2rem; }
  .nav__burger { display: flex; z-index: 5; }

  .about__grid { grid-template-columns: 1fr; }
  .about__portrait { max-width: 260px; }
  .about__stats { grid-template-columns: 1fr; }

  .stack__cols { grid-template-columns: 1fr; }

  .project { grid-template-columns: 1fr; }
  .project__media { min-height: 220px; }
  .project__media::after { background: linear-gradient(180deg, transparent 60%, var(--bg-soft) 100%); }
  .project__body { padding: 0 1.4rem 1.8rem; }

  .cursor-glow { display: none; }
}

@media (max-width: 480px) {
  .about__stats { grid-template-columns: 1fr 1fr; }
  .footer { flex-direction: column; }
  .contact__mail { font-size: 1.25rem; word-break: normal; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
