/* =========================================================
   FocusLa – home page only
   The notebook look: a dotted page, a highlighter, a sticky
   note for the join code, and a colour for every game.
   Each card gets its game's colour from games.json ("color"),
   passed in as the --game CSS variable.
   ========================================================= */

:root {
  --font-hand: "Caveat", "Segoe Print", "Comic Sans MS", cursive;
  --dots: rgba(255, 255, 255, 0.05);
  --note: #fde68a;
  --note-text: #3b2f05;
  --highlight: rgba(123, 224, 176, 0.32);
}

:root[data-theme="light"] {
  --dots: rgba(0, 0, 0, 0.07);
  --highlight: rgba(123, 224, 176, 0.55);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --dots: rgba(0, 0, 0, 0.07);
    --highlight: rgba(123, 224, 176, 0.55);
  }
}

/* A dotted notebook page behind everything */
body.home {
  background-image: radial-gradient(var(--dots) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  background-attachment: fixed;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */

.home .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 30px;
  height: 30px;
  transform: rotate(-8deg);
}

.home .site-header .theme-toggle {
  margin-left: auto;
}

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

.home .hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: center;
  gap: 40px;
  margin: 44px 0 40px;
}

.hero-kicker {
  margin: 0 0 10px;
  font-family: var(--font-hand);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  transform: rotate(-2deg);
  transform-origin: left;
}

.home .hero h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5.6vw, 56px);
  line-height: 1.05;
}

/* A highlighter swipe behind the second line */
.hl {
  background: linear-gradient(100deg, transparent 0.4em, var(--highlight) 0.5em, var(--highlight) calc(100% - 0.3em), transparent calc(100% - 0.2em)) 0 62% / 100% 0.5em no-repeat;
}

.hero-sub {
  max-width: 560px;
  margin: 0;
  color: var(--text-muted);
  font-size: 17px;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  font-weight: 600;
  font-size: 15px;
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-points span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px dashed var(--text-faint);
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Sticky note: join a room ---------- */

.sticky-note {
  position: relative;
  padding: 26px 22px 18px;
  border-radius: 4px 4px 4px 22px;
  background: var(--note);
  color: var(--note-text);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
  transform: rotate(2deg);
  transition: transform 0.2s ease;
}

.sticky-note:focus-within,
.sticky-note:hover {
  transform: rotate(0deg) translateY(-2px);
}

/* A bit of tape on top */
.sticky-note::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 92px;
  height: 22px;
  margin-left: -46px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transform: rotate(-3deg);
}

.note-title {
  margin: 0 0 12px;
  font-family: var(--font-hand);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.05;
}

.note-row {
  display: flex;
  gap: 8px;
}

.note-row input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  border: 2px solid rgba(59, 47, 5, 0.25);
  background: rgba(255, 255, 255, 0.65);
  color: var(--note-text);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.note-row input::placeholder {
  color: rgba(59, 47, 5, 0.35);
}

.note-row input:focus-visible {
  outline: 2px solid var(--note-text);
  outline-offset: 1px;
}

.note-row .btn {
  height: 48px;
  background: var(--note-text);
  color: var(--note);
}

.note-message {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Featured game ---------- */

.featured {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: stretch;
  margin-bottom: 40px;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.featured-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
  background:
    radial-gradient(circle at 30% 40%, color-mix(in srgb, var(--game) 45%, transparent), transparent 60%),
    color-mix(in srgb, var(--game) 16%, #14161c);
}

.featured-art img {
  width: min(78%, 360px);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
  transition: transform 0.3s ease;
}

.featured:hover .featured-art img {
  transform: translateX(6px) rotate(-1deg);
}

.featured-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 30px 32px;
}

.featured-label {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 24px;
  font-weight: 700;
  color: color-mix(in srgb, var(--game) 75%, var(--text));
}

.featured-text h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.05;
}

.featured-text .card-actions {
  margin-top: 8px;
}

/* ---------- Chips ---------- */

.home .chips {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -16px 28px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ---------- Section headings ---------- */

.home .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 18px;
}

.home .section-title {
  font-size: 28px;
}

.section-note {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------- Game cards ---------- */

.home .card-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.home .game-card {
  position: relative;
  gap: 12px;
  padding: 14px 14px 16px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.home .game-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--game) 55%, var(--border));
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--game) 45%, transparent);
}

/* The picture: the game's colour, with a soft glow */
.home .card-art {
  position: relative;
  height: 132px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 110%, color-mix(in srgb, var(--game) 55%, transparent), transparent 70%),
    color-mix(in srgb, var(--game) 14%, #14161c);
}

.home .card-art img {
  max-width: 150px;
  max-height: 96px;
  transition: transform 0.25s ease;
}

.home .game-card:hover .card-art img {
  transform: scale(1.08) rotate(-2deg);
}

.home .card-text {
  padding: 0 4px;
}

.home .card-footer {
  padding: 0 4px;
}

/* Little labels: players, real-time… */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.tags li.is-time {
  background: transparent;
  border: 1px solid var(--border);
}

.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--game);
  color: #14161c;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(4deg);
}

/* Each card's play button wears its game's colour */
.home .game-card .btn-primary,
.featured .btn-primary {
  background: var(--game);
  color: #14161c;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px dashed var(--border-strong);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--text-muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .home .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 28px;
  }
  .sticky-note {
    max-width: 360px;
    transform: rotate(1deg);
  }
  .featured {
    grid-template-columns: 1fr;
  }
  .featured-art {
    min-height: 170px;
  }
  .featured-text {
    padding: 20px;
  }
}

/* Phones: smaller side-by-side cards, so the list isn't a mile long */
@media (max-width: 560px) {
  .home .card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .home .game-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas: "art text" "foot foot";
    gap: 10px 14px;
    padding: 12px;
  }
  .home .card-art {
    grid-area: art;
    height: 96px;
  }
  .home .card-art img {
    max-width: 80px;
    max-height: 64px;
  }
  .home .card-text {
    grid-area: text;
    align-self: center;
    padding: 0;
  }
  .home .card-title {
    font-size: 18px;
  }
  .home .card-footer {
    grid-area: foot;
    padding: 0;
  }
  .home .card-actions .btn {
    height: 40px;
  }
  .badge {
    top: 6px;
    right: 6px;
  }
  .home .section-title {
    font-size: 24px;
  }
  /* Category chips: one row you can swipe along */
  .home .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .home .chip {
    flex: none;
    height: 40px;
    padding: 0 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home .game-card,
  .home .card-art img,
  .featured-art img,
  .sticky-note {
    transition: none;
  }
}
