/*
 * ATS policy system.
 * Loaded only on /policies/ and translated policy pages by the ATS policy MU
 * plugin. The scope intentionally avoids Elementor, WooCommerce, Tutor LMS,
 * WC Vendors and membership components outside policy content.
 */

body.ats-policy-page,
body.ats-policy-index {
  --ats-policy-navy: #071b46;
  --ats-policy-navy-deep: #020b1e;
  --ats-policy-gold: #c8a56a;
  --ats-policy-text: #1c2228;
  --ats-policy-muted: #69737b;
  --ats-policy-surface: #f7f5f1;
  --ats-policy-border: #e5e0d7;
  --ats-policy-focus: #e7d2a8;
}

/* The policy index is server-rendered from the shared catalog so English and
 * French always expose the same complete set of policies and WPML can supply
 * the correct language-specific URLs. */
body.ats-policy-index #page-main-content {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
}

body.ats-policy-index #page-main-content > article {
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  background: transparent;
}

body.ats-policy-index .ats-policy-index-content {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 0 clamp(40px, 5vw, 64px);
  color: var(--ats-policy-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

body.ats-policy-index .ats-policy-index-content h1,
body.ats-policy-index .ats-policy-index-content h2 {
  color: var(--ats-policy-navy);
  font-family: inherit;
  line-height: 1.25;
}

body.ats-policy-index .ats-policy-index-title {
  margin: 0 0 12px;
  font-size: clamp(1.65rem, 2.8vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -.025em;
}

body.ats-policy-index .ats-policy-index-intro {
  margin: 0 0 14px;
  padding: 18px 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 12px;
  background: var(--ats-policy-surface);
}

body.ats-policy-index .ats-policy-index-intro h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

body.ats-policy-index .ats-policy-index-intro p {
  margin: 0;
}

body.ats-policy-index .ats-policy-index-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.ats-policy-index .ats-policy-index-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 12px;
  background: #fff;
}

body.ats-policy-index .ats-policy-index-group h2 {
  margin: 0 0 10px;
  font-size: .95rem;
  font-weight: 400;
  letter-spacing: .03em;
  line-height: 1.4;
  text-transform: uppercase;
}

body.ats-policy-index .ats-policy-index-group ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.ats-policy-index .ats-policy-index-group li {
  margin: 0;
}

body.ats-policy-index .ats-policy-index-group a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 10px;
  background: #fff;
  color: var(--ats-policy-navy);
  font-size: .94rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

body.ats-policy-index .ats-policy-index-group a:hover {
  border-color: var(--ats-policy-gold);
  background: var(--ats-policy-surface);
  transform: translateY(-1px);
}

body.ats-policy-index .ats-policy-index-arrow {
  flex: 0 0 auto;
  color: var(--ats-policy-gold);
  font-size: 1.1rem;
}

body.ats-policy-index .ats-policy-index-content :where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--ats-policy-focus);
  outline-offset: 3px;
}

body.ats-policy-page #page-main-content {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
}

body.ats-policy-page #page-main-content > article {
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  background: transparent;
}

