/*
  style.css — Portfolio for Rana Ali Raza (Ali)
  Dark, high-contrast theme. Hero is full WebGL; the rest stays clean & fast.
  Sections fade/slide in on scroll; cards tilt + glow on hover.
  Respects prefers-reduced-motion (motion-driven effects are disabled there).
*/

/* ===== Design tokens ===== */
:root {
  --bg:        #0a0a0f;
  --bg-alt:    #0e0e16;
  --surface:   #14141f;
  --surface-2: #1b1b29;
  --line:      rgba(255, 255, 255, 0.08);
  --text:      #f4f4f8;
  --muted:     #a7a7b8;
  --muted-2:   #6f6f82;
  --brand:     #7c5cff;
  --brand-2:   #19d3c5;
  --brand-glow: rgba(124, 92, 255, 0.35);
  --whatsapp:  #25d366;

  --maxw: 1140px;
  --radius: 16px;
  --radius-sm: 10px;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Reset / base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* subtle film grain via repeating noise */
  position: relative;
}

/* Grain overlay (very subtle, decorative) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 10000;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), #9d7bff);
  color: #fff;
  box-shadow: 0 8px 30px var(--brand-glow);
}
.btn-primary:hover { box-shadow: 0 12px 40px var(--brand-glow); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--brand); background: rgba(124, 92, 255, 0.08); }

.btn-whatsapp { background: var(--whatsapp); color: #04210f; font-weight: 600; }
.btn-whatsapp:hover { box-shadow: 0 10px 30px rgba(37, 211, 102, 0.3); }

.btn-block { width: 100%; }

/* ===== Header / nav ===== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 1.05rem;
}
.brand-name { font-size: 1.1rem; }

.nav-menu { list-style: none; display: flex; align-items: center; gap: 30px; }
.nav-menu a { color: var(--muted); font-weight: 500; font-size: 0.98rem; transition: color 0.2s var(--ease); }
.nav-menu a:hover { color: var(--text); }
.nav-cta {
  color: var(--text) !important;
  border: 1px solid var(--line);
  padding: 9px 18px;
  border-radius: 999px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease) !important;
}
.nav-cta:hover { border-color: var(--brand); background: rgba(124, 92, 255, 0.1); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.3s var(--ease), opacity 0.3s var(--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;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
.hero-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  background:
    radial-gradient(circle at 20% 25%, rgba(124, 92, 255, 0.45), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(25, 211, 197, 0.35), transparent 50%),
    linear-gradient(160deg, #0a0a0f, #11111c 60%, #0a0a0f);
}
/* Dark vignette so text stays readable over the shader */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10,10,15,0.55) 0%, rgba(10,10,15,0.15) 30%, rgba(10,10,15,0.35) 70%, rgba(10,10,15,0.92) 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin-inline: auto;
  padding: 120px 24px 80px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin-bottom: 22px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.hero-title {
  font-size: clamp(2.1rem, 6vw, 4.1rem);
  margin-bottom: 24px;
  text-wrap: balance;
}
.hero-sub {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 36px;
}
.hero-sub strong { color: var(--text); }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.hero-scroll {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 26px;
  height: 42px;
  border: 2px solid var(--muted-2);
  border-radius: 999px;
  display: grid;
  place-items: start center;
  padding-top: 7px;
}
.hero-scroll-dot { width: 4px; height: 8px; border-radius: 4px; background: var(--text); animation: scrollDot 1.8s var(--ease) infinite; }
@keyframes scrollDot { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ===== Sections ===== */
.section { padding: clamp(70px, 11vw, 130px) 0; position: relative; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }

.section-head { max-width: 680px; margin-bottom: 56px; }
.section-kicker {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 14px;
}
.section-title { font-size: clamp(1.9rem, 4.5vw, 3rem); margin-bottom: 16px; }
.section-lead { color: var(--muted); font-size: 1.1rem; }

/* ===== Cards ===== */
.cards { display: grid; gap: 22px; }
.services-grid { grid-template-columns: repeat(4, 1fr); }
.projects-grid { grid-template-columns: repeat(2, 1fr); }

.card, .project {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  position: relative;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  transform-style: preserve-3d;
  will-change: transform;
}
.card:hover, .project:hover,
.card:focus-visible, .project:focus-visible {
  border-color: rgba(124, 92, 255, 0.55);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--brand-glow);
}
/* Glow that follows the cursor (driven by JS custom props) */
.card::before, .project::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(124, 92, 255, 0.16), transparent 60%);
  pointer-events: none;
}
.card:hover::before, .project:hover::before { opacity: 1; }

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 50px; height: 50px;
  border-radius: 12px;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid var(--line);
  font-size: 1.3rem;
  font-family: var(--font-display);
  color: var(--brand-2);
  margin-bottom: 18px;
}
.card-title { font-size: 1.2rem; margin-bottom: 10px; }
.card-text { color: var(--muted); font-size: 0.98rem; }

/* Project cards */
.project-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tag {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-2);
  background: rgba(25, 211, 197, 0.1);
  border: 1px solid rgba(25, 211, 197, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
}
.status { font-size: 0.78rem; color: var(--muted-2); }
.status-soon::before { content: "● "; color: #e0a93b; }
.status-live::before { content: "● "; color: var(--whatsapp); }
.project-title { font-size: 1.35rem; margin-bottom: 16px; }

.project-detail { display: grid; gap: 4px 0; margin-bottom: 22px; }
.project-detail dt {
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-top: 12px;
}
.project-detail dt:first-child { margin-top: 0; }
.project-detail dd { color: var(--muted); font-size: 0.96rem; }

.project-link {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text);
  transition: gap 0.2s var(--ease), color 0.2s var(--ease);
}
.project-link:hover { color: var(--brand-2); }
.project-link[aria-disabled="true"] { color: var(--muted-2); pointer-events: none; cursor: default; }

