/* ===========================
   AI Resource Hub — Homepage
   Loaded only by index.html, after css/style.css
   =========================== */

.home > section {
  padding: 0;
}

.home-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Hero ---------- */

.home > .home-hero {
  padding: 72px 0 28px;
}

.home-hero-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 24px 48px;
  align-items: end;
  margin-bottom: 36px;
}

.home-hero h1 {
  font-size: clamp(2.3rem, 5.4vw, 4.7rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: balance;
}

.home-hero-side p {
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  margin: 0 0 22px;
  max-width: 46ch;
}

.home-hero-side .hero-actions {
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .home > .home-hero { padding-top: 40px; }
  .home-hero-head { grid-template-columns: 1fr; }
}

/* ---------- Spotlight rail (the hero media) ---------- */

.rail {
  position: relative;
}

.rail-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(270px, 23.5%);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 24px;
  padding: 0 24px 6px;
  margin: 0 -24px;
  scrollbar-width: none;
}

.rail-track::-webkit-scrollbar { display: none; }

@media (max-width: 900px) {
  .rail-track { grid-auto-columns: 74%; }
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  overflow: hidden;
  background: var(--color-surface-2);
  color: #fff;
  scroll-snap-align: start;
  isolation: isolate;
}

.tile:hover { color: #fff; }

.tile-media,
.tile-media img,
.tile-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-media { z-index: -1; }

.tile-media img,
.tile-media video {
  transition: transform 0.6s cubic-bezier(.2,.7,.2,1);
}

.tile:hover .tile-media img,
.tile:hover .tile-media video {
  transform: scale(1.04);
}

/* Readability scrim on the bottom of every media tile */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,0.78) 100%);
}

.tile-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px;
}

.tile-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.tile-desc {
  font-size: 0.95rem;
  line-height: 1.4;
  color: rgba(255,255,255,0.78);
  margin: 0;
  max-width: 40ch;
}

/* The input → output recipe printed big on each studio tile */
.tile-recipe {
  position: absolute;
  top: 20px;
  left: 22px;
  right: 22px;
  font-size: 0.86rem;
  font-weight: 600;
  color: rgba(255,255,255,0.86);
}

.htag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--color-gold);
  color: #121214;
  vertical-align: middle;
}

.htag.is-top {
  background: rgba(0,0,0,0.35);
  color: var(--color-gold);
  box-shadow: inset 0 0 0 1px currentColor;
}

.htag.is-free {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

.tile-play {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  font-size: 0.75rem;
}

.rail-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.rail-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 1rem;
  cursor: pointer;
}

.rail-btn:hover { border-color: var(--color-text-muted); }
.rail-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- Quick links ---------- */

.quick {
  display: flex;
  margin-top: 18px !important;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.quick a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 10px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.92rem;
}

.quick a:hover { border-color: var(--color-text-muted); color: var(--color-text); }

.quick img {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
}

.quick small {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.85rem;
}

/* ---------- Section heads ---------- */

.home > .home-block {
  padding: 88px 0 0;
}

.block-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.block-head h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
  margin: 0;
}

.block-head p {
  color: var(--color-text-muted);
  margin: 8px 0 0;
  max-width: 56ch;
}

.block-link {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--color-text);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
}

.block-link:hover { color: var(--color-text); border-color: var(--color-text-muted); }

/* ---------- Studio grid ---------- */

.studios {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1100px) { .studios { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px)  { .studios { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .studios { grid-template-columns: 1fr; } }

.studio {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.studio:hover { color: var(--color-text); border-color: var(--color-text-muted); }

.studio-art {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.studio-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(.2,.7,.2,1);
}

.studio:hover .studio-art img { transform: scale(1.05); }

.studio-art .htag {
  position: absolute;
  top: 12px;
  left: 12px;
}

.studio-art span.studio-glyph {
  position: absolute;
  right: 14px;
  bottom: 8px;
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 62%;
  font-size: 3.4rem;
  line-height: 1;
  color: rgba(255,255,255,0.9);
  mix-blend-mode: overlay;
}

.studio-body {
  padding: 16px 18px 18px;
}

.studio-body h3 {
  font-size: 1.15rem;
  font-weight: 750;
  margin: 0 0 6px;
}

.studio-body p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
}

.studio-where {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ---------- Community strip ---------- */

.community {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 18%);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.community::-webkit-scrollbar { display: none; }

@media (max-width: 700px) { .community { grid-auto-columns: 58%; } }

.community .tile {
  aspect-ratio: 9 / 16;
  border-radius: 18px;
}

.community .tile-title {
  font-size: 1.15rem;
  font-stretch: 85%;
  font-weight: 750;
}

.community-empty {
  border: 1px dashed var(--color-border);
  border-radius: 18px;
  padding: 32px;
  color: var(--color-text-muted);
  text-align: center;
}

/* ---------- Guides list ---------- */

.learn-list {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 40px;
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.learn-list li { border-bottom: 1px solid var(--color-border); }

.learn-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 4px;
  color: var(--color-text);
}

.learn-list a:hover { color: var(--color-text); }

.learn-list strong {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 700;
  font-stretch: 85%;
  letter-spacing: -0.015em;
}

.learn-list span {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.learn-list a:hover strong { color: var(--color-accent); }

/* ---------- Closing banner ---------- */

.home-banner {
  position: relative;
  margin-top: 72px;
  border-radius: 26px;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(32px, 6vw, 72px);
  color: #fff;
}

.home-banner > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.home-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.2) 75%);
}

.home-banner h2 {
  font-size: clamp(1.8rem, 3.8vw, 3.1rem);
  font-weight: 700;
  line-height: 1;
  margin: 0 0 14px;
  max-width: 14ch;
}

.home-banner p {
  margin: 0 0 24px;
  max-width: 44ch;
  color: rgba(255,255,255,0.82);
}

.home .ad-slot { margin-top: 56px; max-width: 1440px; }

/* ---------- Load-in: the one orchestrated moment ---------- */

@media (prefers-reduced-motion: no-preference) {
  .home-hero h1,
  .home-hero-side,
  .rail-track > .tile {
    animation: home-rise 0.7s cubic-bezier(.2,.7,.2,1) both;
  }
  .home-hero-side { animation-delay: 0.08s; }
  .rail-track > .tile:nth-child(1) { animation-delay: 0.14s; }
  .rail-track > .tile:nth-child(2) { animation-delay: 0.2s; }
  .rail-track > .tile:nth-child(3) { animation-delay: 0.26s; }
  .rail-track > .tile:nth-child(n+4) { animation-delay: 0.32s; }
}

@keyframes home-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.tile-media img { transition: transform 0.6s cubic-bezier(.2,.7,.2,1), opacity 0.3s ease; }

@media (min-width: 900px) { .learn-list { grid-template-columns: 1fr 1fr; } }

/* Bright thumbnails: keep the top caption readable on white backgrounds */
.tile-recipe { z-index: 1; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.55), 0 2px 12px rgba(0,0,0,.45); }
.tile-media::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 34%; background: linear-gradient(to bottom, rgba(0,0,0,.5), rgba(0,0,0,0)); pointer-events: none; }
.studio-art .htag.is-top, .studio-art .htag.is-free, .tile .htag.is-top { background: rgba(10,10,14,.72); color: #fff; border-color: transparent; backdrop-filter: blur(4px); }
