/* ── Legal pages (privacidad.html, terminos.html) ── */

/* Nav: override 3-col grid to 2-col (no center slot needed on legal pages) */
body.legal .site-nav {
  grid-template-columns: 1fr auto;
}

/* Nav color fix: hero is dark, nav starts transparent with --ink text */
body.legal .site-nav:not(.is-scrolled) {
  color: var(--white);
}

/* ── Hero ── */

.legal-hero {
  padding: clamp(7rem, 14vw, 11rem) var(--grid-pad) clamp(3.5rem, 7vw, 5.5rem);
  background: var(--ink);
  color: var(--white);
}

.legal-hero-inner {
  max-width: 82rem;
  margin: 0 auto;
}

.legal-hero .rule {
  margin-bottom: 1.1rem;
}

.legal-hero .section-label {
  color: var(--dark-muted);
  margin: 0;
}

.legal-hero h1 {
  margin: 1.1rem 0 0;
  font-family: var(--display);
  font-size: clamp(3.8rem, 9vw, 10rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.86;
  text-transform: uppercase;
}

.legal-back {
  display: inline-block;
  margin-top: 2.2rem;
  color: var(--dark-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.12rem;
  transition: color 160ms ease, border-color 160ms ease;
}

.legal-back:hover {
  color: var(--white);
  border-bottom-color: var(--white);
}

/* ── Page layout ── */

.legal-outer {
  max-width: 82rem;
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) var(--grid-pad) clamp(5rem, 10vw, 8rem);
}

@media (min-width: 1100px) {
  .legal-outer {
    display: grid;
    grid-template-columns: 14rem 1fr;
    gap: clamp(4rem, 7vw, 8rem);
    align-items: start;
  }
}

/* ── Table of contents ── */

.legal-toc {
  display: none;
}

@media (min-width: 1100px) {
  .legal-toc {
    display: block;
    position: sticky;
    top: 5.5rem;
    align-self: start;
  }
}

.toc-heading {
  margin: 0 0 1.1rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid rgba(10, 10, 10, 0.1);
  display: grid;
  gap: 0;
}

.toc-list li a {
  display: block;
  padding: 0.42rem 0 0.42rem 1rem;
  margin-left: -1px;
  font-size: 0.8rem;
  line-height: 1.38;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.toc-list li a:hover {
  color: var(--ink);
}

.toc-list li a.is-active {
  color: var(--ink);
  border-left-color: var(--ink);
  font-weight: 500;
}

/* ── Content column ── */

.legal-content {
  min-width: 0;
}

.legal-preamble {
  padding-bottom: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0;
  border-bottom: 1px solid rgba(10, 10, 10, 0.1);
}

.legal-updated {
  display: block;
  margin-bottom: 1.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.legal-intro {
  max-width: 65ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.1vw, 1.06rem);
  line-height: 1.78;
}

/* ── Sections ── */

.legal-section {
  padding-top: clamp(2rem, 4vw, 2.8rem);
  padding-bottom: clamp(2rem, 4vw, 2.8rem);
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}

.legal-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.section-kicker {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(10, 10, 10, 0.35);
}

.legal-section h2 {
  margin: 0 0 1.4rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.8vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 0.94;
  text-transform: uppercase;
  color: var(--ink);
}

.legal-section p {
  max-width: 65ch;
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.05vw, 1.04rem);
  line-height: 1.78;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section p a {
  color: var(--ink);
  border-bottom: 1px solid rgba(10, 10, 10, 0.28);
  transition: border-color 160ms ease;
}

.legal-section p a:hover {
  border-bottom-color: var(--ink);
}

.legal-section ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.15rem;
  max-width: 65ch;
  display: grid;
  gap: 0.55rem;
}

.legal-section ul:last-child {
  margin-bottom: 0;
}

.legal-section ul li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--muted);
  font-size: clamp(0.93rem, 1vw, 1.02rem);
  line-height: 1.72;
}

.legal-section ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 0.36rem;
  height: 0.36rem;
  border: 1px solid currentColor;
  transform: translateY(-50%);
}

.legal-section strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── Footer note ── */

.legal-footnote {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: 1.4rem;
  border-top: 1px solid rgba(10, 10, 10, 0.1);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Mobile ── */

@media (max-width: 767px) {
  .legal-outer {
    padding-top: 3rem;
    padding-bottom: 3.5rem;
  }

  .legal-section {
    padding-top: 1.8rem;
    padding-bottom: 1.8rem;
  }

  .legal-section h2 {
    font-size: clamp(1.4rem, 7vw, 2rem);
    margin-bottom: 1.1rem;
  }
}

/* ── 404 Error page ── */

body.error-page .site-nav:not(.is-scrolled) {
  color: var(--white);
}

body.error-page .site-nav.is-scrolled {
  background: rgba(10, 10, 10, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.error-hero {
  position: relative;
  min-height: 100svh;
  background: var(--ink);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(8rem, 15vw, 12rem) var(--grid-pad) clamp(7rem, 12vw, 10rem);
  overflow: hidden;
  isolation: isolate;
}

.error-hero #pointcloud {
  opacity: 0.85;
  animation: canvasFadeIn 2s ease-out both;
}

/* Grid decoration — upper right */
.error-hero::before {
  content: "";
  position: absolute;
  top: clamp(6rem, 10vw, 9rem);
  right: var(--grid-pad);
  width: min(42vw, 36rem);
  height: min(34vw, 28rem);
  background:
    linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 2.5rem 2.5rem;
  pointer-events: none;
  z-index: 0;
  animation: errorGridIn 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

@keyframes errorGridIn {
  from { opacity: 0; transform: translate3d(0, 1.5rem, 0) scale(0.98); transform-origin: top right; }
  to   { opacity: 0.18; transform: translate3d(0, 0, 0) scale(1); transform-origin: top right; }
}

@keyframes errorCodeIn {
  from { opacity: 0; transform: scaleX(1.045); }
  to   { opacity: 1; transform: scaleX(1); }
}

.error-inner {
  position: relative;
  z-index: 1;
  max-width: 72rem;
}

.error-inner .rule {
  margin-bottom: 1.1rem;
  animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.error-inner .section-label {
  color: var(--dark-muted);
  margin: 0 0 1.5rem;
  animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
}

.error-code {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(9rem, 21vw, 25rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.76;
  text-transform: uppercase;
  color: var(--white);
  animation: errorCodeIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.error-msg {
  max-width: 34rem;
  margin: 2.8rem 0 0;
  color: var(--dark-muted);
  font-size: clamp(1rem, 1.2vw, 1.18rem);
  line-height: 1.72;
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.45s both;
}

.error-actions {
  display: flex;
  align-items: center;
  gap: 2.4rem;
  margin-top: 3rem;
  flex-wrap: wrap;
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.62s both;
}

.error-link {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dark-muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 0.12rem;
  transition: color 160ms ease, border-color 160ms ease;
}

.error-link:hover {
  color: var(--white);
  border-bottom-color: var(--white);
}

.error-coordinates {
  position: absolute;
  z-index: 1;
  right: var(--grid-pad);
  bottom: clamp(2.4rem, 5vh, 4rem);
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.7rem, 0.8vw, 0.82rem);
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.32);
  animation: heroFadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) 1.1s both;
}

.error-coordinates .rule {
  margin-bottom: 0.45rem;
  background: rgba(255, 255, 255, 0.32);
}

@media (max-width: 768px) {
  .error-hero::before {
    display: none;
  }

  .error-code {
    font-size: clamp(7rem, 28vw, 9rem);
  }

  .error-msg br {
    display: none;
  }

  .error-coordinates {
    display: none;
  }
}
