/* ==========================================================================
   base.css — deferred.
   Long-form typography, content components, CTA blocks, footer.
   ========================================================================== */

/* --- Accessibility helpers ------------------------------------------------ */
.screen-reader-text {
  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;
}
.screen-reader-text:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.search-form input[type='search'] {
  flex: 1 1 260px;
  min-height: 48px;
  padding: var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
}

/* --- Long-form reading ----------------------------------------------------
   These pages run 2,000–7,000 words. Measure and rhythm matter more here than
   on a typical marketing site — a reader who loses their place leaves. */
.entry__content {
  padding-bottom: var(--sp-7);
}

/* The reading column is constrained ONCE, on the container. Constraining each
   child individually is what produced the ragged left edge — every element
   resolved its own max-width and centred itself independently, so headings
   and paragraphs started at different x-positions. One container, one edge. */
.entry__content {
  max-width: var(--measure);
  margin-inline: auto;
}

.entry__content > * {
  max-width: 100%;
  margin-inline: 0;
}

/* Break out of the reading column for content that needs the room. The
   negative margins are clamped so they never exceed the available gutter. */
.entry__content > figure,
.entry__content > .table-wrap,
.entry__content > .comparison {
  --bleed: clamp(0rem, (100vw - var(--measure) - (var(--gutter) * 2)) / 2, 8rem);
  width: calc(100% + (var(--bleed) * 2));
  max-width: calc(100% + (var(--bleed) * 2));
  margin-inline: calc(var(--bleed) * -1);
}

/* Asymmetric heading spacing: generous above, tight below. A heading belongs
   to the text that follows it, and equal margins on both sides leave it
   floating between two sections instead of introducing one. */
.entry__content h2 {
  font-size: var(--step-2);
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  letter-spacing: -.015em;
}
.entry__content h3 {
  font-size: var(--step-1);
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-2);
  letter-spacing: -.01em;
}
.entry__content h4 {
  font-size: var(--step-0);
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-2);
  color: var(--ink);
}

/* Nothing should push away from a heading it sits directly beneath. */
.entry__content h2 + *,
.entry__content h3 + *,
.entry__content h4 + * { margin-top: 0; }

.entry__content > :first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.entry__content p,
.entry__content li {
  font-size: var(--step-0);
  line-height: var(--lh-relaxed);
  color: var(--ink);
}

.entry__content ul,
.entry__content ol {
  padding-left: 1.4em;
  margin-bottom: var(--sp-5);
}
.entry__content li { margin-bottom: var(--sp-2); }

.entry__content a { font-weight: 500; }

.entry__content img {
  border-radius: var(--radius);
  margin-block: var(--sp-5);
}

.entry__content blockquote {
  margin: var(--sp-5) 0;
  padding: var(--sp-4) var(--sp-5);
  border-left: 4px solid var(--gold);
  background: var(--surface-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.entry__content blockquote > :last-child { margin-bottom: 0; }

.entry__content hr {
  margin-block: var(--sp-7);
  border: 0;
  border-top: 1px solid var(--line);
}

/* --- Tables ---------------------------------------------------------------
   Replaces the Table Addons for Elementor widget. Scrolls horizontally on
   narrow screens rather than squashing columns to illegibility. */
.entry__content table,
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  margin-block: var(--sp-5);
  font-size: var(--step--1);
}
.entry__content table th,
.entry__content table td {
  padding: var(--sp-3);
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.entry__content table th {
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}
.entry__content table tbody tr:nth-child(even) { background: var(--surface-alt); }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Blocks that sit outside .entry__content but should share its left edge.
   Without this the byline and the 18+ notice run the full 1200px while the
   article text sits in a 640px column — the page reads as two layouts. */
.byline,
.notice,
.quick-answer,
.author-box {
  max-width: var(--measure);
  margin-inline: auto;
}

/* --- Byline --------------------------------------------------------------- */
.byline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.byline strong { color: var(--ink-soft); font-weight: 700; }
.byline__item--time { margin-left: auto; }

/* --- Breadcrumbs ---------------------------------------------------------- */
.breadcrumbs { padding-top: var(--sp-4); }
.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
  color: var(--ink-muted);
}
.breadcrumbs__item + .breadcrumbs__item::before {
  content: '/';
  margin-right: var(--sp-2);
  color: var(--line-strong);
}
.breadcrumbs a { color: var(--ink-muted); }
.breadcrumbs a:hover { color: var(--navy); }
.breadcrumbs [aria-current='page'] { color: var(--ink); font-weight: 500; }

/* --- Notices -------------------------------------------------------------- */
.notice {
  margin-block: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border-left: 4px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--step--1);
  line-height: var(--lh-normal);
}
.notice > :last-child { margin-bottom: 0; }

