/* ============================================================
   HOMEPAGE  —  studio hero ("Builder in the loop") + section polish
   Loaded only on / via the homepage extra_head. Studio theme (home).
   See RELAUNCH_PLAN.md Phase 3.
   ============================================================ */

/* ===================== HERO ===================== */
.lwh-hero { position: relative; isolation: isolate; overflow: hidden; }

/* ---- code-driven motion canvas ---- */
.lwh-hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.lwh-blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5;
  will-change: transform;
}
.lwh-blob--1 { width: 38rem; height: 38rem; top: -12rem; left: -10rem;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%);
  animation: lwh-drift-1 22s ease-in-out infinite; }
.lwh-blob--2 { width: 32rem; height: 32rem; top: -6rem; right: -8rem;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 50%, transparent), transparent 70%);
  animation: lwh-drift-2 26s ease-in-out infinite; }
/* faint dotted grid overlay */
.lwh-grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 22%, transparent) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 75%);
  opacity: .5;
}
@keyframes lwh-drift-1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,30px) scale(1.08); } }
@keyframes lwh-drift-2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-36px,24px) scale(1.06); } }

/* ---- eyebrow pill dot ---- */
.lwh-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--signal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 22%, transparent); display: inline-block; }
.lwh-dot--violet { background: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 22%, transparent); }

/* ---- portrait + glow ---- */
.lwh-portrait-wrap { position: relative; max-width: 28rem; margin: 0 auto; }
.lwh-portrait-glow {
  position: absolute; inset: -8% -6% -4%; z-index: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%,
    color-mix(in srgb, var(--accent) 55%, transparent),
    color-mix(in srgb, var(--accent-2) 35%, transparent) 45%, transparent 70%);
  filter: blur(38px); opacity: .75; animation: lwh-glow 6s ease-in-out infinite;
}
@keyframes lwh-glow { 0%,100% { opacity: .6; transform: scale(1); } 50% { opacity: .85; transform: scale(1.05); } }
.lwh-portrait {
  position: relative; z-index: 1; width: 100%; display: block;
  border-radius: 20px; box-shadow: var(--shadow);
  /* Soft bottom fade so the forearms dissolve into the page instead of a hard crop. */
  -webkit-mask-image: linear-gradient(to bottom, #000 84%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 84%, transparent 100%);
}

/* ---- floating proof chips ---- */
.lwh-chip {
  position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .8rem; font-size: .8rem; font-weight: 600; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm);
  white-space: nowrap; will-change: transform;
  transform: rotate(var(--chip-rot, 0deg));
}
.lwh-chip--code { font-family: var(--font-mono); }
/* --chip-rot tilts each chip a touch so they read as hand-placed, not gridded.
   The float keyframes re-apply the same rotation so the tilt survives the animation. */
.lwh-chip--tl { top: 6%;   left: -16%;  --chip-rot: -3deg;   animation: lwh-float 7s ease-in-out infinite; }
.lwh-chip--tr { top: -4%;  right: -12%; --chip-rot: 3.5deg;  animation: lwh-float 8s ease-in-out infinite .6s; }
.lwh-chip--bl { bottom: 7%; left: -20%; --chip-rot: 2.5deg;  animation: lwh-float 9s ease-in-out infinite .3s; }
.lwh-chip--br { bottom: 3%; right: -10%; --chip-rot: -2.5deg; animation: lwh-float 7.5s ease-in-out infinite .9s; }
@keyframes lwh-float {
  0%,100% { transform: rotate(var(--chip-rot, 0deg)) translateY(0); }
  50%     { transform: rotate(var(--chip-rot, 0deg)) translateY(-9px); }
}

/* Mobile: copy leads the hero (see column order in the template), so the
   portrait follows as a supporting visual — keep it modest rather than
   full-bleed, and the floating chips would overflow a narrow screen anyway. */
@media (max-width: 1023px) {
  .lwh-chip { display: none; }
  .lwh-portrait-wrap { max-width: 22rem; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .lwh-blob, .lwh-portrait-glow, .lwh-chip { animation: none; }
}

/* ===================== SECTION POLISH =====================
   Retheme the legacy Memphis component classes to the studio grammar.
   Scoped to the homepage (this file only loads on /). Retired globally
   in Phase 6. */

/* Section band (replaces `bg-memphis-white border-y-3 border-memphis-black`) */
.lwh-band {
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* Thin the heavy 3px frames; soften black borders to hairlines */
.lwh-hero ~ section .border-3,
section .border-3 { border-width: 1px; }
.border-memphis-black { border-color: var(--line); }
.border-memphis-black\/10, .border-memphis-black\/20 { border-color: var(--line); }

/* Titles */
.section-title {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
}
/* Word-scoped accent underline — replaces the centered ::after bar on that title */
.section-title--mark::after { display: none !important; }
.lwh-mark { position: relative; display: inline-block; }
.lwh-mark::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.2em;
  height: 3px; background: var(--accent); border-radius: var(--radius-pill);
}

/* ===================== "12-DAY JOURNEY" — responsive timeline + reveal ===================== */
.lwh-journey__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px)  { .lwh-journey__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px)  { .lwh-journey__grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .lwh-journey__grid { grid-template-columns: repeat(5, 1fr); } }

