/*
 * Legal pages: a parchment scroll on the grove canvas.
 */

.legal-grove {
  min-height: 100svh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-block: clamp(6rem, 10vw, 8.5rem) clamp(3rem, 6vw, 5rem);
  background: var(--kw-product-profile-canvas) center / cover no-repeat #cbe9bd;
}

.legal-scroll {
  position: relative;
  z-index: 3;
  display: flex;
  width: min(64rem, 100%);
  flex-direction: column;
  padding: clamp(4rem, 7vw, 6.5rem) clamp(2.5rem, 7vw, 7rem);
  background: var(--kw-ui-conversation-scroll) center / 100% 100% no-repeat;
  filter: drop-shadow(0 2.2rem 2.8rem rgba(10, 35, 22, 0.35));
  isolation: isolate;
}

.legal-scroll::before {
  content: "";
  position: absolute;
  inset: clamp(1.8rem, 3.2vw, 2.8rem) clamp(1.2rem, 3.2vw, 2.6rem);
  z-index: -1;
  background: rgba(255, 253, 246, 0.94); /* High opacity cream color for excellent contrast */
  border: 1px solid rgba(91, 50, 24, 0.12);
  border-radius: 0.95rem;
  box-shadow: 
    inset 0 0 2rem rgba(91, 50, 24, 0.05),
    0 0.25rem 0.5rem rgba(0, 0, 0, 0.02);
}

.legal-kicker {
  margin: 0 0 0.6rem;
  color: #7a583a;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.legal-scroll h1 {
  margin: 0;
  color: #103c2c;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
  letter-spacing: -0.02em;
}

.legal-scroll > p:not(.legal-kicker) {
  margin: 1rem auto 0;
  max-width: 46rem;
  color: #1b4332;
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  font-weight: 550; /* readable but distinct weight */
  text-align: center;
  line-height: 1.55;
  text-wrap: pretty;
}

.legal-section {
  display: grid;
  gap: 0.8rem;
  margin-top: 2.2rem;
  border-top: 1px dashed rgba(91, 50, 24, 0.15);
  padding-top: 1.8rem;
}

.legal-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 2rem;
}

.legal-section h2 {
  margin: 0 0 0.2rem;
  color: #103c2c;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.legal-section p {
  margin: 0;
  color: #213628;
  font-family: var(--font-body);
  font-weight: 480; /* Perfect readability weight */
  font-size: 0.975rem;
  line-height: 1.65;
  text-wrap: pretty;
}

.legal-section a {
  color: #2d6a4f;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(45, 106, 79, 0.4);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  transition: color 200ms ease, text-decoration-color 200ms ease;
}

.legal-section a:hover {
  color: #1b4332;
  text-decoration-color: #1b4332;
}

.legal-list {
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.legal-list li {
  position: relative;
  padding: 0.95rem 1.25rem 1.05rem;
  color: #213628;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(91, 50, 24, 0.15);
  border-radius: 0.65rem;
  font-family: var(--font-body);
  font-weight: 480; /* Highly readable weight */
  font-size: 0.95rem;
  line-height: 1.6;
  text-wrap: pretty;
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease, border-color 220ms ease, background-color 220ms ease;
}

.legal-list li:hover {
  transform: translateY(-0.1rem);
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(91, 50, 24, 0.28);
  box-shadow: 
    0 0.4rem 0.8rem rgba(91, 50, 24, 0.06),
    0 0.08rem 0.16rem rgba(91, 50, 24, 0.02);
}

.legal-list b {
  color: #103c2c;
  font-family: var(--font-display);
  font-weight: 800;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 2.6rem;
  border-top: 1px solid rgba(91, 50, 24, 0.12);
  padding-top: 2rem;
}

@media (max-width: 720px) {
  .legal-grove {
    padding: 5.5rem 0.85rem 2rem;
  }

  .legal-scroll {
    padding: 3.5rem 1.5rem 3.2rem;
    background-size: cover;
    border-radius: 1rem;
    overflow: hidden;
  }

  .legal-scroll::before {
    inset: 1.2rem 0.8rem;
    background: rgba(255, 253, 246, 0.95);
  }

  .legal-list li {
    padding: 0.85rem 1rem 0.95rem;
  }

  .legal-section {
    margin-top: 1.8rem;
    padding-top: 1.4rem;
  }
  
  .legal-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
}

/* Bilingual visibility toggles */
html[lang="en"] [lang="es"],
html:not([lang="es"]) [lang="es"] {
  display: none !important;
}
html[lang="es"] [lang="en"] {
  display: none !important;
}

/* ---------- dark storybook legal pass ---------- */

.legal-grove {
  background:
    radial-gradient(circle at 74% 10%, rgba(105, 78, 158, 0.22), transparent 24rem),
    linear-gradient(180deg, var(--kw-story-night), #0f0d20);
}

.legal-grove .asset-layer {
  opacity: 0.14;
  filter: saturate(0.5) brightness(0.7);
}

.legal-scroll {
  background: var(--kw-story-panel);
  border: 0.06rem solid var(--kw-story-line);
  border-radius: 0.8rem;
  filter: none;
}

.legal-scroll::before {
  background: rgba(23, 22, 41, 0.86);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.legal-kicker,
.legal-section a {
  color: var(--kw-story-cream);
}

.legal-scroll h1,
.legal-section h2,
.legal-list b {
  color: #fff;
}

.legal-scroll > p:not(.legal-kicker),
.legal-scroll > div > p:not(.legal-kicker),
.legal-section p,
.legal-list li {
  color: #ebe7f8;
}

.legal-section {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.legal-list li {
  background: #242235;
  border-color: var(--kw-story-line);
}

.legal-list li:hover {
  background: #2f2c44;
  border-color: #625b7b;
  box-shadow: none;
}

.legal-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}
