/*
 * AgeReady Core — component styles.
 *
 * These live in the plugin, not the theme, because the components they style
 * are plugin output: the disclosure, the sources line, the table of contents,
 * the dimension tables and the calculator all have to keep working and keep
 * looking deliberate if the theme is ever swapped.
 *
 * Every colour is a var() with a hard-coded fallback, so on the AgeReady
 * theme these inherit the design tokens, and on any other theme they still
 * render correctly rather than collapsing to browser defaults.
 *
 * Contrast is checked against the fallback values, which are the worst case.
 */

/* ---------------------------------------------------------------- helpers */

.ar-pick .sr-only,
.ar-calc .sr-only {
  position: absolute !important;
  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;
}

/* ----------------------------------------------------- reviewed sources */

.ar-sources-line {
  background: var(--green-soft, #E4EDE6);
  border: 1px solid #C6DACC;
  border-radius: var(--radius, 5px);
  padding: 12px 16px;
  margin: 0 0 20px;
  font-size: .888rem;
  line-height: 1.55;
  color: var(--ink, #17212B);
}
.ar-sources-line__label { font-weight: 700; color: var(--green-dk, #2E5240); }
.ar-sources-line a { color: var(--green-dk, #2E5240); }

/* --------------------------------------------------------- disclosure */

/* Renders above the content, never below it. If a reader has to scroll to
   find out a page is monetised, the disclosure has failed. */
.ar-disclosure {
  display: block;
  background: var(--sand-2, #EAE3D7);
  border: 1px solid var(--rule-2, #C6BDAC);
  border-left: 5px solid var(--clay, #9A5B2C);
  border-radius: 0 var(--radius, 5px) var(--radius, 5px) 0;
  padding: 14px 18px;
  margin: 0 0 24px;
  font-size: .888rem;
  line-height: 1.6;
  color: var(--ink, #17212B);
}
.ar-disclosure strong { color: #7A461F; }
.ar-disclosure a { color: var(--green-dk, #2E5240); }

/* ------------------------------------------------------ key takeaways */

.ar-takeaways {
  background: var(--navy, #12293F);
  color: #fff;
  border-radius: var(--radius-lg, 6px);
  padding: 28px 30px;
  margin: 0 0 32px;
}
.ar-takeaways__title {
  color: #fff !important;
  font-size: 1.166rem !important;
  margin: 0 0 14px !important;
  letter-spacing: .01em;
}
/* Same reasoning as .ar-calc__result below: a theme that colours list items
   with `.ar-prose li` (0-1-1) would beat a bare `.ar-takeaways li` and put
   dark text on this navy block, so the list selectors carry an extra class. */
.ar-takeaways ul { margin: 0; padding-left: 1.2em; }
.ar-takeaways ul li { color: #E3EAF0; margin-bottom: 10px; }
.ar-takeaways ul li:last-child { margin-bottom: 0; }
.ar-takeaways ul li::marker { color: #A8D2B6; }
.ar-takeaways a, .ar-takeaways ul li a { color: #BFE0CB; }

/* -------------------------------------------------- table of contents */

.ar-toc {
  background: var(--paper, #FFFFFF);
  border: 1px solid var(--rule, #DDD6C9);
  border-radius: var(--radius-lg, 6px);
  padding: 20px 24px;
  margin: 0 0 32px;
}
.ar-toc__title {
  font-size: .777rem !important;
  font-weight: 700 !important;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-2, #4A5764) !important;
  margin: 0 0 12px !important;
  font-family: inherit !important;
}
.ar-toc__list { margin: 0; padding-left: 1.4em; }
.ar-toc__list li { margin-bottom: 8px; }
.ar-toc__list li:last-child { margin-bottom: 0; }
.ar-toc__list li::marker { color: var(--ink-3, #6B7783); font-size: .833rem; }
.ar-toc__list a { color: var(--green-dk, #2E5240); text-decoration: none; }
.ar-toc__list a:hover { text-decoration: underline; }

/* ---------------------------------------------------------- callouts */

.ar-note {
  display: block;
  border-radius: var(--radius-lg, 6px);
  padding: 18px 22px;
  margin: 28px 0;
  border: 1px solid transparent;
}
.ar-note__title {
  font-size: .777rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.ar-note__body > *:last-child { margin-bottom: 0; }
.ar-note__body { color: var(--ink, #17212B); }

.ar-note--tip  { background: var(--green-soft, #E4EDE6); border-color: #C6DACC; }
.ar-note--tip  .ar-note__title { color: var(--green-dk, #2E5240); }

.ar-note--warn { background: #FDF3E7; border-color: #E8D3B8; }
.ar-note--warn .ar-note__title { color: #7A461F; }

/* ------------------------------------------------------ product pick */

/* A recommendation has to look like a recommendation. If this block could be
   mistaken for the article's own prose, the disclosure at the top of the page
   has not done its job. */
.ar-pick {
  background: var(--sand, #F5F1EA);
  border: 1px solid var(--rule-2, #C6BDAC);
  border-top: 4px solid var(--clay, #9A5B2C);
  border-radius: var(--radius-lg, 6px);
  padding: 24px 26px;
  margin: 32px 0;
}
.ar-pick__flag {
  font-size: .777rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: #7A461F;
  margin: 0 0 8px;
}
.ar-pick__name {
  font-size: 1.222rem; font-weight: 700; line-height: 1.3;
  color: var(--ink, #17212B);
  margin: 0 0 6px;
}
.ar-pick__spec {
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: .833rem;
  color: var(--ink-2, #4A5764);
  margin: 0 0 12px;
}
.ar-pick__why { color: var(--ink-2, #4A5764); margin: 0 0 18px; font-size: .944rem; }
.ar-pick__cta { margin: 0 0 14px; }
.ar-pick__note {
  font-size: .833rem;
  color: var(--ink-2, #4A5764);
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule-2, #C6BDAC);
}

/* ---------------------------------------------------- dimension tables */

.ar-dims { margin: 32px 0; }

.ar-dims__table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background: var(--paper, #FFFFFF);
  border: 1px solid var(--rule, #DDD6C9);
  border-radius: var(--radius, 5px);
  font-size: .944rem;
}
.ar-dims__table caption {
  text-align: left;
  font-weight: 700;
  font-size: .777rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-2, #4A5764);
  padding: 0 0 10px;
}
.ar-dims__table th,
.ar-dims__table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule, #DDD6C9);
  vertical-align: top;
}
.ar-dims__table thead th {
  background: var(--sand-2, #EAE3D7);
  color: var(--ink, #17212B);
  font-size: .777rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule-2, #C6BDAC);
}
.ar-dims__table tbody th { font-weight: 600; color: var(--ink, #17212B); width: 42%; }
.ar-dims__table tbody tr:last-child th,
.ar-dims__table tbody tr:last-child td { border-bottom: 0; }
.ar-dims__value {
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: .888rem;
  color: var(--ink, #17212B);
}
.ar-dims__section {
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: .833rem;
  color: var(--ink-2, #4A5764);
  white-space: nowrap;
}

.ar-dims__source {
  font-size: .833rem;
  color: var(--ink-2, #4A5764);
  margin: 0 0 10px;
}
.ar-dims__source a { color: var(--green-dk, #2E5240); }

/* The scope note. Not decoration — it is the difference between reporting a
   standard and implying a legal requirement. */
.ar-dims__note {
  font-size: .833rem;
  line-height: 1.6;
  color: var(--ink, #17212B);
  background: var(--sand-2, #EAE3D7);
  border-left: 4px solid var(--ink-3, #6B7783);
  border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
  padding: 12px 16px;
  margin: 0;
}

/* Tables must scroll inside their own box, never push the page sideways. */
@media (max-width: 560px) {
  .ar-dims { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ar-dims__table { min-width: 460px; }
  .ar-dims__source, .ar-dims__note { min-width: 0; }
}

/* -------------------------------------------------------- calculator */

.ar-calc {
  background: var(--paper, #FFFFFF);
  border: 1px solid var(--rule-2, #C6BDAC);
  border-radius: var(--radius-lg, 6px);
  padding: 26px;
  margin: 32px 0;
}

.ar-calc__group { border: 0; padding: 0; margin: 0 0 28px; }
.ar-calc__group:last-of-type { margin-bottom: 0; }
.ar-calc__group legend {
  padding: 0;
  font-size: .777rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--green-dk, #2E5240);
  margin-bottom: 14px;
}

.ar-calc__row {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule, #DDD6C9);
}
.ar-calc__row:last-child { border-bottom: 0; }

.ar-calc__check { display: flex; align-items: flex-start; gap: 12px; }

/* A 22px box with a 3:1 border. The default browser checkbox is both too
   small for the target audience and too pale to meet 1.4.11. */
.ar-calc__box {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  margin: 3px 0 0;
  accent-color: var(--green, #3E6B4F);
  border: 2px solid var(--control-edge, #6B7783);
  border-radius: 3px;
  cursor: pointer;
}
.ar-calc__check label { cursor: pointer; line-height: 1.45; }
.ar-calc__label { font-weight: 600; color: var(--ink, #17212B); display: block; }
.ar-calc__range {
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: .833rem;
  color: var(--ink-2, #4A5764);
}

.ar-calc__qty {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 0 34px;
}
.ar-calc__qty label { font-size: .888rem; color: var(--ink-2, #4A5764); }
.ar-calc__qty input {
  width: 84px; min-height: 44px;
  padding: 8px 10px;
  font-family: inherit; font-size: 1rem;
  color: var(--ink, #17212B);
  background: var(--paper, #FFFFFF);
  border: 2px solid var(--control-edge, #6B7783);
  border-radius: var(--radius-sm, 4px);
}

.ar-calc__result {
  margin-top: 26px;
  background: var(--navy, #12293F);
  border-radius: var(--radius, 5px);
  padding: 22px 24px;
  color: #fff;
}
/* These four are scoped under .ar-calc__result on purpose, giving them a
   0-2-0 specificity. The calculator renders inside the theme's article body,
   and a theme that colours prose with a type selector -- `.ar-prose p` is
   0-1-1 -- otherwise beats a bare `.ar-calc__total` and paints dark body text
   onto this navy panel. The failure is invisible until the shortcode sits
   inside real article styles, and it is unreadable when it lands. */
.ar-calc__result .ar-calc__result-label {
  font-size: .777rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: #A8D2B6;
  margin: 0 0 6px;
}
.ar-calc__result .ar-calc__total {
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  color: #fff;
  margin: 0 0 12px;
}
.ar-calc__result .ar-calc__caveat {
  font-size: .833rem; line-height: 1.6;
  color: #C4D1DC;
  margin: 0 0 16px;
}
.ar-calc__result .ar-calc__reset { color: #fff; border-color: rgba(255,255,255,.55); background: transparent; }
.ar-calc__result .ar-calc__reset:hover { background: rgba(255,255,255,.12); color: #fff; border-color: #fff; }

.ar-calc :focus-visible { outline: 3px solid var(--focus, #2E5240); outline-offset: 2px; }
.ar-calc__result :focus-visible { outline-color: #fff; }

/* Fallback button styling, for a theme that has no .ar-btn of its own.
   Wrapped in :where() so these rules carry ZERO specificity: the moment the
   active theme defines .ar-btn--ghost-light or any other variant, the theme
   wins. Without this the border shorthand here silently resets the theme's
   variant border colours to transparent. */
:where(.ar-btn) {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 13px 24px;
  font-family: inherit; font-size: 1rem; font-weight: 700; line-height: 1.2;
  border: 2px solid transparent; border-radius: var(--radius, 5px);
  text-decoration: none; cursor: pointer;
}
:where(.ar-btn--primary) { background: var(--green, #3E6B4F); color: #fff; }
:where(.ar-btn--primary:hover) { background: var(--green-dk, #2E5240); color: #fff; }
:where(.ar-btn--ghost) {
  background: transparent;
  color: var(--green-dk, #2E5240);
  border-color: var(--control-edge, #6B7783);
}

@media (max-width: 400px) {
  .ar-calc, .ar-pick, .ar-takeaways { padding: 18px; }
  .ar-calc__qty { margin-left: 0; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .ar-calc *, .ar-pick * { transition-duration: .001ms !important; }
}
