/* ABOUTME: Home page styles: hero with fanned covers and a faint puzzle grid, feature, cover marquee and tutorial tiles. */
/* ABOUTME: Also the Speedoku band with its animated mini grid, range cards, news cards and the About strip. */

/* Hero */

.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 70% at 75% 40%, #6b2c65 0%, transparent 60%), linear-gradient(160deg, var(--plum) 0%, var(--plum-900) 100%);
  color: var(--white);
  padding-block: clamp(1.5rem, 0.5rem + 3vw, 3.5rem) clamp(3rem, 1.5rem + 5vw, 5.5rem);
}

.hero__grid {
  position: absolute;
  top: 50%;
  right: -4%;
  width: min(820px, 90vw);
  aspect-ratio: 1;
  translate: 0 -50%;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 1.5px solid rgb(255 255 255 / 0.1);
  mask-image: radial-gradient(circle at 55% 50%, #000 20%, transparent 72%);
  pointer-events: none;
}

.hero__grid span {
  display: grid;
  place-items: center;
  border-right: 1px solid rgb(255 255 255 / 0.06);
  border-bottom: 1px solid rgb(255 255 255 / 0.06);
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.5rem + 1.6vw, 2rem);
  color: rgb(246 240 237 / 0.2);
  transition: color 1.6s ease, opacity 1.6s ease;
}

.hero__grid span:nth-child(3n) {
  border-right-color: rgb(255 255 255 / 0.12);
}

.hero__grid span:nth-child(n + 19):nth-child(-n + 27),
.hero__grid span:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-color: rgb(255 255 255 / 0.12);
}

.hero__grid span.is-lit {
  color: rgb(218 183 175 / 0.55);
}

.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}

.hero__title {
  font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  font-variation-settings: "SOFT" 50, "opsz" 144;
}

.hero__title em {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--rose-300);
}

.hero__lead {
  max-width: 48ch;
  font-size: var(--step-1);
  line-height: 1.6;
  color: rgb(255 255 255 / 0.82);
  margin-bottom: 2.25rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

@media (prefers-reduced-motion: no-preference) {
  .hero__fade {
    animation: rise 0.9s var(--ease) both;
    animation-delay: calc(var(--d) * 110ms + 100ms);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* Fanned covers */

.hero__fan {
  position: relative;
  height: clamp(300px, 18rem + 7vw, 440px);
}

.hero__cover {
  --spread: clamp(52px, 5vw, 78px);
  --angle: calc(var(--o) * 7deg);
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: clamp(130px, 9rem + 5vw, 230px);
  margin-left: calc(clamp(130px, 9rem + 5vw, 230px) / -2);
  transform-origin: 50% 120%;
  transform: translateX(calc(var(--o) * var(--spread))) rotate(var(--angle)) translateY(calc(var(--a) * 10px));
  z-index: calc(10 - var(--a));
  transition: transform 0.6s var(--ease);
}

.hero__cover img {
  width: 100%;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.2), 0 24px 40px -12px rgb(0 0 0 / 0.55);
}

@media (prefers-reduced-motion: no-preference) {
  .hero__cover {
    animation: deal 1.1s var(--ease) both;
    animation-delay: calc(var(--i) * 90ms + 250ms);
  }

  @keyframes deal {
    from {
      opacity: 0;
      transform: translateY(60px) rotate(0deg);
    }
  }

  .hero__fan:hover .hero__cover {
    --spread: clamp(60px, 6vw, 92px);
  }

  .hero__cover:hover {
    transform: translateX(calc(var(--o) * var(--spread))) rotate(var(--angle)) translateY(-18px);
  }
}

@media (max-width: 860px) {
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Tall enough for the covers (3:2) plus the lift of the outer ones, with no empty band above. */
  .hero__fan {
    height: calc(clamp(96px, 25vw, 170px) * 1.5 + 2.5rem);
    order: -1;
    margin-bottom: 0.5rem;
  }

  .hero {
    padding-top: 1rem;
  }

  .hero__cover {
    --spread: 12vw;
    bottom: 1.5rem;
    width: clamp(96px, 25vw, 170px);
    margin-left: calc(clamp(96px, 25vw, 170px) / -2);
  }

  .hero__fan:hover .hero__cover {
    --spread: 13vw;
  }

  .hero__grid {
    top: 28%;
    right: 50%;
    translate: 50% -50%;
  }
}

/* Feature: Properly Killer Sudoku */

.feature__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 1rem + 5vw, 6rem);
  align-items: center;
}

