/* ============================================================
   htuna.com — Build. Ship. Repeat.
   ============================================================ */

:root {
  --bg: #0a0a0f;
  --bg-soft: #101018;
  --ink: #f4f4f0;
  --ink-dim: #9a9aa6;
  --lime: #c8ff4d;
  --line: rgba(244, 244, 240, 0.1);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.68, -0.4, 0.32, 1.4);
}

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

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--lime) var(--bg);
}

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

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

body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }

/* ============ PRELOADER ============ */
.preloader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: grid; place-items: center;
  transition: transform 0.7s var(--ease-out), visibility 0.7s;
}
.preloader.done { transform: translateY(-100%); visibility: hidden; }
.preloader-inner { text-align: center; }
.preloader-word {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  height: 1.6em;
  overflow: hidden;
  position: relative;
  margin-bottom: 1.2rem;
}
.preloader-word span {
  position: absolute; inset: 0;
  opacity: 0;
  color: var(--lime);
  animation: wordCycle 0.9s steps(1) infinite;
}
.preloader-word span:nth-child(2) { animation-delay: 0.3s; }
.preloader-word span:nth-child(3) { animation-delay: 0.6s; }
@keyframes wordCycle {
  0%, 32% { opacity: 1; }
  33%, 100% { opacity: 0; }
}
.preloader-bar {
  width: min(240px, 60vw); height: 2px;
  background: var(--line);
  border-radius: 2px; overflow: hidden;
  margin: 0 auto;
}
.preloader-bar span {
  display: block; height: 100%; width: 0%;
  background: var(--lime);
  transition: width 0.2s linear;
}

/* ============ CURSOR ============ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none;
  border-radius: 50%;
  z-index: 150;
  opacity: 0;
  transform: translate(-50%, -50%);
}
body.has-cursor .cursor-dot, body.has-cursor .cursor-ring { opacity: 1; }
.cursor-dot {
  width: 8px; height: 8px;
  background: var(--lime);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1.5px solid rgba(200, 255, 77, 0.5);
  transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out),
              border-color 0.25s, background-color 0.25s;
}
.cursor-ring.is-hover {
  width: 64px; height: 64px;
  background: rgba(200, 255, 77, 0.08);
  border-color: var(--lime);
}

/* ============ NOISE ============ */
.noise {
  position: fixed; inset: -50%;
  z-index: 120;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -8%); }
  30% { transform: translate(6%, 4%); }
  50% { transform: translate(-4%, 7%); }
  70% { transform: translate(7%, -3%); }
  90% { transform: translate(-6%, -5%); }
}

