/* ===== Base ===== */
:root {
  --bg: #07080c;
  --surface: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f2f3f7;
  --text-muted: #a2aabf;
  --glass: rgba(9, 11, 16, 0.62);
  --glass-blur: blur(22px) saturate(140%);
  --accent: #6ee7ff;
  --accent-2: #a78bfa;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(110, 231, 255, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(167, 139, 250, 0.07), transparent);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===== Preloader ===== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.9s var(--ease-out), visibility 0s 0.9s;
}

.preloader-count {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
}

body.loaded .preloader {
  transform: translateY(-100%);
  visibility: hidden;
}

/* ===== WebGL + grain ===== */
#webgl {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 50;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.045;
  animation: grain-shift 0.6s steps(4) infinite;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-1%, -3%); }
  100% { transform: translate(2%, 2%); }
}

/* ===== Custom cursor ===== */
.cursor {
  position: fixed;
  z-index: 90;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out),
    background 0.3s, border-color 0.3s;
}

.cursor-dot {
  position: fixed;
  z-index: 90;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.cursor.is-hover {
  width: 64px;
  height: 64px;
  background: rgba(110, 231, 255, 0.1);
  border-color: var(--accent);
}

@media (pointer: coarse) {
  .cursor,
  .cursor-dot {
    display: none;
  }
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px clamp(24px, 5vw, 64px);
  mix-blend-mode: difference;
}

.nav a {
  color: #fff;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem !important;
}

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

.nav-links a {
  position: relative;
}

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

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-lang {
  display: flex;
  gap: 4px;
}

.nav-lang button {
  background: none;
  border: none;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 4px 7px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.3s;
}

.nav-lang button:hover {
  opacity: 0.8;
}

.nav-lang button.active {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 600px) {
  .nav-links {
    gap: 16px;
  }

  .nav {
    gap: 12px;
  }
}

/* ===== Layout ===== */
main {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 64px);
  /* halo around glyphs so ink passing underneath never eats the text */
  text-shadow: 0 0 2px rgba(7, 8, 12, 0.95), 0 1px 4px rgba(7, 8, 12, 0.9),
    0 2px 14px rgba(7, 8, 12, 0.85), 0 4px 32px rgba(7, 8, 12, 0.7);
}

/* gradient-clipped text: a shadow would paint over the gradient fill */
.stat-num,
.contact-big em,
.btn {
  text-shadow: none;
}

/* ===== Hero ===== */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding-top: 80px;
}

.hero-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 12px #4ade80;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.4; }
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 11.5vw, 10rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  /* drop-shadow follows the stroke outline too, unlike text-shadow */
  filter: drop-shadow(0 2px 6px rgba(7, 8, 12, 0.9)) drop-shadow(0 8px 28px rgba(7, 8, 12, 0.7));
}

.hero-name .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.hero-name .line-inner {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 1.1s var(--ease-out);
  transition-delay: calc(0.9s + var(--i) * 0.12s);
}

body.loaded .hero-name .line-inner {
  transform: translateY(0);
}

.hero-name .outline {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--text);
}

.hero-row {
  display: flex;
  gap: clamp(24px, 6vw, 96px);
  align-items: flex-start;
  margin-top: 40px;
  flex-wrap: wrap;
  /* frosted card so the pitch stays legible when ink drifts under it */
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px clamp(20px, 3vw, 36px);
  max-width: max-content;
}

.hero-title {
  color: var(--accent);
  font-size: 0.9rem;
  white-space: nowrap;
  padding-top: 6px;
}

.hero-pitch {
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 16px 32px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s, transform 0.3s var(--ease-out);
}

.btn:hover {
  transform: translateY(-3px);
}

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

.btn-primary:hover {
  background: var(--accent);
  box-shadow: 0 0 40px rgba(110, 231, 255, 0.35);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 0;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-scroll-arrow {
  display: inline-block;
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {
  50% { transform: translateY(5px); }
}

/* ===== Sections ===== */
.section {
  padding: clamp(80px, 12vh, 140px) 0;
}

.section-title {
  color: var(--accent);
  margin-bottom: clamp(40px, 6vh, 72px);
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 56px clamp(24px, 4vw, 48px);
}

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--text) 40%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  color: var(--text-muted);
}

/* ===== Marquee ===== */
.marquee {
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  margin: 0 calc(-1 * clamp(24px, 5vw, 64px));
}

.marquee-track {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 500;
  color: var(--text-muted);
  animation: marquee 28s linear infinite;
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ===== Work ===== */
.works {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.work {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  padding: 40px 32px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: background 0.4s, border-color 0.4s;
}

.work:hover {
  background: rgba(14, 17, 25, 0.72);
  border-color: rgba(110, 231, 255, 0.25);
}

.work-index {
  color: var(--text-muted);
  font-size: 1rem;
  padding-top: 10px;
}

.work-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  transition: color 0.3s;
}

.work:hover .work-title {
  color: var(--accent);
}

.work-client {
  color: var(--accent-2);
  margin: 8px 0 16px;
}

.work-desc {
  color: var(--text-muted);
  max-width: 64ch;
  margin-bottom: 16px;
}

.work-desc strong {
  color: var(--text);
  font-weight: 600;
}

.work-meta {
  color: var(--text-muted);
  opacity: 0.7;
  margin-bottom: 20px;
}

.work-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
  transition: color 0.3s, border-color 0.3s;
}

.work-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.work-link .arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease-out);
}

.work-link:hover .arrow {
  transform: translate(3px, -3px);
}

/* ===== Contact ===== */
.contact {
  text-align: center;
}

.contact-big {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 6.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 48px;
}

.contact-big em {
  font-style: normal;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 20px 44px;
  transition: border-color 0.3s, box-shadow 0.3s, color 0.3s, transform 0.3s var(--ease-out);
}

/* "a" tag qualifier: must outrank .fade-up.visible's transform, declared later */
a.contact-email:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 60px rgba(110, 231, 255, 0.2);
  transform: translateY(-3px);
}

.contact-note {
  color: var(--text-muted);
  margin-top: 24px;
}

/* ===== Footer ===== */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
}

.footer a:hover {
  color: var(--accent);
}

/* ===== Scroll reveal ===== */
.fade-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 0.1s);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero label/actions reveal with the preloader, not on scroll */
.hero .fade-up {
  transition-delay: calc(1.2s + var(--i, 0) * 0.1s);
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .fade-up,
  .hero-name .line-inner {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 600px) {
  .work {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .nav-links {
    gap: 20px;
  }
}