.feature__media {
  position: relative;
}

.feature__media img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.feature__badge {
  position: absolute;
  top: -14px;
  left: -14px;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25rem;
  box-shadow: var(--shadow-md);
  rotate: -12deg;
}

.feature h2 {
  color: var(--plum);
}

.feature__points {
  margin: 1.5rem 0 2rem;
  padding: 0;
  list-style: none;
}

.feature__points li {
  position: relative;
  padding: 0.65rem 0 0.65rem 2.1rem;
  border-top: 1px solid var(--line);
}

.feature__points li:last-child {
  border-bottom: 1px solid var(--line);
}

.feature__points li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 1rem;
  width: 1.1rem;
  height: 1.1rem;
  border: 1.5px dashed var(--rose);
  border-radius: 3px;
}

.feature__points strong {
  color: var(--plum);
}

.feature__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .feature__inner {
    grid-template-columns: 1fr;
  }
}

/* Cover marquee */

.shelf {
  padding-block: clamp(3.5rem, 2.5rem + 4vw, 6rem);
  background: var(--cream);
  overflow: hidden;
}

.marquee {
  display: flex;
  width: max-content;
  padding-block: 1rem 1.5rem;
}

.marquee__track {
  display: flex;
  gap: clamp(1rem, 0.5rem + 1.5vw, 2rem);
  margin: 0;
  padding: 0 clamp(0.5rem, 0.25rem + 0.75vw, 1rem);
  list-style: none;
}

.marquee__book {
  display: block;
  width: clamp(120px, 10vw + 40px, 180px);
  transition: transform 0.4s var(--ease);
}

.marquee__book img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow-book);
}

.marquee__book:hover {
  transform: translateY(-6px) scale(1.03);
}

@media (prefers-reduced-motion: no-preference) {
  .marquee {
    animation: marquee 70s linear infinite;
  }

  .marquee:hover,
  .marquee:focus-within {
    animation-play-state: paused;
  }

  @keyframes marquee {
    to {
      transform: translateX(-50%);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .shelf .marquee {
    width: auto;
    overflow-x: auto;
  }

  .marquee__track[aria-hidden="true"] {
    display: none;
  }
}

/* Tutorial tiles */

.learn__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.learn-tile {
  display: grid;
  gap: 0.35rem;
  height: 100%;
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}

.learn-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
  color: var(--ink);
}

.learn-tile__icon {
  color: var(--plum);
  margin-bottom: 0.75rem;
  transition: transform 0.5s var(--ease);
}

.learn-tile:hover .learn-tile__icon {
  transform: rotate(-4deg) scale(1.06);
}

.learn-tile__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--plum);
}

.learn-tile__blurb {
  font-size: 0.93rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

@media (max-width: 960px) {
  .learn__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .learn-tile {
    padding: 1.1rem;
  }
}

/* Speedoku band */

.speedoku-band {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-700) 100%);
  color: var(--white);
  padding-block: clamp(3.5rem, 2.5rem + 5vw, 6.5rem);
}

.speedoku-band::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.12) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
  mask-image: linear-gradient(90deg, transparent 30%, #000);
}

.speedoku-band__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 1rem + 5vw, 6rem);
  align-items: center;
}

.speedoku-band h2 {
  color: var(--white);
}

.speedoku-band p {
  max-width: 52ch;
  color: rgb(255 255 255 / 0.86);
  margin-bottom: 2rem;
}

.speedoku-band .button--light {
  color: var(--blue-700);
}

.mini-speedoku {
  --cell: clamp(64px, 6vw + 30px, 92px);
  --gap: clamp(22px, 2vw + 8px, 34px);
  position: relative;
  padding: 1.5rem;
  background: var(--white);
  border-radius: 22px;
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.45);
  rotate: -3deg;
}

.mini-speedoku__grid {
  display: grid;
  grid-template-columns: repeat(3, var(--cell));
  gap: var(--gap);
}