body.ats-policy-page .ats-policy-content {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 0 clamp(40px, 5vw, 64px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ats-policy-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

body.ats-policy-page .ats-policy-content > .elementor {
  width: 100%;
  max-width: none;
  margin: 0;
}

body.ats-policy-page .ats-policy-content .elementor-section.elementor-section-boxed > .elementor-container,
body.ats-policy-page .ats-policy-content .elementor-container {
  width: 100%;
  max-width: none;
}

body.ats-policy-page .ats-policy-content .elementor-section,
body.ats-policy-page .ats-policy-content .elementor-column-gap-default > .elementor-column > .elementor-element-populated,
body.ats-policy-page .ats-policy-content .elementor-column-gap-extended > .elementor-column > .elementor-element-populated,
body.ats-policy-page .ats-policy-content .elementor-column-gap-narrow > .elementor-column > .elementor-element-populated {
  padding-block: 0;
}

body.ats-policy-page .ats-policy-content h1,
body.ats-policy-page .ats-policy-content h2,
body.ats-policy-page .ats-policy-content h3 {
  color: var(--ats-policy-navy);
  font-family: inherit;
  font-weight: 700;
  line-height: 1.25;
  scroll-margin-top: 110px;
}

body.ats-policy-page .ats-policy-content h1 {
  margin: 0 0 12px;
  font-size: clamp(1.65rem, 2.8vw, 1.85rem);
  letter-spacing: -.025em;
}

body.ats-policy-page .ats-policy-content h2 {
  margin: 22px 0 8px;
  font-size: clamp(1.35rem, 2.3vw, 1.75rem);
  letter-spacing: -.018em;
}

body.ats-policy-page .ats-policy-content h3 {
  margin: 24px 0 8px;
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
}

body.ats-policy-page .ats-policy-content p,
body.ats-policy-page .ats-policy-content ul,
body.ats-policy-page .ats-policy-content ol,
body.ats-policy-page .ats-policy-content table,
body.ats-policy-page .ats-policy-content blockquote {
  max-width: none;
}

body.ats-policy-page .ats-policy-content p {
  margin: 0 0 16px;
}

body.ats-policy-page .ats-policy-content ul,
body.ats-policy-page .ats-policy-content ol {
  margin: 10px 0 20px;
  padding-left: 1.5rem;
}

body.ats-policy-page .ats-policy-content li {
  margin: 6px 0;
}

body.ats-policy-page .ats-policy-content hr {
  margin: 30px 0;
  border: 0;
  border-top: 1px solid var(--ats-policy-border);
}

body.ats-policy-page .ats-policy-content a {
  color: var(--ats-policy-navy);
  text-decoration: underline;
  text-decoration-color: rgba(7, 27, 70, .35);
  text-underline-offset: 3px;
}

body.ats-policy-page .ats-policy-content a:hover {
  color: #0a2c64;
  text-decoration-color: var(--ats-policy-gold);
}

body.ats-policy-page .ats-policy-content :where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--ats-policy-focus);
  outline-offset: 3px;
}

/* The reference page's existing .ats-legal blocks now use the same central
 * tokens as every other policy. Its inline style is removed at render time. */
body.ats-policy-page .ats-policy-content .ats-legal {
  max-width: none;
  margin: 0;
  color: inherit;
  font-family: inherit;
  line-height: inherit;
}

body.ats-policy-page .ats-policy-content .ats-legal .meta,
body.ats-policy-page .ats-policy-content .ats-legal .clause {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 12px;
  background: #fff;
}

body.ats-policy-page .ats-policy-content .ats-legal .meta {
  background: var(--ats-policy-surface);
}

body.ats-policy-page .ats-policy-content .ats-legal .caps,
body.ats-policy-page .ats-policy-content .ats-policy-toc > p,
body.ats-policy-page .ats-policy-content .ats-legal .toc > p {
  margin: 0 0 10px;
  color: var(--ats-policy-navy);
  font-size: .9rem;
  font-weight: 400;
  letter-spacing: .03em;
  line-height: 1.4;
  text-transform: uppercase;
}

body.ats-policy-page .ats-policy-content .ats-legal .small {
  color: var(--ats-policy-muted);
  font-size: .94rem;
}

body.ats-policy-page .ats-policy-content .ats-legal code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--ats-policy-surface);
}

/* Shared quick-links pattern: the reference uses .toc while generated pages
 * use .ats-policy-toc so both remain visually identical. */
body.ats-policy-page .ats-policy-toc,
body.ats-policy-page .ats-policy-content .ats-legal .toc {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 12px;
  background: #fff;
}

body.ats-policy-page .ats-policy-toc ul,
body.ats-policy-page .ats-policy-content .ats-legal .toc ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 24px;
  margin: 0;
  padding-left: 1.25rem;
}

body.ats-policy-page .ats-policy-toc li,
body.ats-policy-page .ats-policy-content .ats-legal .toc li {
  margin: 2px 0;
}

