/* Homepage directory: one surface, site accent, tiles that fill the viewport. */
body.page-home {
  --home-cols: 5;
  --home-gap: clamp(0.65rem, 1.15vw, 1.35rem);
  --home-top-space: clamp(0.85rem, 1.6vh, 1.6rem);
  --home-side-space: clamp(1rem, 2.2vw, 2.25rem);
  --home-heading-gap: clamp(0.7rem, 1.5vh, 1.25rem);
  --home-title-size: clamp(1.7rem, 1.2rem + 1.4vw, 2.65rem);
  --home-intro-size: clamp(0.92rem, 0.75rem + 0.35vw, 1.1rem);
  --home-card-title-size: clamp(0.98rem, 0.72rem + 0.55vw, 1.35rem);
  --home-copy-size: clamp(0.8rem, 0.62rem + 0.32vw, 1rem);
  --home-meta-size: clamp(0.68rem, 0.55rem + 0.2vw, 0.82rem);
  --home-icon-size: clamp(2rem, 1.2rem + 1.5vw, 3.15rem);
  --home-card-padding: clamp(0.8rem, 1.2vw, 1.45rem);
  --home-card-radius: clamp(1.1rem, 1.4vw, 1.75rem);
  min-height: 100dvh;
  padding-top: 66px;
  background: var(--bg-color);
}

body.page-home #main-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.page-home .cards-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  max-width: none;
  width: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: var(--home-top-space) var(--home-side-space) 0.55rem;
  text-align: center;
}

body.page-home .header-inner {
  max-width: none;
  padding-inline: var(--home-side-space);
}

body.page-home .header-content {
  flex: 0 0 auto;
  margin-bottom: var(--home-heading-gap);
}

body.page-home .page-title {
  margin: 0.2rem 0 0.35rem;
  font-size: var(--home-title-size);
  line-height: 1.15;
  color: var(--text-color);
}

body.page-home .brand-highlight { color: #ff2d55; }
body.page-home.dark .brand-highlight { color: #ff6484; }

body.page-home .home-intro {
  max-width: 62ch;
  margin: 0.35rem auto 0;
  color: var(--text-secondary);
  font-size: var(--home-intro-size);
  line-height: 1.45;
}

body.page-home .cards-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--home-cols), minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--home-gap);
  margin: 0;
  min-height: 0;
  align-content: stretch;
}

body.page-home #home-content .card {
  --topic-color: var(--accent-color);
  container-type: size;
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--home-card-padding);
  min-height: 10.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--home-card-radius);
  color: var(--text-color);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
  overflow-wrap: break-word;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

body.page-home #home-content .card::before,
body.page-home #home-content .card::after { display: none; }

body.page-home #home-content .card:focus-within,
body.page-home #home-content .card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
}

body.page-home #home-content .card:active {
  transform: scale(0.985);
}

body.page-home #home-content .card-link {
  position: absolute;
  inset: 0;
  z-index: 3;
  text-indent: -9999px;
  overflow: hidden;
  border-radius: inherit;
}

body.page-home #home-content .card > .topic-icon {
  width: var(--home-icon-size);
  height: var(--home-icon-size);
  flex: 0 0 auto;
  margin: 0 0 0.7rem;
  color: var(--topic-color);
  filter: none;
  transform: none;
}

body.page-home #home-content .card .content-wrapper {
  min-width: 0;
  width: 100%;
}

body.page-home #home-content .card h3 {
  margin: 0 0 0.4rem;
  font-size: var(--home-card-title-size);
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-color);
  background: none;
  -webkit-text-fill-color: currentColor;
  text-shadow: none;
  transform: none;
}

body.page-home #home-content .card p {
  margin: 0;
  font-size: var(--home-copy-size);
  line-height: 1.4;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.page-home .card-eyebrow,
body.page-home .card-access {
  display: block;
  margin: 0 0 0.35rem;
  font-size: var(--home-meta-size);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
body.page-home .card-eyebrow { color: var(--topic-color); }
body.page-home .card-access { color: var(--text-secondary); }

body.page-home #home-content .card:has(.card-eyebrow) {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: var(--surface-2);
}

body.page-home #home-content .card-link:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 3px;
}

