/* Plant detail page (entry/): banner, gallery, taxonomy ladder and the content
   cards. Card sizes follow the 1440px design, whose cards count their 1px
   stroke in the layout (padding 24px plus the border). */

/* ---------- Banner ----------
   A plain green band on this page: no photo and no veil. */
.plant-banner {
  --page-header-image: none;
  --page-header-veil: none;
  background: var(--green-900);
}

.plant-banner .page-header__title {
  max-width: 880px;
  overflow-wrap: anywhere;
}

.plant-banner .page-header__lead {
  display: -webkit-box;
  max-width: 880px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ---------- States ---------- */
.plant-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 56px 0;
  text-align: center;
}

.plant-state .petal {
  inline-size: 38px;
  block-size: 38px;
}

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

.plant-state__text {
  max-width: min(560px, 100%);
  /* May quote the name from the address, which can be one very long word. */
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 30px;
}

.plant-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.plant-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 320px;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 30px;
}

.plant-loading::before {
  content: '';
  inline-size: 20px;
  block-size: 20px;
  border: 2px solid var(--green-200);
  border-top-color: var(--green-600);
  border-radius: 50%;
  animation: plant-spin 0.8s linear infinite;
}

@keyframes plant-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .plant-loading::before {
    animation: none;
  }
}

/* ---------- «العودة إلى النتائج» ---------- */
.plant-back {
  display: flex;
  margin-bottom: 24px;
}