/* ============ SCROLL PROGRESS ============ */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--lime), #5ee6c8);
  z-index: 140;
}

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 3rem);
  transition: background 0.4s, backdrop-filter 0.4s, transform 0.45s var(--ease-out);
}
.nav.is-scrolled {
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav.is-hidden { transform: translateY(-110%); }
.nav-logo {
  display: inline-flex; align-items: baseline; gap: 1px;
  text-decoration: none; color: var(--ink);
  font-weight: 700; font-size: 1.25rem;
}
.logo-mark {
  display: inline-grid; place-items: center;
  width: 1.6em; height: 1.6em;
  background: var(--lime); color: var(--bg);
  border-radius: 0.45em;
  font-family: var(--font-mono);
  margin-right: 0.35em;
  transform: rotate(-4deg);
  transition: transform 0.4s var(--ease-snap);
}
.nav-logo:hover .logo-mark { transform: rotate(356deg) scale(1.1); }
.logo-text sup { font-size: 0.5em; color: var(--lime); }
.nav-links { display: flex; gap: clamp(1rem, 3vw, 2.4rem); }
.nav-links a {
  color: var(--ink-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.25s;
}
.nav-links a:hover { color: var(--lime); }
.nav-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  line-height: 1.5;
}
.nav-clock { color: var(--lime); }
@media (max-width: 640px) { .nav-meta { display: none; } }

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; place-items: center;
  padding: 7rem clamp(1.2rem, 4vw, 3rem) 4rem;
  overflow: hidden;
}
#heroCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-content { position: relative; z-index: 2; text-align: center; max-width: 1100px; }
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  display: inline-flex; align-items: center; gap: 0.6em;
  margin-bottom: 2rem;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 0 rgba(200, 255, 77, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(200, 255, 77, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(200, 255, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 255, 77, 0); }
}
.hero-title {
  font-size: clamp(3.4rem, min(11vw, 22vh), 9rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center;
}
.hero-line { display: block; overflow: hidden; }
.hero-word, .hero-punct {
  display: inline-block;
  transform: translateY(110%);
  animation: riseUp 0.9s var(--ease-out) forwards;
}
.hero-line:nth-child(1) .hero-word, .hero-line:nth-child(1) .hero-punct { animation-delay: 0.15s; }
.hero-line:nth-child(2) .hero-word, .hero-line:nth-child(2) .hero-punct { animation-delay: 0.3s; }
.hero-line:nth-child(3) .hero-word, .hero-line:nth-child(3) .hero-punct { animation-delay: 0.45s; }
@keyframes riseUp { to { transform: translateY(0); } }
.hero-word { transition: color 0.3s, -webkit-text-stroke 0.3s, letter-spacing 0.5s var(--ease-out); }
.hero-word:hover { letter-spacing: 0.02em; color: var(--lime); }
.hero-word--outline {
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
}
.hero-word--outline:hover { -webkit-text-stroke: 2px var(--lime); color: transparent; }
.hero-punct { color: var(--lime); }
.blink { animation: riseUp 0.9s var(--ease-out) 0.45s forwards, blink 1.1s step-end 1.5s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-sub {
  margin-top: 2.2rem;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--ink-dim);
}
.hero-sub em { color: var(--ink); font-style: italic; }
.hero-cta {
  margin-top: 2.6rem;
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
}
.btn {
  display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.95em 1.9em;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.3s var(--ease-snap), background 0.3s, color 0.3s, border-color 0.3s;
}
.btn--primary { background: var(--lime); color: var(--bg); }
.btn--primary:hover { transform: scale(1.05); background: #d9ff7a; }
.btn--primary svg { animation: bounceDown 1.6s var(--ease-out) infinite; }
@keyframes bounceDown { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
.btn--ghost {
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn--ghost:hover { border-color: var(--lime); color: var(--lime); transform: scale(1.05); }
.hero-scroll-hint {
  position: absolute; bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.scroll-line {
  width: 1px; height: 46px;
  background: var(--line);
  position: relative; overflow: hidden;
}
.scroll-line::after {
  content: ""; position: absolute; top: -50%; left: 0;
  width: 100%; height: 50%;
  background: var(--lime);
  animation: scrollDrip 1.8s var(--ease-out) infinite;
}
@keyframes scrollDrip { to { top: 110%; } }

/* ============ MARQUEE ============ */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
  overflow: hidden;
  background: var(--bg-soft);
}
.marquee-track {
  display: flex; width: max-content;
  animation: marquee 26s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.marquee-track i { color: var(--lime); font-style: normal; margin: 0 0.8em; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ SECTIONS ============ */
section { padding: clamp(5rem, 12vh, 9rem) clamp(1.2rem, 4vw, 3rem); }
.section-head { max-width: 1200px; margin: 0 auto 3.5rem; position: relative; }
.section-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--lime);
  letter-spacing: 0.2em;
}
.section-title {
  font-size: clamp(2.6rem, 8vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-top: 0.6rem;
}
.section-title > span { display: block; }
.outline-text {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
}
.section-note {
  margin-top: 1.4rem;
  color: var(--ink-dim);
  max-width: 46ch;
}

/* line reveal */
.reveal-lines { display: block; overflow: hidden; }
.reveal-lines > span {
  display: block;
  transform: translateY(110%);
  transition: transform 0.9s var(--ease-out);
}
.in-view .reveal-lines > span, .reveal-lines.in-view > span { transform: translateY(0); }

/* fade+rise reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ============ WORK GRID ============ */
.work-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.4rem;
}
.card {
  --accent: var(--lime);
  position: relative;
  display: flex; flex-direction: column; gap: 1rem;
  padding: 2rem 1.8rem 1.6rem;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--bg-soft);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: border-color 0.35s, box-shadow 0.35s, transform 0.2s;
  will-change: transform;
}
.card:hover {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 24px 60px -20px rgba(var(--accent-rgb), 0.25);
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--accent-rgb), 0.12), transparent 45%);
  opacity: 0;
  transition: opacity 0.4s;
}
.card:hover::before { opacity: 1; }
.card-glare {
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.06) 45%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.8s var(--ease-out);
  pointer-events: none;
}
.card:hover .card-glare { transform: translateX(120%); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  font-size: 1.5rem;
  border-radius: 15px;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  transition: transform 0.4s var(--ease-snap), background 0.3s;
}
.card:hover .card-icon { transform: rotate(-8deg) scale(1.12); background: rgba(var(--accent-rgb), 0.24); }
.card-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 0.4em 0.9em;
  border-radius: 100px;
}
.card-title {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: color 0.3s;
}
.card:hover .card-title { color: var(--accent); }
.card-desc { color: var(--ink-dim); font-size: 0.95rem; flex-grow: 1; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
}
.card-arrow {
  font-size: 1.2rem;
  color: var(--accent);
  transition: transform 0.35s var(--ease-snap);
}
.card:hover .card-arrow { transform: translateX(6px) rotate(-45deg); }

/* ============ ABOUT ============ */
.about { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.about-grid {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }
.about-lead {
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  line-height: 1.45;
  font-weight: 500;
  margin-bottom: 1.4rem;
}
.about-text p:not(.about-lead) { color: var(--ink-dim); max-width: 56ch; }
.about-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem 1.2rem;
  transition: border-color 0.3s, transform 0.35s var(--ease-out);
}
.stat:hover { border-color: var(--lime); transform: translateY(-4px); }
.stat-num {
  display: block;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ============ CONTACT ============ */
.contact { text-align: center; }
.contact-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1.5rem;
}
.contact-link {
  display: inline-block;
  text-decoration: none;
  color: var(--ink);
  font-size: clamp(3.4rem, 12vw, 9.5rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.contact-word { display: block; }
.contact-link .outline-text { transition: color 0.4s; }
.contact-link:hover .outline-text { color: var(--lime); -webkit-text-stroke-color: var(--lime); }
.contact-link em { font-style: normal; color: var(--lime); display: inline-block; transition: transform 0.35s var(--ease-snap); }
.contact-link:hover em { transform: translate(0.08em, -0.08em); }
.contact-mail {
  margin-top: 2rem;
  font-family: var(--font-mono);
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

/* ============ FOOTER ============ */
.footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 1.6rem clamp(1.2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
}
.footer-top { color: var(--ink-dim); text-decoration: none; transition: color 0.25s; }
.footer-top:hover { color: var(--lime); }

/* ============ GRAVITY EASTER EGG ============ */
body.gravity-flip main, body.gravity-flip .footer {
  transform: rotate(180deg);
  transition: transform 1.2s var(--ease-snap);
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal, .reveal-lines > span { opacity: 1; transform: none; }
  .hero-word, .hero-punct { transform: none; }
}
