/* Homepage community layout — shares .post / .compose / .feed-tabs from feed.css */

.page-home .main--home {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 0 calc(var(--bottom-h, 64px) + env(safe-area-inset-bottom, 0px) + 1rem);
}

/* Shorter hero so the feed peeks on first paint */
.page-home .hero--home {
  --hero-pos: 62% center;
  position: relative;
  min-height: clamp(420px, 72svh, 620px);
  max-height: 720px;
  display: grid;
  align-items: end;
  overflow: visible;
  background-color: #2a1c12;
  background-image: none;
}
.page-home .hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.page-home .hero__bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-pos);
  display: block;
}
.page-home .hero__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      105deg,
      rgba(20, 16, 12, 0.92) 0%,
      rgba(20, 16, 12, 0.72) 38%,
      rgba(20, 16, 12, 0.35) 62%,
      rgba(20, 16, 12, 0.2) 100%
    ),
    linear-gradient(180deg, rgba(20, 16, 12, 0.15) 0%, rgba(20, 16, 12, 0.45) 55%, rgba(20, 16, 12, 0.92) 100%);
  pointer-events: none;
}
  /* Keep the big hero logo absolutely placed (same scroll-to-header effect as desktop) */
.page-home .hero__logo {
  position: absolute;
  z-index: 3;
}
.page-home .hero__content {
  position: relative;
  z-index: 1;
}
.page-home .hero__cta .btn {
  min-height: 44px;
  white-space: nowrap;
}
.page-home .hero__cta .btn--ghost {
  backdrop-filter: blur(6px);
}

@media (max-width: 720px) {
  .page-home .hero--home {
    --hero-pos: 78% 42%;
    min-height: clamp(380px, 73svh, 560px);
    max-height: none;
  }
  /* Sit under the fixed header so EN / Log in / Join stay clear */
  .page-home .hero__logo {
    top: calc(var(--topbar-h, 56px) + 0.2rem);
    left: max(0.75rem, env(safe-area-inset-left, 0px));
  }
  .page-home .hero__logo img {
    width: clamp(118px, 36vw, 176px);
  }
  .page-home.logo-docked .hero__logo {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }
  .page-home.is-scrolled .topbar .brand__logo {
    max-height: calc(var(--topbar-h) - 16px);
    max-width: min(100px, 30vw);
  }
  .page-home .hero__lead { display: none; }
  .page-home .hero__cta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    max-width: 22rem;
  }
  .page-home .hero__cta .btn {
    flex: 0 0 auto;
    width: 100%;
    justify-content: center;
  }
}

@media (min-width: 721px) {
  .page-home .hero--home {
    --hero-pos: 58% center;
    min-height: clamp(480px, 72vh, 680px);
    max-height: 760px;
    padding-top: clamp(11rem, 20vw, 15rem);
  }
  .page-home .hero__logo {
    top: 0.15rem;
    left: 0.65rem;
  }
  .page-home .hero__logo img {
    width: clamp(176px, 22vw, 248px);
  }
  .page-home .hero__logo.is-docking img {
    width: 100%;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-home .hero__content,
  .page-home .hero__tag,
  .page-home .hero__lead,
  .page-home .hero__cta,
  .page-home .hero__promise,
  .page-home .hero__url-hint {
    animation: none !important;
  }
  .hero__logo.is-docking {
    transition: none;
  }
}

.home-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 12px 1.5rem;
  box-sizing: border-box;
}
.home-layout__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.home-sidebar { display: none; }

.home-feed__intro h2 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.home-feed__intro p { margin: 0 0 0.65rem; }
.home-feed .feed-tabs { margin-bottom: 0.35rem; }

.page-home .feed {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.page-home .post {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  margin-left: -12px;
  margin-right: -12px;
  width: calc(100% + 24px);
}
.home-feed__more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.5rem 0 0.25rem;
}
.home-feed__more .btn { min-height: 44px; }
.empty--compact {
  padding: 1.25rem 0.75rem;
  text-align: center;
}

