/* LiveDeck interactive components
   Shared by the marketing site and every LiveDeck.
   Theme each document by setting the --ld-* custom properties on a parent. */

.ld-scope {
  --ld-ink: #121A24;
  --ld-ink-2: #3D4550;
  --ld-surface: #FFFFFF;
  --ld-surface-2: #EEF3EF;
  --ld-line: #D9DED9;
  --ld-accent: #2F6B4F;
  --ld-accent-ink: #FFFFFF;
  --ld-accent-soft: #DCE4DE;
  --ld-highlight: #DDF46B;
  --ld-right: #2F6B4F;
  --ld-wrong: #A23B2A;
  --ld-radius: 16px;
  --ld-font-display: inherit;
  --ld-font-body: inherit;
  --ld-focus: #2F6B4F;
  --ld-ease: cubic-bezier(.2, .8, .2, 1);
}

.ld-scope :focus-visible {
  outline: 3px solid var(--ld-focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Shared button look */
.ld-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  padding: 0.6em 1.1em;
  border-radius: 999px;
  border: 1.5px solid var(--ld-ink);
  background: transparent;
  color: var(--ld-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: background .2s, color .2s, border-color .2s;
}
.ld-btn:hover { background: var(--ld-ink); color: var(--ld-surface); }
.ld-btn--solid { background: var(--ld-accent); border-color: var(--ld-accent); color: var(--ld-accent-ink); }
.ld-btn--solid:hover { background: var(--ld-ink); border-color: var(--ld-ink); color: var(--ld-surface); }

/* Count up */
.ld-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 20px);
}
@media (min-width: 900px) { .ld-stats--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ld-stat {
  background: var(--ld-surface);
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-radius);
  padding: clamp(16px, 2.4vw, 24px);
  display: flex; flex-direction: column; gap: 6px;
}
.ld-stat__num {
  font-family: var(--ld-font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ld-ink);
}
.ld-stat__label { font-size: 0.95rem; color: var(--ld-ink-2); line-height: 1.4; }

/* Calculator */
.ld-calc {
  background: var(--ld-surface);
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-radius);
  padding: clamp(18px, 3vw, 28px);
  display: flex; flex-direction: column; gap: 18px;
}
.ld-calc__row { display: flex; flex-direction: column; gap: 10px; }
.ld-calc__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.98rem; color: var(--ld-ink-2); }
.ld-calc__head output { font-weight: 700; color: var(--ld-ink); font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.ld-calc__choices { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.ld-calc__choices legend { font-size: 0.98rem; color: var(--ld-ink-2); margin-bottom: 8px; padding: 0; }
.ld-calc__choice { position: relative; }
.ld-calc__choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ld-calc__choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1.5px solid var(--ld-line); font-weight: 600; font-size: 0.95rem;
}
.ld-calc__choice input:checked + span { background: var(--ld-ink); border-color: var(--ld-ink); color: var(--ld-surface); }
.ld-calc__choice input:focus-visible + span { outline: 3px solid var(--ld-focus); outline-offset: 3px; }
.ld-calc__results { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.ld-calc__result {
  background: var(--ld-ink); color: var(--ld-surface);
  border-radius: calc(var(--ld-radius) - 4px); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.ld-calc__result span { font-size: 0.88rem; opacity: .85; }
.ld-calc__result output {
  font-family: var(--ld-font-display); font-size: clamp(1.7rem, 4vw, 2.3rem);
  line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.ld-calc__note { font-size: 0.82rem; color: var(--ld-ink-2); margin: 0; }

/* Range inputs */
.ld-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; background: transparent; margin: 0; cursor: pointer;
  --fill: 50%;
}
.ld-range::-webkit-slider-runnable-track {
  height: 8px; border-radius: 4px;
  background: linear-gradient(to right, var(--ld-accent) var(--fill), var(--ld-accent-soft) var(--fill));
}
.ld-range::-moz-range-track { height: 8px; border-radius: 4px; background: var(--ld-accent-soft); }
.ld-range::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--ld-accent); }
.ld-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 50%; margin-top: -10px;
  background: var(--ld-ink); border: 4px solid var(--ld-surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.ld-range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ld-ink); border: 4px solid var(--ld-surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.ld-range:focus-visible { outline: none; }
.ld-range:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--ld-focus); outline-offset: 3px; }
.ld-range:focus-visible::-moz-range-thumb { outline: 3px solid var(--ld-focus); outline-offset: 3px; }

