/* ============================================================
   Portfolio — dark theme, animated, dependency-free
   Re-theme the whole site by editing the variables below.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #0b0b10;
  --surface: #14141b;
  --surface-2: #1b1b24;
  --border: #262633;
  --ink: #f4f4f8;
  --muted: #a0a0b0;
  --accent: #7c7cf0;
  --accent-strong: #9d9dfa;
  --accent-soft: rgba(124, 124, 240, 0.13);
  --radius: 18px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(124, 124, 240, 0.35), 0 10px 34px rgba(124, 124, 240, 0.22);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

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

::selection { background: rgba(124, 124, 240, 0.4); color: #fff; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2b2b38; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3d3d4e; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.container { width: min(1120px, 92%); margin-inline: auto; }

/* ---------- Scroll progress bar ---------- */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), #a855f7, #ec4899);
  z-index: 100; border-radius: 0 3px 3px 0;
}

/* ---------- Reveal-on-scroll (staggered) ---------- */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 11, 16, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.nav.scrolled { border-color: var(--border); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); }

.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }

.logo { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.logo-dot { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 2rem; font-size: 0.95rem; font-weight: 500; }
.nav-links a { color: var(--muted); position: relative; transition: color 0.2s ease; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 100%;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transform-origin: left; transition: transform 0.25s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-cta {
  background: var(--accent); color: #fff !important;
  padding: 0.55rem 1.15rem; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(124, 124, 240, 0.35);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}
.nav-cta::after { display: none; }
.nav-cta:hover { background: var(--accent-strong); transform: translateY(-1px); box-shadow: 0 6px 22px rgba(124, 124, 240, 0.5); }

.nav-toggle { display: none; background: none; border: 0; padding: 8px; }
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: var(--ink);
  margin: 5px 0; border-radius: 2px; transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 7.5rem 0 4.5rem;
  overflow: hidden;
}

/* Floating gradient blobs */
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(90px); pointer-events: none; z-index: 0;
}
.hero::before {
  width: 620px; height: 420px; top: -140px; right: -120px;
  background: radial-gradient(circle, rgba(124, 124, 240, 0.34), transparent 65%);
  animation: blob-a 14s ease-in-out infinite alternate;
}
.hero::after {
  width: 520px; height: 380px; top: 90px; left: -160px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.24), transparent 65%);
  animation: blob-b 18s ease-in-out infinite alternate;
}
@keyframes blob-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-6%, 8%, 0) scale(1.18); }
}
@keyframes blob-b {
  from { transform: translate3d(0, 0, 0) scale(1.1); }
  to   { transform: translate3d(8%, -6%, 0) scale(0.92); }
}

/* Subtle blueprint grid */
.hero-grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 75%);
}

.hero-inner { position: relative; z-index: 1; max-width: 760px; }

.badge {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.85rem; font-weight: 600; color: var(--accent-strong);
  background: var(--accent-soft); border: 1px solid rgba(124, 124, 240, 0.35);
  padding: 0.4rem 0.95rem; border-radius: 999px; margin-bottom: 1.6rem;
  backdrop-filter: blur(6px);
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34d399; position: relative;
}
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #34d399; opacity: 0.5;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(2.6); opacity: 0; }
}

.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.1rem);
  line-height: 1.08; letter-spacing: -0.03em; font-weight: 800;
  margin-bottom: 1.4rem;
}

/* Rotating headline word */
.rotate { display: inline-grid; color: var(--accent); font-style: normal; }
.rotate .word {
  grid-area: 1 / 1; opacity: 0;
  transform: translateY(0.45em); filter: blur(8px);
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}
.rotate .word.active { opacity: 1; transform: none; filter: none; }

.hero-sub { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin-bottom: 2.2rem; }

.hero-cta { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 3.5rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 0.8rem 1.6rem; border-radius: 999px;
  font-weight: 600; font-size: 0.98rem; border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #6d6df5, #8b5cf6);
  color: #fff;
  box-shadow: 0 8px 24px rgba(124, 124, 240, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(124, 124, 240, 0.55); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); }