.home-secondary {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.35rem;
}
.home-rail__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.home-rail__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.home-rail__head a {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ember-2);
  white-space: nowrap;
}
.home-rail__scroller {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.35rem;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  scrollbar-width: thin;
}
.home-card {
  flex: 0 0 min(78vw, 260px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.home-card--rig:hover,
.home-card--rig:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--ember) 40%, var(--border));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}
.home-card--rig:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ember) 70%, white);
  outline-offset: 2px;
}
.home-card--rig .home-card__media img {
  transition: transform 0.35s ease, filter 0.25s ease;
}
.home-card--rig:hover .home-card__media img,
.home-card--rig:focus-visible .home-card__media img {
  transform: scale(1.04);
  filter: brightness(1.05);
}
.home-card--trail,
.home-card--crew {
  flex-direction: row;
  align-items: stretch;
  flex-basis: min(88vw, 320px);
}
.home-card__media {
  aspect-ratio: 16 / 10;
  background: var(--trail);
  overflow: hidden;
}
.home-card__media--sm {
  width: 96px;
  flex: 0 0 96px;
  aspect-ratio: auto;
  align-self: stretch;
}
.home-card__media--logo {
  width: 88px;
  flex: 0 0 88px;
  aspect-ratio: auto;
  display: grid;
  place-items: center;
  background: var(--panel-2);
}
.home-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-card__media--logo img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
}
.home-card__ph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 120px;
  background: linear-gradient(135deg, var(--panel-2), var(--trail));
}
.home-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem 0.8rem;
  min-width: 0;
}
.home-card__body strong {
  font-size: 0.95rem;
  line-height: 1.25;
}
.home-card__body span {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.home-card--trail .home-card__body,
.home-card--crew .home-card__body {
  justify-content: center;
}

/* Guest auth sheet */
.guest-auth[hidden] { display: none !important; }
.guest-auth {
  position: fixed;
  inset: 0;
  z-index: 95;
}
.guest-auth__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.guest-auth__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(88vh, 520px);
  overflow: auto;
  background: var(--bg-elev);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  padding: 0.5rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.45);
}
.guest-auth__handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 0.25rem auto 0.35rem;
}
.guest-auth__close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
  border-radius: 50%;
}
.guest-auth__panel h2 {
  margin: 0.35rem 2rem 0.45rem 0;
  font-size: 1.25rem;
}
.guest-auth__body {
  margin: 0 0 0.65rem;
  color: var(--text-dim);
}
.guest-auth__url {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  margin: 0 0 1rem;
}
.guest-auth__url em { color: var(--ember-2); font-style: normal; }
.guest-auth__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.guest-auth__actions .btn { min-height: 44px; width: 100%; justify-content: center; }
body.guest-auth-open { overflow: hidden; }

@media (min-width: 700px) {
  .page-home .post {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
  }
  .home-card { flex-basis: 240px; }
  .guest-auth__panel {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100vw - 2rem));
    border-radius: 16px;
    border: 1px solid var(--border-strong);
  }
  .guest-auth__handle { display: none; }
}

@media (min-width: 980px) {
  .home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.25rem;
    align-items: start;
    padding-top: 1rem;
  }
  .home-sidebar {
    display: block;
    position: sticky;
    top: calc(var(--header-height, var(--topbar-h, 64px)) + 16px);
    align-self: start;
    height: fit-content;
    max-height: none;
    overflow: visible;
  }
  .home-sidebar .feed-sidebar { display: block; }
  /* Same upcoming events already appear in the desktop rail. */
  .page-home .feed-digest { display: none; }
  /* Featured Rig + Active Crews live in the sidebar on desktop */
  .home-rail--mobile-only { display: none !important; }
}

@media (min-width: 1200px) {
  .home-layout {
    grid-template-columns: minmax(0, 720px) 320px;
    justify-content: center;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .page-home .hero--home {
    min-height: clamp(280px, 70svh, 420px);
    max-height: none;
    display: grid;
    align-items: end;
  }
}

.page-explore .explore-search { margin-bottom: 1.25rem; }
.page-explore .explore-discover { padding-top: 0; gap: 1.5rem; }
.page-explore .explore-people {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}
.page-explore .explore-person {
  margin: 0;
  min-height: 44px;
}
@media (min-width: 640px) {
  .page-explore .explore-people {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 768px) {
  .page-home .main--home {
    padding-bottom: 1rem;
  }
  .page-explore .home-rail__scroller {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
}