/* Hotspot diagram */
.ld-hotspots { display: grid; gap: 16px; }
@media (min-width: 760px) { .ld-hotspots--side { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; } }
.ld-hotspots__stage {
  position: relative; border-radius: var(--ld-radius); overflow: hidden;
  background: var(--ld-surface-2); border: 1px solid var(--ld-line);
}
.ld-hotspots__stage svg { display: block; width: 100%; height: auto; }
.ld-hotspot {
  position: absolute; left: var(--x); top: var(--y);
  width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: transparent;
}
.ld-hotspot::before, .ld-hotspot::after {
  content: ""; position: absolute; border-radius: 50%;
}
.ld-hotspot::before { inset: 11px; background: var(--ld-accent); box-shadow: 0 0 0 4px var(--ld-surface); transition: transform .25s var(--ld-ease); }
.ld-hotspot::after { inset: 8px; border: 2px solid var(--ld-accent); animation: ld-ring 2.2s ease-out infinite; }
.ld-hotspot[aria-expanded="true"]::before { background: var(--ld-ink); transform: scale(1.25); }
.ld-hotspot[aria-expanded="true"]::after { border-color: var(--ld-ink); }
.ld-hotspot__num {
  position: relative; z-index: 1; color: var(--ld-accent-ink); font-size: 12px; font-weight: 700; line-height: 44px;
}
@keyframes ld-ring { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.ld-hotspots__panel {
  background: var(--ld-surface); border: 1px solid var(--ld-line); border-radius: var(--ld-radius);
  padding: clamp(16px, 2.4vw, 24px); min-height: 7.5em;
}
.ld-hotspots__panel h3, .ld-hotspots__panel h4 { margin: 0 0 6px; font-family: var(--ld-font-display); font-size: 1.25rem; line-height: 1.2; color: var(--ld-ink); }
.ld-hotspots__panel p { margin: 0; color: var(--ld-ink-2); line-height: 1.5; }
.ld-hotspots__prompt { color: var(--ld-ink-2); }

/* Chart with toggles */
.ld-chart { display: flex; flex-direction: column; gap: 16px; }
.ld-toggles { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--ld-surface-2); align-self: flex-start; }
.ld-toggles button {
  font: inherit; font-weight: 600; font-size: 0.92rem; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 0; background: transparent; color: var(--ld-ink-2); cursor: pointer;
}
.ld-toggles button[aria-pressed="true"] { background: var(--ld-ink); color: var(--ld-surface); }
.ld-chart__bars {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: clamp(6px, 1.4vw, 14px); align-items: end;
  height: clamp(180px, 30vh, 260px);
  border-bottom: 1.5px solid var(--ld-line);
}
.ld-chart__bars li { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 6px; }
.ld-chart__bar {
  height: var(--h, 0%); min-height: 2px; border-radius: 6px 6px 0 0; background: var(--ld-accent);
  transition: height .8s var(--ld-ease);
  position: relative;
}
.ld-chart__bars li:last-child .ld-chart__bar { background: var(--ld-ink); }
.ld-chart__val {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  font-size: clamp(0.7rem, 1.6vw, 0.85rem); font-weight: 700; color: var(--ld-ink); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ld-chart__labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: clamp(6px, 1.4vw, 14px); font-size: clamp(0.68rem, 1.6vw, 0.85rem); color: var(--ld-ink-2); text-align: center; }
.ld-chart__caption { margin: 0; font-size: 0.9rem; color: var(--ld-ink-2); }

