/* ═══════════════════════════════════════════════════════════════════
   Terms & Conditions — full page styles
   Loaded after style.css + theme.css. Uses the site's CSS-var tokens
   plus local terms-specific variables for easy theming.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Local tokens ───────────────────────────────────────────────── */
.terms-page{
  --tc-accent:       #6366f1;
  --tc-accent-soft:  rgba(99, 102, 241, .10);
  --tc-accent-muted: rgba(99, 102, 241, .55);
  --tc-num-bg:       rgba(99, 102, 241, .10);
  --tc-num-color:    #6366f1;
  --tc-border:       var(--line);
  --tc-body-max:     1120px;
  --tc-toc-w:        220px;
  --tc-topbar-h:     64px;
}

/* ── Reading progress bar ───────────────────────────────────────── */
.terms-progress{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .08s linear;
  pointer-events: none;
}

/* ── Page wrapper ───────────────────────────────────────────────── */
.terms-page{
  min-height: 100dvh;
}

.terms-main{
  min-height: calc(100dvh - var(--tc-topbar-h));
}

/* ══════════════════════════════════════════════════════════════════
   HERO BAND
   ══════════════════════════════════════════════════════════════════ */
.terms-hero-band{
  position: relative;
  overflow: hidden;
  padding: 72px 24px 64px;
  border-bottom: 1px solid var(--tc-border);
  background:
    radial-gradient(1100px 540px at 60% -10%, rgba(99, 102, 241, .22), transparent 56%),
    radial-gradient(800px 440px at 0% 60%, rgba(124, 58, 237, .10), transparent 52%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg) 100%);
}

.terms-hero-band::after{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--nx-grain, none);
  background-size: 200px 200px;
  opacity: .5;
  pointer-events: none;
}

.terms-hero-inner{
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
}

/* Eyebrow */
.terms-eyebrow{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, .30);
  background: rgba(99, 102, 241, .09);
  color: var(--tc-accent);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

/* Main title */
.terms-title{
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 780;
  letter-spacing: -0.04em;
  line-height: 1.06;
  color: var(--text);
  margin: 0 0 20px;
}

/* Lede */
.terms-lede{
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--muted);
  font-weight: 400;
  max-width: 580px;
  margin: 0 0 28px;
}

/* Meta pills row */
.terms-meta-row{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.terms-meta-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--tc-border);
  background: rgba(255, 255, 255, .06);
  font-size: .78rem;
  font-weight: 520;
  color: var(--muted);
  white-space: nowrap;
}

.terms-meta-pill svg{
  flex-shrink: 0;
  opacity: .65;
}

/* ══════════════════════════════════════════════════════════════════
   BODY: SIDEBAR + DOCUMENT
   ══════════════════════════════════════════════════════════════════ */
.terms-body-wrap{
  display: grid;
  grid-template-columns: var(--tc-toc-w) 1fr;
  max-width: var(--tc-body-max);
  margin: 0 auto;
  gap: 0;
  padding: 0 24px 96px;
  align-items: start;
}

/* ── Sidebar TOC ────────────────────────────────────────────────── */
.terms-toc-aside{
  position: sticky;
  top: calc(var(--tc-topbar-h) + 32px);
  max-height: calc(100dvh - var(--tc-topbar-h) - 64px);
  overflow-y: auto;
  padding: 36px 28px 36px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, .22) transparent;
}

.terms-toc-aside::-webkit-scrollbar{
  width: 4px;
}
.terms-toc-aside::-webkit-scrollbar-thumb{
  background: rgba(99, 102, 241, .22);
  border-radius: 4px;
}

.terms-toc-heading{
  font-size: .68rem;
  font-weight: 720;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  padding-left: 12px;
}

