/* ============================================================
   Homepage — horizontal scroll with slime.

   Colors: use global tokens from app.css (:root) directly.
   --bg, --surface, --border, --primary, --secondary, --accent,
   --text, --muted, --danger

   Homepage-only tokens defined below in :root.
   ============================================================ */

/* ── 1. Tokens ────────────────────────────────────────────── */
:root {
  /* Layout */
  --hp-header-h: 60px;

  /* Typography */
  --hp-font-display:     'Cormorant Garamond', Georgia, serif;
  --hp-font-display-alt: 'Bricolage Grotesque', system-ui, sans-serif;
  --hp-font-mono:        'DM Mono', 'Fira Code', monospace;

  /* Alpha variants — derived from global tokens */
  --hp-primary-faint:    color-mix(in srgb, var(--primary) 12%, transparent);
  --hp-primary-line:     color-mix(in srgb, var(--primary) 28%, transparent);
  --hp-subtle:           var(--muted);
  --hp-secondary-border: color-mix(in srgb, var(--secondary) 40%, transparent);

  /* Per-letter name palette — edit here to retheme "Iqbal." */
  --hp-name-I:   #FF6B6B;  /* coral      */
  --hp-name-q:   #4DB6AC;  /* teal       */
  --hp-name-b:   #FFD54F;  /* golden     */
  --hp-name-a:   #FF8A65;  /* orange     */
  --hp-name-l:   #CE93D8;  /* lavender   */
  --hp-name-dot: #26C6DA;  /* cyan       */
}

/* ── 2. Page-level overrides ──────────────────────────────── */
.hp-page.public-body {
  background: var(--bg);
}
.hp-page .site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.hp-page .site-header .nav-logo {
  color: var(--text);
}

.hp-page .site-main {
  max-width: none;
  margin: 0;
  padding: 0;
  width: 100%;
}
.hp-page .site-footer { display: none; }

/* ── 3. Scroll rig ────────────────────────────────────────── */
.hp-outer {
  height: 300vh;
  position: relative;
}

.hp-sticky {
  position: sticky;
  top: var(--hp-header-h);
  height: calc(100vh - var(--hp-header-h));
  height: calc(100dvh - var(--hp-header-h));
  overflow: hidden;
}

.hp-track {
  display: flex;
  width: 300vw;
  height: 100%;
  will-change: transform;
}

/* ── 4. Sections ──────────────────────────────────────────── */
.hp-section {
  width: 100vw;
  height: 100%;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 16px 120px;
}
@media (min-width: 768px)  { .hp-section { padding-left: 32px;  padding-right: 32px;  } }
@media (min-width: 1024px) { .hp-section { padding-left: 48px;  padding-right: 48px;  } }
@media (min-width: 1280px) { .hp-section { padding-left: 128px; padding-right: 128px; } }
@media (min-width: 1536px) { .hp-section { padding-left: 256px; padding-right: 256px; } }

/* Section backgrounds */
.hp-hero     {
  background:
    radial-gradient(ellipse at 20% 110%, rgba(120,80,220,0.18), transparent 55%),
    radial-gradient(ellipse at 110% -10%, rgba(40,170,200,0.18), transparent 60%),
    var(--bg);
}
.hp-projects { background: var(--surface); }
.hp-contact  { background: var(--bg); }

/* ── 5. Slime wrapper ─────────────────────────────────────── */
#hp-slime-wrapper { display: none; } /* temporarily disabled — remove to restore */

#hp-slime-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 20;
  will-change: transform;
}

/* Slime inside wrapper: positioned relative to wrapper, travel disabled */
.hp-page #hp-slime-wrapper .slime {
  position: absolute;
  bottom: 60px;
  left: 0;
  animation: none;
}

/* Idle state (default when not scrolling) */
.hp-page #hp-slime-wrapper.slime-idle .slime {
  animation: slime-idle-float 3.2s ease-in-out infinite;
}
.hp-page #hp-slime-wrapper.slime-idle .slime-body {
  animation: slime-idle-body 3.2s ease-in-out infinite !important;
}
.hp-page #hp-slime-wrapper.slime-idle .slime-shadow {
  animation: slime-idle-shadow 3.2s ease-in-out infinite !important;
}

