/* Legal documents — /privacidad and /condiciones (AUTH_ACCOUNTS_UX_PLAN Slice 2).
   Loaded only by templates/legal/. The pages are public: they render inside the
   auth shell (body.auth-shell > main.auth-page) when logged out and inside the
   app shell (.content) when logged in, so every rule works in both contexts. */

.legal-doc {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: clamp(30px, 5vw, 54px) clamp(22px, 5vw, 58px) clamp(28px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
  color: var(--brown);
  font-family: var(--font-serif);
}

/* The auth-page flex row would stretch the card to the viewport cross axis;
   long documents should size to their content and read from the top. */
.auth-page .legal-doc {
  align-self: flex-start;
}

/* ---- Masthead ------------------------------------------------------- */

.legal-masthead {
  text-align: center;
}

.legal-home {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  text-decoration: none;
}

.legal-home .brand-mark.legal-coin {
  width: 54px;
  height: 54px;
  font-size: 1.45rem;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--line);
}

.legal-wordmark {
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--brown);
}

.legal-home:hover .legal-wordmark {
  color: var(--brown-soft);
}

.legal-home:focus-visible {
  outline: 2px solid var(--brown-soft);
  outline-offset: 4px;
  border-radius: 8px;
}

.legal-kicker {
  margin: 0 0 6px;
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--olive);
}

.legal-masthead h1 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 4.5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--brown);
}

.legal-version {
  display: inline-block;
  margin: 0 0 20px;
  padding: 5px 16px;
  border: 1px solid rgba(182, 139, 60, 0.5);
  border-radius: 999px;
  background: rgba(182, 139, 60, 0.07);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--brown-soft);
}

/* Hairline rule with the small gold diamond ornament (matches the auth card). */
.legal-rule {
  position: relative;
  overflow: visible;
  width: 82%;
  height: 1px;
  margin: 0 auto 26px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent);
}

.legal-rule::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--paper);
  border: 1px solid var(--gold);
}

/* ---- Table of contents ---------------------------------------------- */

.legal-toc {
  margin: 0 0 8px;
  padding: 18px 24px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--parchment);
}

.legal-toc-title {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--olive);
}

.legal-toc ol {
  margin: 0;
  padding-left: 1.6em;
  list-style: upper-roman;
  font-family: var(--font-ui);
  font-size: 0.98rem;
  line-height: 1.4;
}

.legal-toc li {
  margin: 5px 0;
  break-inside: avoid;
}

.legal-toc li::marker {
  color: var(--gold);
  font-size: 0.9em;
}

.legal-toc a {
  display: inline-block;
  padding: 3px 2px;
  color: var(--brown-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(116, 86, 60, 0.4);
}

@media (min-width: 640px) {
  .legal-toc ol {
    columns: 2;
    column-gap: 40px;
  }
}

/* ---- Document body --------------------------------------------------- */

.legal-body {
  font-size: 1.05rem;
  line-height: 1.7;
}

.legal-body section {
  scroll-margin-top: 90px;
}

.legal-body h2 {
  margin: 2.1em 0 0.65em;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  color: var(--brown);
}

.legal-body section:first-child h2 {
  margin-top: 1.3em;
}

.legal-body h2::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 12px;
  vertical-align: 3px;
  transform: rotate(45deg);
  border: 1px solid var(--gold);
  background: rgba(182, 139, 60, 0.16);
}

.legal-body p {
  margin: 0 0 1em;
}

.legal-body ul {
  margin: 0 0 1em;
  padding-left: 1.3em;
}

.legal-body li {
  margin: 0.55em 0;
}

.legal-body li::marker {
  color: var(--olive);
}

.legal-body strong {
  color: var(--brown);
}

.legal-body a,
.legal-endnote a,
.legal-toc a {
  color: var(--brown-soft);
}

.legal-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-body a:hover,
.legal-toc a:hover,
.legal-endnote a:hover {
  color: var(--brown);
}

.legal-body a:focus-visible,
.legal-toc a:focus-visible,
.legal-endnote a:focus-visible {
  outline: 2px solid var(--brown-soft);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---- Endnote ---------------------------------------------------------- */

.legal-endnote {
  margin-top: 34px;
  text-align: center;
  font-family: var(--font-ui);
}

.legal-endnote .legal-rule {
  margin-bottom: 22px;
}

.legal-sibling {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: var(--gray);
}

.legal-return {
  margin: 0;
  font-size: 0.98rem;
}

.legal-return a {
  display: inline-block;
  padding: 9px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Mobile: full-bleed sheet on the auth shell ----------------------- */

@media (max-width: 900px) {
  .auth-shell .legal-doc {
    width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: clamp(26px, 7vw, 44px) clamp(18px, 5.5vw, 34px) 38px;
  }

  .legal-body section {
    scroll-margin-top: 20px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html:has(.legal-doc) {
    scroll-behavior: smooth;
  }
}

@media print {
  .legal-doc {
    width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }

  .legal-return,
  .site-footer {
    display: none;
  }
}