/* Step hover micro-interaction (the numbered badge gives a playful nudge) */
.lwh-journey__step { transition: transform .2s ease; }
.lwh-journey__step:hover { transform: translateY(-5px); }
.lwh-journey__num { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.lwh-journey__step:hover .lwh-journey__num { transform: scale(1.12) rotate(-6deg); }

/* Staggered scroll reveal — armed by JS so no-JS content stays visible */
.lwh-journey.is-armed .lwh-journey__head,
.lwh-journey.is-armed .lwh-journey__step { opacity: 0; }
.lwh-journey.is-in .lwh-journey__head { animation: lwh-rise-in .6s cubic-bezier(.22, 1, .36, 1) both; }
.lwh-journey.is-in .lwh-journey__step { opacity: 1; animation: lwh-rise-in .55s cubic-bezier(.22, 1, .36, 1) backwards; }
.lwh-journey.is-in .lwh-journey__step:nth-child(1) { animation-delay: .06s; }
.lwh-journey.is-in .lwh-journey__step:nth-child(2) { animation-delay: .14s; }
.lwh-journey.is-in .lwh-journey__step:nth-child(3) { animation-delay: .22s; }
.lwh-journey.is-in .lwh-journey__step:nth-child(4) { animation-delay: .30s; }
.lwh-journey.is-in .lwh-journey__step:nth-child(5) { animation-delay: .38s; }

@media (prefers-reduced-motion: reduce) {
  .lwh-journey.is-in .lwh-journey__head,
  .lwh-journey.is-in .lwh-journey__step { animation: none !important; }
  .lwh-journey.is-armed .lwh-journey__head,
  .lwh-journey.is-armed .lwh-journey__step { opacity: 1 !important; }
  .lwh-journey__step, .lwh-journey__num { transition: none; }
}

/* ===================== BOILERPLATE WAITLIST (card CTA + modal) ===================== */
.lwh-wl-btn {
  appearance: none; -webkit-appearance: none;
  background: none; border: 0; padding: 0;
  cursor: pointer; font: inherit; align-self: flex-start;
}
.lwh-modal {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.lwh-modal.is-open { display: flex; }
.lwh-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(13, 17, 23, .6);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.lwh-modal__panel { position: relative; width: 100%; max-width: 28rem; }
.lwh-modal__close { position: absolute; top: .75rem; right: .75rem; color: var(--muted); line-height: 0; }
.lwh-modal__close:hover { color: var(--ink); }
.lwh-modal__title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--ink); margin-bottom: .25rem; }
.lwh-modal__sub { font-size: .875rem; color: var(--muted); margin-bottom: 1rem; }
.lwh-modal__sub strong { color: var(--ink); font-weight: 600; }

/* Cards */
.card-memphis {
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card-memphis:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow) !important;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

/* Soft-shadow utilities */
.shadow-memphis, .shadow-memphis-sm { box-shadow: var(--shadow-sm) !important; }

/* Badges → studio pills */
.badge-memphis {
  border: none !important;
  border-radius: var(--radius-pill);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: color-mix(in srgb, var(--accent) 72%, var(--ink));
}
.badge-teal  { background: color-mix(in srgb, var(--signal) 14%, transparent); color: color-mix(in srgb, var(--signal) 70%, var(--ink)); }
.badge-purple{ background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: color-mix(in srgb, var(--accent-2) 72%, var(--ink)); }
.badge-yellow{ background: color-mix(in srgb, var(--warn) 18%, transparent); color: color-mix(in srgb, var(--warn) 45%, var(--ink)); }