/* Moving state (rolling while scrolling) */
.hp-page #hp-slime-wrapper.slime-moving .slime {
  height: 90px;
  animation: slime-roll-container 0.55s ease-in-out infinite;
}
.hp-page #hp-slime-wrapper.slime-moving .slime-body {
  width: 90px !important;
  height: 90px !important;
  left: 37px !important;
  bottom: 0 !important;
  border-radius: 50% !important;
  transform-origin: center center !important;
  animation: slime-roll-body 1.1s linear infinite !important;
}
.hp-page #hp-slime-wrapper.slime-moving .slime-shadow {
  animation: slime-roll-shadow 0.55s ease-in-out infinite !important;
}

/* ── 6. Hero — layout ─────────────────────────────────────── */
.hp-hero-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.hp-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.hp-hero-left {
  flex: 0 0 auto;
  max-width: clamp(300px, 38vw, 460px);
}

.hp-hero-sep {
  flex: 0 0 1px;
  align-self: stretch;
  background: linear-gradient(to bottom, transparent 0%, var(--primary) 18%, var(--primary) 82%, transparent 100%);
  opacity: 0.28;
  margin: 0 clamp(2rem, 4.5vw, 5rem);
  transform-origin: top;
  transform: scaleY(0);
  animation: hp-sep-draw 0.55s ease 0.95s forwards;
}

.hp-hero-aside {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  opacity: 0;
  animation: hp-fade-up 0.7s ease 1.1s forwards;
}

/* ── 7. Hero — decorative shapes ─────────────────────────── */
.hp-sp {
  position: absolute;
  pointer-events: none;
}

/* Teal goo — top-right */
.hp-sp-a {
  width: clamp(180px, 22vw, 320px);
  height: clamp(160px, 19vw, 280px);
  top: 8%;
  right: 6%;
  opacity: 0.85;
}

/* Amber orb — mid-right */
.hp-sp-b {
  width: clamp(100px, 13vw, 170px);
  height: clamp(100px, 13vw, 170px);
  top: 58%;
  right: 14%;
  opacity: 0.8;
}

/* Magenta goo — top-left */
.hp-sp-c {
  width: clamp(70px, 9vw, 130px);
  height: clamp(70px, 9vw, 140px);
  top: 18%;
  left: 2%;
  opacity: 0.65;
}

/* Ring speck — top-center */
.hp-sp-d {
  width: 14px;
  height: 14px;
  top: 12%;
  left: 38%;
  opacity: 0.55;
}

/* Ring speck — mid-right edge */
.hp-sp-e {
  width: 18px;
  height: 18px;
  top: 52%;
  right: 7%;
  opacity: 0.6;
}

/* ── 8. Hero — name letters ───────────────────────────────── */
.hp-accent { color: var(--secondary); font-style: italic; }

/* Per-letter treatments (unused when name is simple) */
.hp-n-I {
  font-style: italic;
  color: var(--hp-name-I);
  text-shadow: 0 0 28px #7A4FE040;
}

.hp-n-q {
  font-family: var(--hp-font-mono);
  font-size: 0.63em;
  position: relative;
  top: -0.35em;
  margin-right: 0.04em;
  color: var(--hp-name-q);
}

.hp-n-b {
  font-family: var(--hp-font-display-alt);
  font-weight: 800;
  font-size: 0.79em;
  position: relative;
  top: -0.11em;
  color: var(--hp-name-b);
}

.hp-n-a {
  font-style: italic;
  color: var(--hp-name-a);
}

.hp-n-l {
  color: var(--hp-name-l);
}

.hp-n-dot {
  font-family: var(--hp-font-mono);
  font-size: 0.6em;
  position: relative;
  top: -0.10em;
  color: var(--hp-name-dot);
}

/* ── 9. Hero — content ────────────────────────────────────── */
.hp-greeting {
  font-family: var(--hp-font-mono);
  font-size: clamp(0.75rem, 1.2vw, 0.9rem);
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: lowercase;
  margin-bottom: 0.25rem;
  opacity: 0;
  animation: hp-fade-up 0.7s ease 0.1s forwards;
}

