/*
 * KamTravels Colombia trip cost calculator.
 * Colours and shapes match the Medellín quiz (quiz.kamtravels.net). Everything is scoped under .ktc
 * so it can sit inside a WordPress post without the theme's styles leaking in or this leaking out.
 */
.ktc {
  --ktc-brand: #fb2056;
  /* Darker shade of the brand colour for buttons and small text, so white/body text passes contrast */
  --ktc-brand-strong: #d9123f;
  --ktc-brand-tint: #fff0f3;
  --ktc-ink: #2a1f23;
  --ktc-muted: #6b5a60;
  --ktc-bg: #fff8f2;
  --ktc-card: #ffffff;
  --ktc-line: #f0e2da;
  --ktc-edge: #9a8780;
  --ktc-radius: 16px;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem clamp(0.625rem, 3vw, 1rem) 1.5rem;
  border-radius: var(--ktc-radius);
  background: var(--ktc-bg);
  color: var(--ktc-ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
}

.ktc *,
.ktc *::before,
.ktc *::after {
  box-sizing: border-box;
}

.ktc p,
.ktc ul,
.ktc ol,
.ktc h2,
.ktc h3,
.ktc fieldset,
.ktc legend,
.ktc table {
  margin: 0;
  padding: 0;
  border: 0;
}

.ktc ul,
.ktc ol {
  list-style: none;
}

.ktc h2,
.ktc h3,
.ktc legend,
.ktc summary,
.ktc button,
.ktc input,
.ktc label,
.ktc a {
  font-family: inherit;
  font-style: normal;
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
}

.ktc button,
.ktc input {
  font: inherit;
  color: inherit;
  box-shadow: none;
}

/* Some themes force button colours with !important; these win back inside the calculator. */
.ktc button {
  background-image: none !important;
}

.ktc a {
  color: var(--ktc-brand-strong);
}

.ktc-sr,
.ktc-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ktc-hp {
  left: -9999px;
}

.ktc-loading {
  padding: 2rem 0;
  color: var(--ktc-muted);
  text-align: center;
}

/* Header */
.ktc-header {
  margin-bottom: 1.25rem;
}

.ktc .ktc-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ktc-brand-strong);
}

.ktc .ktc-title {
  margin: 0 0 0.5rem;
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ktc-ink);
}

.ktc .ktc-lede {
  font-size: 1.0625rem;
  color: var(--ktc-muted);
}

/* Cards */
.ktc-card {
  margin-top: 1rem;
  padding: 1.125rem clamp(0.75rem, 3vw, 1rem);
  border: 2px solid var(--ktc-line);
  border-radius: var(--ktc-radius);
  background: var(--ktc-card);
}

.ktc .ktc-h2 {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ktc-ink);
}

.ktc .ktc-h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ktc-ink);
}

.ktc .ktc-h3:focus {
  outline: none;
}

.ktc .ktc-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ktc-muted);
}

.ktc .ktc-empty {
  color: var(--ktc-muted);
}

/* Route builder */
.ktc-route {
  display: grid;
  gap: 0.625rem;
}

.ktc-stop {
  padding: 0.75rem;
  border: 2px solid var(--ktc-edge);
  border-radius: 12px;
}

.ktc-stop__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.ktc-stop__num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 999px;
  background: var(--ktc-brand-strong);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
}

.ktc-stop__name {
  flex: 1 1 7rem;
  min-width: 0;
  font-weight: 700;
  line-height: 1.25;
}

.ktc-stepper,
.ktc-stop__tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
}

.ktc-stop__tools {
  margin-left: auto;
}

.ktc .ktc-stop__tools .ktc-iconbtn {
  width: 2.5rem;
  height: 2.5rem;
}

.ktc-stepper__value {
  min-width: 5.5rem;
  font-weight: 600;
  text-align: center;
}

