/* Discover, plant map, my garden and quizzes: the pages built on the plant index.
   They reuse the browse page's search, filters, chips, cards and pagination
   (browse.css) and add what is their own. */

.explore {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.discover-note,
.explore-note {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 20px;
}

.explore-note a {
  color: var(--green-700);
  font-weight: 600;
}

.chip__count {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
}

.chip[aria-pressed='true'] .chip__count {
  color: var(--green-700);
}

/* ---------- Discover ---------- */
.discover-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.discover-count {
  color: var(--text-default);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.discover-count:empty {
  display: none;
}

.discover-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #9da4ae;
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-default);
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
}

.filter-group > label.filter-group__label {
  display: block;
}

/* ---------- Plant map ---------- */
.map-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
  gap: 32px;
}

.map-card,
.map-panel,
.garden-card,
.quiz-stage,
.quiz-score {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.map-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.map-layers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nation-map {
  display: block;
  width: 100%;
  max-height: 620px;
}

.nation-map__region {
  fill: #fff;
  stroke: var(--green-900);
  stroke-width: 0.6;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  outline: none;
  transition: fill 0.15s ease;
}

.nation-map__region[data-band='1'],
.map-legend [data-band='1'] {
  fill: #dff6e7;
  background: #dff6e7;
}

.nation-map__region[data-band='2'],
.map-legend [data-band='2'] {
  fill: #b8eacb;
  background: #b8eacb;
}

.nation-map__region[data-band='3'],
.map-legend [data-band='3'] {
  fill: #88d8ad;
  background: #88d8ad;
}

.nation-map__region[data-band='4'],
.map-legend [data-band='4'] {
  fill: #54c08a;
  background: #54c08a;
}

.nation-map__region[data-band='5'],
.map-legend [data-band='5'] {
  fill: #1b8354;
  background: #1b8354;
}

.nation-map__region:hover,
.nation-map__region:focus-visible {
  stroke: var(--text-default);
  stroke-width: 2;
}

.nation-map__region[aria-pressed='true'] {
  stroke: var(--text-default);
  stroke-width: 2.5;
}

.nation-map__labels text {
  fill: var(--text-default);
  font-family: var(--font);
  font-weight: 600;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.map-hint {
  min-height: 24px;
  color: var(--text-default);
  font-size: 15px;
  font-weight: 600;
  line-height: 24px;
  text-align: center;
}

.map-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 20px;
}

.map-legend__bands {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.map-legend__bands i {
  display: block;
  width: 28px;
  height: 12px;
}

.map-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.map-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-panel__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
}

.map-panel__back,
.garden-clear,
.garden-remove,
.quiz-skip {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--green-700);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: underline;
  cursor: pointer;
}

.map-panel__lead {
  color: var(--text-paragraph);
  font-size: 15px;
  line-height: 24px;
}

.map-panel__label {
  color: var(--text-default);
  font-size: 15px;
  font-weight: 600;
  line-height: 24px;
}

.map-panel .chip span[lang],
.map-panel .chip {
  direction: rtl;
}

.map-ranking {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-ranking__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--bg-pressed);
  background: none;
  color: var(--text-default);
  font-family: var(--font);
  font-size: 15px;
  line-height: 24px;
  text-align: start;
  cursor: pointer;
}

.map-ranking li:last-child .map-ranking__row {
  border-bottom: 0;
}

.map-ranking__row:hover {
  background: var(--accent-surface-subtle);
}

.map-ranking__name {
  font-weight: 600;
}

.map-ranking__count {
  color: var(--text-secondary);
  font-size: 14px;
}

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

.map-thumb {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-default);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  text-decoration: none;
}

.map-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  object-fit: cover;
}

.map-thumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-thumb:hover span {
  color: var(--green-700);
  text-decoration: underline;
}

.map-panel__all {
  align-self: flex-start;
}

/* ---------- Progress bar ---------- */
.meter {
  display: block;
  flex: 1 1 120px;
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--bg-pressed);
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green-600);
}

/* ---------- My garden ---------- */
.garden-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.garden-top {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 24px;
}

.garden-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
}

.garden-card__label {
  color: var(--accent-scientific);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.garden-card__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
}

.garden-card__lead {
  color: var(--text-paragraph);
  font-size: 15px;
  line-height: 24px;
}

.garden-summary {
  flex-direction: row;
  align-items: center;
  gap: 24px;
}

.garden-summary__text {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.garden-summary__level {
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
}

.garden-summary__next,
.garden-challenge__progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
}

.garden-stats {
  display: flex;
  gap: 12px;
  margin: 0;
}

.garden-stats > div {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  min-width: 96px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--accent-surface-subtle);
}

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

.garden-stats dd {
  margin: 0;
  color: var(--green-700);
  font-size: 28px;
  font-weight: 700;
  line-height: 36px;
}

