/* =================== Page layout =================== */

.home {
  /* spacing + tokens */
  --gap: 22px;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);

  /* colors */
  --fg: #e8e8ea;
  --muted: #b6b6c0;
  --panel: #1b1d22;
  --panel-2: #1e2026;
  --accent: #7a48ff;

  color: var(--fg);
  background: transparent;
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px;
}

.home-top {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: var(--gap);
  align-items: stretch;
}


/* =================== Carousel =================== */

.carousel {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  height: 100%;
  min-height: 0;
  background: linear-gradient(135deg, #1c1d23, #15161a);
  box-shadow: var(--shadow);
}

.carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  width: 100%;
  height: 100%;
  transition: transform 500ms ease;
}

.slide {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  min-height: 100%;
}

.slide .text {
  padding: 22px 22px 22px 24px;

  display: flex;
  flex-direction: column;
  justify-content: center;

  background: radial-gradient(
    1000px 360px at left,
    #2a2235 0%,
    #1a1b20 60%,
    transparent 100%
  );

  white-space: pre-line;
}

.slide h3 {
  font-size: 26px;
  line-height: 1.15;
  margin: 0 0 8px;
}

.slide p {
  margin: 4px 0 14px;
  color: var(--muted);
  max-width: 48ch;
  font-size: 14px;
}


/* =================== Carousel CTA buttons =================== */

/*
 * All carousel buttons use identical dimensions.
 *
 * Read the FAQ
 * Browse Decks
 * Explore Content
 * Submit a Deck
 */
.slide .cta {
  align-self: flex-start;

  display: flex;
  justify-content: center;
  align-items: center;

  width: 125px;
  height: 36px;

  box-sizing: border-box;

  padding: 0 10px;
  margin: 0;

  border-radius: 0;
  border: 1px solid #ffffff22;

  background: linear-gradient(
    180deg,
    #2a2542,
    #1d1a2d
  );

  color: #fff;
  text-decoration: none;
  text-align: center;

  font-weight: 600;
  font-size: 13px;
  line-height: 1;

  /*
   * IMPORTANT:
   * .slide .text uses white-space: pre-line.
   *
   * Without this override, the CTA inherits that
   * behavior and preserves the line breaks/spacing
   * surrounding its text in the generated HTML.
   *
   * That makes the visible label look vertically
   * off-center even though flexbox is centered.
   */
  white-space: nowrap;
}


/* =================== Carousel images =================== */

.slide .image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* =================== Carousel controls =================== */

.carousel-ui {
  position: absolute;

  left: 10px;
  right: 10px;
  bottom: 8px;

  display: grid;
  grid-template-columns: 1fr;
  place-items: center;

  pointer-events: none;
}

.carousel-ui .nav {
  display: none;
}

.dots {
  display: flex;
  gap: 10px;
  pointer-events: all;
}

.dot {
  width: 25px;
  height: 10px;

  border-radius: 0;
  border: 1px solid #ffffff44;

  background: #ffffff1a;

  cursor: pointer;

  transition:
    background .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    transform .12s ease;
}

.dot:hover {
  transform: translateY(-1px);
}

.dot.active {
  background: var(--accent);
  border-color: var(--accent);

  box-shadow:
    0 0 12px rgba(122,72,255,.55);
}

.dot:focus-visible {
  outline: none;

  box-shadow:
    0 0 0 2px #000,
    0 0 0 4px var(--accent);
}


/* =================== Recent Decks =================== */

.recent {
  background: linear-gradient(
    180deg,
    var(--panel),
    var(--panel-2)
  );

  border-radius: var(--radius);
  box-shadow: var(--shadow);

  padding: 12px;
}

.recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 10px;
}

.recent h2 {
  font-size: 16px;
  margin: 0;
}

.recent-list {
  list-style: none;

  display: grid;
  gap: 8px;

  margin: 0;
  padding: 0;
}

.recent-item {
  position: relative;

  height: 72px;

  border-radius: 0;

  overflow: hidden;

  border: 1px solid #ffffff18;

  background: #0f1115;

  transition:
    transform .14s ease,
    box-shadow .14s ease;

  isolation: isolate;
}

.recent-item a {
  display: block;

  width: 100%;
  height: 100%;

  color: inherit;
  text-decoration: none;

  position: relative;
}

.recent-item .bg {
  position: absolute;
  inset: 0;

  background-size: cover;
  background-position: center;

  filter:
    saturate(1.05)
    brightness(0.9);
}