.ktc .ktc-iconbtn {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  border: 2px solid var(--ktc-edge);
  border-radius: 999px;
  background: var(--ktc-card) !important;
  color: var(--ktc-ink) !important;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.ktc .ktc-iconbtn--quiet {
  border-color: var(--ktc-line);
  color: var(--ktc-muted) !important;
  font-size: 1.125rem;
}

.ktc .ktc-iconbtn:hover:not(:disabled) {
  border-color: var(--ktc-brand-strong);
  color: var(--ktc-brand-strong) !important;
}

.ktc .ktc-iconbtn:disabled {
  opacity: 0.35;
  cursor: default;
}

.ktc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ktc .ktc-chip {
  min-height: 2.75rem;
  margin: 0;
  padding: 0.5rem 0.875rem;
  border: 2px solid var(--ktc-edge);
  border-radius: 999px;
  background: var(--ktc-card) !important;
  color: var(--ktc-ink) !important;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.ktc .ktc-chip:hover {
  border-color: var(--ktc-brand-strong);
  background: var(--ktc-brand-tint) !important;
}

/* Style and extras */
.ktc-fieldset + .ktc-fieldset {
  margin-top: 1.5rem;
}

.ktc-options {
  display: grid;
  gap: 0.625rem;
}

.ktc-option,
.ktc-toggle {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 2px solid var(--ktc-edge);
  border-radius: var(--ktc-radius);
  background: var(--ktc-card);
  cursor: pointer;
}

.ktc-option:hover,
.ktc-toggle:hover {
  border-color: var(--ktc-brand-strong);
}

.ktc-option:has(input:checked) {
  border-color: var(--ktc-brand-strong);
  background: var(--ktc-brand-tint);
}

.ktc-option input,
.ktc-toggle input,
.ktc-currency input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.ktc-option::before {
  content: '';
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  border: 2px solid var(--ktc-edge);
  border-radius: 999px;
  background: var(--ktc-card);
}

.ktc-option:has(input:checked)::before {
  border: 6px solid var(--ktc-brand-strong);
}

.ktc-option__body,
.ktc-toggle__body {
  display: grid;
}

.ktc-option__title {
  font-weight: 700;
}

.ktc-option__desc {
  font-size: 0.9375rem;
  color: var(--ktc-muted);
}

.ktc-toggle__switch {
  position: relative;
  flex: none;
  width: 2.75rem;
  height: 1.5rem;
  margin-top: 0.125rem;
  border-radius: 999px;
  background: var(--ktc-edge);
  transition: background 0.15s ease;
}

.ktc-toggle__switch::after {
  content: '';
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.15s ease;
}

.ktc-toggle input:checked + .ktc-toggle__switch {
  background: var(--ktc-brand-strong);
}

.ktc-toggle input:checked + .ktc-toggle__switch::after {
  transform: translateX(1.25rem);
}

.ktc-option:has(input:focus-visible),
.ktc-toggle:has(input:focus-visible),
.ktc-currency__opt:has(input:focus-visible),
.ktc button:focus-visible,
.ktc a:focus-visible,
.ktc input:focus-visible,
.ktc summary:focus-visible {
  outline: 3px solid var(--ktc-brand);
  outline-offset: 2px;
}

/* Results */
.ktc-card--results {
  border-color: var(--ktc-brand-tint);
}

.ktc-results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ktc .ktc-results-head .ktc-h2 {
  margin: 0;
}

.ktc-currency {
  display: inline-flex;
  padding: 0.1875rem;
  border-radius: 999px;
  background: var(--ktc-line);
}

.ktc-currency__opt {
  position: relative;
}

.ktc-currency__opt span {
  display: block;
  min-width: 3.25rem;
  padding: 0.5rem 0.625rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.ktc-currency__opt input:checked + span {
  background: var(--ktc-brand-strong);
  color: #fff;
}

.ktc-total {
  padding: 1rem;
  border-radius: var(--ktc-radius);
  background: var(--ktc-brand-tint);
  text-align: center;
}

.ktc .ktc-total__amount {
  margin: 0.125rem 0 0.25rem;
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ktc-brand-strong);
}

.ktc .ktc-total__sub {
  font-size: 0.9375rem;
  color: var(--ktc-ink);
}

.ktc-breakdown {
  display: grid;
  gap: 0.875rem;
  margin: 1.25rem 0 0.5rem;
}

.ktc-row__top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}

.ktc-bar {
  height: 0.5rem;
  margin: 0.25rem 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ktc-line);
}

.ktc-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ktc-brand);
}

