.legal-page,
.not-found-page {
  overflow-x: hidden;
  background: var(--paper);
}

.legal-hero {
  padding: 90px 20px 75px;
  background: var(--surface);
  border-bottom: 2px solid var(--ink);
}

.legal-hero-inner,
.legal-layout,
.legal-footer-inner {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.legal-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: end;
  gap: 60px;
}

.legal-page .page-kicker {
  margin: 0 0 20px;
  color: var(--coral-dark);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.legal-hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(54px, 7.4vw, 94px);
  line-height: 0.93;
  letter-spacing: -0.07em;
}

.legal-deck {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--ink-soft);
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.65;
}

.legal-stamp {
  padding: 20px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: 7px 8px 0 var(--ink);
  transform: rotate(2deg);
}

.legal-stamp span,
.legal-stamp strong { display: block; }
.legal-stamp span { font-size: 10px; font-weight: 950; letter-spacing: 0.13em; text-transform: uppercase; }
.legal-stamp strong { margin-top: 10px; font-size: 21px; line-height: 1.05; }
.legal-stamp small { display: block; margin-top: 10px; font-family: "Avenir Next", Avenir, system-ui, sans-serif; line-height: 1.45; }

.legal-layout {
  padding: 80px 0 120px;
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 75px;
  align-items: start;
}

.legal-toc {
  position: sticky;
  top: 104px;
  padding: 20px 0;
  border-block: 2px solid var(--ink);
}

