/* ============================================
   Emerald Keira — Ultimate v3
   ============================================ */

:root {
  --bg: #000;
  --text: #fff;
  --accent: #00ffaa;
  --dim: #ccc;
  --faint: #999;
  --border: #222;
  --holo-1: #00ffaa;
  --holo-2: #00ddff;
  --holo-3: #a78bfa;
  --holo-4: #f472b6;
  --holo-5: #00ffaa;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

/* Lock scroll during intro */
body.loading {
  overflow: hidden;
}

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

::selection {
  background: rgba(0, 255, 170, 0.25);
  color: var(--text);
}

/* --- Intro Overlay --- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.intro.fade-out {
  opacity: 0;
  pointer-events: none;
}

.intro-shamrock {
  font-size: clamp(4rem, 12vw, 8rem);
  background: linear-gradient(135deg, var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4), var(--holo-1));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: introShimmer 2s ease-in-out infinite, introPulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 40px rgba(0, 255, 170, 0.4));
}

.intro-ring {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 2px solid rgba(0, 255, 170, 0.2);
  border-radius: 50%;
  animation: introRing 2s ease-out infinite;
}

@keyframes introShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes introPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes introRing {
  0% { transform: scale(0.5); opacity: 1; border-color: rgba(0, 255, 170, 0.4); }
  100% { transform: scale(3); opacity: 0; border-color: rgba(0, 255, 170, 0); }
}

/* --- Scroll Progress --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  z-index: 101;
  background: linear-gradient(90deg, var(--holo-1), var(--holo-2), var(--holo-3), var(--holo-4));
  background-size: 300% 100%;
  animation: holoGradient 4s linear infinite;
  width: 0%;
  pointer-events: none;
}

/* --- Custom Cursor (desktop only) --- */
.cursor, .cursor-dot { display: none; }

@media (hover: hover) and (pointer: fine) {
  html, a, button { cursor: none; }

  .cursor {
    display: block;
    position: fixed;
    top: -24px;
    left: -24px;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(0, 255, 170, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    will-change: transform;
    transition: width 0.35s ease, height 0.35s ease, top 0.35s ease, left 0.35s ease, border-color 0.35s ease, background 0.35s ease;
  }

  .cursor.hover {
    width: 72px;
    height: 72px;
    top: -36px;
    left: -36px;
    background: rgba(0, 255, 170, 0.06);
    border-color: var(--accent);
  }

  .cursor-dot {
    display: block;
    position: fixed;
    top: -3px;
    left: -3px;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    will-change: transform;
  }
}

/* --- Canvas layers --- */
#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#trail {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.03;
  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.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px;
}

/* --- Morphing Blobs --- */
.blob {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  will-change: border-radius, transform;
}

.blob-1 {
  width: 500px;
  height: 500px;
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, rgba(0, 255, 170, 0.06) 0%, transparent 70%);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  animation: morph1 18s ease-in-out infinite alternate, orbDrift1 20s ease-in-out infinite alternate;
}

.blob-2 {
  width: 400px;
  height: 400px;
  top: 45%;
  right: -10%;
  background: radial-gradient(circle, rgba(0, 200, 255, 0.04) 0%, transparent 70%);
  border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
  animation: morph2 22s ease-in-out infinite alternate, orbDrift2 28s ease-in-out infinite alternate;
}

.blob-3 {
  width: 450px;
  height: 450px;
  bottom: -8%;
  left: 20%;
  background: radial-gradient(circle, rgba(164, 139, 250, 0.035) 0%, transparent 70%);
  border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%;
  animation: morph3 20s ease-in-out infinite alternate, orbDrift3 24s ease-in-out infinite alternate;
}

@keyframes morph1 {
  0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
  25% { border-radius: 58% 42% 32% 68% / 62% 28% 72% 38%; }
  50% { border-radius: 50% 50% 60% 40% / 40% 60% 40% 60%; }
  75% { border-radius: 40% 60% 50% 50% / 55% 45% 55% 45%; }
  100% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; }
}

@keyframes morph2 {
  0% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; }
  33% { border-radius: 40% 60% 70% 30% / 50% 50% 50% 50%; }
  66% { border-radius: 55% 45% 45% 55% / 35% 65% 35% 65%; }
  100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

@keyframes morph3 {
  0% { border-radius: 50% 50% 30% 70% / 40% 60% 40% 60%; }
  50% { border-radius: 35% 65% 55% 45% / 65% 35% 65% 35%; }
  100% { border-radius: 60% 40% 40% 60% / 50% 50% 50% 50%; }
}

