/* =========================================================
   Pioneer Python — Home + Arcade styles: hero, generic buttons,
   card grid, nav cards (Home), and game cards (Arcade).
   Loaded ONLY on index.html and python-arcade.html (linked there
   directly, after styles.css). All colors come from the shared theme
   tokens so these pages follow light/dark mode automatically.
   ========================================================= */

.page--home { gap: clamp(2rem, 5vw, 3.5rem); }

/* Generic buttons (introduced for the hero CTAs). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  transition: filter 150ms var(--ease),
              background-color 150ms var(--ease),
              border-color 150ms var(--ease),
              transform 200ms var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.btn--primary { background: var(--color-accent); color: var(--color-surface); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-border);
}
.btn--ghost:hover { background: var(--color-accent-soft); border-color: var(--color-accent); }

/* Hero ----------------------------------------------------- */
.home-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 5vw, 4rem);
  box-shadow: var(--shadow-sm);
}

/* Decorative backdrop: a faint dot-grid plus a soft brand glow that
   slowly drifts. Sits behind the content and ignores pointer events. */
.home-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, var(--hero-dot) 1px, transparent 0);
  background-size: 22px 22px;
  opacity: 0.6;
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 30% 30%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 80% at 30% 30%, #000 30%, transparent 75%);
}
.home-hero__bg::after {
  content: "";
  position: absolute;
  width: 50%;
  height: 140%;
  top: -20%;
  right: -10%;
  background: radial-gradient(circle, var(--color-accent-soft), transparent 70%);
  animation: hero-glow 14s ease-in-out infinite alternate;
}

@keyframes hero-glow {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-8%, 6%) scale(1.15); }
}

.home-hero__logo,
.home-hero__text { position: relative; z-index: 1; }
/* Let the text column shrink/wrap rather than overflow in the narrow
   two-column hero zone just above the 720px stack breakpoint. */
.home-hero__text { min-width: 0; }

.home-hero__logo-svg {
  width: clamp(96px, 12vw, 168px);
  height: auto;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.18));
  animation: hero-float 6s ease-in-out infinite;
}

@keyframes hero-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(-2deg); }
}

.home-hero__eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}

.home-hero__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 4.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4em;
}
.home-hero__prompt { color: var(--color-accent); }
.home-hero__typed { color: var(--color-ink); }

/* Blinking block cursor that trails the typed title. */
.home-hero__cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  margin-left: 0.05em;
  transform: translateY(0.12em);
  background: var(--color-accent);
  animation: hero-blink 1.05s step-end infinite;
}

@keyframes hero-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.home-hero__tagline {
  margin: 1rem 0 1.75rem;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--color-ink-muted);
  max-width: 52ch;
}

.home-hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Explore section ----------------------------------------- */
.home-explore__heading {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  margin: 0 0 1.25rem;
}

.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  /* Flexible by default: cards auto-flow and wrap, so any number of items
     fills the rows cleanly (used by the Arcade, room to grow). */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Home page pins its column count so the layout stays balanced rather than
   leaving an orphan on a half-empty row. Six cards -> two clean rows of three.
   This number must track the number of VISIBLE cards in index.html: it was
   repeat(3, 1fr) for six cards (3 x 2), went to four when Attendance, APRC,
   and AWPC were commented out, to five when Binary was added, and back to
   three (3 x 2) when TCC made six. Restore a card, bump this to match. */
.page--home .card-grid { grid-template-columns: repeat(3, 1fr); }

/* Staggered entrance; disabled under reduced-motion below. */
.card-grid__item {
  opacity: 0;
  transform: translateY(16px);
  animation: card-rise 500ms var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 70ms + 150ms);
}

@keyframes card-rise {
  to { opacity: 1; transform: translateY(0); }
}

.nav-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: clamp(1.25rem, 2.5vw, 1.6rem);
  box-shadow: var(--shadow-sm);
  color: var(--color-ink);
  text-decoration: none;
  transition: transform 200ms var(--ease),
              box-shadow 200ms var(--ease),
              border-color 200ms var(--ease);
}
.nav-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}
.nav-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.nav-card__icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  margin-bottom: 0.25rem;
}
.nav-card__icon svg { width: 24px; height: 24px; }

.nav-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-ink);
}
.nav-card__desc {
  font-size: 0.92rem;
  color: var(--color-ink-muted);
  flex: 1;
}
.nav-card__go {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-top: 0.4rem;
  transition: transform 200ms var(--ease);
}
.nav-card:hover .nav-card__go { transform: translateX(3px); }

/* Game cards (Arcade) — screenshot-thumbnail variant ------- */
.game-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  color: var(--color-ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms var(--ease),
              box-shadow 200ms var(--ease),
              border-color 200ms var(--ease);
}
.game-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}
.game-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Thumbnail: a branded placeholder (gradient + game label) sits underneath;
   a real screenshot, when present, covers it via object-fit. Fixed aspect
   ratio reserves space so there's no layout shift while images load. */
.game-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--color-brand-blue), var(--color-accent));
  overflow: hidden;
}
.game-card__thumb-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  z-index: 0;
}
.game-card__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.game-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  flex: 1;
  padding: clamp(1rem, 2vw, 1.25rem);
}
.game-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-ink);
}
.game-card__desc {
  font-size: 0.92rem;
  color: var(--color-ink-muted);
  flex: 1;
}
.game-card__go {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-top: 0.4rem;
  transition: transform 200ms var(--ease);
}
.game-card:hover .game-card__go { transform: translateX(3px); }

/* Laptops: three across, the same as wide screens now that there are six
   cards. Kept as its own rule so a future change to the wide-screen count
   (say, five across) still falls back to three here. */
@media (min-width: 1025px) and (max-width: 1400px) {
  .page--home .card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Tablets: home grid drops to 2 columns (3 x 2 -> 2 x 3). */
@media (max-width: 1024px) {
  .page--home .card-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Narrow screens: stack the logo above the hero text, home cards single-column. */
@media (max-width: 720px) {
  .home-hero {
    grid-template-columns: 1fr;
    justify-items: start;
    text-align: left;
  }
  .page--home .card-grid { grid-template-columns: 1fr; }
}

/* Respect reduced-motion: drop all home-page motion, show end states. */
@media (prefers-reduced-motion: reduce) {
  .home-hero__logo-svg,
  .home-hero__bg::after,
  .home-hero__cursor { animation: none; }
  .card-grid__item {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