/* The level as a plant that grows: a round badge with one more leaf pair per level. */
.garden-badge {
  position: relative;
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-surface-soft)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 88 88'%3E%3Cpath d='M44 70V40' stroke='%23166a45' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M44 46c0-11-8-17-19-17 0 11 8 17 19 17zm0 8c0-9 7-14 17-14 0 9-7 14-17 14z' fill='%231b8354'/%3E%3C/svg%3E")
    center / 100% 100% no-repeat;
}

.garden-badge--0 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 88 88'%3E%3Cellipse cx='44' cy='52' rx='11' ry='15' fill='%23166a45' transform='rotate(25 44 52)'/%3E%3C/svg%3E");
}

.garden-badge--1 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 88 88'%3E%3Cpath d='M44 70V50' stroke='%23166a45' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M44 54c0-9-6-13-14-13 0 9 6 13 14 13z' fill='%231b8354'/%3E%3C/svg%3E");
}

.garden-badge--4,
.garden-badge--5 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 88 88'%3E%3Cpath d='M44 74V44' stroke='%23166a45' stroke-width='5' stroke-linecap='round'/%3E%3Ccircle cx='44' cy='34' r='19' fill='%231b8354'/%3E%3Ccircle cx='30' cy='42' r='11' fill='%2354c08a'/%3E%3Ccircle cx='58' cy='42' r='11' fill='%2354c08a'/%3E%3C/svg%3E");
}

.garden-challenge__note {
  color: var(--text-paragraph);
  font-size: 14px;
  line-height: 20px;
}

.garden-plants__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.garden-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 14px;
  line-height: 20px;
}

.garden-empty {
  align-items: center;
  padding: 40px 24px;
  text-align: center;
}

.garden-empty__actions,
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.garden-regions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 24px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.garden-regions a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 0;
  color: var(--text-default);
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}

.garden-regions a:hover .garden-regions__name {
  color: var(--green-700);
  text-decoration: underline;
}

.garden-regions__name {
  flex: none;
  width: 104px;
  font-weight: 600;
}

.garden-regions__count {
  flex: none;
  width: 64px;
  color: var(--text-secondary);
  text-align: end;
}

.garden-regions .is-complete .garden-regions__count {
  color: var(--success-text);
  font-weight: 600;
}

/* ---------- Notes that open ---------- */
.explore-details {
  padding: 16px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.explore-details summary {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  cursor: pointer;
}

.explore-details ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 0;
  padding-inline-start: 20px;
  color: var(--text-paragraph);
  font-size: 15px;
  line-height: 24px;
  list-style: disc;
}

/* ---------- Quizzes ---------- */
#quiz-root {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quiz-score {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
  padding: 16px 24px;
  color: var(--text-paragraph);
  font-size: 15px;
  line-height: 24px;
}

.quiz-score strong {
  color: var(--green-700);
  font-size: 20px;
  font-weight: 700;
}

.quiz-score .btn {
  margin-inline-start: auto;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  height: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.quiz-card__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-surface-soft);
  color: var(--green-700);
}

.quiz-card__icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quiz-card--daily {
  border-color: var(--green-300);
  background: var(--accent-surface-subtle);
}

.quiz-card__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
}

.quiz-card__title {
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
}

.quiz-card__description {
  color: var(--text-paragraph);
  font-size: 15px;
  line-height: 24px;
}

.quiz-card__points,
.quiz-card__done {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 20px;
}

.quiz-card__done {
  color: var(--success-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 40px;
}

.quiz-stage {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding: 24px 32px 32px;
}

.quiz-stage__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-stage__title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
  outline: none;
}

.quiz-stage__back,
.quiz-plant-link {
  color: var(--green-700);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  color: var(--text-paragraph);
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
}

.quiz-clock {
  color: var(--green-700);
  font-size: 18px;
  font-weight: 700;
}

.quiz-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.quiz-figure {
  width: 100%;
  max-width: 420px;
  margin: 0;
}

.quiz-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  background: var(--bg-neutral);
  object-fit: cover;
}

.quiz-prompt {
  color: var(--text-default);
  font-size: 20px;
  font-weight: 600;
  line-height: 32px;
  text-align: center;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.quiz-option {
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid #9da4ae;
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--text-default);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 500;
  line-height: 28px;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--green-600);
  background: var(--accent-surface-subtle);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option.is-right,
.quiz-tiles.is-right .quiz-tile {
  border-color: var(--green-600);
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 700;
}

.quiz-option.is-wrong,
.quiz-tiles.is-wrong .quiz-tile {
  border-color: #d92d20;
  background: #fef3f2;
  color: #b42318;
}

.quiz-feedback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 24px;
  text-align: center;
}

.quiz-feedback__right,
.quiz-feedback__wrong,
.quiz-bonus {
  font-size: 17px;
  font-weight: 700;
  line-height: 28px;
}

.quiz-feedback__right,
.quiz-bonus {
  color: var(--success-text);
}

.quiz-feedback__wrong {
  color: #b42318;
}

