/* =============================================================
   CRATOORA — Hero Page Styles
   File    : styles/hero.css
   Requires: styles/tokens.css
   Images  :
     mobile  ≤767px : ../images/Crate-Digging.png  (portrait)
     desktop ≥768px : ../images/Crate-Studio.png   (landscape)
   Version : 3.2
   ============================================================= */

/* INTRO / BOOT SCREEN */
.intro-screen {
  position         : fixed;
  inset            : 0;
  z-index          : var(--z-max);
  display          : flex;
  flex-direction   : column;
  align-items      : center;
  justify-content  : center;
  gap              : 1.1rem;
  background       : #080808;
  -webkit-transition: opacity 0.65s ease;
  transition       : opacity 0.65s ease;
  opacity          : 1;
}
.intro-screen.done { opacity: 0; pointer-events: none; }
.intro-logo {
  display: flex; align-items: center; gap: 0.8rem;
  -webkit-animation: introRise 0.7s 0.15s cubic-bezier(0.23,1,0.32,1) both;
  animation: introRise 0.7s 0.15s cubic-bezier(0.23,1,0.32,1) both;
}
.intro-icon {
  width: 48px; height: 48px; object-fit: contain;
  -webkit-animation: introGlow 2.2s 0.8s ease-in-out infinite;
  animation: introGlow 2.2s 0.8s ease-in-out infinite;
}
@-webkit-keyframes introGlow {
  0%,100% { -webkit-filter: drop-shadow(0 0 6px rgba(139,92,246,0.45)); filter: drop-shadow(0 0 6px rgba(139,92,246,0.45)); }
  50%     { -webkit-filter: drop-shadow(0 0 22px rgba(139,92,246,0.9)); filter: drop-shadow(0 0 22px rgba(139,92,246,0.9)); }
}
@keyframes introGlow {
  0%,100% { filter: drop-shadow(0 0 6px rgba(139,92,246,0.45)); }
  50%     { filter: drop-shadow(0 0 22px rgba(139,92,246,0.9)); }
}
.intro-wordmark {
  font-family: var(--font-display); font-size: 2rem; font-weight: 800;
  letter-spacing: -0.03em; color: #fff;
}
.intro-tagline {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255,255,255,0.32);
  -webkit-animation: introRise 0.7s 0.35s cubic-bezier(0.23,1,0.32,1) both;
  animation: introRise 0.7s 0.35s cubic-bezier(0.23,1,0.32,1) both;
}
.intro-bar {
  width: 160px; height: 2px; background: rgba(255,255,255,0.07);
  border-radius: 99px; overflow: hidden; margin-top: 0.25rem;
  -webkit-animation: introRise 0.7s 0.5s cubic-bezier(0.23,1,0.32,1) both;
  animation: introRise 0.7s 0.5s cubic-bezier(0.23,1,0.32,1) both;
}
.intro-bar-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, #8B5CF6, #D97706);
  -webkit-animation: introBarFill 2s 0.65s cubic-bezier(0.23,1,0.32,1) forwards;
  animation: introBarFill 2s 0.65s cubic-bezier(0.23,1,0.32,1) forwards;
}
@-webkit-keyframes introBarFill { to { width: 100%; } }
@keyframes introBarFill         { to { width: 100%; } }
@-webkit-keyframes introRise {
  from { opacity: 0; -webkit-transform: translateY(10px); transform: translateY(10px); }
  to   { opacity: 1; -webkit-transform: translateY(0);    transform: translateY(0); }
}
@keyframes introRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* UPDATE BANNER */
.update-banner {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: calc(var(--z-header) + 1);
  -webkit-transform: translateY(-100%); transform: translateY(-100%);
  -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.23,1,0.32,1);
  transition: transform 0.4s cubic-bezier(0.23,1,0.32,1);
}
.update-banner.visible { -webkit-transform: translateY(0); transform: translateY(0); }
.update-banner-inner {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.25rem;
  background: #8B5CF6; font-size: 0.82rem; font-weight: 600; color: #fff;
}
.update-banner-icon { font-size: 1rem; flex-shrink: 0; }
.update-banner-msg  { flex: 1; }
.update-banner-btn {
  padding: 0.28rem 0.85rem; background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4); border-radius: 8px; color: #fff;
  font-size: 0.75rem; font-weight: 700; cursor: pointer; font-family: var(--font-body); white-space: nowrap;
}
.update-banner-btn:hover { background: rgba(255,255,255,0.35); }
.update-banner-dismiss {
  background: none; border: none; color: rgba(255,255,255,0.65); cursor: pointer;
  font-size: 0.95rem; padding: 0 0.2rem; font-family: var(--font-body);
}
.update-banner-dismiss:hover { color: #fff; }

/* MOBILE NAV BACKDROP */
.nav-backdrop {
  position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1);
  background: rgba(0,0,0,0.65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  -webkit-transition: opacity 0.3s ease; transition: opacity 0.3s ease;
}
.nav-backdrop.open { opacity: 1; pointer-events: all; }

/* MOBILE NAV DRAWER */
.mobile-nav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: var(--z-drawer);
  width: min(300px, 86vw); background: #0d0d0d;
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex; flex-direction: column;
  -webkit-transform: translateX(-100%); transform: translateX(-100%);
  -webkit-transition: -webkit-transform 0.38s cubic-bezier(0.23,1,0.32,1);
  transition: transform 0.38s cubic-bezier(0.23,1,0.32,1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-nav.open { -webkit-transform: translateX(0); transform: translateX(0); }
.nav-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(1rem, env(safe-area-inset-top, 1rem)) 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07); flex-shrink: 0;
}
.nav-logo { height: 28px; width: auto; object-fit: contain; }
.nav-close {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border: none; border-radius: 8px;
  color: rgba(255,255,255,0.55); font-size: 0.88rem; cursor: pointer; font-family: var(--font-body);
  -webkit-transition: background 0.15s, color 0.15s; transition: background 0.15s, color 0.15s;
}
.nav-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-body { flex: 1; overflow-y: auto; padding: 0.75rem 0; -webkit-overflow-scrolling: touch; }
.nav-item-link {
  display: block; padding: 0.72rem 1.25rem;
  font-size: 0.9rem; font-weight: 600; color: rgba(255,255,255,0.6);
  -webkit-transition: color 0.15s, background 0.15s; transition: color 0.15s, background 0.15s;
}
.nav-item-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.accordion-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0.72rem 1.25rem;
  font-size: 0.9rem; font-weight: 600; color: rgba(255,255,255,0.6);
  background: none; border: none; cursor: pointer; font-family: var(--font-body);
  -webkit-transition: color 0.15s; transition: color 0.15s;
}
.accordion-trigger:hover { color: #fff; }
.accordion-trigger .caret {
  flex-shrink: 0;
  -webkit-transition: -webkit-transform 0.25s cubic-bezier(0.23,1,0.32,1);
  transition: transform 0.25s cubic-bezier(0.23,1,0.32,1);
}
.accordion-trigger[aria-expanded="true"] .caret { -webkit-transform: rotate(180deg); transform: rotate(180deg); }
.accordion-panel {
  max-height: 0; overflow: hidden; background: rgba(255,255,255,0.025);
  -webkit-transition: max-height 0.35s cubic-bezier(0.23,1,0.32,1);
  transition: max-height 0.35s cubic-bezier(0.23,1,0.32,1);
}
.accordion-panel.open { max-height: 500px; }
.accordion-panel .nav-link {
  display: block; padding: 0.6rem 1.5rem;
  font-size: 0.84rem; font-weight: 500; color: rgba(255,255,255,0.55); white-space: nowrap;
  -webkit-transition: color 0.15s; transition: color 0.15s;
}
.accordion-panel .nav-link:hover { color: #fff; }
.nav-footer {
  padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.07);
  display: flex; gap: 0.65rem; flex-shrink: 0;
}
.btn-nav-signin, .btn-nav-signup {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 0.68rem 1rem; border-radius: 12px; font-size: 0.86rem; font-weight: 700;
  -webkit-transition: all 0.18s ease; transition: all 0.18s ease;
}
.btn-nav-signin { border: 1px solid rgba(255,255,255,0.14); color: rgba(255,255,255,0.6); }
.btn-nav-signin:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.btn-nav-signup { background: #8B5CF6; color: #fff; border: none; }
.btn-nav-signup:hover { background: #7C3AED; }

/* SITE HEADER */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: var(--z-header); /* = 900 via tokens.css — above everything except drawers/modals/max */
  height: var(--header-height);
  background: rgba(8,8,8,0.9);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  /* NOTE: do NOT add transform/translateZ here — combining transform with
     backdrop-filter on position:fixed breaks Safari compositor ordering */
  -webkit-transition: background 0.35s ease, border-color 0.35s ease;
  transition: background 0.35s ease, border-color 0.35s ease;
}
.site-header.scrolled { background: rgba(8,8,8,0.97); border-color: rgba(255,255,255,0.1); }
.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; height: 100%;
  display: flex; align-items: center; gap: 1.5rem;
}
.header-logo { display: flex; align-items: center; flex-shrink: 0; }
.logo-img {
  height: 34px; width: auto; display: block; object-fit: contain;
  -webkit-transition: -webkit-filter 0.3s ease; transition: filter 0.3s ease;
}
.header-logo:hover .logo-img {
  -webkit-filter: drop-shadow(0 0 10px rgba(139,92,246,0.55));
  filter: drop-shadow(0 0 10px rgba(139,92,246,0.55));
}

/* Desktop nav */
.nav-links { display: none; }
@media (min-width: 768px) {
  .nav-links { display: flex; align-items: center; gap: 0.15rem; flex: 1; min-width: 0; }
}
.nav-link {
  padding: 0.42rem 1rem; font-size: 0.84rem; font-weight: 600;
  color: rgba(255,255,255,0.6); border-radius: 8px; white-space: nowrap;
  -webkit-transition: color 0.15s, background 0.15s; transition: color 0.15s, background 0.15s;
}
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,0.07); }
@media (min-width: 768px) and (max-width: 1023px) {
  .logo-img { height: 29px; }
  .header-inner { gap: 1.2rem; }
  .nav-link { padding: 0.38rem 0.75rem; font-size: 0.8rem; }
}
.header-actions { display: flex; align-items: center; gap: 0.35rem; margin-left: auto; }

