/**
 * Meadow School — child-facing entry page.
 *
 * Warmer and greener than the rest of the app chrome, so walking into the tab
 * already feels like walking into the meadow. Layered on top of theme.css.
 */

.meadow-page {
  --meadow-slate: #31423a;
  --meadow-cream: #fff7e2;
  --meadow-warm: #ffd88a;
  --meadow-green: #4a7f3f;
  display: grid;
  gap: 1.25rem;
}

.meadow-loading {
  padding: 3rem 0;
  text-align: center;
  opacity: 0.7;
}

/* ------------------------------------------------------------------- hero */

.meadow-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: clamp(230px, 34vw, 340px);
  display: flex;
  align-items: flex-end;
  padding: clamp(1.2rem, 3vw, 2rem);
  color: #fffdf6;
  /* The scrim hugs the text side only: strong under the words, gone by
     mid-image so the artwork keeps its true colours. Legibility over the
     art's brighter patches comes from the text shadow below, not the tint. */
  background:
    linear-gradient(100deg, rgba(28, 44, 34, 0.78) 0%, rgba(28, 44, 34, 0.45) 30%, rgba(28, 44, 34, 0) 55%),
    url("../meadow-school/start-bg.png") center / cover no-repeat,
    linear-gradient(180deg, #74c4f7 0%, #b8e2ff 48%, #ffeec4 100%);
  box-shadow: 0 14px 40px rgba(24, 44, 32, 0.22);
  text-shadow: 0 1px 3px rgba(20, 32, 24, 0.55);
}

.meadow-hero-plain {
  min-height: 0;
  background: linear-gradient(120deg, #31423a, #4a7f3f);
  align-items: center;
  justify-content: center;
  text-align: center;
}

.meadow-hero-body {
  max-width: 34rem;
}

.meadow-kicker {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--meadow-warm);
}

.meadow-hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 4.6vw, 2.4rem);
  line-height: 1.15;
}

.meadow-hero p {
  margin: 0 0 1rem;
  line-height: 1.5;
  color: #eef6ea;
}

.meadow-lead {
  font-size: clamp(0.98rem, 2.4vw, 1.1rem);
}

.meadow-hero .btn {
  text-shadow: none;
}

.btn-enter {
  padding: 0.85rem 1.8rem;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  font-weight: 800;
  border-radius: 999px;
}

/* ------------------------------------------------------------ next lesson */

/*
 * Section headings sit between cream cards on a dark page, so they need to
 * clearly belong to the cards BELOW them: generous air above (padding-top on
 * top of the page gap), a short gap below, and the warm gold that the rest of
 * the app uses for row headings.
 */
.meadow-next h2,
.meadow-alts h2,
.meadow-catalogue h2 {
  margin: 0 0 0.8rem;
  padding-top: 1.1rem;
  font-size: 1.12rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--meadow-warm);
}

.meadow-lesson-card {
  display: grid;
  grid-template-columns: minmax(0, 150px) 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem;
  border-radius: 18px;
  text-decoration: none;
  /* Do not inherit the dark-page chalk colour — this card is cream. */
  color: var(--meadow-slate);
  background: var(--meadow-cream);
  border: 2px solid rgba(74, 127, 63, 0.35);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.meadow-lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(24, 44, 32, 0.16);
}

