/* ==========================================================================
   Home page
   ========================================================================== */

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.home-hero {
  position: relative;
  overflow: hidden;
  padding-bottom: clamp(24px, 3vw, 40px);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--green-50) 72%, var(--green-25) 91%, #FFFFFF 100%);
}

.home-hero__dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--green-600) 1px, transparent 1.2px);
  background-size: 22px 22px;
  opacity: .08;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 40%, transparent 42%, #000 100%);
  mask-image: radial-gradient(ellipse 70% 80% at 50% 40%, transparent 42%, #000 100%);
  pointer-events: none;
}

.home-hero__emblem {
  position: absolute;
  left: -120px; /* decorative: same side in every direction, as before */
  top: 50%;
  width: 440px;
  opacity: .04;
  transform: translateY(-50%);
  pointer-events: none;
  user-select: none;
}

.home-hero__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  text-align: center;
}

.home-hero__title {
  max-width: 950px;
  margin-top: 15px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.35;
  text-wrap: balance;
}

.home-hero__lead {
  max-width: 660px;
  color: var(--ink-500);
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 1.85;
  text-wrap: pretty;
}

/* API badge with a periodic shine */
.api-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 13px;
  border: 1px solid var(--green-150);
  border-radius: 999px;
  background: rgba(255, 255, 255, .85);
  color: var(--green-800);
  font-size: 13px;
  font-weight: 700;
}
.api-badge:hover { border-color: var(--green-400); color: var(--green-900); }
.api-badge > * { position: relative; }
.api-badge__tag {
  display: inline-flex;
  align-items: center;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-50);
  font-size: 11px;
  letter-spacing: .05em;
}
.api-badge__ring {
  position: absolute !important;
  inset: -1px;
  border: 1.5px solid var(--green-600);
  border-radius: 999px;
  opacity: 0;
  animation: api-ring 4.5s ease-in-out infinite;
}
.api-badge__shine { position: absolute !important; inset: 0; overflow: hidden; border-radius: 999px; }
.api-badge__shine::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(154, 178, 106, .2), transparent);
  transform: translateX(-150%) skewX(-20deg);
  animation: api-shine 4.5s ease-in-out infinite;
}
@keyframes api-ring { 0%, 62%, 100% { opacity: 0; } 74%, 86% { opacity: 1; } }
@keyframes api-shine { 0%, 58% { transform: translateX(-150%) skewX(-20deg); } 88%, 100% { transform: translateX(420%) skewX(-20deg); } }

/* Hero search */
.hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(650px, 100%);
  min-height: 60px;
  margin-top: 6px;
  padding-block: 7px;
  padding-inline: 18px 7px;
  border: 1px solid var(--green-150);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink-300);
  box-shadow: 0 14px 36px rgba(78, 99, 48, .1);
  text-align: start;
  transition: border-color .2s, box-shadow .2s;
}
.hero-search:hover,
.hero-search:focus-within { border-color: var(--green-400); box-shadow: 0 18px 42px rgba(78, 99, 48, .16); }
.hero-search__icon {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-600);
}
.hero-search__icon svg { width: 18px; height: 18px; }
.hero-search__icon:hover { color: var(--green-900); }
.hero-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-900);
  font-size: 15px;
}
.hero-search input::placeholder { color: var(--ink-300); opacity: 1; }
.hero-search__label { flex: 1; font-size: 15px; }
.hero-search__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 11px;
  background: var(--green-600);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.hero-search__submit:hover { background: var(--green-800); }
button.hero-search { cursor: pointer; }

.home-hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }

/* Languages */
.home-langs { width: 100%; margin-top: 10px; }
.home-langs__label {
  margin-bottom: 13px;
  font-size: 14px;
}
.home-langs__label > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green-800);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.home-langs__label svg { width: 16px; height: 16px; }

.home-langs__search {
  width: min(100%, 430px);
  min-height: 42px;
  margin: 0 auto 12px;
  border-color: var(--green-150);
  border-radius: 13px;
  background: rgba(255, 255, 255, .72);
  color: var(--green-700);
  box-shadow: 0 5px 18px rgba(78, 99, 48, .05);
}
.home-langs__search img { width: 17px; height: 17px; opacity: .68; }
.home-langs__search input { height: 26px; font-size: 13px; }