body.ats-policy-page .ats-policy-toc a,
body.ats-policy-page .ats-policy-content .ats-legal .toc a {
  text-decoration: none;
}

body.ats-policy-page .ats-policy-related {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 12px;
  background: #fff;
}

body.ats-policy-page .ats-policy-related h2 {
  margin: 0 0 8px;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
}

body.ats-policy-page .ats-policy-related p {
  margin-bottom: 18px;
  color: var(--ats-policy-muted);
}

body.ats-policy-page .ats-policy-related ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.ats-policy-page .ats-policy-related li {
  margin: 0;
}

body.ats-policy-page .ats-policy-related a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 10px;
  background: #fff;
  font-size: .94rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

body.ats-policy-page .ats-policy-section {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 12px;
  background: #fff;
}

body.ats-policy-page .ats-policy-section > h2 {
  margin: 0 0 8px;
  font-size: .95rem !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  letter-spacing: .03em;
  text-transform: uppercase;
}

body.ats-policy-page .ats-policy-section > h3 {
  margin-top: 14px;
}

body.ats-policy-page .ats-policy-meta {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--ats-policy-border);
  border-radius: 12px;
  background: var(--ats-policy-surface);
}

body.ats-policy-page .ats-policy-related a:hover {
  border-color: var(--ats-policy-gold);
  background: var(--ats-policy-surface);
  transform: translateY(-1px);
}

body.ats-policy-page .ats-policy-related a > span:last-child {
  flex: 0 0 auto;
  color: var(--ats-policy-gold);
  font-size: 1.1rem;
}

body.ats-policy-page .ats-policy-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

body.ats-policy-page .ats-policy-content th,
body.ats-policy-page .ats-policy-content td {
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid var(--ats-policy-border);
  text-align: left;
  vertical-align: top;
}

body.ats-policy-page .ats-policy-content th {
  background: var(--ats-policy-surface);
  color: var(--ats-policy-navy);
}

@media (max-width: 767px) {
  body.ats-policy-index #page-main-content > article {
    margin-inline: 14px;
    width: calc(100% - 28px);
  }

  body.ats-policy-index .ats-policy-index-content {
    font-size: 15px;
    line-height: 1.68;
  }

  body.ats-policy-index .ats-policy-index-title {
    font-size: 1.8rem;
  }

  body.ats-policy-index .ats-policy-index-intro,
  body.ats-policy-index .ats-policy-index-group {
    padding: 14px;
  }

  body.ats-policy-index .ats-policy-index-groups {
    grid-template-columns: 1fr;
  }

  body.ats-policy-page #page-main-content > article {
    margin-inline: 14px;
    width: calc(100% - 28px);
  }

  body.ats-policy-page .ats-policy-content {
    padding: 0;
    border-radius: 0;
    font-size: 15px;
    line-height: 1.68;
  }

  body.ats-policy-page .ats-policy-content h1 {
    font-size: 1.8rem;
  }

  body.ats-policy-page .ats-policy-content h2 {
    font-size: 1.35rem;
  }

  body.ats-policy-page .ats-policy-content h3 {
    font-size: 1.08rem;
  }

  body.ats-policy-page .ats-policy-toc,
  body.ats-policy-page .ats-policy-content .ats-legal .toc {
    padding: 16px;
  }

  body.ats-policy-page .ats-policy-toc ul,
  body.ats-policy-page .ats-policy-content .ats-legal .toc ul,
  body.ats-policy-page .ats-policy-related ul {
    grid-template-columns: 1fr;
  }

  body.ats-policy-page .ats-policy-content .ats-legal .meta,
  body.ats-policy-page .ats-policy-content .ats-legal .clause {
    padding: 16px;
  }

  body.ats-policy-page .ats-policy-section,
  body.ats-policy-page .ats-policy-meta,
  body.ats-policy-page .ats-policy-related {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.ats-policy-index .ats-policy-index-group a,
  body.ats-policy-page .ats-policy-related a {
    transition: none;
  }
}