/* Buttons → studio */
.btn-memphis { border-radius: var(--radius-pill) !important; border: 1px solid transparent !important; box-shadow: none !important; font-family: var(--font-body); }
.btn-teal, .btn-pink, .btn-yellow { background: var(--accent) !important; color: #fff !important; }
.btn-teal:hover, .btn-pink:hover, .btn-yellow:hover { background: var(--accent-strong) !important; }
.btn-outline { background: transparent !important; color: var(--ink) !important; border-color: var(--line) !important; }
.btn-outline:hover { border-color: var(--accent) !important; color: var(--accent) !important; }

/* ===================== DUAL-HUB SECTION (3.4) ===================== */
.lwh-hub-card {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 2rem;
  display: flex; flex-direction: column;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.lwh-hub-card:hover { transform: translateY(-4px); }
.lwh-hub-card__icon {
  width: 3rem; height: 3rem; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 1rem; overflow: hidden;
}
.lwh-hub-card__icon img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.lwh-hub-card__title { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.02em; margin-bottom: .5rem; }
.lwh-hub-card__meta { display: inline-flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.25rem; }
.lwh-hub-pill { font-size: .72rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; }
.lwh-hub-card__cta { margin-top: auto; padding-top: 1.5rem; font-weight: 700; display: inline-flex; align-items: center; gap: .4rem; }

/* Build = studio (light, indigo) */
.lwh-hub-card--build {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.lwh-hub-card--build:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.lwh-hub-card--build .lwh-hub-card__icon { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.lwh-hub-card--build .lwh-hub-pill { background: color-mix(in srgb, var(--accent) 12%, transparent); color: color-mix(in srgb, var(--accent) 72%, var(--ink)); }
.lwh-hub-card--build .lwh-hub-card__cta { color: var(--accent); }

/* Hierarchy: Build = primary (larger, more weight), Self Hosting = secondary (smaller) */
.lwh-hub-card--primary {
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 68%);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: var(--shadow);
  padding: 2.25rem;
}
.lwh-hub-card--primary .lwh-hub-card__icon { width: 3.4rem; height: 3.4rem; font-size: 1.6rem; }
.lwh-hub-card--primary .lwh-hub-card__title { font-size: 1.9rem; }
.lwh-hub-card--secondary { padding: 1.75rem; }
.lwh-hub-card--secondary .lwh-hub-card__icon { width: 2.75rem; height: 2.75rem; font-size: 1.25rem; }
.lwh-hub-card--secondary .lwh-hub-card__title { font-size: 1.4rem; }

/* Topic pills ("what you'll learn") on the primary card */
.lwh-hub-topics { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.1rem; }
.lwh-hub-topic {
  font-size: .72rem; font-weight: 600;
  padding: .28rem .65rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: color-mix(in srgb, var(--accent) 75%, var(--ink));
}

/* Flowing dashed connector — vertical on mobile, horizontal on desktop */
.lwh-hub-connector {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .55rem; width: 100%; padding: .15rem 0;
  --lwh-dash: color-mix(in srgb, var(--accent) 60%, var(--line));
}
.lwh-hub-connector__line {
  width: 2px; min-height: 1.4rem; align-self: center; border-radius: 2px;
  background-image: linear-gradient(to bottom, var(--lwh-dash) 0 5px, transparent 5px 11px);
  background-size: 100% 11px;
  animation: lwh-dash-y .85s linear infinite;
}
.lwh-hub-connector__label {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 700;
  letter-spacing: .01em; white-space: nowrap;
  padding: .3rem .7rem; border-radius: 999px;
  border: 1px dotted color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: color-mix(in srgb, var(--accent) 78%, var(--ink));
}
@keyframes lwh-dash-y { to { background-position: 0 11px; } }
@keyframes lwh-dash-x { to { background-position: 11px 0; } }

@media (min-width: 1024px) {
  .lwh-hub-card--primary { flex: 1.55 1 0%; }
  .lwh-hub-card--secondary { flex: 1 1 0%; }
  .lwh-hub-connector { flex-direction: row; width: auto; align-self: center; padding: 0 .3rem; }
  .lwh-hub-connector__line {
    height: 2px; width: 2.4rem; min-height: 0;
    background-image: linear-gradient(to right, var(--lwh-dash) 0 5px, transparent 5px 11px);
    background-size: 11px 100%;
    animation: lwh-dash-x .85s linear infinite;
  }
}

/* ===================== "YOUR PATH" — full-viewport animated stage ===================== */
.lwh-path { position: relative; }
.lwh-path::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(58% 50% at 50% 38%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
}
.lwh-path > * { position: relative; z-index: 1; }

/* Generative art behind each card: a drifting aurora + a faint grid */
.lwh-hub-card__art {
  position: absolute; inset: 0; z-index: 0;
  border-radius: inherit; overflow: hidden; pointer-events: none;
  transition: transform .25s ease;
}
.lwh-hub-card > *:not(.lwh-hub-card__art) { position: relative; z-index: 1; }
.lwh-hub-card__art::before {
  content: ""; position: absolute; inset: -35%;
  background:
    radial-gradient(38% 38% at 22% 28%, var(--art-c1), transparent 70%),
    radial-gradient(34% 34% at 82% 18%, var(--art-c2), transparent 72%),
    radial-gradient(46% 46% at 68% 88%, var(--art-c3), transparent 72%);
  filter: blur(34px);
  opacity: var(--art-opacity, .55);
  animation: lwh-aurora 18s ease-in-out infinite alternate;
}
.lwh-hub-card__art::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ink) 7%, transparent) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(120% 120% at 0% 0%, #000 26%, transparent 72%);
          mask-image: radial-gradient(120% 120% at 0% 0%, #000 26%, transparent 72%);
  opacity: .5;
}
@keyframes lwh-aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -2.5%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 1.5%, 0) scale(1.04); }
}
.lwh-hub-card--primary {
  --art-c1: color-mix(in srgb, var(--accent) 55%, transparent);
  --art-c2: color-mix(in srgb, var(--accent-2) 50%, transparent);
  --art-c3: color-mix(in srgb, var(--accent) 38%, transparent);
  --art-opacity: .6;
}
.lwh-hub-card--secondary {
  --art-c1: color-mix(in srgb, var(--signal) 42%, transparent);
  --art-c2: color-mix(in srgb, var(--accent) 24%, transparent);
  --art-c3: color-mix(in srgb, var(--signal) 28%, transparent);
  --art-opacity: .42;
}

