/*
 * Single Document Template — scoped styles
 * Source: dev/doc-return-policy.dc.html (Design Compiler mockup)
 *
 * All rules are scoped under `.ldoc` to override Elementor / theme typography
 * without leaking into the rest of the site. Non-coders editing per-site
 * accents change ONE place: the CSS variables in `.ldoc` below.
 *
 * Themable per site:
 *   --accent       brand accent color (button, icons, active TOC marker, list markers)
 *   --lh           body line-height (1.75 comfortable, 1.6 compact)
 *   --sec-gap      space between major sections (46px comfortable, 32px compact)
 *
 * The neutral palette (--ink, --head, --muted, --faint, --rule, --panel) is
 * fixed by the design system and not intended for per-site changes.
 */

/* ===== Scope reset ===== */
.ldoc, .ldoc * { box-sizing: border-box; }

.ldoc {
  --accent: var(--mn-yellow, #FFCE00);
  --lh: 1.75;
  --sec-gap: 46px;
  --measure: 70ch;
  --base: 16px;
  /* Fallback until document.js measures the sticky site header. */
  --sticky-header: calc(var(--wp-admin--admin-bar--height, 0px) + 64px);
  --sticky-top: calc(var(--sticky-header) + 16px);
  --anchor: var(--sticky-top);

  --ink: #232323;
  --head: #141414;
  --muted: #6A6A6A;
  --faint: #8A8A8A;
  --rule: #E6E6E6;
  --rule-soft: #EFEFEF;
  --panel: #FAFAFA;

  position: relative;
  font-family: var(--mn-sans, "Source Sans 3", system-ui, sans-serif);
  color: var(--ink);
  background: var(--cream-light, var(--mn-tint, #F6F5F1));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  width: 100%;
}
.ldoc ::selection { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* ===== Reading progress ===== */
.ldoc-progress {
  position: sticky;
  top: var(--sticky-header);
  left: 0;
  height: 3px;
  /* Transparent track — filled bar only, so it doesn't read as a page border. */
  background: transparent;
  z-index: 40;
  width: 100%;
  pointer-events: none;
}
.ldoc-progress [data-progress-bar] {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.08s linear;
}

/* ===== Three-column grid ===== */
.ldoc-grid {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 260px;
  gap: 56px;
  align-items: start;
  width: 100%;
  max-width: var(--nu-wide-width, 1440px);
  margin: 0 auto;
  /* Match site header/footer gutters so content aligns with site chrome. */
  padding-inline: var(--nu-gutter, clamp(1.25rem, 4vw, 3rem));
  padding-top: 30px;
  padding-bottom: 30px;
  border-top: none;
}

.ldoc-main { min-width: 0; }

/* Sticky rails — pin within .ldoc-grid while the document scrolls. */
.ldoc-aside-left,
.ldoc-aside-right {
  position: sticky;
  top: var(--sticky-top);
  align-self: start;
  /* Do not trap wheel scrolling — overflow auto + overscroll-contain on the
     rails can prevent page scroll, so the Elementor sticky masthead never engages. */
  max-height: none;
  overflow: visible;
}

/* ===== Header chrome ===== */
.ldoc-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted); /* was --faint; improve contrast on cream */
  margin: 0 0 18px;
}
.ldoc-breadcrumb a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  display: inline-flex;
  align-items: center;
}
.ldoc-breadcrumb a:hover,
.ldoc-breadcrumb a:focus-visible {
  color: var(--head);
  text-decoration-color: var(--accent);
}
.ldoc-breadcrumb__sep {
  color: var(--muted);
  opacity: 0.7;
}
.ldoc-breadcrumb [aria-current="page"] {
  color: var(--head);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.ldoc-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
  padding-bottom: 24px;
}
.ldoc-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ldoc-meta i {
  font-size: 14px;
  width: 15px;
  text-align: center;
}
.ldoc-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

/* ===== Body content (element-level styling so non-designers just edit plain HTML) ===== */
.doc-body {
  max-width: var(--measure);
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.doc-body > *:first-child { margin-top: 0; }

.doc-body p { margin: 0 0 1.05em; font-size: var(--base); line-height: var(--lh); color: var(--ink); }
.doc-body strong, .doc-body b { color: var(--head); font-weight: 600; }
.doc-body em, .doc-body i { font-style: italic; }

/* Body hyperlinks: inherit site prose style from mn-prose-links.css
   (ink text + yellow underline). Do not recolor with --accent (fails contrast). */
.doc-body a:not(:is(.doc-cta, .mn-btn, .button, .elementor-button)) {
  color: var(--mn-ink, var(--ink, #231614));
}

.doc-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--head);
  margin: var(--sec-gap) 0 0.7em;
  padding-top: var(--sec-gap);
  border-top: 1px solid var(--rule);
  scroll-margin-top: var(--anchor);
}
.doc-body h2:first-of-type { margin-top: 22px; padding-top: 20px; }

.doc-body h3 {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--head);
  margin: 1.8em 0 0.5em;
  scroll-margin-top: var(--anchor);
}
.doc-body h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--head);
  margin: 1.5em 0 0.4em;
}

