/* ==========================================================================
   Legal pages (Terms, Privacy, Refund) — container layout + modern design
   Load AFTER style.css:  <link rel="stylesheet" href="<?= $this->asset('css/legal.css') ?>">
   Everything lives inside the same container as the header/footer.
   ========================================================================== */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

html body.page-legal.page-landing {
  --lg-w: min(100% - (var(--gutter) * 2), var(--container));
  --lg-ink: #0b1f3a;
  --lg-text: #41536d;
}

/* ---------- Hero: a contained banner ---------- */
html body.page-legal.page-landing .hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 48px;
  width: var(--lg-w);
  min-height: 0;
  margin: 32px auto 0;
  padding: clamp(36px, 5vw, 64px) clamp(24px, 5vw, 64px);
  border: 0;
  border-radius: 28px;
  text-align: left;
  background: linear-gradient(135deg, var(--brand-blue-deep) 0%, var(--brand-blue) 62%, #2467b5 100%);
  box-shadow: 0 34px 70px -34px rgba(16, 42, 86, .6);
}
html body.page-legal.page-landing .hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  width: auto; height: auto; top: 0; left: 0; border-radius: 0; filter: none; animation: none; opacity: 1;
  background:
    radial-gradient(50% 90% at 100% 0%, rgba(114, 199, 255, .38), transparent 65%),
    radial-gradient(40% 70% at 0% 100%, rgba(31, 111, 235, .45), transparent 70%);
}
html body.page-legal.page-landing .hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(70% 100% at 80% 20%, #000, transparent 75%);
          mask-image: radial-gradient(70% 100% at 80% 20%, #000, transparent 75%);
}
html body.page-legal.page-landing .hero h1 {
  grid-column: 1; grid-row: 1; align-self: end;
  max-width: 18ch; margin: 0 0 14px;
  color: #fff;
  font-size: clamp(32px, 4.4vw, 52px);
  font-weight: 780; line-height: 1.06; letter-spacing: -.035em;
  text-wrap: balance;
}
html body.page-legal.page-landing .hero h1 .blue {
  background: linear-gradient(95deg, #72c7ff, #d6eeff);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
html body.page-legal.page-landing .hero-sub {
  grid-column: 1; grid-row: 2; align-self: start;
  max-width: 48ch; margin: 0;
  color: #c6d7ef; font-size: 17px; line-height: 1.65;
}
html body.page-legal.page-landing .hero-art {
  grid-column: 2; grid-row: 1 / span 2; justify-self: end; align-self: center;
  width: 220px; margin: 0; padding: 14px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 26px;
  background: linear-gradient(160deg, #fff, #eaf3ff);
  box-shadow: 0 28px 56px -18px rgba(5, 18, 45, .6);
  transform: rotate(2.5deg);
  animation: legal-art-float 6s ease-in-out infinite;
}
@keyframes legal-art-float { 0%,100% { transform: rotate(2.5deg) translateY(0); } 50% { transform: rotate(2.5deg) translateY(-8px); } }

/* ---------- Content section ---------- */
html body.page-legal.page-landing main > section:not(.hero):not(.cta-section) {
  width: var(--lg-w);
  margin: 0 auto;
  padding: 56px 0 24px;
}
html body.page-legal.page-landing main > section:not(.hero):not(.cta-section) .section-inner {
  width: 100%; max-width: none; margin: 0;
}
html body.page-legal.page-landing .section-inner.has-toc {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  column-gap: 40px;
  align-items: start;
}
.page-legal .section-inner.has-toc > .section-label,
.page-legal .section-inner.has-toc > .section-title,
.page-legal .section-inner.has-toc > .section-sub { grid-column: 1 / -1; }

html body.page-legal.page-landing .section-label { margin-bottom: 14px; }
html body.page-legal.page-landing .section-title {
  margin-bottom: 14px;
  color: var(--lg-ink);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 760; letter-spacing: -.03em; line-height: 1.12;
}
html body.page-legal.page-landing .section-sub {
  max-width: 820px;
  margin: 0 0 40px;
  padding: 2px 0 2px 20px;
  border: 0; border-left: 3px solid var(--site-accent); border-radius: 0;
  background: none; box-shadow: none;
  color: var(--lg-text); font-size: 16px; line-height: 1.75;
}

/* ---------- Sticky table of contents ---------- */
.page-legal .lg-toc {
  grid-column: 1; grid-row: 4;
  position: sticky; top: calc(var(--chrome-h, 72px) + 24px);
  max-height: calc(100vh - var(--chrome-h, 72px) - 48px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--site-border); border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 40px -26px rgba(14, 26, 46, .3);
}
.page-legal .lg-toc-title {
  margin: 4px 10px 10px;
  color: var(--site-muted); font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.page-legal .lg-toc a {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--lg-text); font-size: 13.5px; font-weight: 500; line-height: 1.4; text-decoration: none;
  transition: background-color .15s, color .15s;
}
.page-legal .lg-toc a > span:first-child {
  flex: 0 0 20px; color: #8a9bb2; font-size: 12px; font-variant-numeric: tabular-nums;
}
.page-legal .lg-toc a:hover { background: var(--site-highlight-strong); color: var(--site-accent); }
.page-legal .lg-toc a.is-active { background: rgba(31, 111, 235, .1); color: var(--site-accent); font-weight: 650; }
.page-legal .lg-toc a.is-active > span:first-child { color: var(--site-accent); }

/* ---------- Cards ---------- */
html body.page-legal.page-landing .terms-list {
  grid-column: 2; grid-row: 4;
  display: flex; flex-direction: column; gap: 16px;
  width: 100%; max-width: none; margin: 0;
}
html body.page-legal.page-landing .terms-list .feature-card {
  position: relative;
  scroll-margin-top: calc(var(--chrome-h, 72px) + 20px);
  padding: 28px 32px;
  border: 1px solid var(--site-border); border-radius: 20px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(14, 26, 46, .04);
  transition: border-color .2s, box-shadow .2s;
}
html body.page-legal.page-landing .terms-list .feature-card:hover {
  background: #fff;
  border-color: rgba(31, 111, 235, .35);
  box-shadow: 0 22px 44px -28px rgba(31, 111, 235, .4);
}
html body.page-legal.page-landing .terms-list .feature-title {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 16px;
  color: var(--lg-ink); font-size: 19px; font-weight: 700; letter-spacing: -.015em; line-height: 1.3;
}
.page-legal .lg-num {
  display: grid; place-items: center; flex: 0 0 34px;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, #3b86f5, var(--site-accent));
  color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 8px 16px -8px rgba(31, 111, 235, .7);
}
html body.page-legal.page-landing .terms-list .feature-desc {
  margin: 0 0 12px; color: var(--lg-text); font-size: 15px; line-height: 1.75;
}
html body.page-legal.page-landing .terms-list .feature-desc:last-child { margin-bottom: 0; }
.page-legal .terms-list strong { color: var(--lg-ink); font-weight: 650; }

.page-legal .terms-list ul { margin: 12px 0 0; padding: 0; list-style: none; }
.page-legal .terms-list .feature-desc + ul { margin-top: 4px; }
.page-legal .terms-list li {
  position: relative; margin: 0 0 10px; padding-left: 24px;
  color: var(--lg-text); font-size: 15px; line-height: 1.7;
}
.page-legal .terms-list li:last-child { margin-bottom: 0; }
.page-legal .terms-list li::before {
  content: ""; position: absolute; left: 4px; top: .62em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--site-accent); box-shadow: 0 0 0 3px rgba(31, 111, 235, .14);
}
.page-legal .terms-list ul ul { margin-top: 10px; padding-left: 4px; }
.page-legal .terms-list ul ul li::before { background: #38a8ff; box-shadow: none; width: 6px; height: 6px; }
.page-legal .terms-list a {
  color: var(--site-accent); font-weight: 600;
  text-decoration: underline; text-decoration-color: rgba(31, 111, 235, .35); text-underline-offset: 3px;
}
.page-legal .terms-list a:hover { color: #0f4fc2; text-decoration-color: currentColor; }

/* ---------- Contact band: contained card ---------- */
html body.page-legal.page-landing .cta-section {
  position: relative; isolation: isolate; overflow: hidden;
  width: var(--lg-w);
  margin: 32px auto 80px;
  padding: clamp(44px, 6vw, 72px) 24px;
  border: 0; border-radius: 28px; text-align: center;
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(114, 199, 255, .38), transparent 60%),
    linear-gradient(135deg, #0b1f3a 0%, var(--brand-blue-deep) 45%, var(--brand-blue) 100%);
  box-shadow: 0 34px 70px -34px rgba(16, 42, 86, .6);
}
html body.page-legal.page-landing .cta-section .section-inner { max-width: 640px; margin-inline: auto; }
html body.page-legal.page-landing .cta-section h2 {
  margin: 0 0 12px; color: #fff; text-shadow: none;
  font-size: clamp(26px, 3.4vw, 38px); font-weight: 740; letter-spacing: -.03em;
}
html body.page-legal.page-landing .cta-section p { margin: 0 0 28px; color: #c6d7ef; font-size: 16px; line-height: 1.65; }
html body.page-legal.page-landing .cta-section .btn-primary {
  background: #fff; color: #1348b8; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5);
}
html body.page-legal.page-landing .cta-section .btn-primary:hover { background: #eef5ff; color: #1348b8; }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 1000px) {
  html body.page-legal.page-landing .section-inner.has-toc { display: block; }
  .page-legal .lg-toc {
    position: static; display: flex; gap: 6px; max-height: none;
    margin: 0 0 20px; padding: 8px; overflow-x: auto; overflow-y: hidden;
    border-radius: 14px; scrollbar-width: none;
  }
  .page-legal .lg-toc::-webkit-scrollbar { display: none; }
  .page-legal .lg-toc-title { display: none; }
  .page-legal .lg-toc a { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; }
}
@media (max-width: 800px) {
  html body.page-legal.page-landing .hero { grid-template-columns: 1fr; text-align: center; margin-top: 20px; border-radius: 22px; }
  html body.page-legal.page-landing .hero h1,
  html body.page-legal.page-landing .hero-sub { grid-column: 1; grid-row: auto; margin-inline: auto; }
  html body.page-legal.page-landing .hero-art {
    grid-column: 1; grid-row: auto; justify-self: center;
    width: 120px; margin-top: 24px; padding: 10px; border-radius: 18px;
  }
}
@media (max-width: 600px) {
  html body.page-legal.page-landing main > section:not(.hero):not(.cta-section) { padding-top: 40px; }
  html body.page-legal.page-landing .terms-list .feature-card { padding: 22px 20px; border-radius: 16px; }
  html body.page-legal.page-landing .terms-list .feature-title { font-size: 17px; gap: 12px; }
  html body.page-legal.page-landing .cta-section { margin-bottom: 56px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html body.page-legal.page-landing .hero-art { animation: none; }
}