/* ── SEARCH ──────────────────────────────────────────────────
   FIX: position:relative added so .search-input-wrap (absolute)
   anchors to this element, not to .site-header or the viewport.
   ──────────────────────────────────────────────────────────── */
.header-search { display: flex; align-items: center; position: relative; }

.search-icon-btn {
  position: relative; z-index: calc(var(--z-header) + 1);
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px;
  background: none; border: none; color: rgba(255,255,255,0.55); cursor: pointer; flex-shrink: 0;
  -webkit-transition: color 0.18s, background 0.18s; transition: color 0.18s, background 0.18s;
}
.search-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.search-icon-btn[aria-expanded="true"] {
  color: #fff; background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.16);
}
.search-icon-btn svg {
  display: block;
  -webkit-transition: -webkit-transform 0.2s ease; transition: transform 0.2s ease;
}
.search-icon-btn[aria-expanded="true"] svg {
  -webkit-transform: rotate(90deg) scale(0.85); transform: rotate(90deg) scale(0.85);
}

/* Hide auth buttons while search is open so icon doesn't bleed into Start Free */
.header-actions.search-active .btn-start,
.header-actions.search-active .btn-signin { display: none; }

/* Compact pill — expands leftward from icon */
.search-input-wrap {
  position: absolute; right: 0; top: 50%;
  -webkit-transform: translateY(-50%); transform: translateY(-50%);
  display: flex; align-items: center; gap: 0.5rem; padding-inline: 0.75rem;
  height: 2.5rem; border-radius: 999px;
  background: rgba(0,0,0,0.96); border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 25px rgba(0,0,0,0.7);
  opacity: 0; pointer-events: none; min-width: 0; width: 0; overflow: hidden;
  -webkit-transition: opacity 0.18s ease, width 0.25s cubic-bezier(0.23,1,0.32,1), border-color 0.18s ease;
  transition: opacity 0.18s ease, width 0.25s cubic-bezier(0.23,1,0.32,1), border-color 0.18s ease;
}
.search-input-wrap.active {
  opacity: 1; pointer-events: auto;
  width: min(260px, 70vw); border-color: rgba(255,255,255,0.3);
}
.search-panel-icon { color: rgba(255,255,255,0.35); flex-shrink: 0; display: flex; align-items: center; }
.search-input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: #fff; font-size: 0.88rem; font-family: var(--font-body); padding: 0.4rem 0;
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: rgba(255,255,255,0.28); }
.search-clear {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none;
  color: rgba(255,255,255,0.55); cursor: pointer; font-size: 0.65rem;
  font-family: var(--font-body); opacity: 0;
  -webkit-transition: opacity 0.15s, color 0.15s, background 0.15s;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.search-clear.visible { opacity: 1; }
.search-clear:hover { color: #fff; background: rgba(255,255,255,0.18); }

/* Auth buttons */
.btn-signin {
  display: inline-flex; padding: 0.4rem 0.9rem; font-size: 0.81rem; font-weight: 600;
  color: rgba(255,255,255,0.6); border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  -webkit-transition: color 0.15s, background 0.15s, border-color 0.15s;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.btn-signin:hover { color: #fff; background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.3); }
.btn-start {
  padding: 0.46rem 1.05rem; font-size: 0.82rem; font-weight: 700;
  background: #8B5CF6; color: #fff; border-radius: 999px;
  -webkit-transition: background 0.2s, -webkit-transform 0.15s, box-shadow 0.2s;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-start:hover {
  background: #7C3AED; -webkit-transform: translateY(-1px); transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139,92,246,0.45);
}

/* Burger */
.burger {
  display: flex; flex-direction: column; justify-content: center;
  gap: 5px; width: 36px; height: 36px; padding: 7px;
  background: none; border: none; border-radius: 8px; cursor: pointer; flex-shrink: 0;
  -webkit-transition: background 0.15s; transition: background 0.15s;
}
.burger:hover { background: rgba(255,255,255,0.08); }
.burger span {
  display: block; height: 2px; border-radius: 2px; background: rgba(255,255,255,0.8);
  -webkit-transition: all 0.28s cubic-bezier(0.23,1,0.32,1); transition: all 0.28s cubic-bezier(0.23,1,0.32,1);
}
.burger span:nth-child(1) { width: 22px; }
.burger span:nth-child(2) { width: 14px; }
.burger span:nth-child(3) { width: 22px; }
.burger[aria-expanded="true"] span:nth-child(1) {
  -webkit-transform: rotate(45deg) translate(5px,5px); transform: rotate(45deg) translate(5px,5px); width: 20px;
}
.burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0; -webkit-transform: scaleX(0); transform: scaleX(0);
}
.burger[aria-expanded="true"] span:nth-child(3) {
  -webkit-transform: rotate(-45deg) translate(5px,-5px); transform: rotate(-45deg) translate(5px,-5px); width: 20px;
}
@media (min-width: 1024px) { .burger { display: none; } }

/* Desktop nav dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  display: inline-flex; align-items: center; gap: 0.28rem;
  padding: 0.42rem 1rem; font-size: 0.84rem; font-weight: 600;
  color: rgba(255,255,255,0.6); border-radius: 8px; white-space: nowrap;
  background: none; border: none; cursor: pointer; font-family: var(--font-body);
  -webkit-transition: color 0.15s, background 0.15s; transition: color 0.15s, background 0.15s;
}
.nav-dropdown-trigger:hover,
.nav-dropdown-trigger[aria-expanded="true"] { color: #fff; background: rgba(255,255,255,0.07); }
.nav-dd-caret {
  opacity: 0.55; flex-shrink: 0;
  -webkit-transition: -webkit-transform 0.22s cubic-bezier(0.23,1,0.32,1);
  transition: transform 0.22s cubic-bezier(0.23,1,0.32,1);
}
.nav-dropdown-trigger[aria-expanded="true"] .nav-dd-caret {
  -webkit-transform: rotate(180deg); transform: rotate(180deg);
}
.nav-dropdown-panel {
  position: absolute; top: calc(100% + 0.55rem); left: -0.5rem; min-width: 246px;
  background: rgba(10,10,10,0.98); -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; padding: 0.45rem;
  box-shadow: 0 16px 52px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: calc(var(--z-header) + 10);
  opacity: 0; pointer-events: none;
  -webkit-transform: translateY(-6px) scale(0.97); transform: translateY(-6px) scale(0.97);
  -webkit-transform-origin: top left; transform-origin: top left;
  -webkit-transition: opacity 0.2s ease, -webkit-transform 0.22s cubic-bezier(0.23,1,0.32,1);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.23,1,0.32,1);
}
.nav-dropdown-panel.open {
  opacity: 1; pointer-events: all;
  -webkit-transform: translateY(0) scale(1); transform: translateY(0) scale(1);
}
.dd-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.8rem; border-radius: 10px; text-decoration: none;
  -webkit-transition: background 0.13s; transition: background 0.13s;
}
.dd-link:hover { background: rgba(255,255,255,0.07); }
.dd-icon  { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }
.dd-label { display: block; font-size: 0.83rem; font-weight: 600; color: #fff; white-space: nowrap; }
.dd-sub   { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.38); margin-top: 1px; }
.dd-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 0.3rem 0.8rem; }
@media (min-width: 768px) and (max-width: 1023px) {
  .nav-dropdown-trigger { padding: 0.38rem 0.75rem; font-size: 0.8rem; }
}

/* ── RETURNING USER STRIP ────────────────────────────────────
   Flush dark section — no card, no purple border.
   Sits tight under the header (main already clears it).
   Fades in via .visible class added by JS.
   ──────────────────────────────────────────────────────────── */
.returning-strip {
  display: none;           /* Takes zero space for first-time visitors */
  position: relative;
  z-index: 0;
  margin-top: 0;
  padding: 1.55rem 1.25rem 1.45rem;
  background: rgba(10,10,10,0.96);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  opacity: 0;
  -webkit-transform: translateY(-4px); transform: translateY(-4px);
  /* pointer-events not needed — display:none already blocks interaction */
  -webkit-transition: opacity 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.23,1,0.32,1);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.23,1,0.32,1);
}
.returning-strip.visible {
  opacity: 1; -webkit-transform: translateY(0); transform: translateY(0);
}
/* Inner: no card chrome — just a flex row with max-width centering */
.returning-strip-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.25rem; flex-wrap: nowrap;
}
.returning-greeting { display: flex; align-items: center; gap: 0.9rem; flex: 1; min-width: 0; }
.returning-wave     { font-size: 1.85rem; flex-shrink: 0; line-height: 1; }
.returning-title    { font-size: 1.05rem; font-weight: 700; color: #fff; line-height: 1.2; }
.returning-sub      { font-size: 0.72rem; color: rgba(255,255,255,0.38); margin-top: 0.22rem; line-height: 1.4; }
.returning-actions  { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

/* Mobile: entire returning strip hidden — hero IS the first impression.
   Header already has Sign In. Strip lives at desktop (768px+) only. */
@media (max-width: 767px) {
  .returning-strip { display: none !important; }
}
/* Sign In — ghost outline pill */
.btn-returning-signin {
  padding: 0.55rem 1.15rem; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.28); color: rgba(255,255,255,0.75);
  background: transparent;
  -webkit-transition: color 0.15s, border-color 0.15s; transition: color 0.15s, border-color 0.15s;
}
.btn-returning-signin:hover { color: #fff; border-color: rgba(255,255,255,0.55); }
/* Browse → — purple filled pill */
.btn-returning-browse {
  padding: 0.55rem 1.25rem; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700;
  background: #8B5CF6; color: #fff; border: none;
  -webkit-transition: background 0.15s, -webkit-transform 0.15s;
  transition: background 0.15s, transform 0.15s;
}
.btn-returning-browse:hover { background: #7C3AED; -webkit-transform: translateY(-1px); transform: translateY(-1px); }

/* HERO SECTION */
.hero {
  position: relative;
  z-index: 1;          /* Explicit — stays below header(900) in root stacking context */
  min-height: 100svh;
  display: flex; align-items: flex-end; overflow: hidden;
  padding-top: calc(var(--header-height) * 0.35);
  /* isolation:isolate creates a new stacking context that strictly
     contains all child will-change/transform compositor layers,
     preventing them from ever painting above the fixed header */
  isolation: isolate;
}

/* Mobile: portrait Crate-Digging */
.hero-img {
  position: absolute; inset: 0;
  background-image: url('https://assets.cratoora.com/images/Crate-Digging.png');
  background-size: cover; background-position: center 36%; background-repeat: no-repeat;
  -webkit-transform-origin: center 36%; transform-origin: center 36%;
  will-change: filter, -webkit-transform;
  /* Explicit initial filter state — prevents will-change:filter from
     creating a darker-than-expected compositing layer before JS fires */
  -webkit-filter: blur(0px) brightness(1); filter: blur(0px) brightness(1);
}

/* Desktop: wide Crate-Studio */
@media (min-width: 768px) {
  .hero-img {
    background-image: url('https://assets.cratoora.com/images/Crate-Studio.png');
    background-position: center 38%;
    -webkit-transform-origin: center 38%; transform-origin: center 38%;
  }
}

/* SVG grain overlay */
.hero-img::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.42;
  background: 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='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E") 0 0 / 220px 220px;
}

/* Diagonal shelter + seamless top fade into header */
.hero-shelter {
  position: absolute; inset: 0; pointer-events: none;
  background:
    /* Top fade — softer, header bleeds in without showing the gradient itself */
    linear-gradient(to bottom, rgba(8,8,8,0.52) 0%, rgba(8,8,8,0.18) 12%, transparent 30%),
    /* Diagonal left shelter — keeps text legible */
    linear-gradient(112deg, rgba(8,8,8,0.97) 0%, rgba(8,8,8,0.84) 28%, rgba(8,8,8,0.34) 54%, rgba(8,8,8,0.00) 72%),
    /* Bottom fade — full coverage, no hard line */
    linear-gradient(to top, rgba(8,8,8,1) 0%, rgba(8,8,8,0.75) 12%, rgba(8,8,8,0.3) 28%, rgba(8,8,8,0.00) 42%);
}

/* Hero content */
.hero-content {
  position: relative; z-index: 2;
  width: 100%; max-width: 1280px; margin: 0 auto;
  /* Mobile: generous bottom so CTA clears browser chrome + safe area */
  padding: 0 1.25rem max(6rem, calc(4rem + env(safe-area-inset-bottom, 0px)));
}
@media (min-width: 768px) {
  /* Desktop: tighter — no chrome overlap to worry about */
  .hero-content { padding: 0 1.25rem 4rem; }
}
.hero-inner { max-width: 500px; }

/* Eyebrow */
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.67rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: #8B5CF6; margin-bottom: 1rem; opacity: 0;
  -webkit-animation: riseIn 0.6s 0.4s cubic-bezier(0.23,1,0.32,1) forwards;
  animation: riseIn 0.6s 0.4s cubic-bezier(0.23,1,0.32,1) forwards;
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #8B5CF6;
  -webkit-animation: livePulse 2s ease-in-out infinite; animation: livePulse 2s ease-in-out infinite;
}
@-webkit-keyframes livePulse {
  0%,100% { -webkit-transform: scale(1);   transform: scale(1);   opacity: 1; }
  50%     { -webkit-transform: scale(1.6); transform: scale(1.6); opacity: 0.5; }
}
@keyframes livePulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.6); opacity: 0.5; }
}