@supports (width: 1cqmin) {
  body.page-home #home-content .card > .topic-icon {
    width: clamp(1.85rem, 12cqw + 7cqh, 4.25rem);
    height: clamp(1.85rem, 12cqw + 7cqh, 4.25rem);
    margin-bottom: clamp(0.4rem, 3.5cqmin, 1rem);
  }
  body.page-home #home-content .card h3 {
    font-size: clamp(0.95rem, 6.2cqmin + 1.2cqh, 1.55rem);
  }
  body.page-home #home-content .card p {
    font-size: clamp(0.78rem, 4.4cqmin + 0.6cqh, 1.08rem);
  }
  body.page-home #home-content .card {
    padding: clamp(0.75rem, 5.5cqmin, 1.7rem);
  }
}

body.page-home .app-store-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 0.55rem;
  margin: 0.8rem auto 0.15rem;
  padding: 0.4rem 0.9rem 0.4rem 0.7rem;
  min-height: 44px;
  width: max-content;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 160ms, box-shadow 160ms, transform 160ms;
}
body.page-home .app-store-badge:hover {
  background: #2a2a2a;
  color: #fff;
  box-shadow: var(--shadow-md);
}
body.page-home .app-store-badge:active { transform: translateY(1px); }
body.page-home .app-store-badge:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 3px;
}
body.page-home .app-store-badge-logo {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}
body.page-home .app-store-badge-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
  text-align: left;
}
body.page-home .app-store-badge-kicker {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
body.page-home .app-store-badge-store {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
body.page-home.dark .app-store-badge,
body.dark.page-home .app-store-badge {
  background: #fff;
  color: #111;
}
body.page-home.dark .app-store-badge:hover,
body.dark.page-home .app-store-badge:hover {
  background: #f2f2f2;
  color: #111;
}

@media (max-width: 768px) {
  body.page-home {
    --home-cols: 2;
    --home-side-space: 1rem;
    --home-top-space: 0.35rem;
    --home-heading-gap: 0.65rem;
  }
  body.page-home .cards-container { padding-bottom: 0.35rem; }
  body.page-home #home-content .card {
    min-height: 6.35rem;
  }
  body.page-home #home-content .card p,
  body.page-home #home-content .card-eyebrow,
  body.page-home #home-content .card-access { display: none; }
}
@media (max-width: 359px) {
  body.page-home { --home-cols: 1; }
}

/* Tall windows use the app's 2-column rows so tiles stay complete. */
@media (min-width: 769px) and (max-aspect-ratio: 5/4) {
  body.page-home { --home-cols: 2; }
}

@media (min-width: 1441px) {
  body.page-home {
    --home-title-size: clamp(2.1rem, 1.4rem + 1.2vw, 3.1rem);
    --home-brand-icon: clamp(2.5rem, 2vw, 3.25rem);
    --home-header-height: max(4rem, calc(var(--home-brand-icon) + 1.25rem));
    padding-top: calc(var(--home-header-height) + 1px);
  }
  body.page-home .header-inner {
    max-width: none;
    min-height: var(--home-header-height);
    padding-inline: var(--home-side-space);
  }
  body.page-home .logo { width: var(--home-brand-icon); height: var(--home-brand-icon); }
  body.page-home .logo-wordmark { font-size: clamp(1rem, 1vw, 1.35rem); }
  body.page-home :is(#header .search-trigger-label, .news-ticker__title, #footer .footer-btns button) {
    font-size: clamp(.85rem, .8vw, 1.1rem);
  }
  body.page-home #footer .footer-copy { font-size: clamp(.75rem, .65vw, .95rem); }
}

@media (max-height: 760px) {
  body.page-home {
    --home-top-space: 0.55rem;
    --home-heading-gap: 0.55rem;
    --home-title-size: clamp(1.45rem, 2.4vh, 2rem);
  }
  body.page-home .home-intro { display: none; }
  body.page-home #home-content .card p { -webkit-line-clamp: 2; }
  body.page-home .app-store-badge { margin-top: 0.45rem; min-height: 40px; }
}

body.page-home.large-font .page-title { font-size: max(2.4rem, calc(var(--home-title-size) * 1.12)) !important; }
body.page-home.large-font .home-intro { font-size: max(1.15rem, calc(var(--home-intro-size) * 1.15)) !important; }
body.page-home.large-font #home-content .card h3 { font-size: max(1.25rem, calc(var(--home-card-title-size) * 1.15)) !important; }
body.page-home.large-font #home-content .card p { font-size: max(1rem, calc(var(--home-copy-size) * 1.12)) !important; }

@media (max-width: 600px) {
  body.page-home.large-font { --home-cols: 1; }
}
@media (min-width: 1101px) and (min-aspect-ratio: 5/4) {
  body.page-home.large-font { --home-cols: 4; }
}
