/* ==========================================================================
   BrainCrete — legal pages (Terms of Service, Privacy Policy)
   Builds on the tokens in /assets/css/style.css
   ========================================================================== */

.legal-page { background: var(--surface-alt); }
.legal-page .nav { background: rgba(255, 255, 255, 0.95); }

/* ---------- reading progress ---------- */
.lg-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 200; background: transparent; pointer-events: none; }
.lg-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); box-shadow: 0 0 12px rgba(14, 164, 114, .6); transition: width .08s linear; }

/* ---------- hero ---------- */
.lg-hero {
  position: relative; overflow: hidden; color: #cbd5e1;
  background: #0b1220;
  padding: 56px 0 0;
  isolation: isolate;
}
.lg-hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 140%; z-index: -2;
  background:
    radial-gradient(620px 360px at 88% 8%, rgba(14, 164, 114, .34), transparent 62%),
    radial-gradient(520px 320px at 4% 0%, rgba(242, 177, 52, .16), transparent 60%),
    radial-gradient(700px 420px at 50% 120%, rgba(14, 164, 114, .18), transparent 60%);
  animation: lgDrift 18s ease-in-out infinite alternate;
}
.lg-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 70% 20%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 90% at 70% 20%, #000 20%, transparent 75%);
}
@keyframes lgDrift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-2%, 3%, 0); } }