/* ---------- Layout ---------- */
.plant {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.plant__content {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.plant__aside {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 24px;
  width: 400px;
  min-width: 0;
  /* Stays in view beside long content; an aside taller than the window sticks
     by its bottom edge instead (entry.js measures --plant-aside-height). */
  position: sticky;
  top: min(24px, calc(100vh - var(--plant-aside-height, 0px) - 24px));
}

/* ---------- Card ---------- */
.pcard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.pcard__title {
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
}

.pcard__text {
  color: var(--text-paragraph);
  font-size: 17px;
  line-height: 30px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* ---------- Entry head ---------- */
.plant-head {
  gap: 8px;
  align-items: flex-start;
}

.plant-tag {
  display: inline-flex;
  align-items: center;
  gap: 5.5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

.plant-tag::before {
  content: '';
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  background: currentColor;
}

.plant-head__name {
  font-size: 44px;
  font-weight: 700;
  line-height: 60px;
  overflow-wrap: anywhere;
}

/* «الحقل الدلالي»: the plant's category line. */
.plant-head__fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--accent-scientific);
  font-size: 15px;
  font-weight: 500;
  line-height: 24px;
}

.plant-head__fields-label {
  color: var(--text-secondary);
}

.plant-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plant-head__actions .btn {
  /* 121px in the design, whose stroke is inside the 16px padding. */
  min-width: 121px;
  padding-inline: 15px;
}

.plant-head__actions .ico > img {
  /* The icon file is the design's arrow pointing down. */
  transform: rotate(90deg);
}

/* ---------- Names and translations ---------- */
.plant-names {
  gap: 4px;
}

/* A translation: the word, then its language code. */
.plant-translations {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plant-translation {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  line-height: 24px;
}

.plant-translation:last-child {
  border-bottom: 0;
}

.plant-translation__word {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plant-translation__lang {
  flex: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  direction: ltr;
}

.plant-names__subtitle {
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.plant-row .plant-row__scientific {
  color: var(--accent-scientific);
}

.plant-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.plant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.plant-row:last-child {
  border-bottom: 0;
}

.plant-row dt {
  flex: none;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
}

.plant-row dd {
  min-width: 0;
  font-size: 16px;
  line-height: 24px;
  text-align: left;
  overflow-wrap: anywhere;
}

/* ---------- Info tiles ---------- */
/* Two to a row; a tile left alone in its row takes the full width. */
.plant-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

.plant-info__item {
  display: flex;
  flex: 1 1 calc(50% - 6px);
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  font-weight: 500;
}

.plant-info__item--wide {
  flex-basis: 100%;
}

.plant-info__item dt {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 20px;
}

.plant-info__item dd {
  font-size: 15px;
  line-height: 24px;
  overflow-wrap: anywhere;
}

.plant-info__item a {
  color: var(--green-600);
}

.plant-info__item a {
  display: inline-block;
  max-width: 100%;
  text-underline-offset: 3px;
}

/* ---------- Witnesses ---------- */
.plant-quotes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plant-quote {
  margin: 0;
  padding: 20px 24px;
  border-inline-start: 4px solid var(--green-400);
  border-radius: var(--radius-md);
  background: var(--accent-surface-subtle);
}

.plant-quote__text {
  margin: 0;
  color: var(--green-900);
  font-size: 22px;
  font-weight: 500;
  line-height: 40px;
  overflow-wrap: anywhere;
}

/* ---------- Distribution ---------- */
.plant-geo {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.plant-geo__panel {
  display: flex;
  flex: 1 1 200px;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  /* The design's rule is a 1px box followed by the 16px gap. */
  padding: 16px 0 20px;
  border-top: 1px solid var(--border);
}

.plant-geo--nomap .plant-geo__panel {
  padding: 0;
  border-top: 0;
}

.plant-geo__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plant-geo__label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

.plant-geo__value {
  font-size: 15px;
  font-weight: 500;
  line-height: 26px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.plant-flora {
  display: block;
  flex: 0 1 472px;
  min-width: 0;
  max-width: 100%;
}

.plant-flora[hidden] {
  display: none;
}

/* ---------- Gallery ---------- */
.plant-gallery {
  gap: 12px;
  padding: 12px;
}

.plant-gallery__main {
  position: relative;
  display: block;
  width: 100%;
  height: 300px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  cursor: zoom-in;
}

.plant-gallery__main img,
.plant-gallery__thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.plant-gallery__thumbs {
  display: grid;
  /* Four to a row. The design's row is 88, 83, 84 and 83px wide from the right. */
  grid-template-columns: 88fr 83fr 84fr 83fr;
  gap: 12px;
}

.plant-gallery__thumb {
  position: relative;
  min-width: 0;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  cursor: pointer;
}

/* The design draws the selection border over the photo. */
.plant-gallery__thumb[aria-current='true']::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--green-600);
  border-radius: inherit;
}

/* ---------- Lightbox ---------- */
.plant-lightbox {
  width: min(1100px, 100vw - 32px);
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 16px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  color: var(--text-default);
}

html.plant-lightbox-open {
  overflow: hidden;
}

.plant-lightbox::backdrop {
  background: rgba(22, 22, 22, 0.7);
}

.plant-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.plant-lightbox__count {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
}

.plant-lightbox__nav {
  display: flex;
  gap: 8px;
}

.plant-lightbox__nav .btn {
  width: 40px;
  padding: 0;
  font-size: 20px;
}

.plant-lightbox img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 140px);
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  object-fit: contain;
}

/* ---------- Taxonomy ---------- */
.plant-taxonomy {
  border-color: var(--accent-border);
  background: var(--accent-surface-subtle);
}

.plant-ladder {
  margin: 0;
}

.plant-ladder__level {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.plant-ladder__rail {
  position: relative;
  flex: none;
  align-self: stretch;
  width: 16px;
}

.plant-ladder__rail::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: url('../img/ui/ladder-dot.svg') center / 100% 100% no-repeat;
}

.plant-ladder__rail::after {
  content: '';
  position: absolute;
  top: 20px;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--green-200);
}

.plant-ladder__level:last-child .plant-ladder__rail::before {
  left: 0;
  width: 16px;
  height: 16px;
  background-image: url('../img/ui/ladder-dot-current.svg');
}

.plant-ladder__level:last-child .plant-ladder__rail::after {
  content: none;
}

.plant-ladder__text {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-bottom: 18px;
}

.plant-ladder__level:last-child .plant-ladder__text {
  padding-bottom: 0;
}

.plant-ladder__label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green-700);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.plant-ladder__latin {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
}

.plant-ladder__value {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  overflow-wrap: anywhere;
}

.plant-ladder__value--latin {
  font-weight: 400;
  text-align: right;
}

.plant-ladder__level:last-child .plant-ladder__value {
  color: var(--green-600);
}

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .plant__aside {
    width: 320px;
  }
}