@keyframes orbDrift1 { to { transform: translate(60px, 50px); } }
@keyframes orbDrift2 { to { transform: translate(-50px, -60px); } }
@keyframes orbDrift3 { to { transform: translate(40px, -40px); } }

/* --- Holographic gradient keyframes --- */
@keyframes holoGradient {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

@keyframes holoShift {
  0%, 100% { color: var(--holo-1); filter: drop-shadow(0 0 8px rgba(0, 255, 170, 0.4)); }
  25% { color: var(--holo-2); filter: drop-shadow(0 0 8px rgba(0, 221, 255, 0.4)); }
  50% { color: var(--holo-3); filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.4)); }
  75% { color: var(--holo-4); filter: drop-shadow(0 0 8px rgba(244, 114, 182, 0.4)); }
}

/* --- Section Dividers --- */
.section-divider {
  position: relative;
  z-index: 3;
  height: 1px;
  max-width: 500px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 170, 0.15), transparent);
}

.section-divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 30px 8px rgba(0, 255, 170, 0.12);
}

/* --- Header --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.5rem 5vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.5s ease, backdrop-filter 0.5s ease, transform 0.4s ease;
}

header.scrolled {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

header.header-hidden {
  transform: translateY(-100%);
}

.logo {
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1;
  animation: holoShift 6s ease-in-out infinite;
  transition: filter 0.3s ease;
}

.logo:hover {
  filter: drop-shadow(0 0 24px rgba(0, 255, 170, 0.7)) !important;
}

nav {
  display: flex;
  gap: 2.5rem;
}

nav a {
  color: var(--dim);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: color 0.3s;
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.35s ease;
}

nav a:hover { color: var(--text); }
nav a:hover::after { width: 100%; }

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6rem 5vw 8rem;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(5rem, 14vw, 15rem);
  line-height: 0.85;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 2.5rem;
}

.hero-title .line {
  display: block;
  overflow: hidden;
}

.hero-title .char {
  display: inline-block;
  color: #fff;
  transform: translateY(115%);
  animation: charUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Applied by JS after chars land, with staggered --holo-delay per char */
.hero-title .char.holo {
  animation: holoChar 6s ease-in-out infinite;
  animation-delay: var(--holo-delay, 0s);
  transform: translateY(0);
}

@keyframes holoChar {
  0%, 100% { color: #fff; text-shadow: 0 0 20px rgba(255, 255, 255, 0.05); }
  20% { color: var(--holo-1); text-shadow: 0 0 25px rgba(0, 255, 170, 0.3); }
  40% { color: var(--holo-2); text-shadow: 0 0 25px rgba(0, 221, 255, 0.3); }
  60% { color: var(--holo-3); text-shadow: 0 0 25px rgba(167, 139, 250, 0.3); }
  80% { color: var(--holo-4); text-shadow: 0 0 25px rgba(244, 114, 182, 0.25); }
}

@keyframes charUp {
  to { transform: translateY(0); }
}

.hero-tag {
  font-size: clamp(1rem, 3.5vw, 1.6rem);
  color: var(--dim);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
}

.hero-sub {
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  color: #aaa;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 3rem;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: center;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 1rem 2.5rem;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: clamp(0.85rem, 3vw, 1rem);
  font-weight: 700;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: all 0.35s ease;
  will-change: transform;
  position: relative;
  overflow: hidden;
}

/* Button shimmer sweep */
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 170, 0.08), transparent);
  transition: left 0.6s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: var(--accent);
  color: #000;
  transform: translateY(-3px);
  box-shadow: 0 0 30px rgba(0, 255, 170, 0.2), 0 0 60px rgba(0, 255, 170, 0.1);
}

/* --- Fade Up Animation --- */
.fade-up {
  opacity: 0;
  transform: translateY(28px);
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Marquee --- */
.marquee {
  position: relative;
  z-index: 3;
  overflow: hidden;
  padding: 1.8rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: scroll 25s linear infinite;
}

.marquee-track span {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.marquee-track .shamrock {
  font-style: normal;
  animation: holoShift 4s ease-in-out infinite;
  animation-delay: var(--i, 0s);
}

@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- Sections --- */
section {
  position: relative;
  z-index: 3;
  padding: 7rem 5vw;
  max-width: 1600px;
  margin: 0 auto;
}

/* --- Background Text --- */
.bg-text {
  font-family: 'Playfair Display', serif;
  font-size: clamp(5rem, 15vw, 18rem);
  text-align: center;
  letter-spacing: -0.03em;
  opacity: 0.12;
  color: rgba(0, 255, 170, 0.3);
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.06);
  pointer-events: none;
  user-select: none;
  margin-bottom: -1rem;
  will-change: transform;
}

/* --- Cards --- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.card {
  position: relative;
  height: 70vh;
  min-height: 480px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0a0a0a;
  transition: box-shadow 0.5s ease, border-color 0.4s ease;
  will-change: transform;
}

.card:hover {
  box-shadow: 0 0 80px rgba(0, 255, 170, 0.1);
  border-color: rgba(0, 255, 170, 0.15);
}

.card-img {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  background-color: #111;
  transform: translateY(var(--parallax-y, 0));
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

/* Shimmer while images load */
.card-img::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 25%, rgba(255, 255, 255, 0.03) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: imgShimmer 2s ease-in-out infinite;
}