.ktc .ktc-row__note {
  font-size: 0.875rem;
  color: var(--ktc-muted);
}

.ktc-details {
  margin-top: 0.75rem;
  border-top: 2px solid var(--ktc-line);
}

.ktc-details summary {
  padding: 0.75rem 0;
  font-weight: 700;
  cursor: pointer;
}

.ktc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.ktc-table th,
.ktc-table td {
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 1px solid var(--ktc-line);
  background: none;
  vertical-align: top;
  text-align: left;
  font-weight: 400;
}

.ktc-table th {
  font-weight: 700;
}

.ktc-table td {
  text-align: right;
}

.ktc-table span {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--ktc-muted);
}

.ktc-legs {
  display: grid;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.ktc-legs li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.ktc-legs em,
.ktc-links em {
  display: block;
  font-size: 0.8125rem;
  font-style: normal;
  color: var(--ktc-muted);
}

/* Affiliate links */
.ktc-book {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ktc-line);
}

.ktc .ktc-disclosure {
  font-size: 0.8125rem;
  color: var(--ktc-muted);
}

.ktc-links {
  display: grid;
  gap: 0.5rem;
}

.ktc .ktc-link {
  display: block;
  padding: 0.75rem 2.25rem 0.75rem 1rem;
  position: relative;
  border: 2px solid var(--ktc-edge);
  border-radius: 12px;
  background: var(--ktc-card);
  color: var(--ktc-ink);
  font-weight: 600;
  text-decoration: none;
}

.ktc .ktc-link::after {
  content: '\2197';
  position: absolute;
  top: 50%;
  right: 0.875rem;
  transform: translateY(-50%);
  color: var(--ktc-brand-strong);
}

.ktc .ktc-link:hover {
  border-color: var(--ktc-brand-strong);
}

.ktc .ktc-link--quiet {
  border-style: dashed;
  border-color: var(--ktc-line);
  font-weight: 500;
}

/* Quiz cross-link, email, share */
.ktc-callout {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: var(--ktc-radius);
  background: var(--ktc-brand-tint);
}

.ktc .ktc-btn {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  margin: 1rem 0 0;
  padding: 0.875rem 1.25rem;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--ktc-brand-strong) !important;
  color: #fff !important;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.ktc .ktc-btn:hover {
  background: #b80f35 !important;
  color: #fff !important;
}

.ktc .ktc-btn--ghost {
  border-color: var(--ktc-edge);
  background: transparent !important;
  color: var(--ktc-ink) !important;
}

.ktc .ktc-btn--ghost:hover {
  border-color: var(--ktc-brand-strong);
  background: var(--ktc-card) !important;
  color: var(--ktc-brand-strong) !important;
}

.ktc .ktc-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.ktc-email {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ktc-line);
}

.ktc-form label {
  display: block;
  margin: 0.875rem 0 0.375rem;
  font-weight: 600;
}

.ktc .ktc-form input,
.ktc .ktc-linkbox {
  display: block;
  width: 100%;
  min-height: 3rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 2px solid var(--ktc-edge);
  border-radius: 12px;
  background: var(--ktc-card);
  font-size: 1rem;
}

.ktc .ktc-error {
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  border: 2px solid var(--ktc-brand-strong);
  border-radius: 12px;
  background: var(--ktc-brand-tint);
  font-weight: 600;
}

.ktc-share {
  margin-top: 1.25rem;
}

.ktc .ktc-copied {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--ktc-muted);
  text-align: center;
}

.ktc .ktc-copied .ktc-linkbox {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.ktc-how ul {
  display: grid;
  gap: 0.375rem;
  padding: 0 0 0.75rem 1.125rem;
  list-style: disc;
  font-size: 0.875rem;
  color: var(--ktc-muted);
}

.ktc .ktc-fine {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--ktc-muted);
  text-align: center;
}

@media (min-width: 40rem) {
  .ktc {
    padding: 1.75rem 1.5rem 2rem;
  }

  .ktc-card {
    padding: 1.25rem 1.5rem;
  }

  .ktc .ktc-title {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ktc-toggle__switch,
  .ktc-toggle__switch::after {
    transition: none;
  }
}