.legal-toc > span {
  display: block;
  margin-bottom: 13px;
  color: var(--coral-dark);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.legal-toc a {
  min-height: 38px;
  padding: 8px 5px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.legal-toc a:hover { color: var(--ink); }
.legal-toc b { color: var(--coral-dark); font: 950 9px ui-rounded, system-ui, sans-serif; }

.legal-document { min-width: 0; }
.legal-intro-note {
  margin: 0 0 55px;
  padding: 20px 22px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 15px;
  align-items: start;
  background: #fff8e5;
  border: 1.5px solid #dfc66c;
  border-radius: 14px;
}

.legal-intro-note > b {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
}

.legal-intro-note p { margin: 0; color: var(--ink-soft); font-family: "Avenir Next", Avenir, system-ui, sans-serif; line-height: 1.6; }
.legal-intro-note strong { color: var(--ink); }

.legal-section {
  padding: 52px 0;
  scroll-margin-top: 90px;
  border-top: 1.5px solid var(--line);
}

.legal-section:first-of-type { padding-top: 0; border-top: 0; }
.legal-section-heading { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 18px; align-items: start; }
.legal-section-number {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 13px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 11px;
  font-weight: 950;
}

.legal-section:nth-of-type(3n + 1) .legal-section-number { background: #d9f3ec; }
.legal-section:nth-of-type(3n + 2) .legal-section-number { background: #ffe3dc; }
.legal-section:nth-of-type(3n) .legal-section-number { background: #e7e3ff; }
.legal-section h2 { margin: 3px 0 0; font-size: clamp(28px, 3.2vw, 40px); line-height: 1; letter-spacing: -0.045em; }

.legal-prose {
  margin: 24px 0 0 76px;
  color: #45444d;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
}

.legal-prose p { margin: 0 0 18px; }
.legal-prose h3 { margin: 28px 0 10px; color: var(--ink); font-family: ui-rounded, system-ui, sans-serif; font-size: 17px; }
.legal-prose ul { margin: 14px 0 21px; padding-left: 22px; }
.legal-prose li { margin: 8px 0; padding-left: 4px; }
.legal-prose a { color: var(--coral-dark); font-weight: 850; text-underline-offset: 3px; }

.plain-note {
  margin: 26px 0 4px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--white);
  border-left: 5px solid var(--coral);
  border-radius: 0 11px 11px 0;
  font-size: 14px;
}

.plain-note strong { font-family: ui-rounded, system-ui, sans-serif; }
.legal-contact-card { margin-top: 25px; padding: 20px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 13px; }
.legal-contact-card p:last-child { margin-bottom: 0; }

.legal-footer { color: var(--paper); background: var(--ink); }
.legal-footer .wordmark { color: var(--paper); }
.legal-footer-inner { min-height: 160px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 30px; }
.legal-footer p { margin: 8px 0 0; color: #c9c4b8; font-family: "Avenir Next", Avenir, system-ui, sans-serif; }
.legal-footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 22px; }
.legal-footer-links a { min-height: 36px; display: inline-flex; align-items: center; color: var(--paper); font-size: 12px; font-weight: 900; text-decoration: none; }

.not-found-main {
  min-height: calc(100vh - 84px);
  padding: 55px 20px 75px;
  display: grid;
  place-items: center;
  background-image: radial-gradient(var(--line) 1.1px, transparent 1.1px);
  background-size: 18px 18px;
}

.not-found-stage {
  width: min(100%, 1050px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: center;
  gap: 70px;
}

.error-code { margin: 0; color: var(--coral-dark); font-size: 12px; font-weight: 950; letter-spacing: .18em; }
.not-found-copy h1 { margin: 18px 0 0; font-size: clamp(58px, 8vw, 108px); line-height: .88; letter-spacing: -.075em; }
.not-found-copy > p:last-of-type { max-width: 610px; margin: 28px 0 0; color: var(--ink-soft); font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-size: 18px; line-height: 1.65; }
.not-found-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 13px; }

.lost-file-scene { position: relative; min-height: 455px; display: grid; place-items: center; }
.lost-file {
  position: absolute;
  width: 300px;
  min-height: 350px;
  padding: 34px;
  background: var(--white);
  border: 3px solid var(--ink);
  box-shadow: 13px 16px 0 rgba(38, 38, 46, .16);
  transform: rotate(4deg);
}
.lost-file span { font-size: 9px; font-weight: 950; letter-spacing: .14em; }
.lost-file h2 { margin: 25px 0 10px; font-size: 32px; line-height: 1; }
.lost-file p { color: var(--ink-soft); font-family: "Avenir Next", Avenir, system-ui, sans-serif; line-height: 1.55; }
.lost-file-lines { margin-top: 30px; display: grid; gap: 13px; }
.lost-file-lines i { height: 8px; background: var(--surface); border-radius: 999px; }
.lost-file-lines i:nth-child(2) { width: 70%; }
.lost-file-lines i:nth-child(3) { width: 46%; }
.lost-mascot { position: absolute; right: -9px; bottom: 0; width: 142px; height: 142px; display: block; object-fit: contain; filter: drop-shadow(0 8px 3px rgba(38,38,46,.2)); transform: rotate(-6deg); animation: lost-bob 2.2s ease-in-out infinite alternate; }
.lost-stamp { position: absolute; top: 25px; right: -15px; padding: 11px 13px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 11px; box-shadow: 4px 5px 0 var(--ink); font-size: 10px; font-weight: 950; transform: rotate(9deg); }

@keyframes lost-bob { to { transform: translateY(-8px) rotate(-2deg); } }

@media (max-width: 900px) {
  .legal-hero-inner { grid-template-columns: 1fr; gap: 38px; }
  .legal-stamp { width: min(100%, 300px); }
  .legal-layout { grid-template-columns: 1fr; gap: 45px; width: min(calc(100% - 40px), 760px); }
  .legal-toc { position: static; top: auto; }
  .legal-toc nav { display: grid; grid-template-columns: 1fr 1fr; }
  .not-found-stage { grid-template-columns: 1fr; gap: 25px; text-align: center; }
  .not-found-copy > p:last-of-type { margin-inline: auto; }
  .not-found-actions { justify-content: center; }
  .lost-file-scene { min-height: 410px; }
}

@media (max-width: 620px) {
  .legal-page .site-header .nav-login { display: none; }
  .legal-hero { padding: 65px 14px 58px; }
  .legal-hero h1 { font-size: clamp(48px, 15vw, 66px); }
  .legal-deck { font-size: 16px; }
  .legal-layout { width: min(calc(100% - 28px), 760px); padding: 55px 0 85px; }
  .legal-toc nav { grid-template-columns: 1fr; }
  .legal-section { padding: 42px 0; }
  .legal-section-heading { grid-template-columns: 46px minmax(0, 1fr); gap: 12px; }
  .legal-section-number { width: 42px; height: 42px; border-radius: 11px; }
  .legal-section h2 { margin-top: 2px; font-size: 29px; }
  .legal-prose { margin: 20px 0 0; font-size: 15px; line-height: 1.7; }
  .legal-intro-note { grid-template-columns: 1fr; }
  .legal-footer-inner { padding: 45px 14px; grid-template-columns: 1fr; text-align: center; }
  .legal-footer .wordmark { justify-self: center; }
  .legal-footer-links { justify-content: center; }
  .not-found-main { padding: 42px 14px 70px; }
  .not-found-copy h1 { font-size: clamp(57px, 20vw, 82px); }
  .not-found-copy > p:last-of-type { font-size: 16px; }
  .not-found-actions { display: grid; }
  .not-found-actions .button { width: 100%; }
  .lost-file-scene { min-height: 360px; }
  .lost-file { width: 245px; min-height: 300px; padding: 27px; }
  .lost-file h2 { font-size: 27px; }
  .lost-mascot { right: 4px; width: 108px; height: 108px; }
  .lost-stamp { right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lost-mascot { animation: none; }
}