.doc-body ul, .doc-body ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.doc-body li { font-size: var(--base); line-height: var(--lh); color: var(--ink); margin-bottom: 0.45em; padding-left: 0.2em; }
.doc-body li::marker { color: var(--accent); }
.doc-body li > ul, .doc-body li > ol { margin: 0.45em 0 0.2em; }

.doc-body blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: #4A4A4A;
}
.doc-body blockquote p { color: #4A4A4A; }

.doc-body hr { border: 0; border-top: 1px solid var(--rule); margin: var(--sec-gap) 0; }

.doc-body img,
.doc-body video,
.doc-body iframe {
  max-width: 100%;
  height: auto;
}
.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.4em;
  font-size: 0.875em;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.doc-body th, .doc-body td {
  border: 1px solid var(--rule);
  padding: 7px 11px;
  text-align: left;
  line-height: 1.45;
  vertical-align: top;
}
.doc-body th { background: var(--panel); font-weight: 600; color: var(--head); }

.doc-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #F2F2F2;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

.doc-body .doc-cta,
.doc-body a.doc-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--mn-ink, #231614);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 1.4em;
}
.doc-body .doc-cta:hover,
.doc-body a.doc-cta:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

/* ===== Table of contents (left rail) ===== */
.ldoc-toc-nav .eyebrow { margin: 0 0 14px 16px; }
.toc-rail { border-left: 1px solid var(--rule); }
.toc-rail__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.toc-rail__list > li { margin: 0; }
.ldoc [data-toc-link] {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: 13.5px;
  line-height: 1.4;
  color: #4A4A4A; /* ~7:1 on cream — stronger than #5A5A5A for WCAG AA */
  text-decoration: none;
  padding: 8px 8px 8px 16px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ldoc [data-toc-link]:hover { color: var(--head); }
.ldoc [data-toc-link][aria-current="location"],
.ldoc [data-toc-link][aria-current="true"] {
  color: var(--mn-ink, #231614);
  font-weight: 600;
  border-left-color: var(--accent);
}

/* ===== More documents sidebar ===== */
/* Slight inset under the eyebrow; card below keeps its own padding. */
.ldoc-doc-list {
  display: flex;
  flex-direction: column;
  padding-inline: 8px;
}
.ldoc-doc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  text-decoration: none;
  color: #333;
  font-size: 13.5px;
}
.ldoc-doc-link:hover,
.ldoc-doc-link:focus-visible {
  color: var(--mn-ink, #231614);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.ldoc-doc-link i,
.ldoc-doc-link svg {
  flex-shrink: 0;
  opacity: 0.55;
  color: inherit;
}
.ldoc-doc-link i {
  font-size: 14px;
  width: 16px;
}
.ldoc-doc-link svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ===== Contact card (right sidebar) ===== */
.ldoc-contact-card {
  margin-top: 20px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px;
  background: var(--panel);
}
.ldoc-contact-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--head);
  margin: 0 0 8px;
}
.ldoc-contact-card__text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 14px;
}
.ldoc-contact-card address {
  font-style: normal;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 16px;
}
.ldoc-contact-card address strong {
  display: block;
  color: var(--head);
  font-weight: 600;
  margin-bottom: 3px;
}
.ldoc-contact-card__phone {
  display: block;
  margin-top: 6px;
}
.ldoc-contact-card__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--mn-ink, #231614);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.ldoc-contact-card__btn:hover {
  filter: brightness(0.97);
  color: var(--mn-ink, #231614);
  text-decoration: none;
}
.ldoc-contact-card__btn:focus-visible {
  outline: 2px solid var(--mn-ink, #231614);
  outline-offset: 2px;
}
.ldoc-contact-card__btn i { font-size: 15px; }

/* ===== Mobile TOC disclosure ===== */
.ldoc .toc-mobile {
  display: none;
  margin: 8px 0 20px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--panel);
}
.ldoc .toc-mobile summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
}
.ldoc .toc-mobile summary::-webkit-details-marker { display: none; }
.ldoc .toc-mobile summary::marker { content: ""; }
.ldoc .toc-mobile__hint::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
  color: var(--mn-ink, #231614);
}
.ldoc .toc-mobile[open] .toc-mobile__hint::after { content: "−"; }
.ldoc .toc-mobile summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
  color: var(--head);
}
.ldoc .toc-mobile [data-toc-mobile] { padding: 0 0 12px; }
.ldoc .toc-mobile .toc-rail__list { border-left: 0; }
.ldoc .toc-mobile__link,
.ldoc .toc-mobile [data-toc-link] {
  min-height: 44px;
  white-space: normal;
  text-overflow: unset;
  padding: 10px 4px;
  border-left: 0;
  margin-left: 0;
}