.hp-name {
  font-family: var(--hp-font-display);
  font-size: clamp(4rem, 9vw, 8rem);
  font-weight: 300;
  line-height: 0.92;
  color: var(--text);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: hp-fade-up 0.8s ease 0.25s forwards;
}

.hp-desc {
  font-family: var(--hp-font-mono);
  font-size: clamp(0.78rem, 1.3vw, 0.9rem);
  font-weight: 300;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 2rem;
  opacity: 0;
  animation: hp-fade-up 0.8s ease 0.45s forwards;
}

.hp-code-accent {
  font-family: var(--hp-font-mono);
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--hp-subtle);
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: hp-fade-up 0.7s ease 0.65s forwards;
}

.hp-divider {
  width: 40px;
  height: 1px;
  background: var(--primary);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: hp-fade-in 0.6s ease 0.65s forwards;
}

.hp-poetic {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  opacity: 0;
  animation: hp-fade-up 0.8s ease 0.8s forwards;
}

.hp-poetic-line {
  font-family: var(--hp-font-display);
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 300;
  font-style: italic;
  color: var(--secondary);
  letter-spacing: 0.01em;
}

.hp-poetic-sep {
  font-family: var(--hp-font-mono);
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--muted);
  padding-left: 0.25rem;
  letter-spacing: 0.08em;
}

/* ── 10. Now / aside ──────────────────────────────────────── */
.hp-now { display: flex; flex-direction: column; gap: 1.5rem; }

.hp-now-label {
  font-family: var(--hp-font-mono);
  font-size: 0.52rem;
  font-weight: 400;
  color: var(--secondary);
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.hp-now-text {
  font-family: var(--hp-font-display);
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  line-height: 1.45;
}

.hp-now-em   { color: var(--primary); font-style: italic; }
.hp-now-dead { color: #ffffff; letter-spacing: 0.18em; font-weight: 700; }

.hp-now-sub {
  font-family: var(--hp-font-display);
  font-size: clamp(0.95rem, 1.8vw, 1.3rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  opacity: 0.7;
  line-height: 1.5;
}

.hp-now-meta {
  font-family: var(--hp-font-mono);
  font-size: 0.54rem;
  font-weight: 300;
  color: var(--hp-subtle);
  letter-spacing: 0.16em;
  padding-top: 0.9rem;
  border-top: 1px solid var(--hp-primary-line);
}

/* ── 11. Projects ─────────────────────────────────────────── */
.hp-section-inner { width: 100%;  }

.hp-section-title {
  font-family: var(--hp-font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 300;
  color: var(--primary);
  letter-spacing: 0.04em;
  margin-bottom: 2.5rem;
}

.hp-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.hp-project-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.4rem 1.25rem;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
a.hp-project-card:hover,
a.hp-project-card:hover *,
a.hp-project-card:focus,
a.hp-project-card:focus *,
a.hp-project-card:focus-visible,
a.hp-project-card:focus-visible * { text-decoration: none; }

a.hp-project-card:hover {
  border-color: var(--secondary);
  background: var(--surface);
  transform: translateY(-2px);
}
a.hp-project-card:focus,
a.hp-project-card:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: -2px;
}

.hp-project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.hp-project-name {
  font-family: var(--hp-font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text);
}

.hp-project-index {
  font-family: var(--hp-font-mono);
  font-size: 0.65rem;
  font-weight: 300;
  color: var(--muted);
}

.hp-project-desc {
  font-family: var(--hp-font-display);
  font-size: 1rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hp-project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.hp-project-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

/* Kind badge on homepage cards */
.hp-kind-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--hp-font-mono);
  font-size: .58rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .18rem .55rem;
  border-radius: 2px;
  font-weight: 500;
  flex-shrink: 0;
}
.hp-kind-personal {
  color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--secondary) 28%, transparent);
}
.hp-kind-client {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.hp-tag {
  font-family: var(--hp-font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  padding: 0.18em 0.6em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  letter-spacing: 0.04em;
}

/* Skeleton loading state */
.hp-skeleton-card {
  height: 140px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--hp-primary-line) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: hp-shimmer 1.6s ease-in-out infinite;
  border: 1px solid var(--border);
}

/* ── 12. Contact ──────────────────────────────────────────── */
.hp-links { display: flex; flex-direction: column; gap: 0.1rem; }

.hp-link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}
.hp-link:hover {
  text-decoration: none;
  border-bottom-color: var(--secondary);
  transform: translateX(6px);
}