/* Twinkle on the primary card's icon */
.lwh-hub-card--primary .lwh-hub-card__icon { animation: lwh-twinkle 3.4s ease-in-out infinite; }
@keyframes lwh-twinkle { 0%,100% { transform: rotate(0) scale(1); } 50% { transform: rotate(6deg) scale(1.06); } }

/* Scroll-reveal choreography — armed by JS so no-JS content stays visible */
.lwh-path.is-armed .lwh-path__head,
.lwh-path.is-armed .lwh-hub-card,
.lwh-path.is-armed .lwh-hub-connector,
.lwh-path.is-armed .lwh-hub-topic { opacity: 0; }
.lwh-path.is-in .lwh-hub-card { opacity: 1; }
.lwh-path.is-in .lwh-path__head { animation: lwh-rise-in .6s cubic-bezier(.22,1,.36,1) both; }
.lwh-path.is-in .lwh-hub-card--primary { animation: lwh-in-left .7s cubic-bezier(.22,1,.36,1) .06s backwards; }
.lwh-path.is-in .lwh-hub-card--secondary { animation: lwh-in-right .7s cubic-bezier(.22,1,.36,1) .18s backwards; }
.lwh-path.is-in .lwh-hub-connector { animation: lwh-fade-in .5s ease .4s both; }
.lwh-path.is-in .lwh-hub-topic { animation: lwh-pop .5s ease both; }
.lwh-path.is-in .lwh-hub-topic:nth-child(1) { animation-delay: .50s; }
.lwh-path.is-in .lwh-hub-topic:nth-child(2) { animation-delay: .56s; }
.lwh-path.is-in .lwh-hub-topic:nth-child(3) { animation-delay: .62s; }
.lwh-path.is-in .lwh-hub-topic:nth-child(4) { animation-delay: .68s; }
.lwh-path.is-in .lwh-hub-topic:nth-child(5) { animation-delay: .74s; }
@keyframes lwh-rise-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes lwh-in-left  { from { opacity: 0; transform: translateY(24px) translateX(-20px); } to { opacity: 1; transform: none; } }
@keyframes lwh-in-right { from { opacity: 0; transform: translateY(24px) translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes lwh-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lwh-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Desktop: the connector "draws" itself on reveal */
@media (min-width: 1024px) {
  .lwh-path.is-armed .lwh-hub-connector__line { transform: scaleX(0); transform-origin: left center; }
  .lwh-path.is-in .lwh-hub-connector__line { transform: scaleX(1); transition: transform .6s cubic-bezier(.22,1,.36,1) .46s; }
}

/* Respect reduced-motion: everything visible and still */
@media (prefers-reduced-motion: reduce) {
  .lwh-hub-card__art::before,
  .lwh-hub-card--primary .lwh-hub-card__icon,
  .lwh-hub-connector__line,
  .lwh-path.is-in .lwh-path__head,
  .lwh-path.is-in .lwh-hub-card--primary,
  .lwh-path.is-in .lwh-hub-card--secondary,
  .lwh-path.is-in .lwh-hub-connector,
  .lwh-path.is-in .lwh-hub-topic { animation: none !important; }
  .lwh-path.is-armed .lwh-path__head,
  .lwh-path.is-armed .lwh-hub-card,
  .lwh-path.is-armed .lwh-hub-connector,
  .lwh-path.is-armed .lwh-hub-topic { opacity: 1 !important; }
  .lwh-path.is-armed .lwh-hub-connector__line { transform: none !important; }
}