/* ===== Focus visibility ===== */
.ldoc a:focus-visible,
.ldoc button:focus-visible,
.ldoc summary:focus-visible,
.ldoc [data-toc-link]:focus-visible {
  outline: 2px solid var(--mn-ink, #231614);
  outline-offset: 2px;
  border-radius: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 55%, transparent);
}
.ldoc-main:focus,
.ldoc-main:focus-visible,
.ldoc-archive:focus,
.ldoc-archive:focus-visible {
  outline: none;
}
.doc-body h2:focus,
.doc-body h2:focus-visible {
  outline: none;
}

/* ===== Skip link =====
   Must NOT use top:-N relative to .ldoc — that pulls the link up into the
   site header. Keep it clipped until keyboard focus, then fixed to viewport. */
.ldoc .skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  background: #fff;
  color: var(--mn-ink, #231614);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  z-index: 100000;
}
.ldoc .skip-link:focus,
.ldoc .skip-link:focus-visible {
  position: fixed;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 16px;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
  border: 1px solid var(--mn-ink, #231614);
  border-radius: 6px;
  background: #fff;
  outline: 2px solid var(--mn-yellow, #FFCE00);
  outline-offset: 2px;
}

/* ===== Common bits ===== */
.ldoc .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: #555555; }
.ldoc .eyebrow--more-docs { margin-bottom: 14px; }

/* Document title. Color rides the --head token so the palette changes in one
   place; the font stack inherits from .ldoc. */
.ldoc .ldoc-title {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--head);
  margin: 0 0 14px;
}
@media (max-width: 800px) {
  .ldoc .ldoc-title { font-size: 1.8rem; }
}

/* ===== Responsive ===== */
@media (max-width: 1080px) {
  .ldoc-grid {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px 44px;
  }
  .ldoc-aside-left { grid-column: 1; grid-row: 1; }
  .ldoc-main { grid-column: 2; grid-row: 1; }
  /* Keep related docs + contact reachable on tablet (was display:none). */
  .ldoc-aside-right {
    grid-column: 1 / -1;
    grid-row: 2;
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 28px 40px;
    align-items: start;
    margin-top: 8px;
    padding-top: 32px;
    border-top: 1px solid var(--rule);
  }
  .ldoc-aside-right .ldoc-contact-card { margin-top: 0; }
}
@media (max-width: 800px) {
  .ldoc-grid {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 20px;
    padding-bottom: 40px;
    padding-inline: max(var(--nu-gutter, 1.25rem), env(safe-area-inset-left, 0px))
      max(var(--nu-gutter, 1.25rem), env(safe-area-inset-right, 0px));
  }
  .ldoc-aside-left { display: none; }
  .ldoc-main,
  .ldoc-aside-right {
    grid-column: 1;
  }
  .ldoc .toc-mobile { display: block; }
  .doc-body { max-width: 100%; }
  .ldoc-aside-right {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-top: 36px;
    padding-top: 28px;
  }
  .ldoc-meta {
    gap: 10px 12px;
    font-size: 13px;
  }
  .ldoc-breadcrumb a {
    min-height: 44px;
  }
  .ldoc-doc-link {
    min-height: 44px;
    padding: 8px 0;
    font-size: 15px;
  }
}
@media (max-width: 480px) {
  .ldoc .ldoc-title { font-size: 1.55rem; }
  .doc-body { --base: 17px; --lh: 1.7; }
  .doc-body h2 { font-size: 1.35rem; }
}

/* Smooth anchor jumps unless the reader prefers reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .ldoc { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  .ldoc-progress [data-progress-bar],
  .ldoc-contact-card__btn,
  .ldoc-doc-link {
    transition: none !important;
  }
  .ldoc { scroll-behavior: auto; }
}

/* ===== Print ===== */
@media print {
  .ldoc-aside-left, .ldoc-aside-right, .ldoc-progress, .toc-mobile { display: none !important; }
  .ldoc-grid { display: block; }
  .doc-body { max-width: 100%; }
  .doc-body h2 { break-after: avoid; }
  .doc-body a { color: #000; text-decoration: underline; }
}



/* Keep site masthead above document chrome while Elementor sticky is active */
body.single-documents .elementor-location-header .elementor-element-mnmast01.elementor-sticky--active {
  z-index: 10000 !important;
}
body.single-documents .ldoc-progress {
  z-index: 20;
}

/* Memphis Noticias brand overrides (pulled from Blueprint ldoc) */
.ldoc .ldoc-title,
.ldoc .doc-body h2 {
  font-family: var(--mn-serif, "Source Serif 4", Georgia, serif);
}
.ldoc .ldoc-contact-card__btn {
  background: var(--mn-yellow, #FFCE00);
  color: var(--mn-ink, #231614);
  border: 0;
}
.ldoc .ldoc-contact-card__btn:hover {
  filter: brightness(0.97);
}
.ldoc [data-toc-link][aria-current="location"],
.ldoc [data-toc-link][aria-current="true"] {
  color: var(--mn-ink, #231614);
}

.ldoc-aside-left.is-empty-toc {
  display: none;
}