/* ---------- Hero stats + tech marquee ---------- */
.hero-stats {
  display: grid; grid-template-columns: repeat(4, auto); gap: 2.5rem;
  padding-top: 2.2rem; border-top: 1px solid var(--border);
  margin-bottom: 2.2rem; max-width: 640px;
}
.stat strong { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.stat span { font-size: 0.88rem; color: var(--muted); }

.tech-strip { position: relative; z-index: 1; }
.marquee {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 26s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-group { display: flex; gap: 2.4rem; padding-right: 2.4rem; }
.marquee-group span {
  font-size: 0.85rem; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 0.4rem 1rem; border-radius: 999px;
  white-space: nowrap; transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.marquee-group span:hover { color: var(--accent-strong); border-color: rgba(124, 124, 240, 0.5); transform: translateY(-2px); }

/* ---------- Sections ---------- */
.section { padding: 6rem 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }

.section-head { max-width: 640px; margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); letter-spacing: -0.02em; font-weight: 800; margin-bottom: 0.8rem; }
.section-sub { color: var(--muted); }
.eyebrow {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--accent); margin-bottom: 0.7rem;
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2.4rem; }
.filter {
  background: var(--surface); border: 1px solid var(--border);
  padding: 0.5rem 1.1rem; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; color: var(--muted);
  transition: all 0.2s ease;
}
.filter:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-1px); }
.filter.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(124, 124, 240, 0.4); }

/* ---------- Grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.6rem; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
  transform: translateY(-5px); border-color: rgba(124, 124, 240, 0.45);
  box-shadow: var(--shadow), 0 0 0 1px rgba(124, 124, 240, 0.12);
}

/* Project covers removed — all projects now use live previews */

.chip {
  font-size: 0.75rem; font-weight: 700; color: var(--accent-strong);
  background: var(--accent-soft); padding: 0.25rem 0.7rem; border-radius: 999px;
}
.year { font-size: 0.82rem; color: var(--muted); }
.card h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0.45rem; }
.card p { font-size: 0.94rem; color: var(--muted); margin-bottom: 1rem; }

/* Project rows hidden by the filter */
.project.hidden { display: none; }

/* ---------- Work list (editorial rows) ---------- */
.work-list { display: grid; }
.project-row {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem; align-items: center;
  padding: 3.2rem 0; border-top: 1px solid var(--border);
  transition: transform 0.25s ease;
}
.project-row:first-child { border-top: 0; padding-top: 0; }
.project-row:hover { transform: translateX(8px); }
.project-row:nth-child(even) .row-media { order: 2; }
.row-media { border-radius: var(--radius); transition: transform 0.3s ease; }
.project-row:hover .row-media { transform: scale(1.02); }

/* Live previews — the real demo site, scaled to fit the card */
.live-preview {
  aspect-ratio: 16 / 10; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  position: relative; background: var(--surface-2);
}
.live-preview iframe {
  width: 1120px; height: 700px; border: 0;
  flex-shrink: 0;
  transform: scale(0.45); transform-origin: center center;
  pointer-events: none;
}
.live-chip {
  position: absolute; top: 0.9rem; left: 0.9rem; z-index: 2;
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: #fff; background: rgba(11, 11, 16, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.3rem 0.75rem; border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; position: relative; }
.live-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: #34d399; animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.4); opacity: 0; }
}
.row-body { max-width: 520px; }
.row-meta { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.1rem; }
.row-num { font-size: 1.35rem; font-weight: 800; color: var(--accent); opacity: 0.9; letter-spacing: 0.03em; }
.row-body h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.7rem; }
.row-body p { color: var(--muted); font-size: 1rem; margin-bottom: 1.2rem; }
.row-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.row-tags span {
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 0.28rem 0.75rem; border-radius: 999px;
}
.card-link { display: inline-block; font-size: 0.95rem; font-weight: 600; color: var(--accent); }
.card-link::after { content: "→"; display: inline-block; margin-left: 0.45rem; transition: transform 0.25s ease; }
.project-row:hover .card-link { text-decoration: underline; }
.project-row:hover .card-link::after { transform: translateX(5px); }
.project-row.hidden { display: none; }

