/* Front page layout only.
 *
 * Everything here is namespaced with .home-page or a home- prefix, so no calculator, category or
 * article page inherits any of it. Colours, radii, shadows and focus colours come from the tokens
 * in styles.css: this file adds arrangement, not a second palette.
 *
 * The three jobs of the front page are a search box that opens the site's real search dialog, a
 * compact set of doors into calculators, articles and games, and an honest preview of what is
 * actually on the site. No carousels, no autoplay, no invented "trending" data.
 */

/* ---------------------------------------------------------------- hero ----------------------- */

.home-page .home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  align-items: center;
  gap: 20px 40px;
  padding: 40px 0 6px;
}
.home-page .home-hero-copy { min-width: 0; max-width: 720px; }
.home-page .home-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.home-page .home-hero-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 600px;
}
/* The mascot sits beside the words on a wide screen and above them on a phone, always at its own
   ratio so it never shifts the heading as it loads. */
.home-page .home-hero-art {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  justify-self: center;
}

/* The hero search is a button that opens the real search dialog in the header: the same index,
   the same results, no second search engine. It is styled as a large field because that is what
   people reach for, and it keeps the 56px height of a comfortable touch target. */
.home-page .home-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 640px);
  min-height: 56px;
  margin: 0 0 12px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-page .home-search:hover { border-color: var(--highlight); box-shadow: var(--shadow-hover); }
.home-page .home-search:focus-visible { outline: 3px solid var(--highlight); outline-offset: 3px; }
.home-page .home-search-icon { flex: none; color: var(--primary); }
.home-page .home-search-text { min-width: 0; overflow-wrap: anywhere; }

/* The three doors: the same three things the heading promises. Notes are dropped on a narrow
   screen so the row stays a row; the names alone are the tap targets. */
.home-page .home-pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 640px;
  margin: 0;
}
.home-page .home-pillar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.home-page .home-pillar:hover,
.home-page .home-pillar:focus-visible {
  transform: translateY(-2px);
  border-color: var(--highlight);
  box-shadow: var(--shadow-hover);
}
.home-page .home-pillar:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
.home-page .home-pillar-icon { font-size: 1.2rem; line-height: 1.2; }
.home-page .home-pillar-name { font-weight: 700; }
.home-page .home-pillar-note { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }

/* ---------------------------------------------------------------- sections ------------------- */

.home-page .home-section { margin: 34px 0 0; }
.home-page .home-heading { margin: 0 0 6px; font-size: 1.35rem; line-height: 1.25; }
.home-page .home-lede {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 640px;
}
.home-page .home-more { margin: 12px 0 0; }
.home-page .home-more a { font-weight: 600; text-decoration: none; }
.home-page .home-more a:hover { text-decoration: underline; }
.home-page .home-more a:focus-visible { outline: 2px solid var(--highlight); outline-offset: 3px; border-radius: 4px; }

/* ---------------------------------------------------------------- featured picks ------------- */