/* Timeline */
.ld-timeline { display: flex; flex-direction: column; gap: 18px; }
.ld-timeline__steps {
  list-style: none; margin: 0; padding: 0; position: relative;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px;
}
.ld-timeline__steps::before, .ld-timeline__steps::after {
  content: ""; position: absolute; left: 0; top: 21px; height: 3px; border-radius: 2px;
}
.ld-timeline__steps::before { right: 0; background: var(--ld-accent-soft); }
.ld-timeline__steps::after { width: var(--p, 0%); background: var(--ld-accent); transition: width .6s var(--ld-ease); }
.ld-timeline__step {
  font: inherit; position: relative; z-index: 1; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 0; cursor: pointer; color: var(--ld-ink);
  display: flex; flex-direction: column; gap: 8px; min-height: 44px;
}
.ld-timeline__dot {
  width: 20px; height: 20px; border-radius: 50%; margin-top: 12px;
  background: var(--ld-surface); border: 3px solid var(--ld-accent-soft);
  transition: background .3s, border-color .3s, transform .3s var(--ld-ease);
}
.ld-timeline__step.is-done .ld-timeline__dot { border-color: var(--ld-accent); background: var(--ld-accent); }
.ld-timeline__step.is-current .ld-timeline__dot { border-color: var(--ld-ink); background: var(--ld-highlight); transform: scale(1.25); }
.ld-timeline__when { font-weight: 700; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.ld-timeline__what { font-size: clamp(0.78rem, 1.8vw, 0.95rem); color: var(--ld-ink-2); line-height: 1.35; }
.ld-timeline__detail {
  background: var(--ld-surface); border: 1px solid var(--ld-line); border-radius: var(--ld-radius);
  padding: 16px 20px; color: var(--ld-ink-2); line-height: 1.5; min-height: 3.2em;
}
.ld-timeline__detail strong { color: var(--ld-ink); }
@media (max-width: 560px) {
  .ld-timeline__steps { grid-auto-flow: row; grid-auto-columns: auto; gap: 4px; padding-left: 0; }
  .ld-timeline__steps::before, .ld-timeline__steps::after { left: 9px; top: 0; width: 3px; height: auto; bottom: 0; }
  .ld-timeline__steps::after { height: var(--p, 0%); bottom: auto; width: 3px; transition: height .6s var(--ld-ease); }
  .ld-timeline__step { flex-direction: row; align-items: center; gap: 14px; padding: 4px 0; }
  .ld-timeline__dot { margin: 0; flex-shrink: 0; }
  .ld-timeline__text { display: flex; flex-direction: column; }
}

/* Flip cards */
.ld-flips { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.ld-flip__btn {
  font: inherit; color: inherit; text-align: left; width: 100%; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: grid; perspective: 1200px; min-height: 200px;
}
.ld-flip__face {
  grid-area: 1 / 1; display: flex; flex-direction: column; gap: 8px;
  padding: 20px; border-radius: var(--ld-radius); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform .6s var(--ld-ease);
}
.ld-flip__front { background: var(--ld-surface); border: 1px solid var(--ld-line); }
.ld-flip__back { background: var(--ld-ink); color: var(--ld-surface); transform: rotateY(180deg); }
.ld-flip__btn[aria-pressed="true"] .ld-flip__front { transform: rotateY(-180deg); }
.ld-flip__btn[aria-pressed="true"] .ld-flip__back { transform: rotateY(0); }
.ld-flip__title { font-family: var(--ld-font-display); font-size: 1.3rem; line-height: 1.15; display: block; }
.ld-flip__price { font-weight: 700; display: block; }
.ld-flip__hint { margin-top: auto; font-size: 0.82rem; color: var(--ld-ink-2); display: flex; align-items: center; gap: 6px; }
.ld-flip__back .ld-flip__list { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; line-height: 1.4; }
.ld-flip__back .ld-flip__list span::before { content: "✓"; margin-right: 8px; color: var(--ld-highlight); }

/* Quiz */
.ld-quiz { display: flex; flex-direction: column; gap: 14px; }
.ld-quiz__q { margin: 0; font-family: var(--ld-font-display); font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.2; color: var(--ld-ink); }
.ld-quiz__opts { display: flex; flex-direction: column; gap: 10px; }
.ld-quiz__opt {
  font: inherit; font-weight: 600; text-align: left; min-height: 52px; padding: 12px 18px;
  border-radius: 14px; border: 1.5px solid var(--ld-line); background: var(--ld-surface); color: var(--ld-ink);
  cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  transition: background .2s, border-color .2s, color .2s;
}
.ld-quiz__opt:hover { border-color: var(--ld-ink); }
.ld-quiz__opt.is-right { background: var(--ld-right); border-color: var(--ld-right); color: #fff; }
.ld-quiz__opt.is-wrong { background: var(--ld-wrong); border-color: var(--ld-wrong); color: #fff; }
.ld-quiz__opt .ld-quiz__mark { font-size: 0.85rem; font-weight: 700; }
.ld-quiz__feedback { margin: 0; min-height: 1.5em; color: var(--ld-ink); line-height: 1.5; }
.ld-quiz__reset { align-self: flex-start; }

/* Checklist */
.ld-check { display: flex; flex-direction: column; gap: 14px; }
.ld-check__meter { height: 10px; border-radius: 5px; background: var(--ld-accent-soft); overflow: hidden; }
.ld-check__bar { display: block; height: 100%; width: var(--p, 0%); background: var(--ld-accent); border-radius: 5px; transition: width .5s var(--ld-ease); }
.ld-check__count { margin: 0; font-weight: 700; color: var(--ld-ink); }
.ld-check__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ld-check__item label {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 16px;
  border-radius: 14px; border: 1.5px solid var(--ld-line); background: var(--ld-surface); cursor: pointer; color: var(--ld-ink);
}
.ld-check__item input {
  -webkit-appearance: none; appearance: none; margin: 0; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--ld-ink-2); display: grid; place-content: center; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.ld-check__item input::after { content: ""; width: 10px; height: 6px; border: solid var(--ld-accent-ink); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) scale(0); margin-top: -3px; transition: transform .2s var(--ld-ease); }
.ld-check__item input:checked { background: var(--ld-accent); border-color: var(--ld-accent); }
.ld-check__item input:checked::after { transform: rotate(-45deg) scale(1); }
.ld-check__item input:checked + span { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ld-ink-2); }
.ld-check__item input:focus-visible { outline: 3px solid var(--ld-focus); outline-offset: 3px; }

/* Before and after */
.ld-ba { position: relative; border-radius: var(--ld-radius); overflow: hidden; --pos: 50%; border: 1px solid var(--ld-line); user-select: none; }
.ld-ba__layer svg, .ld-ba__layer img { display: block; width: 100%; height: auto; }
.ld-ba__after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.ld-ba__handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: var(--ld-surface);
  pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.ld-ba__handle::after {
  content: "⟷"; position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  background: var(--ld-surface); color: var(--ld-ink); display: grid; place-content: center; font-size: 18px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.ld-ba__tag {
  position: absolute; top: 12px; padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--ld-surface); color: var(--ld-ink); pointer-events: none;
}
.ld-ba__tag--before { left: 12px; }
.ld-ba__tag--after { right: 12px; background: var(--ld-ink); color: var(--ld-surface); }
.ld-ba__range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize;
  -webkit-appearance: none; appearance: none; touch-action: pan-y;
}
.ld-ba__range::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 400px; }
.ld-ba:focus-within .ld-ba__handle::after { outline: 3px solid var(--ld-focus); outline-offset: 2px; }