.hp-link-label {
  font-family: var(--hp-font-mono);
  font-size: clamp(0.7rem, 1.2vw, 0.8rem);
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  min-width: 70px;
}

.hp-link-handle {
  font-family: var(--hp-font-display);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 300;
  color: var(--text);
  transition: color 0.2s;
}
.hp-link:hover .hp-link-handle { color: var(--secondary); }

/* ── 13. Keyframes ────────────────────────────────────────── */
@keyframes hp-sep-draw  { to { transform: scaleY(1); } }

@keyframes hp-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes hp-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slime-idle-float {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-9px); }
}

@keyframes slime-idle-body {
  0%, 100% {
    transform: scaleX(1) scaleY(1);
    border-radius: 65% 94% 73% 57% / 100% 98% 47% 40%;
  }
  25% {
    transform: scaleX(1.06) scaleY(0.92);
    border-radius: 70% 90% 78% 53% / 92% 100% 40% 36%;
  }
  50% {
    transform: scaleX(0.95) scaleY(1.06);
    border-radius: 60% 98% 68% 63% / 107% 96% 53% 44%;
  }
  75% {
    transform: scaleX(1.03) scaleY(0.97);
    border-radius: 67% 91% 76% 57% / 99% 99% 46% 42%;
  }
}

@keyframes slime-idle-shadow {
  0%, 100% { transform: translateX(-50%) scaleX(1.14); opacity: 0.7;  }
  50%       { transform: translateX(-50%) scaleX(0.92); opacity: 0.45; }
}

@keyframes slime-roll-container {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-5px); }
}

@keyframes slime-roll-body {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}

@keyframes slime-roll-shadow {
  0%, 100% { transform: translateX(-50%) scaleX(1.14); opacity: 0.80; }
  50%       { transform: translateX(-50%) scaleX(1.04); opacity: 0.60; }
}

/* ── 14. Mobile: stack vertically ────────────────────────── */
@media (max-width: 768px) {
  .hp-outer  { height: auto; }

  .hp-sticky {
    position: static;
    height: auto;
    overflow: visible;
  }

  .hp-track {
    flex-direction: column;
    width: 100%;
  }

  .hp-section {
    width: 100%;
    height: auto;
    min-height: 100svh;
    padding: 5rem 1.5rem 3rem;
    align-items: flex-start;
  }

  .hp-hero-inner  { flex-direction: column; align-items: flex-start; gap: 2rem; }
  .hp-hero-left   { max-width: none; width: 100%; }
  .hp-hero-sep    { display: none; }
  .hp-hero-aside  { width: 100%; opacity: 1; animation: none; }

  .hp-sp-a { width: clamp(120px, 30vw, 200px); height: clamp(110px, 27vw, 180px); }
  .hp-sp-c { display: none; } /* hide top-left on small screens to avoid overlap */

  /* Re-enable automatic CSS slime travel on mobile */
  #hp-slime-wrapper {
    position: static;
    transform: none !important;
  }
  .hp-page #hp-slime-wrapper .slime {
    animation: slime-travel 12s linear infinite !important;
    position: absolute;
    bottom: 60px;
  }
  .hp-page #hp-slime-wrapper .slime-body {
    animation: slime-hop 4s ease-in-out infinite !important;
  }
  .hp-page #hp-slime-wrapper .slime-shadow {
    animation: slime-shadow-hop 4s ease-in-out infinite !important;
  }

  .hp-name { font-size: clamp(3.5rem, 15vw, 5rem); }

  .hp-project-grid { grid-template-columns: 1fr; }
}