.home-page .home-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.home-page .home-feature {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.home-page .home-feature:hover,
.home-page .home-feature:focus-visible {
  transform: translateY(-3px);
  border-color: var(--highlight);
  box-shadow: var(--shadow-hover);
}
.home-page .home-feature:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
/* One media rule for both cards: a photograph on the article, a tinted icon panel on the
   calculator. Same crop, same weight, so the pair reads as a pair. The panel's soft warm glow is
   drawn behind the icon only, so the photograph is untouched. */
.home-page .home-feature-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background:
    radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--highlight) 16%, transparent), transparent 62%),
    var(--accent);
  font-size: 3.4rem;
  line-height: 1;
}
.home-page .home-feature-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px 18px 18px;
}
.home-page .home-eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.home-page .home-feature-title {
  display: block;
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}
.home-page .home-feature-text {
  display: block;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.home-page .home-feature-cta {
  display: block;
  margin-top: auto;
  color: var(--primary);
  font-weight: 700;
}

/* ---------------------------------------------------------------- games ---------------------- */

.home-page .home-games {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.home-page .home-game {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 96px;
  padding: 14px 16px;
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.home-page .home-game:hover,
.home-page .home-game:focus-visible {
  transform: translateY(-2px);
  border-color: var(--highlight);
  box-shadow: var(--shadow-hover);
}
.home-page .home-game:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
.home-page .home-game-icon { font-size: 1.5rem; line-height: 1.2; }
.home-page .home-game-name { font-weight: 700; line-height: 1.3; }
.home-page .home-game-text { color: var(--muted); font-size: 0.86rem; line-height: 1.45; }

/* ---------------------------------------------------------------- handy tools ---------------- */

.home-page .home-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.home-page .home-tool {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: start;
  min-height: 84px;
  padding: 13px 15px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.home-page .home-tool:hover,
.home-page .home-tool:focus-visible {
  transform: translateY(-2px);
  border-color: var(--highlight);
  box-shadow: var(--shadow-hover);
}
.home-page .home-tool:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
.home-page .home-tool-icon { grid-row: 1 / span 2; font-size: 1.35rem; line-height: 1.2; }
.home-page .home-tool-name { font-weight: 700; line-height: 1.3; }
.home-page .home-tool-text { color: var(--muted); font-size: 0.84rem; line-height: 1.45; }

/* ---------------------------------------------------------------- blog cards ----------------- */

.home-page .home-posts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.home-page .home-post {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.home-page .home-post:hover,
.home-page .home-post:focus-visible {
  transform: translateY(-3px);
  border-color: var(--highlight);
  box-shadow: var(--shadow-hover);
}
.home-page .home-post:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
/* One crop for all three, so a portrait-ish photograph and a landscape one still line up. */
.home-page .home-post-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--accent);
}
.home-page .home-post-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 16px 16px;
}
.home-page .home-post-category {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.home-page .home-post-title {
  display: block;
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
}
.home-page .home-post-text { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

/* ---------------------------------------------------------------- pick and thoughts ---------- */

.home-page .home-pick { margin-top: 34px; }
.home-page .home-pick .cozy-pick { max-width: 640px; }

/* The ideas card keeps its working carousel and moves to the foot of the page, quieter than the
   sections above it: a smaller heading and no extra shadow, so it reads as a footnote. */
.home-page .home-thoughts { margin: 36px 0 6px; }
.home-page .home-thoughts .thoughts-heading {
  margin-bottom: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.home-page .home-thoughts .thought { box-shadow: none; }

/* ---------------------------------------------------------------- responsive ----------------- */

@media (max-width: 900px) {
  /* Tablets keep the mascot beside the words, but give the copy the room back. */
  .home-page .home-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 200px);
    gap: 20px 24px;
  }
}

@media (max-width: 760px) {
  .home-page .home-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 26px 0 2px;
  }
  /* On one column the mascot leads the hero, so it is centred as an emblem rather than pinned to
     the left edge where it would sit out of line with the words beneath it. */
  .home-page .home-hero-art {
    order: -1;
    width: 132px;
    max-width: 100%;
    justify-self: center;
    margin-inline: auto;
    margin-bottom: 2px;
  }
  .home-page .home-hero-sub { margin-bottom: 16px; }
  .home-page .home-features,
  .home-page .home-games,
  .home-page .home-posts { grid-template-columns: minmax(0, 1fr); }
  .home-page .home-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-page .home-section { margin-top: 28px; }
  .home-page .home-game { min-height: 0; }
}

@media (max-width: 560px) {
  .home-page .home-search { min-height: 52px; padding: 10px 14px; font-size: 0.95rem; }
  .home-page .home-pillars { gap: 8px; }
  .home-page .home-pillar {
    align-items: center;
    padding: 10px 8px;
    text-align: center;
  }
  .home-page .home-pillar-note { display: none; }
  .home-page .home-tools { grid-template-columns: minmax(0, 1fr); }
  .home-page .home-feature-body,
  .home-page .home-post-body { padding: 13px 14px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-page .home-search,
  .home-page .home-pillar,
  .home-page .home-feature,
  .home-page .home-game,
  .home-page .home-tool,
  .home-page .home-post { transition: none; }
  .home-page .home-pillar:hover,
  .home-page .home-pillar:focus-visible,
  .home-page .home-feature:hover,
  .home-page .home-feature:focus-visible,
  .home-page .home-game:hover,
  .home-page .home-game:focus-visible,
  .home-page .home-tool:hover,
  .home-page .home-tool:focus-visible,
  .home-page .home-post:hover,
  .home-page .home-post:focus-visible { transform: none; }
}