.recent-item .scrim {
  position: absolute;
  inset: 0;

  background: linear-gradient(
    90deg,
    rgba(6,8,12,0.92) 0%,
    rgba(6,8,12,0.60) 55%,
    rgba(6,8,12,0.18) 100%
  );
}

.recent-item .meta {
  position: relative;
  z-index: 1;

  padding: 9px 10px;

  display: grid;
  gap: 4px;

  align-content: center;
}

.recent-item .title {
  font-size: 14.5px;
  line-height: 1.1;
  font-weight: 800;

  text-shadow:
    0 1px 2px rgba(0,0,0,.5);
}


/* Hide author on homepage */

.recent-item .sub {
  display: none !important;
}


/* Format pill */

.recent-item .format {
  justify-self: start;

  padding: 3px 8px;

  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2px;

  border-radius: 999px;

  border: 1px solid #ffffff2a;

  background:
    rgba(20,22,28,0.65);

  backdrop-filter:
    saturate(1.2)
    blur(2px);

  -webkit-backdrop-filter:
    saturate(1.2)
    blur(2px);

  color: #e8e8ea;
}


/* =================== Recent Deck hover glow =================== */

.recent-item::after {
  content: "";

  position: absolute;
  inset: -3px;

  pointer-events: none;

  opacity: 0;

  transition:
    opacity .14s ease;

  z-index: 2;

  box-shadow:

    /* crisp purple frame */
    0 0 0 2px
      color-mix(
        in oklab,
        var(--accent) 85%,
        black
      ),

    /* inner glow */
    0 0 22px
      color-mix(
        in oklab,
        var(--accent) 55%,
        transparent
      ),

    /* outer glow */
    0 0 48px
      color-mix(
        in oklab,
        var(--accent) 30%,
        transparent
      );
}

.recent-item:hover::after,
.recent-item:focus-within::after {
  opacity: 1;
}

.recent-item:hover,
.recent-item:focus-within {
  transform:
    translateY(-2px);

  box-shadow:
    0 14px 34px rgba(0,0,0,.45),

    0 0 0 1px
      color-mix(
        in oklab,
        var(--accent) 45%,
        transparent
      );
}


/* =================== Twitch =================== */

.home-bottom {
  margin-top: var(--gap);

  display: grid;
  place-items: center;
}

.twitch {
  width: 100%;

  display: flex;
  justify-content: center;

  background: transparent;

  box-shadow: none;

  padding: 0;

  border-radius: 0;
}

.twitch-embed {
  position: relative;

  width: 100%;
  max-width: 900px;

  aspect-ratio: 16 / 9;

  max-height: 420px;

  background: #000;

  overflow: hidden;

  border-radius: 0;
}

.twitch-embed iframe {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  border: 0;
}


/* =================== Square corners =================== */

/* Carousel / slides */

.carousel,
.slide,
.slide .image img {
  border-radius: 0 !important;
}


/* Recent Decks panel + cards */

.recent,
.recent-item {
  border-radius: 0 !important;
}


/* Twitch player */

.twitch-embed,
.twitch-embed iframe {
  border-radius: 0 !important;
}


/* =================== Carousel dot positioning =================== */

/*
 * Center dots beneath the left/text
 * portion of the carousel.
 */

.carousel-ui {
  inset-inline-start: 0;
  inset-inline-end: auto;

  inline-size:
    calc(
      1.15 /
      (1.15 + 0.85) *
      100%
    );

  justify-items: center;
}


/* =================== Page background =================== */

body {
  background: #0f131a !important;
}


/* =================== Responsive =================== */

@media (max-width: 1200px) {

  .home {
    max-width: 1100px;
  }

  .home-top {
    grid-template-columns:
      1.6fr 1fr;
  }
}


@media (max-width: 1024px) {

  .home {
    max-width: 900px;
  }

  .home-top {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 640px) {

  .slide {
    grid-template-columns: 1fr;
  }

  .recent-item {
    height: 60px;
  }

  .slide h3 {
    font-size: 22px;
  }

  .slide p {
    font-size: 13.5px;
  }


  /* Keep CTA size consistent on mobile */

  .slide .cta {
    width: 125px;
    height: 36px;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 0 10px;

    line-height: 1;

    /* Override inherited pre-line behavior */
    white-space: nowrap;
  }


  .twitch-embed {
    width: 100%;
  }


  /*
   * On phones, dots use the full
   * carousel width.
   */

  .carousel-ui {
    inset-inline: 10px;
    inline-size: auto;
  }
}