/* =============================================
   HOME PAGE
   ============================================= */

/* ── Welcome Banner ──────────────────────────────────────── */

.home-welcome-banner {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  background: var(--bg-surface);
  border-bottom: 1px solid transparent;
  transition:
    max-height 360ms var(--ease-out),
    opacity 260ms var(--ease-out),
    transform 260ms var(--ease-out),
    border-color 260ms var(--ease-out);
}

.home-welcome-banner--visible {
  max-height: 60px;
  opacity: 1;
  transform: translateY(0);
  border-bottom-color: var(--border-subtle);
}

.home-welcome-banner-inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: var(--container-xl);
  margin-inline: auto;
  padding: 7px var(--space-5);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  line-height: 1.4;
}

.home-welcome-banner svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.home-welcome-banner a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border-default);
  transition: color var(--duration-fast), text-decoration-color var(--duration-fast);
}

.home-welcome-banner a:hover {
  color: var(--text-primary);
  text-decoration-color: var(--text-secondary);
}

.home-welcome-banner-close {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--duration-fast), color var(--duration-fast);
}

.home-welcome-banner-close:hover {
  opacity: 1;
  color: var(--text-primary);
}

/* Hero — dramatic, full-presence entry */
.hero {
  position: relative;
  padding: clamp(5rem, 3rem + 10vw, 12rem) 0 clamp(4rem, 2rem + 8vw, 8rem);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../../Images/horsehead.jpg") center / cover no-repeat;
  opacity: 0.19;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(11, 13, 20, 0.2) 0%,
    rgba(11, 13, 20, 0.6) 60%,
    var(--bg-base) 100%
  );
  pointer-events: none;
}

:root[data-theme="light"] .hero::before {
  opacity: 0.08;
}

:root[data-theme="light"] .hero::after {
  background: linear-gradient(
    180deg,
    rgba(232, 233, 238, 0.3) 0%,
    rgba(232, 233, 238, 0.75) 60%,
    var(--bg-base) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-6);
  padding: var(--space-1) var(--space-3);
  background: var(--accent-subtle);
  border: 1px solid rgba(91, 141, 239, 0.15);
  border-radius: var(--radius-full);
}

/* ── Hero entrance animations ─────────────────────────────── */
@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-title {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  font-size: var(--text-hero);
  color: var(--text-primary);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-6);
  animation: hero-fade-up 640ms var(--ease-out) 60ms both;
}

.hero-accent {
  color: var(--accent);
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-10);
  max-width: 560px;
  animation: hero-fade-up 640ms var(--ease-out) 180ms both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  animation: hero-fade-up 640ms var(--ease-out) 290ms both;
}

/* Stat strip under hero */
.hero-stats {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
  animation: hero-fade-up 640ms var(--ease-out) 420ms both;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.hero-stat-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Builder preview */
.builder-preview {
  padding-block: var(--space-section);
}

.builder-preview-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
  align-items: center;
}

.builder-preview-image {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--bg-surface);
}

.builder-preview-image img {
  width: 100%;
  height: auto;
  display: block;
}

.builder-preview-text h2 {
  margin-bottom: var(--space-4);
}

.builder-preview-text p {
  margin-bottom: var(--space-8);
  max-width: 480px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.feature-item {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.feature-icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.feature-item-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.feature-item-text strong {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-base);
}

/* Categories section */
.categories-section {
  padding-block: var(--space-section);
}

.section-header {
  margin-bottom: var(--space-8);
}

.section-label {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--text-tertiary);
  margin-top: var(--space-3);
  max-width: 560px;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2) var(--space-4);
}

/* ---- Preset builds — simple showcased rows ---- */
.presets-section {
  padding-block: var(--space-section);
}

.presets-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

.presets-intro {
  max-width: 36rem;
}

.preset-section-actions {
  margin-top: var(--space-5);
}

.presets-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.preset-build-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  min-height: 100%;
  padding: 0.95rem;
  background: var(--bg-surface);
  border: 1px solid color-mix(in srgb, var(--border-subtle) 92%, white 8%);
  border-radius: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 8px 24px rgba(0, 0, 0, 0.14);
  position: relative;
  align-content: start;
}

.preset-build-row::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  right: 0.95rem;
  top: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.022);
}

.preset-build-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: 0.25rem;
}