.meadow-lesson-art,
.meadow-alt-art {
  overflow: hidden;
  border-radius: 14px;
  aspect-ratio: 4 / 3;
  background: linear-gradient(160deg, #9fd98a, #4a7f3f);
}

.meadow-lesson-art img,
.meadow-alt-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.meadow-lesson-body h3 {
  margin: 0.3rem 0 0.35rem;
  font-size: 1.2rem;
  color: #1c2c22;
}

.meadow-lesson-body p {
  margin: 0 0 0.35rem;
  line-height: 1.45;
  font-size: 0.92rem;
  color: #3a4f44;
}

.meadow-why {
  font-size: 0.85rem;
  color: #5a6e62;
}

.meadow-reason {
  display: inline-block;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(74, 127, 63, 0.16);
  color: var(--meadow-green);
}

.meadow-reason.queued {
  background: rgba(224, 144, 42, 0.18);
  color: #9a5c0f;
}

.meadow-reason.review {
  background: rgba(214, 90, 70, 0.16);
  color: #a63c2a;
}

/* ---------------------------------------------------------- alternatives */

.meadow-alt-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.meadow-alt-card {
  display: block;
  padding: 0.6rem;
  border-radius: 16px;
  text-decoration: none;
  color: var(--meadow-slate);
  background: var(--meadow-cream);
  border: 1px solid rgba(74, 127, 63, 0.28);
  transition: transform 0.15s ease;
}

.meadow-alt-card:hover {
  transform: translateY(-2px);
}

.meadow-alt-body h3 {
  margin: 0.5rem 0 0.3rem;
  font-size: 0.98rem;
  color: #1c2c22;
}

.meadow-status {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
  background: rgba(0, 0, 0, 0.07);
}

.meadow-status.mastered {
  background: rgba(74, 127, 63, 0.18);
  color: var(--meadow-green);
}

.meadow-status.needs_review {
  background: rgba(214, 90, 70, 0.16);
  color: #a63c2a;
}

/* ------------------------------------------------------------- catalogue */

.meadow-catalogue-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.meadow-catalogue-filters select {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(74, 127, 63, 0.35);
  background: var(--meadow-cream);
  color: var(--meadow-slate);
  cursor: pointer;
}

.meadow-catalogue-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.meadow-catalogue-meta {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #5a6e62;
}

.meadow-catalogue-empty {
  margin: 0;
  padding: 1rem 0.2rem;
  color: #5a6e62;
  font-size: 0.95rem;
}

/* Subject — Strand group headings between the card rows. */
.meadow-cat-group + .meadow-cat-group {
  margin-top: 1.4rem;
}

.meadow-cat-heading {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--meadow-warm);
}

/* Catalogue cards: the art and title are the link; the body carries the
   skill line, a clamped description and the curriculum button. */
.meadow-cat-card {
  display: flex;
  flex-direction: column;
}

.meadow-cat-card .meadow-alt-art {
  display: block;
}

.meadow-cat-card h3 a {
  color: inherit;
  text-decoration: none;
}

.meadow-cat-card h3 a:hover {
  text-decoration: underline;
}

.meadow-cat-card .meadow-alt-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.meadow-cat-skill {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--meadow-green);
}

.meadow-cat-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.meadow-cat-details {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  border: none;
  background: none;
  padding: 0.2rem 0.3rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--meadow-green);
  cursor: pointer;
  border-radius: 8px;
}

.meadow-cat-details:hover {
  text-decoration: underline;
}

/* --------------------------------------------------- curriculum details */

.meadow-details-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 32, 24, 0.55);
}

.meadow-details-panel {
  position: relative;
  width: min(30rem, 100%);
  max-height: min(80vh, 34rem);
  overflow: auto;
  padding: 1.3rem 1.4rem;
  border-radius: 18px;
  background: var(--meadow-cream, #fff7e2);
  color: #31423a;
  border: 2px solid rgba(74, 127, 63, 0.35);
  box-shadow: 0 18px 50px rgba(10, 20, 14, 0.4);
}

.meadow-details-panel h3 {
  margin: 0 0 0.3rem;
  padding-right: 2rem;
  font-size: 1.25rem;
  color: #1c2c22;
}

.meadow-details-desc {
  margin: 0 0 0.8rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #3a4f44;
}

.meadow-details-skill {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(74, 127, 63, 0.1);
  font-size: 0.86rem;
  line-height: 1.5;
  color: #3a4f44;
}

.meadow-skill-code {
  display: inline-block;
  margin: 0 0.4rem 0.25rem 0;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  /* Hard-coded: the overlay mounts on <body>, outside .meadow-page, so the
     page's --meadow-green custom property is not in scope here. */
  background: #4a7f3f;
  color: #fff7e2;
}

.meadow-details-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.meadow-details-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(74, 127, 63, 0.14);
  color: #31423a;
  font-size: 0.95rem;
  cursor: pointer;
}

.meadow-details-close:hover {
  background: rgba(74, 127, 63, 0.26);
}

@media (max-width: 560px) {
  .meadow-lesson-card {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .meadow-lesson-card,
  .meadow-alt-card {
    transition: none;
  }
}