.home-langs__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid rgba(102, 128, 58, .16);
  border-radius: 14px;
  background: rgba(255, 255, 255, .55);
  color: var(--ink-700);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(78, 99, 48, .05);
}
.lang-tile:hover { transform: translateY(-2px); border-color: var(--green-200); background: #FFFFFF; color: var(--green-800); }
.lang-tile__name { overflow: hidden; text-overflow: ellipsis; }
.lang-tile__meta { overflow: hidden; font-size: 11px; font-weight: 500; opacity: .78; text-overflow: ellipsis; }

.lang-tile--more { border-color: var(--green-600); background: var(--green-600); color: #FFFFFF; cursor: pointer; }
.lang-tile--more:hover { background: var(--green-700); color: #FFFFFF; }
.lang-tile--more .lang-tile__meta { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.lang-tile--more svg { width: 12px; height: 12px; }

.home-langs__grid:not(.is-expanded):not(.is-filtering) .is-extra { display: none; }
.home-langs.is-filtering .lang-tile--more { display: none; }
.home-langs__empty { margin-top: 12px; color: var(--ink-300); font-size: 13px; text-align: center; }

.home-hero__utilities { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.utility-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 14px;
  border: 1px solid var(--green-150);
  border-radius: 10px;
  background: var(--surface);
  color: var(--green-800);
  font-size: 13px;
  font-weight: 700;
}
.utility-link:hover { border-color: var(--green-400); background: var(--green-25); color: var(--green-900); }
.utility-link svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------------------
   Main sections
   -------------------------------------------------------------------------- */
.home-main {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3vw, 40px);
  padding-bottom: clamp(24px, 3vw, 40px);
}
.home-section { scroll-margin-top: var(--header-offset); }

.sources-note { margin-bottom: 30px; }
.sources-note p {
  max-width: 760px;
  color: var(--ink-500);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.8;
  text-align: center;
}
.sources-note strong { color: var(--green-800); }

.home-browse__more { display: none; justify-content: center; margin-top: 18px; }

/* Categories */
.cat-grid {
  display: grid;
  grid-template-columns: 250px repeat(auto-fill, minmax(205px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The hero category card spans two grid rows (the grid items are the <li> wrappers) */
.cat-grid__hero { grid-row: span 2; }

.cat-hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  min-height: 150px;
  height: 100%;
  padding: 24px;
  overflow: hidden;
  border-radius: 24px;
  background: var(--green-800);
  color: #FFFFFF;
}
.cat-hero-card:hover { background: var(--green-700); color: #FFFFFF; }
.cat-hero-card > * { position: relative; }
.cat-hero-card__emblem {
  position: absolute !important;
  left: -60px;
  bottom: -80px;
  width: 260px;
  opacity: .05;
  filter: brightness(0) invert(1);
  pointer-events: none;
  user-select: none;
}
.cat-hero-card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .14);
}
.cat-hero-card__icon svg { width: 25px; height: 25px; fill: none; }
.cat-hero-card__title {
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.2vw, 27px);
  text-wrap: balance;
}
.cat-hero-card__more { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }

.cat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 96px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--green-150);
  border-radius: 22px;
  background: var(--green-50);
  color: var(--ink-900);
}
.cat-card:hover { transform: translateY(-2px); border-color: var(--green-400); background: var(--green-75); color: var(--ink-900); box-shadow: var(--shadow-card); }
.cat-grid__wide { grid-column: span 2; }
.cat-card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cat-card__name { font-size: 16px; font-weight: 700; line-height: 1.5; text-wrap: balance; }
.cat-card__count { color: var(--ink-300); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Goals */
.goals {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: clamp(22px, 4vw, 40px);
  border-radius: 28px;
  background: linear-gradient(180deg, #FFFFFF 0%, var(--green-50) 100%);
}
.goals__head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 760px; }
.goals__title { font-family: var(--font-display); font-size: clamp(26px, 3.5vw, 40px); text-wrap: balance; }
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.goal-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  padding: 22px;
  border: 1px solid var(--green-150);
  border-radius: 20px;
  background: var(--surface);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.goal-card:hover { transform: translateY(-2px); border-color: var(--green-400); box-shadow: var(--shadow-card); }
.goal-card__top { display: flex; align-items: center; justify-content: space-between; }
.goal-card__icon { width: 40px; height: 40px; }
.goal-card__num { color: var(--green-200); font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.goal-card__text { color: var(--ink-900); font-size: 18px; font-weight: 700; line-height: 1.75; text-wrap: pretty; }

/* Downloads */
.downloads { display: flex; flex-direction: column; gap: 20px; scroll-margin-top: var(--header-offset); }
.downloads__head { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 760px; }
.downloads__title { font-family: var(--font-display); font-size: clamp(26px, 3.5vw, 40px); text-wrap: balance; }
.downloads__panel {
  padding: clamp(16px, 2.5vw, 28px);
  border: 1px solid var(--line-150);
  border-radius: 24px;
  background: var(--green-25);
}
.downloads__notice {
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid var(--green-150);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-500);
  line-height: 1.65;
}
.downloads__filter { margin-bottom: 18px; }

.dl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
  max-height: min(620px, 70vh);
  margin: 0;
  padding: 0;
  padding-inline-end: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  list-style: none;
}
.dl-card { overflow: hidden; border: 1px solid var(--green-150); border-radius: 18px; background: var(--surface); }
.dl-card:hover { border-color: var(--green-400); box-shadow: 0 12px 28px -18px rgba(78, 99, 48, .36); }
.dl-card__top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
  min-height: 70px;
  padding: 13px 14px;
}
.dl-card__code {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--green-50);
  color: var(--green-800);
  font-family: system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .04em;
}
.dl-card__lang { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-card__name,
.dl-card__meta { min-width: 0; overflow: hidden; text-align: start; text-overflow: ellipsis; white-space: nowrap; }
.dl-card__name { color: var(--ink-900); font-size: 15px; font-weight: 700; unicode-bidi: isolate; }
.dl-card__meta { color: var(--ink-300); font-size: 12.5px; }
.dl-card__files { display: flex; grid-column: 2 / -1; justify-self: end; flex-wrap: nowrap; gap: 4px; }
.dl-card__file {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 30px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: var(--green-50);
  color: var(--green-700);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.dl-card__file:hover,
.dl-card__file[aria-expanded="true"] { background: var(--green-75); color: var(--green-900); }
.dl-card__file svg { width: 13px; height: 13px; }
.dl-card__pdfs { display: flex; flex-direction: column; padding: 10px 14px; border-top: 1px solid var(--green-150); background: var(--green-25); }
.dl-card__pdfs a { padding: 4px 0; }
.downloads__empty { margin: 20px 0 8px; color: var(--ink-300); font-size: 14px; font-weight: 500; text-align: center; }

.terms-list { padding-inline-start: 1.4em; }
.terms-list li { margin-bottom: 6px; line-height: 1.7; }
.terms-intro { margin-bottom: 12px; font-weight: 700; line-height: 1.7; }

/* Statistics */
.stats {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(24px, 4vw, 44px);
  padding: clamp(22px, 4vw, 40px);
  overflow: hidden;
  border-radius: 28px;
  background: var(--green-800);
  color: #FFFFFF;
}
.stats__emblem {
  position: absolute;
  left: -90px;
  bottom: -110px;
  width: 340px;
  opacity: .04;
  filter: brightness(0) invert(1);
  pointer-events: none;
  user-select: none;
}
.stats__intro { position: relative; display: flex; flex: 1 1 280px; flex-direction: column; gap: 10px; min-width: 0; }
.stats__title { color: #FFFFFF; font-family: var(--font-display); font-size: clamp(27px, 3.4vw, 42px); line-height: 1.35; }
.stats__lead { color: #E3E9D4; font-size: 15px; line-height: 1.85; }
.stats__link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 20px;
  border-radius: 12px;
  background: #FFFFFF;
  color: var(--green-800);
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
}
.stats__link:hover { background: var(--green-50); color: var(--green-900); }
.stats__link svg { width: 13px; height: 13px; }
.stats__grid {
  position: relative;
  display: grid;
  flex: 2 1 520px;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.stat {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 20px;
  background: rgba(255, 255, 255, .08);
}
.stat__icon {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  height: 52px;
  border-radius: 16px;
  background: #FFFFFF;
  color: var(--green-600);
}
.stat__icon svg { width: 24px; height: 24px; }
/* <dt> label precedes <dd> value in the markup; show the value first */
.stat__text { display: flex; flex-direction: column-reverse; gap: 2px; min-width: 0; margin: 0; }
.stat__value { margin: 0; }
.stat__value { color: #FFFFFF; font-family: var(--font-display); font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; line-height: 1.35; white-space: nowrap; }
.stat__label { color: #E3E9D4; font-size: 14px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .home-langs__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cat-grid__hero { grid-column: span 2; grid-row: span 1; }
}

@media (max-width: 900px) {
  .home-hero__emblem { display: none; }
}

@media (max-width: 767px) {
  .home-hero__title { font-size: clamp(27px, 8vw, 38px); }
  .hero-search { min-height: 54px; padding-block: 6px; padding-inline: 14px 6px; border-radius: 14px; }
  .hero-search__submit { min-height: 42px; padding-inline: 17px; }
  .home-langs__grid { gap: 6px; }
  .lang-tile { min-height: 42px; padding: 5px 7px; border-radius: 11px; font-size: 13px; line-height: 1.25; }
  .lang-tile__meta { font-size: 9.5px; line-height: 1.2; }
  .section-head .more-link { display: none; }
  .home-browse__more { display: flex; }
  .home-hero__utilities .utility-link { flex: 1; width: 100%; }
  .downloads__panel { padding: 12px; }
  .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .dl-card__top { grid-template-columns: 40px minmax(0, 1fr); gap: 3px 9px; padding: 11px; }
  .dl-card__code { width: 40px; height: 40px; }
}

@media (max-width: 559px) {
  .home-langs__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cat-grid { grid-template-columns: minmax(0, 1fr); }
  .cat-grid__hero,
  .cat-grid__wide { grid-column: span 1; }
}

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