.preset-build-kind {
  font-size: 0.7rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.preset-build-visual {
  display: block;
  width: 100%;
  max-width: 7rem;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 7px;
  background: #0f121b;
  border: 1px solid rgba(255, 255, 255, 0.045);
  margin: 0 auto;
}

:root[data-theme="light"] .preset-build-visual {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.preset-build-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preset-build-main {
  min-width: 0;
}

.preset-build-heading {
  margin-bottom: 0.15rem;
}

.preset-build-title {
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.14rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.preset-build-author {
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--text-tertiary) 88%, white 12%);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.preset-build-summary {
  margin: 0 0 0.45rem;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: none;
  font-size: 0.8rem;
}

.preset-build-parts {
  display: grid;
  gap: 7px;
  margin-top: 0.45rem;
  padding-top: 0.55rem;
  border-top: 1px solid color-mix(in srgb, var(--border-subtle) 90%, white 10%);
}

.preset-build-part {
  display: grid;
  gap: 1px;
}

.preset-build-part-label {
  font-size: 0.68rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.preset-build-part-value {
  color: var(--text-primary);
  line-height: var(--leading-normal);
  font-size: 0.8rem;
}

.preset-build-meta {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid color-mix(in srgb, var(--border-subtle) 90%, white 10%);
}

.preset-build-price {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.preset-build-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.preset-build-link {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

/* ---- Become a Contributor ---- */
.contribute-section {
  padding-block: var(--space-section);
  overflow: hidden;
  position: relative;
}

/* Faint directional nebula glow anchored bottom-left */
.contribute-section::before {
  content: "";
  position: absolute;
  bottom: -5%;
  left: -8%;
  width: 55%;
  height: 70%;
  background: radial-gradient(ellipse at 20% 80%, rgba(91, 141, 239, 0.05) 0%, transparent 65%);
  pointer-events: none;
}

.contribute-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
}

/* ── Left: header copy ───────────────────────────── */
.contribute-header {
  max-width: 38ch;
}

.contribute-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-text);
  margin: 0 0 var(--space-5);
}

.contribute-eyebrow::after {
  content: "";
  display: block;
  width: 3rem;
  height: 1px;
  background: var(--border-default);
  flex-shrink: 0;
}

.contribute-heading {
  font-family: var(--font-heading);
  font-size: clamp(2.6rem, 5vw, 4rem);
  font-weight: var(--weight-bold);
  line-height: 1.0;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin: 0 0 var(--space-6);
}

.contribute-heading-accent {
  color: var(--accent-text);
}

.contribute-lead {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin: 0;
  max-width: 34ch;
}

/* ── Right: numbered list ────────────────────────── */
.contribute-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.contribute-item {
  border-top: 1px solid var(--border-subtle);
  position: relative;
}

.contribute-item:last-child {
  border-bottom: 1px solid var(--border-subtle);
}

/* Sliding left-edge accent stroke */
.contribute-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform 240ms var(--ease-out);
  pointer-events: none;
}

.contribute-item:hover::before {
  transform: scaleY(1);
}

.contribute-item--donate::before {
  background: var(--warning);
}

.contribute-item-link {
  display: grid;
  grid-template-columns: 3.25rem 1fr 1.125rem;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-2) var(--space-6) var(--space-6);
  text-decoration: none;
  transition: background 200ms var(--ease-out);
}

.contribute-item-link:hover {
  background: color-mix(in srgb, var(--bg-surface) 50%, transparent);
}

.contribute-num {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: var(--weight-bold);
  letter-spacing: -0.04em;
  color: var(--border-default);
  line-height: 1;
  text-align: right;
  flex-shrink: 0;
  transition: color 180ms var(--ease-out);
}

.contribute-item-body {
  flex: 1;
  min-width: 0;
}

.contribute-item-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
  transition: color 180ms var(--ease-out);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  line-height: var(--leading-snug);
}

.contribute-item-desc {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-tertiary);
  margin: 0;
}

.contribute-item-arrow {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transform: translateX(0);
  transition: transform 220ms var(--ease-out), color 180ms var(--ease-out);
  opacity: 0.5;
}

.contribute-item-arrow svg {
  width: 100%;
  height: 100%;
}

/* ── Hover ───────────────────────────────────────── */
.contribute-item-link:hover .contribute-num {
  color: var(--accent);
}

.contribute-item-link:hover .contribute-item-title {
  color: var(--accent-text);
}

.contribute-item-link:hover .contribute-item-arrow {
  transform: translateX(5px);
  color: var(--accent-text);
  opacity: 1;
}

/* ── Donate item ─────────────────────────────────── */
.contribute-item--donate .contribute-item-link:hover .contribute-num {
  color: var(--warning);
}

.contribute-item--donate .contribute-item-link:hover .contribute-item-title,
.contribute-item--donate .contribute-item-link:hover .contribute-item-arrow {
  color: var(--warning);
}

.contribute-bmc-logo {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  border-radius: 50%;
}

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .hero-stats {
    gap: var(--space-12);
  }
  .presets-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preset-build-meta {
    grid-auto-flow: row;
    justify-content: start;
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .builder-preview-layout {
    grid-template-columns: 1.2fr 1fr;
  }
  .categories-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .presets-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .preset-build-row {
    padding: 1rem;
  }
  .contribute-inner {
    grid-template-columns: 1fr 1.6fr;
    gap: clamp(var(--space-12), 6vw, var(--space-20));
    align-items: start;
  }

  .contribute-header {
    position: sticky;
    top: calc(var(--header-height, 52px) + var(--space-8));
    max-width: none;
  }
}

@media (max-width: 767px) {
  .preset-build-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── Scroll reveal ────────────────────────────────────────── */
@keyframes reveal-fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* JS sets .reveal-ready to hide elements before they enter viewport */
.reveal-ready {
  opacity: 0;
}

.reveal-ready.is-revealed {
  animation: reveal-fade-up 620ms var(--ease-out) both;
}

/* Staggered children — e.g. category cards, preset list */
.reveal-stagger-ready > * {
  opacity: 0;
}

.reveal-stagger-ready.is-revealed > *:nth-child(1) { animation: reveal-fade-up 540ms var(--ease-out) 0ms   both; }
.reveal-stagger-ready.is-revealed > *:nth-child(2) { animation: reveal-fade-up 540ms var(--ease-out) 70ms  both; }
.reveal-stagger-ready.is-revealed > *:nth-child(3) { animation: reveal-fade-up 540ms var(--ease-out) 140ms both; }
.reveal-stagger-ready.is-revealed > *:nth-child(4) { animation: reveal-fade-up 540ms var(--ease-out) 210ms both; }
.reveal-stagger-ready.is-revealed > *:nth-child(5) { animation: reveal-fade-up 540ms var(--ease-out) 280ms both; }

/* ── Reduced motion — honour user preference ─────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-title,
  .hero-subtitle,
  .hero-actions,
  .hero-stats {
    animation: none;
  }

  .reveal-ready,
  .reveal-stagger-ready > * {
    opacity: 1;
  }

  .reveal-ready.is-revealed,
  .reveal-stagger-ready.is-revealed > * {
    animation: none;
  }
}