@keyframes imgShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.card:hover .card-img {
  transform: translateY(var(--parallax-y, 0)) scale(1.06);
}

.card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4rem 2rem 2rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 30%, rgba(0, 0, 0, 0.6) 60%, transparent);
  z-index: 2;
}

.card h3 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 0.95;
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
}

.card p {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  color: var(--dim);
  line-height: 1.55;
  max-width: 360px;
}

/* Card scroll reveal with rotation */
.card.scroll-reveal {
  transform: translateY(60px) perspective(800px) rotateX(4deg);
}

.card.scroll-reveal.visible {
  transform: translateY(0) perspective(800px) rotateX(0);
}

/* --- Connect --- */
#connect {
  text-align: center;
  padding-bottom: 8rem;
}

.connect-heading {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.connect-sub {
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  color: var(--dim);
  margin: 0 0 2.5rem;
  font-weight: 400;
}

.big-link {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  display: inline-block;
  will-change: transform;
  background: linear-gradient(
    90deg,
    var(--holo-1),
    var(--holo-2),
    var(--holo-3),
    var(--holo-4),
    var(--holo-1)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: holoGradient 5s linear infinite;
  filter: drop-shadow(0 0 20px rgba(0, 255, 170, 0.15));
  transition: filter 0.4s ease, transform 0.4s ease;
}

.big-link:hover {
  filter: drop-shadow(0 0 40px rgba(0, 255, 170, 0.4));
}

.connect-line {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--holo-1), var(--holo-2), var(--holo-3));
  background-size: 200% 100%;
  animation: holoGradient 3s linear infinite;
  margin: 2rem auto;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.connect-line.visible {
  width: 120px;
}

.connect-note {
  color: var(--faint);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- Scroll Reveal --- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--d, 0s);
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Footer --- */
footer {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  letter-spacing: 0.05em;
}

/* --- Gyro Prompt (touch devices only) --- */
.gyro-prompt {
  display: none;
}

@media (hover: none) {
  .gyro-prompt {
    display: block;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: rgba(0, 255, 170, 0.08);
    border: 1px solid rgba(0, 255, 170, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.7rem 1.6rem;
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.4s ease, transform 0.4s ease;
  }

  .gyro-prompt.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
  }
}

/* --- Mobile Active States --- */
@media (hover: none) {
  .card:active {
    transform: scale(0.98) !important;
    transition: transform 0.15s ease;
  }

  .card:active .card-img {
    transform: scale(1.08);
  }

  .btn:active {
    background: var(--accent);
    color: #000;
    transform: scale(0.96);
  }

  .big-link:active {
    filter: drop-shadow(0 0 60px rgba(0, 255, 170, 0.5));
    transform: scale(0.97);
  }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  header {
    padding: 1.2rem 6vw;
  }

  nav {
    gap: 1.8rem;
  }

  nav a {
    font-size: 0.8rem;
  }

  .hero {
    padding: 5rem 6vw 6rem;
  }

  .hero-title {
    margin-bottom: 2rem;
  }

  .hero-tag {
    margin-bottom: 0.5rem;
  }

  .hero-sub {
    margin-bottom: 2.5rem;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }

  .btn {
    width: 100%;
    text-align: center;
    padding: 1rem 2rem;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .card {
    height: 55vh;
    min-height: 380px;
  }

  section {
    padding: 5rem 6vw;
  }

  #connect {
    padding-bottom: 6rem;
  }

  .bg-text {
    font-size: clamp(3.5rem, 18vw, 8rem);
    margin-bottom: 0;
  }

  .marquee-track span {
    letter-spacing: 0.12em;
  }

  .connect-heading {
    font-size: clamp(1.8rem, 8vw, 3rem);
  }

  .section-divider {
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: clamp(3.2rem, 16vw, 5rem);
  }

  .card h3 {
    font-size: 1.8rem;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }
