/*
=========================================================
LEGAL PAGE STYLESHEET - Joshua Dalton Media
=========================================================

Aesthetic: Editorial Film Archive
Poppins display headings, auto-numbered sections,
two-column desktop layout, animated hero.

Shared by /terms/ and /privacy/
=========================================================

What belongs in this file
-------------------------
- Legal-page background tokens
- Hero styling (tall, cinematic, text at bottom)
- Numbered section entries (badge + ghost number)
- Two-column layout at >= 700px
- Sign-off treatment
- Responsive breakpoints

Maintenance rule
----------------
If a style is unique to one legal page or belongs to the
global site shell, it should not be added here. Keep this
file focused on the shared legal-page family.
*/

/* ================= PAGE TOKENS ================= */
.terms-page {
  --page-bg-overlay-start: rgba(13,13,13,.92);
  --page-bg-overlay-end: rgba(13,13,13,.72);
}
.privacy-page {
  --page-bg-overlay-start: rgba(13,13,13,.9);
  --page-bg-overlay-end: rgba(13,13,13,.74);
}

/* ================= HERO ================= */
.legal-intro.section {
  position: relative;
  min-height: 44vh;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(160deg, rgba(13,13,13,.1) 0%, rgba(13,13,13,.72) 52%, rgba(13,13,13,.97) 100%),
    url('/images/site/backgrounds/auckland-wedding-videographer-arkles-bay-beach.avif') center / cover no-repeat;
  padding: 0 !important;
  border: none !important;
  overflow: hidden;
}

.legal-intro .wrap {
  position: relative;
  z-index: 1;
}

.legal-header {
  padding: 0 0 44px;
  max-width: none;
  display: grid;
  gap: 12px;
}

/* Page title */
.legal-header h1 {
  font-family: var(--jdm-font);
  font-size: clamp(2.2rem, 8vw, 4.8rem);
  font-weight: 600;
  font-style: normal;
  line-height: 1.04;
  letter-spacing: -.015em;
  margin: 0;
  color: #fff;
  opacity: 0;
  animation: legalUp .5s .12s ease forwards;
}

/* Lead text */
.legal-header .lead {
  font-size: .88rem;
  line-height: 1.6;
  color: rgba(239,239,239,.68);
  max-width: 46ch;
  margin: 0;
  opacity: 0;
  animation: legalUp .5s .2s ease forwards;
}

/* ================= CONTENT WRAPPER ================= */
.legal-content.section {
  border-top: none;
  border-bottom: none;
  background: none;
  padding-top: 0;
  padding-bottom: 64px;
}

.legal-body {
  max-width: 52rem;
  margin: 0 auto;
  display: grid;
  gap: 0;
  counter-reset: legal-n;
}

/* ================= SECTION ENTRIES ================= */
.legal-body > section {
  counter-increment: legal-n;
  position: relative;
  display: grid;
  gap: 10px;
  padding: 26px 0;
  border-top: 1px solid var(--jdm-line);
}

/* First section: red-tinted top border, top margin from hero */
.legal-body > section:first-child {
  border-top: 1px solid rgba(var(--jdm-accent-rgb),.25);
  padding-top: 30px;
  margin-top: 28px;
}

/* Ghost section number - large translucent backdrop (mobile/tablet only) */
.legal-body > section::before {
  content: counter(legal-n, decimal-leading-zero);
  position: absolute;
  top: 50%;
  right: -4px;
  transform: translateY(-50%);
  font-family: var(--jdm-font);
  font-size: clamp(4.5rem, 14vw, 9rem);
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  color: rgba(var(--jdm-accent-rgb), 0.04);
  user-select: none;
  pointer-events: none;
  letter-spacing: -.02em;
  z-index: 0;
}

/* Section heading */
.legal-body > section h2 {
  font-family: var(--jdm-font);
  font-size: clamp(1.1rem, 4vw, 1.55rem);
  font-weight: 600;
  font-style: normal;
  letter-spacing: -.01em;
  line-height: 1.2;
  margin: 0;
  color: var(--jdm-ink);
  display: flex;
  align-items: baseline;
  gap: 10px;
  position: relative;
  z-index: 1;
}

/* Section number badge - before the heading text */
.legal-body > section h2::before {
  content: counter(legal-n, decimal-leading-zero);
  font-family: Poppins, system-ui, sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--jdm-accent);
  flex-shrink: 0;
  line-height: 1;
  padding: 3px 6px;
  border: 1px solid rgba(var(--jdm-accent-rgb), .3);
  border-radius: 3px;
  background: rgba(var(--jdm-accent-rgb), .07);
}

/* Body paragraphs */
.legal-body > section p {
  font-size: .88rem;
  line-height: 1.65;
  color: var(--jdm-muted);
  margin: 0;
  position: relative;
  z-index: 1;
}

.legal-body > section p + p {
  margin-top: 10px;
}

/* ================= SIGN-OFF ================= */
.signoff {
  margin-top: 8px;
  padding: 32px 0 0;
  border-top: 1px solid rgba(var(--jdm-accent-rgb), .18);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
}

/* Signature image appears first visually */
.signoff img {
  width: 96px;
  max-width: 34%;
  opacity: .82;
  order: -1;
}

.signoff-name {
  font-family: var(--jdm-font);
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 400;
  color: var(--jdm-muted);
  margin: 0;
}

/* ================= ANIMATION ================= */
@keyframes legalUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================= RESPONSIVE BREAKPOINTS ================= */

/* ================= TOC SIDEBAR (desktop only) ================= */
.legal-toc {
  display: none;
}

@media (min-width: 360px) {
  /* ================= HERO ================= */
  .legal-intro.section {
    min-height: 50vh;
  }
  .legal-header {
    padding-bottom: 50px;
    gap: 14px;
  }
  .legal-header .lead {
    font-size: .92rem;
  }
}

@media (min-width: 700px) {
  /* ================= HERO ================= */
  .legal-intro.section {
    min-height: 56vh;
  }
  .legal-header {
    padding-bottom: 60px;
    gap: 16px;
    max-width: 50ch;
  }
  .legal-header .lead {
    font-size: .96rem;
  }

  /* ================= TWO-COLUMN SECTIONS ================= */
  .legal-body > section {
    grid-template-columns: 190px 1fr;
    gap: 0 52px;
    padding: 34px 0;
    align-items: start;
  }
  .legal-body > section:first-child {
    padding-top: 38px;
  }

  /* Ghost number hidden at desktop - badge is sufficient */
  .legal-body > section::before {
    display: none;
  }

  /* Heading occupies left column */
  .legal-body > section h2 {
    grid-column: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 1.2rem;
    padding-top: 2px;
  }

  /* All paragraphs forced to right column */
  .legal-body > section p {
    grid-column: 2;
    font-size: .92rem;
  }
  .legal-body > section p + p {
    margin-top: 12px;
  }
}

@media (min-width: 1024px) {
  /* ================= HERO ================= */
  .legal-intro.section {
    min-height: 38vh;
  }
  .legal-header {
    padding-bottom: 52px;
    gap: 16px;
    max-width: 54ch;
  }

  /* ================= PAGE LAYOUT: TOC sidebar + article ================= */
  .legal-content .wrap {
    display: grid;
    grid-template-columns: 184px 1fr;
    gap: 0 52px;
    align-items: start;
  }

  /* Article fills the right column, no longer self-centering */
  .legal-body {
    max-width: none;
  }

  /* ================= REVERT SECTION TO SINGLE-COLUMN ================= */
  /* TOC sidebar replaces the need for the two-column section layout */
  .legal-body > section {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 28px 0;
    align-items: unset;
  }
  .legal-body > section:first-child {
    padding-top: 32px;
  }

  /* h2: badge inline with heading again (row direction) */
  .legal-body > section h2 {
    grid-column: 1;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    font-size: 1.18rem;
    padding-top: 0;
  }

  /* Paragraphs: back to full width in single column */
  .legal-body > section p {
    grid-column: 1;
    font-size: .92rem;
    line-height: 1.68;
  }
  .legal-body > section p + p {
    margin-top: 10px;
  }

  /* ================= TOC SIDEBAR ================= */
  .legal-toc {
    display: block;
    grid-column: 1;
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    padding-top: 36px;
    /* Align with first section top (margin-top 28px + padding-top 32px ~ 60px,
       label height ~ 24px, so this puts the first link near section 01) */
  }

  .legal-toc-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--jdm-muted);
    margin: 0 0 12px;
  }

  .legal-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1px;
    border-left: 1px solid var(--jdm-line);
  }

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

  .legal-toc-list a {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0 5px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--jdm-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: color .15s ease, border-color .15s ease;
  }

  .legal-toc-list a:hover {
    color: var(--jdm-ink);
    text-decoration: none;
  }

  .legal-toc-list a.is-active {
    color: var(--jdm-ink);
    border-left-color: var(--jdm-accent);
  }

  .legal-toc-num {
    font-size: 12px;
    font-weight: 800;
    color: var(--jdm-accent);
    letter-spacing: .06em;
    flex-shrink: 0;
    opacity: .8;
    font-variant-numeric: tabular-nums;
  }

  .legal-toc-list a.is-active .legal-toc-num {
    opacity: 1;
  }
}