.mini-speedoku__cell {
  display: grid;
  place-items: center;
  height: var(--cell);
  border-radius: 12px;
  background: var(--cream);
  color: var(--plum);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: calc(var(--cell) * 0.46);
}

.mini-speedoku__clue {
  position: absolute;
  left: calc(1.5rem + var(--c) * (var(--cell) + var(--gap)) + var(--cell) / 2);
  top: calc(1.5rem + var(--r) * (var(--cell) + var(--gap)) + var(--cell) / 2);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  color: var(--white);
  font-weight: 700;
  font-size: 0.85rem;
  isolation: isolate;
}

.mini-speedoku__clue::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--plum);
  border-radius: 6px;
  rotate: 45deg;
}

.mini-speedoku__timer {
  position: absolute;
  top: -16px;
  right: -16px;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--rose);
  color: var(--white);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-md);
  rotate: 3deg;
}

@media (prefers-reduced-motion: no-preference) {
  .js .mini-speedoku .mini-speedoku__cell {
    color: transparent;
    transition: color 0.3s ease, background-color 0.3s ease;
    transition-delay: calc(var(--n) * 160ms + 400ms);
  }

  .js .mini-speedoku.is-visible .mini-speedoku__cell {
    color: var(--plum);
  }
}

@media (max-width: 760px) {
  .speedoku-band__inner {
    grid-template-columns: 1fr;
  }

  .mini-speedoku {
    justify-self: center;
    --cell: clamp(52px, 15vw, 72px);
    --gap: clamp(18px, 5vw, 26px);
  }
}

/* Range cards: Kobo and Puzzle Express */

.ranges__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.range-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: 320px;
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  border-radius: calc(var(--radius) * 1.4);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.range-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.range-card--kobo {
  background: var(--sand-200);
}

.range-card--express {
  background: var(--rose-100);
}

.range-card h3 {
  color: var(--plum);
}

.range-card p:not(.eyebrow) {
  font-size: 0.97rem;
  color: var(--ink-soft);
}

.range-card__image {
  width: 100%;
  max-width: 260px;
  justify-self: end;
  filter: drop-shadow(0 20px 24px rgb(38 23 37 / 0.25));
  transition: transform 0.6s var(--ease);
}

.range-card:hover .range-card__image {
  transform: rotate(-3deg) scale(1.03);
}

.range-card__stack {
  position: relative;
  height: 220px;
}

.range-card__stack img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  translate: calc(-50% + (var(--i) - 1) * 46px) -50%;
  rotate: calc((var(--i) - 1) * 8deg);
  border-radius: 3px;
  box-shadow: var(--shadow-book);
  transition: rotate 0.5s var(--ease), translate 0.5s var(--ease);
}

.range-card__stack img:nth-child(2) {
  z-index: 1;
}

.range-card:hover .range-card__stack img {
  translate: calc(-50% + (var(--i) - 1) * 58px) -50%;
  rotate: calc((var(--i) - 1) * 12deg);
}

@media (max-width: 960px) {
  .ranges__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .range-card {
    grid-template-columns: 1fr;
  }

  .range-card__image {
    justify-self: center;
    max-width: 200px;
  }
}

/* News cards */

.news {
  background: var(--paper);
  padding-top: 0;
}

.news__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--line);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.news-card__image {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--cream);
}

.news-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.news-card:hover .news-card__image img {
  transform: scale(1.04);
}

.news-card__body {
  display: grid;
  gap: 0.45rem;
  padding: 1.25rem 1.4rem 1.5rem;
}

.news-card time {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--plum-600);
}

.news-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.25;
  color: var(--plum);
}

.news-card__summary {
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 960px) {
  .news__grid {
    grid-template-columns: 1fr;
    max-width: 560px;
  }
}

/* About strip */

.about-strip {
  background: var(--cream);
  padding-block: clamp(3rem, 2rem + 4vw, 5rem);
}

.about-strip__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
  align-items: center;
  max-width: 880px;
}

.about-strip h2 {
  font-size: var(--step-2);
  color: var(--plum);
}

.about-strip p {
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  .about-strip__inner {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .about-strip img {
    width: 52px;
  }
}