.lg-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #94a3b8; margin-bottom: 28px; flex-wrap: wrap; }
.lg-crumbs a { color: #cbd5e1; transition: color .15s ease; }
.lg-crumbs a:hover { color: #fff; }
.lg-crumbs .sep { opacity: .5; }
.lg-crumbs [aria-current] { color: #fff; font-weight: 600; }

.lg-hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 48px; align-items: center; padding-bottom: 44px; }
.lg-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #6ee7b7; background: rgba(14, 164, 114, .14); border: 1px solid rgba(110, 231, 183, .28);
  padding: 7px 14px; border-radius: 999px; margin-bottom: 20px;
}
.lg-eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .2); }
.lg-company { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: 15px; letter-spacing: .04em; color: #94a3b8; margin: 0 0 10px; }
.lg-hero h1 { color: #fff; font-size: clamp(38px, 6vw, 64px); line-height: 1.04; letter-spacing: -.02em; margin: 0 0 22px; }
.lg-hero h1 em { font-style: normal; background: linear-gradient(100deg, #34d399, #f2b134); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }

.lg-switch { display: inline-flex; padding: 5px; gap: 4px; border-radius: 999px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(8px); margin-bottom: 24px; }
.lg-switch a { padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 600; color: #cbd5e1; transition: background .2s ease, color .2s ease; }
.lg-switch a:hover { color: #fff; }
.lg-switch a[aria-current] { background: #fff; color: var(--ink); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }

.lg-jump { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lg-jump .lbl { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; margin-right: 4px; }
.lg-chip {
  display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: #e2e8f0; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.lg-chip b { font-family: "Space Grotesk", sans-serif; color: #6ee7b7; font-weight: 600; }
.lg-chip:hover { transform: translateY(-2px); background: rgba(14, 164, 114, .22); border-color: rgba(110, 231, 183, .5); color: #fff; }

.lg-art { width: 100%; max-width: 380px; margin-left: auto; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .45)); animation: lgFloat 7s ease-in-out infinite; }
@keyframes lgFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* fact cards */
.lg-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .1); border-radius: 20px 20px 0 0; overflow: hidden; }
.lg-fact { background: rgba(11, 18, 32, .86); padding: 20px 22px; backdrop-filter: blur(6px); min-width: 0; }
.lg-fact dt { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6ee7b7; margin: 0 0 6px; }
.lg-fact dd { margin: 0; color: #e2e8f0; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.lg-fact dd a { color: #fff; text-decoration: underline; text-decoration-color: rgba(110, 231, 183, .6); text-underline-offset: 3px; }
.lg-fact.date dd { font-family: "Space Grotesk", sans-serif; font-size: 20px; font-weight: 600; color: #fff; }

/* ---------- body layout ---------- */
.lg-main { padding: 56px 0 24px; }
.lg-wrap { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 56px; align-items: start; }

/* table of contents */
.lg-toc { position: sticky; top: calc(var(--nav-h) + 24px); max-height: calc(100vh - var(--nav-h) - 48px); overflow: auto; padding-right: 6px; scrollbar-width: thin; }
.lg-toc-box { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 12px 12px; box-shadow: var(--shadow-sm); }
.lg-toc h2 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--body-soft); margin: 0 10px 10px; font-family: "Inter", sans-serif; font-weight: 700; }
.lg-toc ol { list-style: none; margin: 0; padding: 0; }
.lg-toc li a { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; line-height: 1.35; color: var(--body); border-left: 3px solid transparent; transition: background .15s ease, color .15s ease; }
.lg-toc li a .n { font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 12px; color: #94a3b8; }
.lg-toc li a:hover { background: var(--surface-alt); color: var(--ink); }
.lg-toc li a.active { background: var(--brand-light); color: var(--brand-ink); border-left-color: var(--brand); font-weight: 600; }
.lg-toc li a.active .n { color: var(--brand-dark); }
.lg-toc-m { display: none; }

/* document */
.lg-doc { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-md); padding: 8px 56px 40px; min-width: 0; }

.lg-intro {
  position: relative; margin: 40px 0 8px; padding: 26px 28px 26px 30px; border-radius: 20px;
  background: linear-gradient(180deg, #fffaf0, #fff7e6); border: 1px solid #f6dfa8; color: #5b4310;
}
.lg-intro::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 5px; border-radius: 0 6px 6px 0; background: linear-gradient(var(--accent), #e2900f); }
.lg-intro p { margin: 0; font-size: 16px; line-height: 1.7; }
.lg-intro strong:first-child { color: #3d2c06; }
.lg-intro a { color: #7a4d00; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.lg-sec { position: relative; padding: 44px 0 14px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.lg-sec + .lg-sec { border-top: 1px solid var(--line); margin-top: 26px; }
.lg-sec h2 { display: flex; align-items: center; gap: 16px; font-size: clamp(22px, 2.6vw, 30px); margin: 0 0 26px; letter-spacing: -.01em; }
.lg-n {
  flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  font-family: "Space Grotesk", sans-serif; font-size: 18px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--brand-dark)); box-shadow: 0 10px 20px -8px rgba(14, 164, 114, .7);
}
.lg-title { min-width: 0; }
.lg-flag { margin-left: 4px; font-family: "Inter", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8a5a00; background: #fff1cf; border: 1px solid #f2d589; padding: 4px 10px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.lg-anchor { opacity: 0; margin-left: 2px; border: 0; background: none; cursor: pointer; color: var(--brand-dark); padding: 6px; border-radius: 8px; line-height: 0; transition: opacity .15s ease, background .15s ease; position: relative; }
.lg-sec h2:hover .lg-anchor, .lg-anchor:focus-visible { opacity: 1; }
.lg-anchor:hover { background: var(--brand-light); }
.lg-anchor.copied::after { content: "Link copied"; position: absolute; left: 50%; top: -34px; transform: translateX(-50%); background: var(--ink); color: #fff; font: 600 12px "Inter", sans-serif; padding: 5px 10px; border-radius: 8px; white-space: nowrap; }

/* clauses */
.lg-doc p { margin: 0 0 16px; font-size: 16px; line-height: 1.78; color: #334155; }
.lg-doc strong { color: var(--ink); font-weight: 600; }
.cl { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 14px; margin: 0 0 16px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.cl-n { display: inline-flex; justify-content: center; height: 26px; padding: 0 8px; align-items: center; margin-top: 3px; border-radius: 8px; font: 600 12.5px "Space Grotesk", sans-serif; letter-spacing: .02em; color: var(--brand-dark); background: var(--brand-light); text-decoration: none; transition: background .15s ease, color .15s ease; }
.cl-n:hover { background: var(--brand); color: #fff; }
.cl-b { min-width: 0; }
.cl-b p { margin: 0; }
.cl-sub { margin-left: 68px; position: relative; padding-left: 18px; }
.cl-sub::before { content: ""; position: absolute; left: 0; top: 11px; width: 8px; height: 8px; border-radius: 3px; background: var(--brand); opacity: .55; }
.lg-doc :target { animation: lgFlash 2.2s ease; }
@keyframes lgFlash { 0%, 30% { background: #fff3c4; box-shadow: 0 0 0 10px #fff3c4; border-radius: 6px; } 100% { background: transparent; box-shadow: 0 0 0 10px transparent; } }

.lg-doc a:not(.cl-n):not(.lg-anchor) { color: var(--brand-dark); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(14, 164, 114, .4); text-underline-offset: 3px; transition: text-decoration-color .15s ease, color .15s ease; }
.lg-doc a:not(.cl-n):not(.lg-anchor):hover { color: var(--brand-ink); text-decoration-color: var(--brand); }

/* lists */
.lg-doc ul, .lg-doc ol { margin: 0 0 18px 68px; padding: 0; list-style: none; }
.lg-doc li { position: relative; padding-left: 24px; margin: 0 0 10px; font-size: 16px; line-height: 1.7; color: #334155; }
.lg-doc ul > li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 8px; height: 8px; border-radius: 3px; background: var(--brand); transform: rotate(45deg); }
.lg-doc ol { counter-reset: lgalpha; }
.lg-doc ol > li { counter-increment: lgalpha; padding-left: 34px; }
.lg-doc ol > li::before { content: "(" counter(lgalpha, lower-alpha) ")"; position: absolute; left: 0; top: 0; font: 600 14px "Space Grotesk", sans-serif; color: var(--brand-dark); }
.lg-doc ul.lg-flush { margin-left: 68px; }

/* definition cards */
.lg-doc ul.defs { margin-left: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lg-doc ul.defs > li { margin: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, #fff, var(--surface-alt)); font-size: 15px; line-height: 1.65; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.lg-doc ul.defs > li::before { display: none; }
.lg-doc ul.defs > li:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(14, 164, 114, .4); }
.lg-doc ul.defs > li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.lg-doc ul.defs strong { display: inline-block; margin-bottom: 4px; color: var(--brand-dark); font-family: "Space Grotesk", sans-serif; font-size: 16px; }

/* table */
.tbl-wrap { margin: 6px 0 24px; border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; box-shadow: var(--shadow-sm); }
.tbl-wrap table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 14.5px; }
.tbl-wrap th { text-align: left; background: var(--ink); color: #fff; font: 600 12px "Inter", sans-serif; letter-spacing: .08em; text-transform: uppercase; padding: 14px 18px; }
.tbl-wrap th strong { color: #fff; font-weight: 600; }
.tbl-wrap td { padding: 16px 18px; vertical-align: top; line-height: 1.6; color: #334155; border-top: 1px solid var(--line); }
.tbl-wrap tbody tr:nth-child(even) td { background: #f8fbfa; }
.tbl-wrap td:first-child { font-weight: 600; color: var(--ink); width: 22%; }
.tbl-wrap td:last-child { width: 26%; color: var(--brand-ink); }

/* end-of-document cards */
.lg-end { padding: 8px 0 72px; }
.lg-end-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; }
.lg-card { position: relative; overflow: hidden; border-radius: 24px; padding: 34px 34px 32px; }
.lg-card.next { background: linear-gradient(135deg, #0b1220, #0f3b2c); color: #cbd5e1; border: 1px solid rgba(255, 255, 255, .06); }
.lg-card.next::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(52, 211, 153, .35), transparent 70%); }
.lg-card .kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6ee7b7; margin: 0 0 10px; }
.lg-card h3 { font-size: 26px; margin: 0 0 18px; color: #fff; }
.lg-card.ask { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.lg-card.ask h3 { color: var(--ink); font-size: 22px; margin-bottom: 8px; }
.lg-card.ask p { color: var(--body-soft); margin: 0 0 20px; font-size: 15px; }
.lg-card .btn { position: relative; z-index: 1; }
.lg-card.next .btn { background: #fff; color: var(--ink); }
.lg-card.next .btn:hover { background: #d1fae5; }
.lg-meta { margin: 0 0 4px; text-align: center; font-size: 13px; color: var(--body-soft); }

/* back to top */
.lg-top { position: fixed; right: 22px; bottom: 22px; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; background: var(--ink); color: #fff; display: grid; place-items: center; box-shadow: 0 12px 24px -8px rgba(11, 18, 32, .5); z-index: 90; transition: transform .2s ease, background .2s ease; }
.lg-top:hover { background: var(--brand-dark); transform: translateY(-3px); }
.lg-top[hidden] { display: none; }

/* footer legal row (also defined in style.css for the other pages) */
.legal-page .footer-legal a[aria-current] { color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .lg-wrap { grid-template-columns: 1fr; gap: 24px; }
  .lg-toc { display: none; }
  .lg-toc-m { display: block; position: sticky; top: calc(var(--nav-h) + 8px); z-index: 20; }
  .lg-toc-m details { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md); }
  .lg-toc-m summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; color: var(--ink); }
  .lg-toc-m summary::-webkit-details-marker { display: none; }
  .lg-toc-m summary .cur { margin-left: auto; margin-right: 12px; font-weight: 500; font-size: 13px; color: var(--body-soft); max-width: 58%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lg-toc-m summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--body-soft); border-bottom: 2px solid var(--body-soft); transform: rotate(45deg); transition: transform .2s ease; margin-right: 4px; }
  .lg-toc-m details[open] summary::after { transform: rotate(-135deg); }
  .lg-toc-m ol { max-height: 60vh; overflow: auto; list-style: none; margin: 0; padding: 4px 10px 12px; border-top: 1px solid var(--line); }
  .lg-toc-m li a { display: grid; grid-template-columns: 30px 1fr; gap: 8px; padding: 10px; border-radius: 10px; font-size: 14px; color: var(--body); }
  .lg-toc-m li a .n { font: 600 12px "Space Grotesk", sans-serif; color: #94a3b8; }
  .lg-toc-m li a.active { background: var(--brand-light); color: var(--brand-ink); font-weight: 600; }
  .lg-hero-grid { grid-template-columns: 1fr; }
  .lg-art { margin: 0 auto; max-width: 280px; order: -1; }
}
@media (max-width: 860px) {
  .lg-facts { grid-template-columns: repeat(2, 1fr); }
  .lg-doc { padding: 4px 26px 28px; border-radius: 22px; }
  .lg-end-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .lg-hero { padding-top: 36px; }
  .lg-hero-grid { padding-bottom: 28px; gap: 20px; }
  .lg-facts { grid-template-columns: 1fr; border-radius: 16px 16px 0 0; }
  .lg-doc { padding: 0 18px 22px; }
  .lg-doc p, .lg-doc li { font-size: 15.5px; }
  .cl { grid-template-columns: 1fr; gap: 6px; }
  .cl-n { justify-self: start; }
  .cl-sub { margin-left: 8px; }
  .lg-doc ul, .lg-doc ol, .lg-doc ul.lg-flush { margin-left: 4px; }
  .lg-doc ul.defs { grid-template-columns: 1fr; }
  .lg-sec h2 { align-items: flex-start; gap: 12px; }
  .lg-n { width: 40px; height: 40px; font-size: 16px; border-radius: 12px; }
  .lg-flag { display: inline-block; margin: 6px 0 0; }
  .lg-switch a { padding: 9px 14px; }
  .lg-art { max-width: 170px; }
}
@media (prefers-reduced-motion: reduce) {
  .lg-hero::before, .lg-art { animation: none; }
  .lg-doc :target { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- print ---------- */
@media print {
  .nav, .lg-progress, .lg-toc, .lg-toc-m, .lg-top, .footer, .lg-end, .lg-switch, .lg-jump, .lg-art, .lg-anchor, .lg-crumbs { display: none !important; }
  body, .legal-page { background: #fff; }
  .lg-hero { background: #fff; color: #000; padding: 0 0 12px; }
  .lg-hero::before, .lg-hero::after { display: none; }
  .lg-hero h1, .lg-company, .lg-eyebrow { color: #000; background: none; border: 0; padding: 0; -webkit-text-fill-color: #000; }
  .lg-hero h1 em { -webkit-text-fill-color: #000; color: #000; background: none; }
  .lg-facts { background: none; border: 1px solid #999; border-radius: 0; grid-template-columns: repeat(2, 1fr); }
  .lg-fact { background: #fff; }
  .lg-fact dt, .lg-fact dd, .lg-fact.date dd, .lg-fact dd a { color: #000; }
  .lg-wrap { display: block; }
  .lg-doc { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .lg-sec { break-inside: auto; padding-top: 22px; }
  .lg-sec h2 { break-after: avoid; }
  .cl { break-inside: avoid; }
  .lg-n { background: none; color: #000; box-shadow: none; border: 1px solid #000; }
  .lg-doc a { color: #000 !important; text-decoration: none !important; }
}