/* Project cover image (cinematic, desaturated until hover) */
.project { padding-top: 0; overflow: hidden; }   /* keeps 28px left/right/bottom */
.project-media {
  margin: 0 -28px 24px;          /* bleed past the card's side padding to the edges */
  height: 190px;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--line);
}
.project-media::after {          /* fade bottom into the card */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20,20,31,0) 45%, rgba(20,20,31,0.85) 100%);
  pointer-events: none;
}
.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.35) brightness(0.82) contrast(1.05);
  transform: scale(1.02);
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}
.project:hover .project-media img,
.project:focus-visible .project-media img {
  transform: scale(1.08);
  filter: grayscale(0) brightness(0.95) contrast(1.05);
}

/* ===== Cinematic tech band ===== */
.techband {
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  background-image:
    url("https://images.unsplash.com/photo-1518770660439-4636190af475?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;       /* subtle parallax on desktop */
  border-block: 1px solid var(--line);
}
.techband-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,15,0.82), rgba(10,10,15,0.7)),
    radial-gradient(circle at 25% 40%, rgba(124,92,255,0.35), transparent 55%),
    radial-gradient(circle at 80% 70%, rgba(25,211,197,0.28), transparent 55%);
}
.techband-inner { position: relative; z-index: 1; text-align: center; padding-block: 80px; }
.techband-kicker {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin-bottom: 16px;
}
.techband-line {
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  max-width: 800px;
  margin-inline: auto;
  text-wrap: balance;
}

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 56px; align-items: center; }
.about-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.about-photo .img-missing {
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 12px, var(--surface-2) 12px, var(--surface-2) 24px);
  color: var(--muted-2);
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}
.about-body p { color: var(--muted); margin-bottom: 16px; }
.about-body .section-title { margin-bottom: 20px; }
.about-meta { list-style: none; display: grid; gap: 10px; margin: 24px 0 30px; }
.about-meta li { color: var(--muted); padding-left: 18px; position: relative; }
.about-meta li::before { content: ""; position: absolute; left: 0; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.about-meta strong { color: var(--text); font-family: var(--font-display); font-weight: 500; margin-right: 6px; }

/* ===== Contact ===== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.contact-list { list-style: none; display: grid; gap: 18px; margin: 28px 0; }
.contact-list li { display: grid; gap: 2px; }
.contact-label { font-family: var(--font-display); font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); }
.contact-list a { color: var(--text); font-size: 1.05rem; transition: color 0.2s var(--ease); width: fit-content; }
.contact-list a:hover { color: var(--brand-2); }
.contact-quick { margin-top: 28px; }

.contact-form {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
}
.field { margin-bottom: 18px; display: grid; gap: 8px; }
.field label { font-family: var(--font-display); font-size: 0.88rem; color: var(--muted); }
.field input, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 13px 15px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.field input:invalid:not(:placeholder-shown),
.field textarea:invalid:not(:placeholder-shown) { border-color: #e0556a; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-status { margin-top: 14px; font-size: 0.95rem; min-height: 1.4em; }
.form-status.ok { color: var(--brand-2); }
.form-status.err { color: #ff7b8a; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--muted-2); font-size: 0.92rem; }
.footer-social { list-style: none; display: flex; gap: 22px; }
.footer-social a { color: var(--muted); transition: color 0.2s var(--ease); }
.footer-social a:hover { color: var(--text); }

/* ===== Floating WhatsApp button ===== */
.floating-wa {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--whatsapp);
  color: #04210f;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 20px 13px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(37, 211, 102, 0.35);
  transform: translateY(0);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.floating-wa svg { display: block; }
.floating-wa:hover { transform: translateY(-3px); box-shadow: 0 16px 42px rgba(37, 211, 102, 0.45); }
/* Soft pulse ring to draw the eye */
.floating-wa::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--whatsapp);
  animation: waPulse 2.4s var(--ease) infinite;
  pointer-events: none;
}
@keyframes waPulse {
  0%   { opacity: 0.6; transform: scale(1); }
  70%  { opacity: 0; transform: scale(1.35); }
  100% { opacity: 0; transform: scale(1.35); }
}

/* ===== Scroll reveal ===== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .about-photo { max-width: 320px; }
  .contact-grid { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed;
    inset: 0 0 auto 0;
    top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 92px 24px 28px;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-110%);
    transition: transform 0.4s var(--ease);
  }
  .nav-menu.open { transform: translateY(0); }
  .nav-menu li { border-top: 1px solid var(--line); }
  .nav-menu a { display: block; padding: 16px 4px; font-size: 1.1rem; }
  .nav-cta { border: 0; padding: 16px 4px; border-radius: 0; }

  .services-grid, .projects-grid { grid-template-columns: 1fr; }
  .hero-inner { padding-top: 110px; }
  .floating-wa { right: 16px; bottom: 16px; padding: 12px 16px; }
  .floating-wa-label { display: none; }     /* icon-only on phones */
  .floating-wa { padding: 14px; }
  /* fixed background attachment is janky on mobile — use normal scroll */
  .techband { background-attachment: scroll; min-height: 280px; }
}

/* ===== Reduced motion: kill all motion-driven effects ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-canvas { display: none; }
  .hero-fallback { display: block; }
}