/* Headline */
.hero-headline {
  font-family: var(--font-display); font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 800; line-height: 0.94; letter-spacing: -0.04em;
  margin-bottom: 1.3rem; opacity: 0;
  -webkit-animation: riseIn 0.6s 0.55s cubic-bezier(0.23,1,0.32,1) forwards;
  animation: riseIn 0.6s 0.55s cubic-bezier(0.23,1,0.32,1) forwards;
}
.headline-plain { display: block; color: #fff; }
.headline-accent {
  display: block;
  background: linear-gradient(135deg, #8B5CF6 0%, #a78bfa 45%, #D97706 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* Sub copy */
.hero-sub {
  font-size: clamp(0.88rem, 2vw, 1.02rem); font-weight: 400;
  color: rgba(255,255,255,0.62); line-height: 1.72; max-width: 400px;
  margin-bottom: 2rem; opacity: 0;
  -webkit-animation: riseIn 0.6s 0.7s cubic-bezier(0.23,1,0.32,1) forwards;
  animation: riseIn 0.6s 0.7s cubic-bezier(0.23,1,0.32,1) forwards;
}

/* CTAs */
.hero-cta {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  margin-bottom: 2.5rem; opacity: 0;
  -webkit-animation: riseIn 0.6s 0.85s cubic-bezier(0.23,1,0.32,1) forwards;
  animation: riseIn 0.6s 0.85s cubic-bezier(0.23,1,0.32,1) forwards;
}
.btn-hero-primary {
  display: inline-flex; align-items: center;
  padding: 0.82rem 1.9rem; background: #8B5CF6; color: #fff; border-radius: 12px;
  font-size: 0.92rem; font-weight: 700;
  -webkit-transition: background 0.2s, -webkit-transform 0.15s, box-shadow 0.2s;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-hero-primary:hover {
  background: #7C3AED; -webkit-transform: translateY(-2px); transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(139,92,246,0.5);
}
.btn-hero-ghost {
  display: inline-flex; align-items: center; padding: 0.82rem 1.45rem;
  border: 1px solid rgba(255,255,255,0.2); border-radius: 12px;
  font-size: 0.88rem; font-weight: 600; color: rgba(255,255,255,0.82);
  -webkit-transition: border-color 0.2s, color 0.2s, background 0.2s;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-hero-ghost:hover { border-color: rgba(255,255,255,0.42); color: #fff; background: rgba(255,255,255,0.06); }

/* Stats — flex-wrap guarantees 0% Exclusivity never clips */
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 1.4rem; opacity: 0;
  -webkit-animation: riseIn 0.6s 1s cubic-bezier(0.23,1,0.32,1) forwards;
  animation: riseIn 0.6s 1s cubic-bezier(0.23,1,0.32,1) forwards;
}
.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 4vw, 1.4rem);
  font-weight: 700; color: #fff; letter-spacing: -0.02em; line-height: 1;
}
.stat-value.accent { color: #8B5CF6; }
.stat-label {
  font-size: 0.62rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.38); white-space: nowrap;
}

/* ── SCROLL CUE ──────────────────────────────────────────────
   Permanently hidden. No scroll word on any surface.
   ──────────────────────────────────────────────────────────── */
.scroll-cue,
.scroll-cue * { display: none !important; }

/* Shared entrance animation */
@-webkit-keyframes riseIn {
  from { opacity: 0; -webkit-transform: translateY(10px); transform: translateY(10px); }
  to   { opacity: 1; -webkit-transform: translateY(0);    transform: translateY(0); }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   PWA INSTALL — bottom-sheet popup
   Slides up from bottom on first visit after 3.5 s.
   JS builds .pwa-overlay + .pwa-install-popup dynamically.
   ============================================================= */
.pwa-overlay {
  position: fixed; inset: 0;
  z-index: calc(var(--z-max) - 1);
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  -webkit-transition: opacity 0.35s ease; transition: opacity 0.35s ease;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.pwa-overlay.visible { opacity: 1; pointer-events: all; }

.pwa-install-popup {
  background: #141414;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px 20px 0 0;
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0));
  width: 100%; max-width: 480px;
  -webkit-transform: translateY(100%); transform: translateY(100%);
  -webkit-transition: -webkit-transform 0.42s cubic-bezier(0.23,1,0.32,1);
  transition: transform 0.42s cubic-bezier(0.23,1,0.32,1);
}
.pwa-overlay.visible .pwa-install-popup {
  -webkit-transform: translateY(0); transform: translateY(0);
}

.pwa-install-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.pwa-install-icon   { width: 52px; height: 52px; border-radius: 12px; object-fit: contain; flex-shrink: 0; }
.pwa-install-title  {
  font-family: var(--font-display); font-size: 1rem; font-weight: 800;
  letter-spacing: -0.02em; color: #fff;
}
.pwa-install-sub { font-size: 0.73rem; color: rgba(255,255,255,0.35); margin-top: 2px; }

.pwa-ios-hint {
  display: flex; align-items: center; gap: 0.55rem;
  background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.22);
  border-radius: 8px; padding: 0.6rem 0.8rem;
  font-size: 0.78rem; color: rgba(255,255,255,0.6); margin-bottom: 1rem;
}
.pwa-ios-hint .hint-icon { font-size: 0.95rem; flex-shrink: 0; }
.pwa-install-body {
  font-size: 0.84rem; color: rgba(255,255,255,0.6); line-height: 1.65; margin-bottom: 1.2rem;
}
.pwa-install-actions { display: flex; gap: 0.7rem; }
.pwa-btn-install, .pwa-btn-later {
  flex: 1; padding: 0.75rem 1rem; border-radius: 12px;
  font-size: 0.88rem; font-weight: 700; cursor: pointer; font-family: var(--font-body);
  -webkit-transition: all 0.18s ease; transition: all 0.18s ease;
}
.pwa-btn-install { background: #8B5CF6; border: none; color: #fff; }
.pwa-btn-install:hover { background: #7C3AED; }
.pwa-btn-later  { background: none; border: 1px solid rgba(255,255,255,0.14); color: rgba(255,255,255,0.6); }
.pwa-btn-later:hover  { border-color: rgba(255,255,255,0.3); color: #fff; }

/* =============================================================
   HERO.CSS — SEARCH OVERRIDE PATCH v1
   Aligns index.html search with stereo.css behavior.
   ID-based rules override the class-based rules above.
   Deploy: append to hero.css (or replace search block).
   ============================================================= */

/* Container — fixed 36×36, overflow:visible so wrap can bleed left */
#headerSearch {
  position: relative;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  width: 36px;
  height: 36px;
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
  overflow: visible;               /* ← lets expanded wrap overflow without clipping */
}

/* Toggle — no scale on expand, clean rotate only (matches stereo) */
#searchToggle {
  position: relative;
  z-index: calc(var(--z-header) + 1);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
  -webkit-transform: rotate(0deg);
          transform: rotate(0deg);
  -webkit-transition: color 0.2s ease, background 0.2s ease,
            -webkit-transform 0.35s cubic-bezier(0.23,1,0.32,1);
          transition: color 0.2s ease, background 0.2s ease,
            transform 0.35s cubic-bezier(0.23,1,0.32,1);
}
#searchToggle:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
/* Rotate only — no scale(0.85) that was causing the icon to shrink/shift */
#headerSearch.active #searchToggle,
#searchToggle[aria-expanded="true"] {
  color: #fff;
  -webkit-transform: rotate(90deg);
          transform: rotate(90deg);
  background: rgba(255,255,255,0.1);
}
/* Remove the SVG-level transform hero.css was applying */
#searchToggle svg,
#searchToggle[aria-expanded="true"] svg {
  -webkit-transform: none !important;
          transform: none !important;
}

/* Input wrap — anchored right of toggle, slides left on expand */
#searchInputWrap {
  position: absolute;
  right: -0.5vw;
  top: 50%;
  -webkit-transform: translateY(-50%);
          transform: translateY(-50%);
  height: 36px;
  width: 0;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(8,8,8,0.96);
  border: 1px solid transparent;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  padding-right: 36px;          /* reserve space under toggle so it stays visible */
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  -webkit-transition: width 0.35s cubic-bezier(0.23,1,0.32,1),
            border-color 0.25s ease;
          transition: width 0.35s cubic-bezier(0.23,1,0.32,1),
            border-color 0.25s ease;
}
#searchInputWrap.active {
  width: clamp(220px, 28vw, 340px);  /* matches stereo */
  border-color: rgba(255,255,255,0.12);
  padding-left: 0.75rem;
}

/* Mobile: flush right, narrower expand */
@media (max-width: 767px) {
  #searchInputWrap         { right: 0; }
  #searchInputWrap.active  { width: clamp(180px, 56vw, 270px); }
}

/* Suppress auth buttons while search is open (class set by appShell.js v9.6) */
.header-actions.search-active .btn-signin,
.header-actions.search-active .btn-start { display: none !important; }