.notice--warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: #713f12;
}
.notice--warn a { color: #854d0e; font-weight: 700; }

.notice--info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--navy);
}

/* --- Quick answer (SERP snippet target) ----------------------------------- */
.quick-answer {
  margin-block: var(--sp-5);
  padding: var(--sp-5);
  background: var(--info-bg);
  border-left: 4px solid var(--info-border);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.quick-answer > :last-child { margin-bottom: 0; }
.quick-answer strong { color: var(--navy); }

/* --- CTA ------------------------------------------------------------------ */
.cta { margin-block: var(--sp-6); }

.cta__panel {
  padding: var(--sp-6) var(--sp-5);
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius-lg);
  text-align: center;
  color: #fff;
}
.cta__title {
  color: #fff;
  font-size: var(--step-2);
  margin-bottom: var(--sp-3);
}
.cta__lede {
  color: #dbeafe;
  max-width: 54ch;
  margin-inline: auto;
  margin-bottom: var(--sp-5);
}
.cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: center;
}
.cta__foot {
  margin: var(--sp-5) 0 0;
  color: #94a3b8;
  font-size: var(--step--1);
}

.steps {
  margin-top: var(--sp-4);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.steps__title {
  margin-bottom: var(--sp-3);
  color: var(--navy);
  font-weight: 700;
}
.steps__list {
  margin: 0;
  padding-left: 1.3em;
}
.steps__list li {
  margin-bottom: var(--sp-2);
  line-height: var(--lh-normal);
}
.steps__note {
  margin: var(--sp-3) 0 0;
  color: var(--ink-muted);
  font-size: var(--step--1);
}

/* Restrained variant — review and legal pages. */
.cta--restrained {
  padding: var(--sp-5);
  background: var(--surface-alt);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.cta--restrained__title {
  font-size: var(--step-1);
  margin-bottom: var(--sp-3);
}
.cta--restrained__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.link-plain {
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: underline;
}

/* --- Sticky mobile CTA ----------------------------------------------------
   Mobile only. Hidden by default and revealed once the visitor has scrolled
   past roughly the first viewport, using a scroll-driven animation so it
   costs no JavaScript. Browsers without animation-timeline just show it,
   which is acceptable rather than broken. */
.sticky-cta {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: var(--z-sticky-cta);
  padding: var(--sp-3) var(--gutter);
  background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .1);
}
.sticky-cta__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: var(--wrap);
  margin-inline: auto;
}
.sticky-cta__label {
  flex: 1 1 auto;
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--navy);
}
.sticky-cta .btn { flex: 0 0 auto; }

