/*
 * Landing page (WP03; FR-007): src/app/landing.js. Tokens and primitives only
 * (WP02); every shape is CSS on empty elements (no images, no external files).
 *
 *   .landing            the page: hero, alert line, 'back to the game' row,
 *                       the start actions, 'How it works'
 *   .landing__hero      centred name (display size), tagline and a stack of
 *                       three pawns, on a soft accent glow
 *   .landing__actions   the six start actions: three columns from 1100 px,
 *                       two from 600 px, one on phones (icon beside the text)
 *   .landing-card       a big button on the raised surface with a 3:1 outline;
 *                       the sample game is .button--primary (filled accent),
 *                       the only one on the screen
 *   .landing-icon       48 px tile; --sample a play triangle, --paste lines
 *                       of text, --setup a small board with a pawn, --saved
 *                       two stacked cards, --play two pawns facing each
 *                       other (play vs computer, computer-opponent WP09)
 *   .landing-entry      the way in for newcomers (an anchor to #demo): a wide
 *                       outlined button with an accent border and tint, above
 *                       the cards; secondary to the primary sample action
 *   .landing__steps     a .panel with three numbered steps
 */

.landing {
  display: grid;
  gap: var(--space-6);
  padding-bottom: var(--space-2);
}

/* ---- hero ---------------------------------------------------------------- */

.landing__hero {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-4) var(--space-2);
  border-radius: var(--radius-lg);
  background: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent);
  text-align: center;
}

.landing__title {
  font-size: var(--text-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

/* What the product is (BRAND.subtitle, FR-002): quiet, secondary text right
   under the name, smaller than the tagline. */
.landing__subtitle {
  max-width: 40rem;
  color: var(--color-text-muted);
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-snug);
}

.landing__tagline {
  max-width: 40rem;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  line-height: var(--line-height-snug);
}

/* A stack of three pawns, seen from the side. */
.landing__art {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: calc(var(--space-7) * 2);
  margin-bottom: var(--space-2);
}

.landing__art-pawn {
  display: block;
  height: var(--space-4);
  border: 2px solid;
  border-radius: var(--radius-round);
  box-shadow: var(--shadow-raised);
}

.landing__art-pawn--1 {
  width: calc(100% - var(--space-5));
  background: var(--accent);
  border-color: var(--accent);
}

.landing__art-pawn--2 {
  width: calc(100% - var(--space-3));
  background: var(--pawn-white-fill);
  border-color: var(--pawn-white-stroke);
}

.landing__art-pawn--3 {
  width: 100%;
  background: var(--pawn-black-fill);
  border-color: var(--pawn-black-stroke);
}

/* ---- message and the open game ------------------------------------------- */

.landing__message {
  color: var(--color-danger);
  text-align: center;
}

.landing__message:empty {
  display: none;
}

.landing__resume {
  justify-content: center;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-info-surface);
}

/* ---- the way in for newcomers --------------------------------------------- */

.landing__entry {
  display: flex;
  justify-content: center;
}

/* An anchor that looks like a button (the shared .button class gives the
   padding, radius and focus behaviour): a 2 px accent outline on a soft accent
   tint, so it is clearly a control and clearly the beginner path, without the
   filled accent that belongs to 'Try a sample game'. */
.landing-entry {
  /* 44 px is the minimum touch target (tokens.css --touch-target). */
  min-height: 44px;
  width: min(100%, 40rem);
  justify-content: flex-start;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-raised));
  color: var(--color-text);
  text-align: start;
  text-decoration: none;
}

.landing-entry:hover {
  border-color: var(--accent-hover);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-raised));
}

.landing-entry__text {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.landing-entry__title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}

.landing-entry__description {
  color: var(--color-text-muted);
  font-size: var(--text-caption);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-snug);
}

/* Demo icon: two pawns stacked, seen from the side. */
.landing-icon--demo .landing-icon__part {
  width: var(--space-5);
  height: var(--space-2);
  border-radius: var(--radius-round);
  background: var(--icon-ink);
}

.landing-icon--demo .landing-icon__part--1 {
  width: var(--space-4);
}

/* ---- the start actions ------------------------------------------------------ */

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

.landing__action {
  display: flex;
  min-width: 0;
}

.landing-card {
  display: grid;
  align-content: start;
  justify-content: stretch;
  justify-items: start;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-5);
  border-color: var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-raised);
  font-weight: var(--font-weight-regular);
  text-align: start;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.landing-card:hover {
  box-shadow: var(--shadow-overlay);
  transform: translateY(calc(var(--space-1) / -2));
}

.landing-card:active {
  box-shadow: var(--shadow-raised);
  transform: none;
}

/* The sample game: the one primary action (the card rules above would
   otherwise replace the primary fill). */
.landing-card.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.landing-card.button--primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.landing-card.button--primary:active {
  border-color: var(--accent-pressed);
  background: var(--accent-pressed);
}