/* ---------- Services ---------- */
.service { padding: 1.7rem; }
.icon {
  display: grid; place-items: center;
  width: 3rem; height: 3rem; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(124, 124, 240, 0.25);
  margin-bottom: 1.2rem;
  animation: float 5s ease-in-out infinite;
}
.service:nth-child(2) .icon { animation-delay: 0.6s; }
.service:nth-child(3) .icon { animation-delay: 1.2s; }
.service:nth-child(4) .icon { animation-delay: 1.8s; }
@keyframes float { 50% { transform: translateY(-6px); } }
.icon svg { width: 1.5rem; height: 1.5rem; }
.service h3 { font-size: 1.08rem; font-weight: 700; margin-bottom: 0.5rem; }
.service p { font-size: 0.92rem; color: var(--muted); }

/* ---------- Process ---------- */
.process-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.6rem; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem 1.6rem; position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.step:hover { transform: translateY(-4px); border-color: rgba(124, 124, 240, 0.45); box-shadow: var(--shadow); }
.step-num {
  font-size: 0.9rem; font-weight: 800; color: var(--accent-strong);
  border: 1px solid rgba(124, 124, 240, 0.35); background: var(--accent-soft);
  padding: 0.25rem 0.7rem; border-radius: 999px; display: inline-block; margin-bottom: 1.1rem;
}
.step h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.45rem; }
.step p { font-size: 0.92rem; color: var(--muted); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 3.5rem; align-items: start; }
.about-grid h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); letter-spacing: -0.02em; font-weight: 800; line-height: 1.2; }
.about-text p { color: var(--muted); margin-bottom: 1.1rem; }
.about-text .btn { margin-top: 0.6rem; }

/* ---------- Contact ---------- */
.contact-card {
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, rgba(124, 124, 240, 0.55), rgba(168, 85, 247, 0.18) 45%, rgba(124, 124, 240, 0.06)) border-box;
  border: 1px solid transparent; border-radius: 24px;
  padding: 3.5rem; text-align: center; max-width: 720px; margin-inline: auto;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s ease;
}
.contact-card:hover { box-shadow: var(--shadow), 0 0 44px rgba(124, 124, 240, 0.14); }
.contact-card h2 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); letter-spacing: -0.02em; font-weight: 800; margin-bottom: 0.7rem; }
.contact-card .section-sub { margin-bottom: 2rem; }

.contact-form { display: grid; gap: 0.9rem; text-align: left; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.contact-form input,
.contact-form textarea {
  width: 100%; padding: 0.85rem 1.05rem;
  border: 1px solid var(--border); border-radius: 12px;
  font-family: inherit; font-size: 0.95rem; color: var(--ink);
  background: var(--surface-2); transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: #6b6b7b; }
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 124, 240, 0.25);
}
.contact-form textarea { resize: vertical; }
.contact-form .btn { justify-self: start; }

.contact-note { font-size: 0.9rem; margin-top: 0.9rem; min-height: 1.4em; }
.contact-note.ok { color: #34d399; }
.contact-note.err { color: #f87171; }

.contact-links { display: flex; justify-content: center; gap: 1.6rem; flex-wrap: wrap; margin-top: 1.8rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.contact-links a { font-weight: 600; color: var(--accent); font-size: 0.95rem; transition: color 0.2s ease; }
.contact-links a:hover { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 2.4rem 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 1.5rem; font-size: 0.9rem; color: var(--muted); }
.footer-links a { transition: color 0.2s ease; }
.footer-links a:hover { color: var(--accent-strong); }
.footer p { font-size: 0.85rem; color: var(--muted); }

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Mobile ---------- */
@media (max-width: 1100px) {
  .live-preview iframe { transform: scale(0.35); }
}
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0.6rem 4%; box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.85rem 0; width: 100%; border-bottom: 1px solid var(--border); }
  .nav-links .nav-cta { text-align: center; margin: 0.85rem 0; }

  .hero { padding-top: 5rem; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 1.6rem; }
  .project-row { grid-template-columns: 1fr; gap: 1.2rem; padding: 2.2rem 0; }
  .project-row:nth-child(even) .row-media { order: 0; }
  .section { padding: 4.5rem 0; }
  .about-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .form-row { grid-template-columns: 1fr; }
  .contact-card { padding: 2.4rem 1.6rem; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .pulse::after, .icon, .hero::before, .hero::after { animation: none; }
  .live-dot::after { animation: none; }
  .marquee-track { animation: none; }
  .rotate .word { opacity: 1; transform: none; filter: none; transition: none; }
}
