/* ================================================================
   Omar Wali — Personal site
   Palette: charcoal #0D0D0F · off-white #F0EEE9 · accent #4A9EFF
   Spacing: 8px base grid
   ================================================================ */

:root {
  --bg: #0d0d0f;
  --ink: #f0eee9;
  --ink-dim: rgba(240, 238, 233, 0.62);
  --ink-faint: rgba(240, 238, 233, 0.38);
  --hairline: rgba(240, 238, 233, 0.1);
  --accent: #4a9eff;
  --accent-dim: rgba(74, 158, 255, 0.35);

  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Playfair Display", Georgia, serif;

  --container: 1120px;
  --nav-h: 72px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
}

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

/* Static depth fallback — sits beneath the canvas, carries the page
   when WebGL is unavailable or motion is reduced. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(110% 80% at 75% 10%, rgba(74, 158, 255, 0.05), transparent 60%),
    radial-gradient(90% 70% at 15% 90%, rgba(240, 238, 233, 0.03), transparent 55%);
  pointer-events: none;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

::selection {
  background: var(--accent-dim);
  color: var(--ink);
}

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

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

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

section[id] {
  scroll-margin-top: var(--nav-h);
}

/* ================= Navigation ================= */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 40px;
  transition: border-color 0.4s ease;
  border-bottom: 1px solid transparent;
}

/* The blur layer lives on a pseudo-element: backdrop-filter on .nav itself
   would create a containing block and trap the fixed mobile menu overlay. */
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(13, 13, 15, 0.72);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.nav.is-scrolled {
  border-bottom-color: var(--hairline);
}

.nav.is-scrolled::before {
  opacity: 1;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 40px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.2s ease;
  position: relative;
  padding-block: 8px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--ink);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  transform: scaleX(1);
}

/* Hamburger — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 48px;
  height: 48px;
  padding: 12px;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  transition: transform 0.3s var(--ease-out), opacity 0.3s ease;
}

body.menu-open .nav-toggle span:first-child {
  transform: translateY(4px) rotate(45deg);
}

body.menu-open .nav-toggle span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* ================= Buttons ================= */

.btn {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 16px 32px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease,
    color 0.25s ease, transform 0.25s var(--ease-out);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

.btn-ghost {
  border-color: var(--hairline);
  color: var(--ink);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ================= Hero ================= */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  padding-top: var(--nav-h);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.01em;
}

.hero-line {
  display: block;
  font-size: clamp(56px, 9vw, 120px);
}

.hero-line-sub {
  font-size: clamp(32px, 5vw, 64px);
  color: var(--ink-dim);
  font-style: italic;
  margin-top: 8px;
}

/* Word-by-word reveal: outer span masks, inner span rises */
.word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.word > span {
  display: inline-block;
  transform: translateY(115%);
  animation: word-rise 0.9s var(--ease-out) forwards;
  animation-delay: calc(120ms * var(--i) + 0.2s);
}

@keyframes word-rise {
  to {
    transform: translateY(0);
  }
}

.hero-subline {
  margin-top: 32px;
  max-width: 480px;
  font-size: 19px;
  color: var(--ink-dim);
  opacity: 0;
  animation: fade-rise 0.9s var(--ease-out) 0.9s forwards;
}

.hero-ctas {
  margin-top: 48px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fade-rise 0.9s var(--ease-out) 1.1s forwards;
}

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll indicator */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  opacity: 0;
  animation: fade-rise 0.9s ease 1.6s forwards;
  transition: opacity 0.4s ease;
}

.scroll-hint.is-hidden {
  opacity: 0 !important;
  pointer-events: none;
}

.scroll-hint-track {
  display: block;
  width: 24px;
  height: 40px;
  border: 1px solid var(--ink-faint);
  border-radius: 12px;
  position: relative;
}

.scroll-hint-dot {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
  animation: hint-drop 2.2s ease-in-out infinite;
}

@keyframes hint-drop {
  0%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }
  60% {
    transform: translateY(16px);
    opacity: 0;
  }
  61% {
    transform: translateY(0);
    opacity: 0;
  }
}

/* ================= Sections (shared) ================= */

.section {
  padding-block: 160px;
}

.section-kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
}

/* Scroll-triggered reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 100ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ================= About ================= */

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 80px;
  align-items: start;
}

.about-bio p {
  color: var(--ink-dim);
  max-width: 52ch;
}

.about-bio p + p {
  margin-top: 24px;
}

.about-stats {
  display: grid;
  gap: 0;
}

.stat {
  padding-block: 24px;
  border-top: 1px solid var(--hairline);
}

.stat:last-child {
  border-bottom: 1px solid var(--hairline);
}

.stat dt {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.stat dd {
  margin-top: 4px;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* ================= Projects ================= */

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}

.project-card {
  border: 1px solid var(--hairline);
  background: rgba(240, 238, 233, 0.02);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), border-color 0.25s ease,
    background-color 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-dim);
  background: rgba(240, 238, 233, 0.04);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
}

.project-card p {
  color: var(--ink-dim);
  font-size: 15px;
  flex-grow: 1;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags li {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--hairline);
  padding: 4px 12px;
  border-radius: 100px;
}

/* ================= Services ================= */

.service-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  margin-top: 32px;
}

.service h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  position: relative;
}

.service h3::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 1px;
  background: var(--accent);
}

.service p {
  margin-top: 16px;
  color: var(--ink-dim);
  font-size: 15px;
}

.services-cta {
  margin-top: 80px;
  text-align: center;
}

/* ================= Contact ================= */

.contact {
  text-align: center;
  padding-block: 200px 160px;
}

.contact-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 1.1;
}

.contact-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
}

.contact-email {
  display: inline-block;
  font-size: clamp(17px, 2.2vw, 24px);
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.contact-email:hover,
.contact-email:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.contact-phone {
  display: inline-block;
  margin-top: 24px;
  font-size: clamp(15px, 1.8vw, 20px);
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.2s ease;
}

.contact-phone:hover,
.contact-phone:focus-visible {
  color: var(--accent);
}

/* ================= Footer ================= */

.footer {
  border-top: 1px solid var(--hairline);
  padding-block: 32px;
}

.footer-inner {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ================= Mobile ================= */

@media (max-width: 900px) {
  .section {
    padding-block: 96px;
  }

  .about-grid,
  .project-grid,
  .service-row {
    grid-template-columns: 1fr;
  }

  .about-grid {
    gap: 56px;
  }

  .service-row {
    gap: 40px;
  }
}

@media (max-width: 720px) {
  .nav {
    padding-inline: 24px;
  }

  .nav-toggle {
    display: flex;
    position: relative;
    z-index: 102;
  }

  .nav-links {
    position: fixed;
    inset: 0;
    z-index: 101;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    background: rgba(13, 13, 15, 0.96);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
  }

  body.menu-open .nav-links {
    opacity: 1;
    visibility: visible;
  }

  body.menu-open {
    overflow: hidden;
  }

  .nav-links a {
    font-size: 22px;
    letter-spacing: 0.02em;
  }

  .container {
    padding-inline: 24px;
  }

  .contact {
    padding-block: 136px 96px;
  }

  .contact-links {
    gap: 24px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* ================= Reduced motion ================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .word > span {
    transform: none;
  }

  .hero-subline,
  .hero-ctas,
  .scroll-hint {
    opacity: 1;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
