/* Home page: hero with search, plant of the day and the enrichment invitation,
   flower and plant cards, and the lexicon in numbers. Sizes follow the 1440px design. */

/* Arrow of the "more" buttons: the file points down, the design turns it to the reading direction. */
.home-arrow > img {
  transform: rotate(90deg);
}

/* ---------- Hero ---------- */
.home-hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 491px;
  padding: 40px var(--page-gutter);
  color: #fff;
  background: var(--green-900) url('../img/home/hero.jpg') center / cover no-repeat;
}

.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(16, 70, 49, 0.15) 0%,
    rgba(16, 70, 49, 0.35) 40%,
    rgba(16, 70, 49, 0.85) 62%,
    rgba(16, 70, 49, 0.95) 100%
  );
}

.home-hero__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  width: 100%;
  max-width: 1280px;
  /* Centring leaves the block on a half pixel; the design rounds it up the page. */
  margin: -1px auto 0;
}

.home-hero__title {
  /* The design tightens the tracking by 1.2px, which browsers do not apply to
     Arabic; the box is wider instead so the title breaks at the same word. */
  max-width: 940px;
  font-size: 60px;
  font-weight: 600;
  line-height: 72px;
}

.hero-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 680px;
  max-width: 100%;
}

.hero-search__field {
  position: relative;
  display: flex;
  flex: 1 0 0;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 2px solid var(--accent-focus);
  border-radius: var(--radius-md);
  background: var(--bg-white);
}

.hero-search__field:focus-within {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(84, 192, 138, 0.45);
}

.hero-search__icon > img {
  transform: scaleX(-1);
}

.hero-search__input {
  flex: 1 0 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text-default);
  font-size: 16px;
  line-height: 24px;
  text-overflow: ellipsis;
}

.hero-search__input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.hero-search__input::-webkit-search-cancel-button {
  display: none;
}

.hero-search__button {
  flex: none;
}

/* The default dark outline disappears on the hero photo. */
.home-hero :focus-visible {
  outline-color: #fff;
}

/* Autocomplete listbox that site.js appends to the search field. */
.hero-search .suggestions {
  position: absolute;
  inset-inline: -2px;
  top: calc(100% + 6px);
  z-index: 10;
  max-height: 288px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--text-default);
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.16);
}

.hero-search .suggestions li {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
}

.hero-search .suggestions li[aria-selected='true'],
.hero-search .suggestions li:hover {
  background: var(--accent-surface-soft);
}

/* ---------- Plant of the day and enrichment ---------- */
.home-featured {
  padding: 64px var(--page-gutter);
  background: var(--accent-surface-subtle);
  /* The row and the card stack by the width they really have (container queries
     below), so they also hold when the text-size tool zooms the page. */
  container-type: inline-size;
}

.home-featured__row {
  display: flex;
  align-items: stretch;
  gap: 32px;
  max-width: 1280px;
  margin: 0 auto;
}

.daily {
  display: flex;
  flex: 1 0 0;
  align-items: stretch;
  gap: 32px;
  min-width: 0;
  min-height: 454px;
  /* The design fixes the card at 454px, which leaves 2px less under the photo. */
  padding: 24px 24px 22px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.daily__content {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  /* Below this the photo gives way first, then the row stacks. */
  min-width: 320px;
  padding-top: 8px;
}

.daily__chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-surface-soft);
  color: var(--green-700);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}

.daily__name {
  font-size: 40px;
  font-weight: 700;
  line-height: 52px;
  overflow-wrap: anywhere;
}

.daily__scientific {
  color: var(--accent-scientific);
  max-width: 100%;
  font-size: 18px;
  line-height: 26px;
  direction: ltr;
  overflow-wrap: anywhere;
}

.daily__description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  /* Three lines are always reserved, so a short text does not pull the facts and the button up. */
  min-height: 84px;
  color: var(--text-secondary);
  line-height: 28px;
}

.daily__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  margin: 0;
}

.daily__fact {
  display: flex;
  /* A third of the row each, also when fewer than three facts are shown. */
  flex: 0 1 calc((100% - 24px) / 3);
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  font-size: 12px;
}

.daily__fact dt {
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 18px;
}

.daily__fact dd {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  /* The design lets a value run into the tile's padding before it wraps. */
  margin-inline-end: -12px;
  font-weight: 600;
  line-height: 22px;
}

.daily__action {
  margin-top: 16px;
}