.terms-toc-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.terms-toc-link{
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: .80rem;
  font-weight: 480;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
  border-left: 2px solid transparent;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.terms-toc-link:hover{
  color: var(--text);
  background: rgba(99, 102, 241, .07);
  border-left-color: rgba(99, 102, 241, .30);
}

.terms-toc-link.is-active{
  color: var(--tc-accent);
  background: var(--tc-accent-soft);
  border-left-color: var(--tc-accent);
  font-weight: 600;
}

/* ── Document ───────────────────────────────────────────────────── */
.terms-doc{
  border-left: 1px solid var(--tc-border);
  padding: 36px 0 0 52px;
  min-width: 0;
}

/* ── Individual section ─────────────────────────────────────────── */
.terms-section{
  padding: 36px 0;
  border-bottom: 1px solid var(--tc-border);
  scroll-margin-top: calc(var(--tc-topbar-h) + 32px);
}

.terms-section:first-child{
  padding-top: 0;
}

.terms-section:last-child{
  border-bottom: none;
}

/* Section header: number + title */
.terms-section-hd{
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.terms-num{
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--tc-num-bg);
  color: var(--tc-num-color);
  font-size: .68rem;
  font-weight: 760;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

.terms-section-hd h2{
  margin: 0;
  font-size: 1.14rem;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

/* Section body */
.terms-section-body{
  padding-left: 46px;
}

.terms-section-body p{
  margin: 0 0 14px;
  font-size: .96rem;
  line-height: 1.72;
  color: var(--muted);
  font-weight: 400;
}

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

/* ── Document footer ────────────────────────────────────────────── */
.terms-doc-footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 32px 0 0;
  margin-top: 8px;
}

.terms-doc-footer-stamp{
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  font-weight: 480;
  color: var(--muted);
  margin: 0;
  opacity: .72;
}

.terms-doc-footer-stamp svg{
  flex-shrink: 0;
  opacity: .6;
}

.terms-back-btn{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--tc-border);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: .84rem;
  font-weight: 580;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.terms-back-btn:hover{
  background: rgba(99, 102, 241, .09);
  border-color: rgba(99, 102, 241, .32);
  box-shadow: 0 4px 16px rgba(99, 102, 241, .10);
}

.terms-back-btn svg{
  flex-shrink: 0;
  opacity: .75;
}

/* ══════════════════════════════════════════════════════════════════
   LIGHT MODE OVERRIDES
   ══════════════════════════════════════════════════════════════════ */
html[data-theme="light"] .terms-page{
  --tc-num-bg:    rgba(99, 102, 241, .10);
  --tc-num-color: #4f46e5;
}

html[data-theme="light"] .terms-hero-band{
  background:
    radial-gradient(1100px 540px at 60% -10%, rgba(99, 102, 241, .16), transparent 56%),
    radial-gradient(800px 440px at 0% 60%, rgba(124, 58, 237, .08), transparent 52%),
    linear-gradient(180deg, #f8fafc 0%, #f1f4f9 100%) !important;
}

html[data-theme="light"] .terms-eyebrow{
  border-color: rgba(99, 102, 241, .28) !important;
  background: rgba(99, 102, 241, .08) !important;
  color: #4f46e5 !important;
}

html[data-theme="light"] .terms-meta-pill{
  background: rgba(255, 255, 255, .80) !important;
  border-color: rgba(15, 23, 42, .10) !important;
  color: #475569 !important;
}

html[data-theme="light"] .terms-doc{
  border-left-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .terms-section{
  border-bottom-color: rgba(15, 23, 42, .08) !important;
}

html[data-theme="light"] .terms-section-hd h2{
  color: #0f172a !important;
}

html[data-theme="light"] .terms-section-body p{
  color: #3d4a6b !important;
}

html[data-theme="light"] .terms-toc-heading{
  color: #94a3b8 !important;
}

html[data-theme="light"] .terms-toc-link{
  color: #64748b !important;
}

html[data-theme="light"] .terms-toc-link:hover{
  color: #1e1b4b !important;
  background: rgba(99, 102, 241, .07) !important;
  border-left-color: rgba(99, 102, 241, .35) !important;
}

html[data-theme="light"] .terms-toc-link.is-active{
  color: #4f46e5 !important;
  background: rgba(99, 102, 241, .09) !important;
  border-left-color: #6366f1 !important;
}

html[data-theme="light"] .terms-back-btn{
  background: rgba(255, 255, 255, .88) !important;
  border-color: rgba(15, 23, 42, .12) !important;
  color: #1e293b !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06) !important;
}

html[data-theme="light"] .terms-back-btn:hover{
  background: rgba(99, 102, 241, .08) !important;
  border-color: rgba(99, 102, 241, .32) !important;
  box-shadow: 0 4px 16px rgba(99, 102, 241, .12) !important;
}

html[data-theme="light"] .terms-doc-footer-stamp{
  color: #94a3b8 !important;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */

/* Narrow desktop / large tablet: compress sidebar */
@media (max-width: 960px){
  .terms-page{
    --tc-toc-w: 180px;
  }
  .terms-doc{
    padding-left: 36px;
  }
  .terms-section-body{
    padding-left: 38px;
  }
}

/* Tablet / mobile: stack to single column */
@media (max-width: 720px){
  .terms-hero-band{
    padding: 52px 20px 48px;
  }

  .terms-body-wrap{
    grid-template-columns: 1fr;
    padding: 0 20px 72px;
  }

  /* TOC becomes a compact scrollable strip above the doc */
  .terms-toc-aside{
    position: static;
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
    padding: 24px 0 0;
    border-bottom: 1px solid var(--tc-border);
    margin-bottom: 8px;
  }

  .terms-toc-heading{
    display: none;
  }

  .terms-toc-list{
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 16px;
    scrollbar-width: none;
  }

  .terms-toc-list::-webkit-scrollbar{
    display: none;
  }

  .terms-toc-link{
    white-space: nowrap;
    padding: 6px 12px;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    font-size: .75rem;
  }

  .terms-toc-link:hover{
    border-left-color: transparent;
    border-bottom-color: rgba(99, 102, 241, .40);
  }

  .terms-toc-link.is-active{
    border-left-color: transparent;
    border-bottom-color: var(--tc-accent);
  }

  .terms-doc{
    border-left: none;
    padding-left: 0;
  }

  .terms-section-body{
    padding-left: 0;
  }

  .terms-section-hd{
    gap: 12px;
  }

  .terms-section-hd h2{
    font-size: 1.04rem;
  }

  .terms-section{
    padding: 28px 0;
  }

  .terms-doc-footer{
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
}

@media (max-width: 480px){
  .terms-title{
    font-size: 2.2rem;
  }

  .terms-lede{
    font-size: .94rem;
  }

  .terms-meta-row{
    gap: 6px;
  }

  .terms-meta-pill{
    font-size: .72rem;
    padding: 5px 11px;
  }
}

/* ── Print ──────────────────────────────────────────────────────── */
@media print{
  .terms-progress,
  .terms-toc-aside,
  .terms-back-btn,
  .topbar{
    display: none !important;
  }

  .terms-body-wrap{
    grid-template-columns: 1fr;
    padding: 0;
  }

  .terms-hero-band{
    background: none;
    border-bottom: 2px solid #000;
    padding: 24px 0;
  }

  .terms-doc{
    border-left: none;
    padding-left: 0;
  }

  .terms-section{
    break-inside: avoid;
    page-break-inside: avoid;
    border-bottom: 1px solid #ccc;
  }

  .terms-section-body{
    padding-left: 0;
  }

  .terms-title{
    color: #000;
  }

  .terms-section-body p{
    color: #222;
  }
}

/* =============================================================================
   MOBILE REFINEMENTS  ·  Sub-480px / 380px
   ============================================================================= */

@media (max-width: 480px) {
  .terms-hero-band {
    padding: 44px 16px 40px !important;
  }

  .terms-title {
    font-size: 1.9rem !important;
    letter-spacing: -0.03em !important;
  }

  .terms-lede {
    font-size: 0.88rem !important;
    line-height: 1.55 !important;
  }

  .terms-body-wrap {
    padding: 0 16px 60px !important;
  }

  .terms-toc-link {
    font-size: 0.72rem !important;
    padding: 5px 10px !important;
    white-space: nowrap !important;
  }

  .terms-section {
    padding: 24px 0 !important;
  }

  .terms-section-hd h2 {
    font-size: 0.98rem !important;
  }

  .terms-section-body {
    font-size: 0.875rem !important;
    line-height: 1.65 !important;
  }

  .terms-section-num {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.72rem !important;
    flex-shrink: 0 !important;
  }

  .terms-doc-footer {
    font-size: 0.82rem !important;
  }

  .terms-meta-pill {
    font-size: 0.7rem !important;
    padding: 4px 10px !important;
  }
}

@media (max-width: 380px) {
  .terms-title {
    font-size: 1.7rem !important;
  }

  .terms-lede {
    font-size: 0.84rem !important;
  }

  .terms-body-wrap {
    padding: 0 14px 56px !important;
  }

  .terms-section-body {
    font-size: 0.855rem !important;
  }

  .terms-section-hd {
    gap: 8px !important;
  }

  .terms-toc-list {
    gap: 3px !important;
  }
}
