/* ═══════════════════════════════════════════════════
   PAMGIA — Legal Page Styles
   Shared typography, layout, tables, and components
   for Privacy Policy, Terms of Service, Cookie Policy.
   ═══════════════════════════════════════════════════ */

/* ── Scroll offset for fixed header ── */
html {
  scroll-padding-top: 5.5rem;
}

/* ── Legal Hero (compact, not full-viewport) ── */
.legal-hero {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg-cold);
  padding: 10rem 5vw 4rem;
  overflow: hidden;
}

/* Gradient vignette */
.legal-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 50% at 50% 60%, rgba(231, 65, 50, 0.04) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 35% 40%, rgba(231, 65, 50, 0.025) 0%, transparent 50%),
    radial-gradient(ellipse 40% 35% at 70% 55%, rgba(245, 240, 235, 0.012) 0%, transparent 45%),
    linear-gradient(180deg, transparent 0%, rgba(20, 12, 8, 0.25) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Noise texture */
.legal-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.033;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  pointer-events: none;
  z-index: 1;
}

/* Glow orb */
.legal-hero-glow {
  position: absolute;
  width: 380px;
  height: 240px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(231, 65, 50, 0.05) 0%, rgba(231, 65, 50, 0.015) 40%, transparent 70%);
  filter: blur(3.5rem);
  pointer-events: none;
  z-index: 0;
}

.legal-hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

/* Icon badge */
.legal-hero-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(231, 65, 50, 0.06);
  border: 1px solid rgba(231, 65, 50, 0.1);
}

.legal-hero-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--brand-red);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

/* Hero label */
.legal-hero .hero-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-red);
  margin-bottom: 1.25rem;
}

/* Hero heading */
.legal-hero .hero-heading {
  font-family: var(--font-accent);
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  text-shadow:
    0 2px 16px rgba(0, 0, 0, 0.7),
    0 4px 32px rgba(0, 0, 0, 0.4);
}

/* Version badge */
.legal-version-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.5rem 1.25rem;
  border: 1px solid rgba(245, 240, 235, 0.08);
  border-radius: 2px;
  background: rgba(245, 240, 235, 0.03);
}

.legal-version-badge span + span::before {
  content: "|";
  margin-right: 0.75rem;
  opacity: 0.3;
}

/* ── Content Section ── */
.legal-content-section {
  background: var(--bg-cold);
  position: relative;
  border-top: 1px solid rgba(245, 240, 235, 0.04);
}

/* Two-column layout: TOC sidebar + article */
.legal-content-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 5vw 6rem;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 4rem;
  align-items: start;
}

/* Single-column variant (for Cookie Policy) */
.legal-content-layout--single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 820px;
  gap: 0;
}

/* ── Table of Contents Sidebar ── */
.legal-toc {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  padding-right: 2rem;
  border-right: 1px solid rgba(245, 240, 235, 0.06);
}

.legal-toc::-webkit-scrollbar {
  width: 3px;
}

.legal-toc::-webkit-scrollbar-track {
  background: transparent;
}

.legal-toc::-webkit-scrollbar-thumb {
  background: rgba(245, 240, 235, 0.1);
  border-radius: 2px;
}

.legal-toc-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.legal-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legal-toc-list li {
  margin: 0;
}

.legal-toc-link {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  padding: 0.35rem 0;
  line-height: 1.4;
  letter-spacing: 0.01em;
  transition: color 0.2s var(--ease-out);
}

.legal-toc-link:hover,
.legal-toc-link:focus-visible {
  color: var(--text-primary);
}

.legal-toc-link:focus-visible {
  outline: 1px solid var(--brand-red);
  outline-offset: 2px;
}

/* ── Legal Article Typography ── */
.legal-article {
  max-width: 72ch;
  width: 100%;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.8;
  color: var(--text-muted);
  overflow-wrap: break-word;
  word-break: break-word;
}

.legal-article h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text-primary);
  margin: 3.5rem 0 1.25rem;
}

.legal-article h2:first-child {
  margin-top: 0;
}

.legal-article h3 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
}

.legal-article h4 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
}

.legal-article p {
  margin-bottom: 1.25rem;
}

.legal-article strong {
  font-weight: 600;
  color: var(--text-primary);
}

.legal-article a {
  color: var(--brand-red);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.legal-article a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-article a:focus-visible {
  outline: 1px solid var(--brand-red);
  outline-offset: 2px;
}

.legal-article ul,
.legal-article ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.legal-article li {
  margin-bottom: 0.5rem;
}

.legal-article li::marker {
  color: rgba(245, 240, 235, 0.25);
}

/* Section dividers */
.legal-article hr {
  border: none;
  height: 1px;
  background: rgba(245, 240, 235, 0.06);
  margin: 3rem 0;
}

/* ── Plain English Callout ── */
.legal-callout {
  position: relative;
  padding: 2rem 2.25rem;
  margin: 0 0 2.5rem;
  background: rgba(231, 65, 50, 0.03);
  border: 1px solid rgba(231, 65, 50, 0.1);
  border-left: 3px solid var(--brand-red);
  border-radius: 0 0.5rem 0.5rem 0;
}

.legal-callout-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-red);
  margin-bottom: 1rem;
}

.legal-callout p {
  color: rgba(245, 240, 235, 0.65);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 0;
}

/* ── Table Styles ── */
.legal-table-wrap {
  overflow-x: auto;
  margin: 1.75rem 0 2rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(245, 240, 235, 0.08);
  -webkit-overflow-scrolling: touch;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.6;
}

.legal-table thead {
  background: rgba(245, 240, 235, 0.05);
  border-bottom: 1px solid rgba(245, 240, 235, 0.1);
}

.legal-table th {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
  padding: 0.9rem 1.25rem;
  text-align: left;
  white-space: nowrap;
}

.legal-table td {
  padding: 0.9rem 1.25rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(245, 240, 235, 0.04);
  vertical-align: top;
}

.legal-table tbody tr:last-child td {
  border-bottom: none;
}

.legal-table tbody tr:hover {
  background: rgba(245, 240, 235, 0.02);
}

/* ── Uppercase Disclaimer (ToS Section 14) ── */
.legal-disclaimer-caps {
  text-transform: uppercase;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  line-height: 1.7;
}

/* ── Contact Block ── */
.legal-contact-block address {
  font-style: normal;
  line-height: 1.9;
}

/* ── Copyright Line ── */
.legal-copyright {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(245, 240, 235, 0.06);
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ── Responsive: TOC collapse at 1024px ── */
@media (max-width: 1024px) {
  .legal-content-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    max-width: 820px;
  }

  .legal-toc {
    display: none;
  }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .legal-hero {
    padding: 7rem 5vw 3rem;
  }

  .legal-hero-glow {
    width: 260px;
    height: 160px;
  }

  .legal-hero-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 1.5rem;
  }

  .legal-hero-icon svg {
    width: 18px;
    height: 18px;
  }

  .legal-content-layout {
    padding: 2.5rem 5vw 4rem;
  }

  .legal-article {
    font-size: 0.95rem;
  }

  .legal-article h2 {
    margin: 2.5rem 0 1rem;
  }

  .legal-article h3 {
    margin: 2rem 0 0.75rem;
  }

  .legal-callout {
    padding: 1.5rem 1.5rem;
  }

  .legal-table {
    font-size: 0.82rem;
  }

  .legal-table th,
  .legal-table td {
    padding: 0.75rem 1rem;
  }

  .legal-article a {
    padding-block: 6px;
    line-height: 1.8;
  }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