@supports (animation-timeline: scroll()) {
  .sticky-cta {
    animation: sticky-cta-in linear both;
    animation-timeline: scroll();
    animation-range: 80vh 110vh;
  }
  @keyframes sticky-cta-in {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .sticky-cta { animation: none; transform: none; opacity: 1; }
}

@media (min-width: 768px) {
  .sticky-cta { display: none; }
}

/* Keep the sticky bar from covering the last line of content. */
@media (max-width: 767px) {
  body { padding-bottom: 76px; }
}

/* --- Related links -------------------------------------------------------- */
.related {
  margin-block: var(--sp-6);
  padding: var(--sp-5);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.related__title {
  font-size: var(--step-1);
  margin-bottom: var(--sp-4);
}
.related__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-3);
}
.related__item a {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.related__item a:hover {
  border-color: var(--navy-light);
  transform: translateX(2px);
}
.related__home,
.home-return {
  margin: var(--sp-4) 0 0;
  font-size: var(--step--1);
  color: var(--ink-muted);
}

/* --- Author box ----------------------------------------------------------- */
.author-box {
  margin-block: var(--sp-6);
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.author-box__title {
  margin-bottom: var(--sp-3);
  color: var(--navy);
  font-size: var(--step-0);
  font-weight: 700;
}
.author-box > :last-child { margin-bottom: 0; }

/* --- FAQ accordion --------------------------------------------------------
   Native <details>. No JavaScript, keyboard accessible for free, and the
   content stays in the DOM so crawlers read it. */
.faq { margin-block: var(--sp-6); }
.faq__item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: var(--sp-3);
  background: var(--surface);
  overflow: hidden;
}
.faq__item summary {
  padding: var(--sp-4) var(--sp-5);
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: '';
  flex: 0 0 auto;
  width: .5em;
  height: .5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--base) var(--ease);
}
.faq__item[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq__item summary:hover { background: var(--surface-alt); }
.faq__body {
  padding: 0 var(--sp-5) var(--sp-4);
  color: var(--ink-soft);
}
.faq__body > :last-child { margin-bottom: 0; }

/* --- Link lists ----------------------------------------------------------- */
.link-list {
  margin: 0 0 var(--sp-5);
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-2);
}
.link-list a { font-weight: 600; }
.link-list--prominent a {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.link-list--prominent a:hover { border-color: var(--navy-light); }

.empty-state {
  padding: var(--sp-6);
  background: var(--surface-alt);
  border-radius: var(--radius);
  color: var(--ink-muted);
  text-align: center;
}

.search-block { margin-block: var(--sp-5); }
.search-block__label { font-weight: 700; color: var(--navy); }
.search-block input[type='search'] {
  width: min(100%, 420px);
  min-height: 48px;
  padding: var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
}

/* --- Footer --------------------------------------------------------------- */
.site-footer {
  margin-top: var(--sp-8);
  padding-block: var(--sp-7) var(--sp-5);
  background: var(--footer-bg);
  color: var(--footer-ink);
  font-size: var(--step--1);
}
.site-footer__cols {
  display: grid;
  gap: var(--sp-6);
  padding-bottom: var(--sp-6);
}
.footer-widget__title,
.site-footer__col p:first-child {
  margin-bottom: var(--sp-3);
  color: var(--footer-head);
  font-size: var(--step-0);
  font-weight: 700;
}
.site-footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-2);
}
.site-footer a { color: var(--footer-ink); text-decoration: underline; }
.site-footer a:hover { color: #fff; }

.site-footer__legal {
  padding-top: var(--sp-5);
  border-top: 1px solid rgba(148, 163, 184, .22);
  font-size: var(--step--2);
  color: #64748b;
}
.site-footer__legal p { margin-bottom: var(--sp-2); }
.site-footer__legal p:last-child { margin-bottom: 0; }

.badge-18 {
  display: inline-block;
  margin-right: var(--sp-2);
  padding: 2px var(--sp-2);
  border: 1px solid var(--gold);
  border-radius: 3px;
  color: var(--gold);
  font-weight: 700;
  font-size: var(--step--2);
}

/* --- Pagination ----------------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  margin-block: var(--sp-6);
}
.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.pagination .page-numbers.current {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ==========================================================================
   Tablet and up
   ========================================================================== */
@media (min-width: 640px) {
  .related__list { grid-template-columns: repeat(2, 1fr); }
  .cta__panel { padding: var(--sp-7) var(--sp-6); }
}

@media (min-width: 900px) {
  .site-footer__cols { grid-template-columns: 1.4fr 1fr; gap: var(--sp-8); }
}