.landing-card__text {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.landing-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}

.landing-card__description {
  color: var(--color-text-muted);
  font-size: var(--text-caption);
  line-height: var(--line-height-snug);
}

.landing-card.button--primary .landing-card__description {
  color: var(--accent-contrast);
}

/* ---- icons ----------------------------------------------------------------- */

.landing-icon {
  --icon-ink: var(--accent);
  position: relative;
  display: grid;
  place-content: center;
  gap: var(--space-1);
  flex: none;
  width: var(--space-7);
  height: var(--space-7);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-raised));
}

.button--primary .landing-icon {
  --icon-ink: var(--accent-contrast);
  background: color-mix(in srgb, var(--accent-contrast) 22%, transparent);
}

.landing-icon__part {
  display: block;
}

/* Play: a triangle pointing right. */
.landing-icon--sample .landing-icon__part--1 {
  width: var(--space-4);
  height: calc(var(--space-4) + var(--space-1));
  margin-left: var(--space-1);
  background: var(--icon-ink);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Paste: three lines of text. */
.landing-icon--paste .landing-icon__part {
  width: var(--space-5);
  height: var(--space-1);
  border-radius: var(--radius-round);
  background: var(--icon-ink);
}

.landing-icon--paste .landing-icon__part--3 {
  width: var(--space-4);
}

/* Setup: a small board of three by three squares with a pawn. */
.landing-icon--setup .landing-icon__part--1 {
  position: relative;
  width: var(--space-5);
  height: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: repeating-conic-gradient(var(--board-square-dark) 0 25%, var(--board-square-light) 0 50%) 0 0 / 66.667% 66.667%;
}

.landing-icon--setup .landing-icon__part--1::after {
  content: "";
  position: absolute;
  inset: 25%;
  border: 2px solid var(--pawn-black-stroke);
  border-radius: var(--radius-round);
  background: var(--pawn-black-fill);
}

/* Saved: two stacked cards. */
.landing-icon--saved .landing-icon__part {
  position: absolute;
  width: var(--space-5);
  height: var(--space-4);
  border: 2px solid var(--icon-ink);
  border-radius: var(--radius-sm);
}

.landing-icon--saved .landing-icon__part--1 {
  top: calc(var(--space-3) - var(--space-1));
  left: var(--space-3);
}

.landing-icon--saved .landing-icon__part--2 {
  top: var(--space-4);
  left: calc(var(--space-3) - var(--space-1));
  background: var(--icon-ink);
}

/* Play vs computer: two pawns facing each other, one solid, one outlined. */
.landing-icon--play .landing-icon__part {
  position: absolute;
  top: calc(var(--space-3) + var(--space-1));
  width: var(--space-4);
  height: var(--space-4);
  border: 2px solid var(--icon-ink);
  border-radius: var(--radius-round);
}

.landing-icon--play .landing-icon__part--1 {
  left: var(--space-2);
  background: var(--icon-ink);
}

.landing-icon--play .landing-icon__part--2 {
  right: var(--space-2);
}

/* Puzzles: a small board with one highlighted square. */
.landing-icon--puzzles .landing-icon__part {
  position: absolute;
  width: var(--space-4);
  height: var(--space-4);
  border: 2px solid var(--icon-ink);
  border-radius: var(--radius-sm);
}

.landing-icon--puzzles .landing-icon__part--1 {
  top: calc(var(--space-3) - var(--space-1));
  left: calc(var(--space-3) - var(--space-1));
}

.landing-icon--puzzles .landing-icon__part--2 {
  right: calc(var(--space-3) - var(--space-1));
  bottom: calc(var(--space-3) - var(--space-1));
  background: var(--icon-ink);
}

/* ---- how it works -------------------------------------------------------------- */

.landing__steps {
  gap: var(--space-4);
  padding: var(--space-5);
}

.landing__step-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-1) var(--space-3);
}

.landing-step__number {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: var(--space-6);
  height: var(--space-6);
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-panel));
  color: var(--accent);
  font-weight: var(--font-weight-bold);
}

.landing-step__title {
  font-size: var(--text-panel-title);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}

/* ---- narrower screens ------------------------------------------------------------ */

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

@media (max-width: 719.98px) {
  .landing {
    gap: var(--space-5);
  }

  .landing__hero {
    padding: var(--space-5) var(--space-2) 0;
  }

  .landing__title {
    font-size: var(--text-2xl);
  }

  .landing__subtitle {
    font-size: var(--text-sm);
  }

  .landing__tagline {
    font-size: var(--text-md);
  }

  .landing__step-list {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .landing__steps {
    padding: var(--space-4);
  }
}

@media (max-width: 599.98px) {
  .landing__actions {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
  }

  .landing-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-card:hover {
    transform: none;
  }
}