@media (max-width: 960px) {
  /* One column: the name first, then the photos, the content cards and the taxonomy. */
  .plant {
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
  }

  .plant__content,
  .plant__aside {
    display: contents;
  }

  .plant .pcard {
    order: 3;
  }

  .plant .plant-head {
    order: 1;
  }

  .plant .plant-gallery {
    order: 2;
  }

  .plant-gallery__main {
    height: auto;
    aspect-ratio: 374 / 300;
    max-height: 480px;
  }
}

@media (max-width: 820px) {
  .plant-geo {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .plant-geo__panel {
    flex: none;
  }

  .plant-flora {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 700px) {
  .plant-banner .page-header__lead {
    -webkit-line-clamp: 3;
  }

  .pcard {
    padding: 16px;
  }

  .plant-gallery {
    padding: 12px;
  }

  .plant-head__name {
    font-size: 34px;
    line-height: 48px;
  }

  .plant-info__item {
    flex-basis: 100%;
  }

  .plant-quote {
    padding: 16px;
  }

  .plant-quote__text {
    font-size: 19px;
    line-height: 34px;
  }

  .plant-row {
    flex-wrap: wrap;
    gap: 4px 16px;
  }
}

/* ---------- Review of 2026-11-26 ----------
   The name is shown once (banner), names sit at the start and translations at
   the end of one row, citations are plain text, every taxonomy level reads
   alike, and the text sizes follow the previous plant page. */
.pcard__title {
  font-size: 26px;
  line-height: 38px;
}

.pcard__text {
  font-size: 19px;
  line-height: 36px;
}

.plant-head {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.plant-names {
  flex-direction: row;
  align-items: flex-start;
  gap: 32px;
}

.plant-names > .plant-rows,
.plant-names > .plant-names__translations {
  flex: 1 1 0;
  min-width: 0;
}

.plant-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.plant-row dt {
  font-size: 16px;
  line-height: 26px;
}

.plant-row dd {
  width: 100%;
  font-size: 19px;
  line-height: 30px;
  text-align: start;
}

.plant-row .plant-row__scientific {
  font-size: 22px;
  font-style: italic;
  font-weight: 700;
  /* Latin text, kept at the start (right) side under its label. */
  text-align: right;
}

.plant-names__translations {
  direction: ltr;
}

.plant-names__subtitle {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
  text-align: left;
}

.plant-translation {
  align-items: center;
  font-size: 18px;
  line-height: 28px;
}

.plant-translation__lang {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.plant-info__item dt {
  font-size: 16px;
  line-height: 26px;
}

.plant-info__item dd {
  font-size: 18px;
  font-weight: 400;
  line-height: 32px;
}

/* «التوفر»: a titled badge on the card itself, as on the previous page. */
.plant-info__item--status {
  padding: 0;
  background: none;
}

.plant-info__item--status dt {
  color: var(--text-default, inherit);
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
}

.plant-tag {
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
}

.plant-quote {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.plant-quote__text {
  color: var(--text-paragraph);
  font-size: 20px;
  font-weight: 400;
  line-height: 38px;
}

.plant-ladder__label {
  font-size: 16px;
  line-height: 24px;
}

.plant-ladder__latin {
  font-size: 14px;
}

.plant-ladder__value,
.plant-ladder__level:last-child .plant-ladder__value {
  color: var(--text-paragraph);
  font-size: 17px;
  font-weight: 400;
  line-height: 28px;
  /* Latin names stay on the same side as the Arabic values. */
  text-align: right;
}

@media (max-width: 700px) {
  .plant-names {
    flex-direction: column;
    gap: 8px;
  }

  .plant-names > .plant-rows,
  .plant-names > .plant-names__translations {
    flex: none;
    width: 100%;
  }

  .pcard__title {
    font-size: 22px;
    line-height: 32px;
  }

  .plant-quote__text {
    font-size: 18px;
    line-height: 34px;
  }
}