.daily__media {
  position: relative;
  flex: 0 1 400px;
  min-width: 240px;
  min-height: 240px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
}

.daily__media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.enrich {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  width: 400px;
  min-height: 454px;
  padding: 32px 32px 30px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.enrich > * {
  position: relative;
  z-index: 1;
}

.enrich__media {
  flex: none;
  align-self: stretch;
  height: 120px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
}

.enrich__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.enrich__title {
  font-size: 24px;
  font-weight: 700;
  line-height: 36px;
}

.enrich__text {
  color: var(--text-secondary);
  line-height: 26px;
}

.enrich__steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

.enrich__steps li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.enrich__steps li > span:last-child {
  position: relative;
  top: 1px;
}

.enrich .enrich__decor {
  position: absolute;
  z-index: 0;
  top: 259px;
  left: -51px;
  width: 180px;
  max-width: none;
  height: 180px;
  pointer-events: none;
}

/* ---------- Card sections ---------- */
.home-section {
  padding: 40px var(--page-gutter);
  background: var(--bg-white);
}

.home-section--tinted {
  background: #f9fafb;
}

.home-section__inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1280px;
  margin: 0 auto;
}

.home-section__head {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-section__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  min-height: 40px;
}

.home-section__title-row .btn--outline {
  flex: none;
}

.home-section__title {
  font-size: 30px;
  font-weight: 700;
  line-height: 38px;
}

.home-section__lead {
  max-width: 720px;
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

/* Live text differs in length; every card keeps the height of the design. */
.home-cards .plant-card__scientific {
  /* Latin sits 1px lower in the design's line box than the browser places it. */
  position: relative;
  top: 1px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-cards .plant-card__description {
  display: -webkit-box;
  flex: none;
  height: 48px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* The design sets the label 1px lower and the arrow half a pixel higher than the browser centres them. */
.home-cards .plant-card__action > span:first-child {
  position: relative;
  top: 1px;
}

.home-cards .plant-card__action > .home-arrow > img {
  transform: translateY(-0.5px) rotate(90deg);
}

/* ---------- The lexicon in numbers ---------- */
.home-stats .home-section__lead {
  max-width: 964px;
}

.home-stats__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  margin: 0;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 224px;
  padding: 16px;
  text-align: center;
}

.stat__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  border-radius: var(--radius-full);
  background: var(--green-50);
}

.stat__icon img {
  display: block;
  max-width: none;
}

.stat__icon--flip img {
  transform: scaleX(-1);
}

.stat__count {
  color: #14573a;
  font-size: 48px;
  line-height: 60px;
  letter-spacing: -0.96px;
  white-space: nowrap;
  direction: ltr;
}

.stat__label {
  margin-top: 8px;
}

/* ---------- Narrow screens ---------- */
/* Widths of the featured section's content box: 1080px is a 1240px window. */
@container (max-width: 1080px) {
  .home-featured__row {
    flex-direction: column;
  }

  .daily {
    flex: none;
  }

  .enrich {
    width: auto;
    min-height: 0;
  }
}

@media (max-width: 1100px) {
  .home-hero {
    min-height: 420px;
  }

  .home-hero__title {
    font-size: 44px;
    line-height: 56px;
  }

  .home-featured {
    padding-block: 40px;
  }

  .home-stats__grid {
    display: grid;
    grid-template-columns: repeat(2, 224px);
  }
}

@media (max-width: 700px) {
  .home-hero {
    min-height: 360px;
    padding-block: 32px;
  }

  .home-hero__title {
    font-size: 30px;
    line-height: 42px;
  }

  .home-featured,
  .home-section {
    padding-block: 32px;
  }

  .home-section__title {
    font-size: 26px;
    line-height: 36px;
  }

  .home-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-stats__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat {
    width: auto;
    padding-inline: 8px;
  }

  .stat__count {
    font-size: 36px;
    line-height: 48px;
  }
}

/* The plant of the day needs 640px for its two columns; below that it stacks. */
@container (max-width: 670px) {
  .daily {
    flex-direction: column-reverse;
    gap: 16px;
    min-height: 0;
    padding: 16px;
  }

  .daily__content {
    flex: none;
    min-width: 0;
    padding-top: 0;
  }

  .daily__description {
    min-height: 0;
  }

  .daily__media {
    flex: none;
    height: 240px;
  }

  .daily__name {
    font-size: 32px;
    line-height: 44px;
  }

  .enrich {
    padding: 20px;
  }
}