.quiz-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.quiz-tile {
  display: grid;
  place-items: center;
  width: 52px;
  height: 56px;
  padding: 0;
  border: 1px solid #9da4ae;
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--text-default);
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
  cursor: pointer;
}

.quiz-tile:disabled {
  opacity: 0.35;
  cursor: default;
}

.quiz-tiles--answer .quiz-tile:disabled {
  opacity: 1;
}

.quiz-tile--empty {
  border-style: dashed;
  background: var(--bg-neutral);
}

.quiz-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  color: var(--text-paragraph);
  font-size: 16px;
  line-height: 24px;
  text-align: center;
}

.quiz-message h3 {
  color: var(--text-default);
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
}

.quiz-result {
  color: var(--green-700);
  font-size: 48px;
  font-weight: 700;
  line-height: 56px;
}

.quiz-total {
  color: var(--text-secondary);
  font-size: 14px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.memory-card {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--green-700);
  border-radius: var(--radius-md);
  background: var(--green-600)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 88 88'%3E%3Cpath d='M44 62V40' stroke='%23fff' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M44 46c0-9-6-14-15-14 0 9 6 14 15 14zm0 6c0-7 5-11 13-11 0 7-5 11-13 11z' fill='%23fff'/%3E%3C/svg%3E")
    center / 60% no-repeat;
  color: var(--text-default);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 700;
  line-height: 24px;
  cursor: pointer;
}

.memory-card.is-open {
  border-color: var(--border);
  background: var(--bg-white);
  cursor: default;
}

.memory-card.is-matched {
  border-color: var(--green-600);
  background: var(--success-bg);
}

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

.memory-card span {
  padding: 4px;
  overflow-wrap: anywhere;
}

/* ---------- Narrow layouts (the classes of the page head script) ---------- */
html.is-medium .quiz-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html.is-narrow .map-body,
html.is-le-900 .garden-top {
  grid-template-columns: minmax(0, 1fr);
}

html.is-compact .explore {
  gap: 24px;
}

html.is-compact .quiz-grid {
  grid-template-columns: minmax(0, 1fr);
}

html.is-compact .quiz-stage {
  padding: 16px;
}

html.is-compact .quiz-options {
  grid-template-columns: minmax(0, 1fr);
}

html.is-compact .quiz-options--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html.is-compact .memory-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

html.is-compact .memory-card {
  font-size: 14px;
  line-height: 20px;
}

html.is-compact .garden-summary {
  flex-direction: column;
  align-items: flex-start;
}

html.is-compact .garden-stats {
  width: 100%;
}

html.is-compact .garden-stats > div {
  flex: 1 1 0;
}

html.is-compact .map-card,
html.is-compact .map-panel,
html.is-compact .garden-card {
  padding: 16px;
}

html.is-compact .quiz-score .btn {
  margin-inline-start: 0;
}

html.is-compact .quiz-tile {
  width: 44px;
  height: 48px;
  font-size: 20px;
}

/* Phones: the discover filters fold, and the map's names are left to the list under it. */
.discover-filters-toggle {
  display: none;
}

html.is-compact .discover-filters-toggle {
  display: inline-flex;
  align-self: flex-start;
}

html.is-compact .discover .browse-filters:not(.is-open) .browse-filters__groups,
html.is-compact .discover .browse-filters:not(.is-open) .discover-note {
  display: none;
}

html.is-compact .nation-map__labels {
  display: none;
}

html.is-compact .garden-remove,
html.is-compact .garden-clear,
html.is-compact .map-panel__back {
  min-height: 40px;
  padding-inline: 4px;
}

/* ---------- Right and wrong are told apart by a mark as well as by colour ---------- */
.quiz-option.is-right::before,
.quiz-feedback__right::before {
  content: '✓ ';
}

.quiz-option.is-wrong::before,
.quiz-feedback__wrong::before {
  content: '✕ ';
}

.map-panel__title:focus {
  outline: none;
}

/* ---------- High contrast ---------- */
html[data-contrast='high'] .explore .chip[aria-pressed='true'],
html[data-contrast='high'] .discover .chip[aria-pressed='true'],
html[data-contrast='high'] .discover .chip--active {
  border-color: #161616;
  background: #161616;
  color: #fff;
}

html[data-contrast='high'] .explore .chip[aria-pressed='true'] .chip__count,
html[data-contrast='high'] .discover .chip[aria-pressed='true'] .chip__count {
  color: #fff;
}

html[data-contrast='high'] .meter {
  border: 1px solid #161616;
}

html[data-contrast='high'] .meter > span {
  background: #161616;
}

html[data-contrast='high'] .quiz-option.is-right,
html[data-contrast='high'] .quiz-option.is-wrong {
  border-width: 3px;
  color: #161616;
}

@media print {
  .map-layers,
  .garden-clear,
  .garden-remove,
  .explore-details {
    display: none;
  }
}