/* Tabs */
.ld-tabs { display: flex; flex-direction: column; gap: 14px; }
.ld-tabs [role="tablist"] { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--ld-surface-2); align-self: flex-start; }
.ld-tabs [role="tab"] {
  font: inherit; font-weight: 600; font-size: 0.92rem; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 0; background: transparent; color: var(--ld-ink-2); cursor: pointer;
}
.ld-tabs [role="tab"][aria-selected="true"] { background: var(--ld-ink); color: var(--ld-surface); }
.ld-tabs [role="tabpanel"] {
  background: var(--ld-surface); border: 1px solid var(--ld-line); border-radius: var(--ld-radius); padding: clamp(16px, 2.4vw, 24px);
  color: var(--ld-ink-2); line-height: 1.55;
}
.ld-tabs [role="tabpanel"] h3, .ld-tabs [role="tabpanel"] h4 { margin: 0 0 8px; color: var(--ld-ink); font-family: var(--ld-font-display); font-size: 1.2rem; }
.ld-tabs [role="tabpanel"] ul { margin: 0; padding-left: 1.2em; }

/* Accordion */
.ld-acc { display: flex; flex-direction: column; gap: 8px; }
.ld-acc details { background: var(--ld-surface); border: 1px solid var(--ld-line); border-radius: 14px; }
.ld-acc summary {
  list-style: none; cursor: pointer; padding: 14px 18px; min-height: 52px; box-sizing: border-box;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; font-weight: 600; color: var(--ld-ink);
  border-radius: 14px;
}
.ld-acc summary::-webkit-details-marker { display: none; }
.ld-acc summary::after {
  content: ""; width: 10px; height: 10px; flex-shrink: 0; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg); margin-top: -4px; transition: transform .25s var(--ld-ease);
}
.ld-acc details[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.ld-acc details > div { padding: 0 18px 16px; color: var(--ld-ink-2); line-height: 1.55; }
.ld-acc details > div p { margin: 0 0 8px; }
.ld-acc details > div p:last-child { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .ld-scope *, .ld-scope *::before, .ld-scope *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .ld-hotspot::after { display: none; }
}

.ld-scope [hidden] { display: none !important; }
.ld-timeline__text { display: flex; flex-direction: column; gap: 2px; }
.ld-chart__bars li:last-child .ld-chart__bar { background: var(--ld-accent); }
.ld-chart--emph-last .ld-chart__bars li:last-child .ld-chart__bar { background: var(--ld-ink); }
.ld-timeline [data-play] { align-self: flex-start; }
@media (max-width: 560px) { .ld-flip__btn { min-height: 150px; } }

/* Flip cards: show one face at a time with visibility, so Safari never shows a mirrored back */
.ld-flip__face { transition: transform .6s var(--ld-ease), visibility 0s linear .3s; }
.ld-flip__back { visibility: hidden; }
.ld-flip__btn[aria-pressed="true"] .ld-flip__front { visibility: hidden; }
.ld-flip__btn[aria-pressed="true"] .ld-flip__back { visibility: visible; }
.ld-flip__btn { transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
@media (prefers-reduced-motion: reduce) {
  .ld-flip__face { transform: none !important; }
}
