/* ═══════════════════════════════════════
   COMPONENTS: Buttons, Cards, Badges,
   Lang Toggle, FAQ, Pricing
   ═══════════════════════════════════════ */

/* ── BUTTONS ── */
.btn-primary {
  background: var(--coral); color: var(--white);
  text-decoration: none; padding: 0.75rem 1.8rem;
  border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 500;
  transition: background 0.2s; border: none; cursor: pointer;
  display: inline-block;
}
.btn-primary:hover { background: var(--coral-deep); }

.btn-secondary {
  background: none; color: var(--ink-soft); text-decoration: none;
  padding: 0.75rem 1.4rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 400;
  border: 1px solid var(--border-strong);
  transition: all 0.2s; cursor: pointer; display: inline-block;
  font-family: var(--font-body);
}
.btn-secondary:hover { border-color: var(--coral); color: var(--coral); }

.btn-outline-white {
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.8); text-decoration: none;
  padding: 0.65rem 1.4rem; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 400; transition: all 0.2s;
}
.btn-outline-white:hover {
  border-color: var(--coral); color: var(--white);
}

/* ── LANG TOGGLE ── */
.lang-toggle {
  display: flex; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); overflow: hidden;
}
.lang-toggle button {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 0.7rem; font-weight: 500;
  padding: 4px 9px; color: var(--ink-muted); transition: all 0.15s;
}
.lang-toggle button.active {
  background: var(--ink); color: var(--white);
}

/* ── PATHWAY CARDS ── */
.pathway-card {
  position: relative; border-radius: var(--radius-lg);
  padding: 2rem 1.8rem; min-height: 180px;
  display: flex; flex-direction: column; justify-content: flex-end;
  cursor: pointer; transition: transform 0.25s, box-shadow 0.25s;
  overflow: hidden; text-decoration: none; color: var(--white);
}
.pathway-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.12);
}
.pathway-card.bg-coral { background: var(--coral); }
.pathway-card.bg-plum  { background: var(--plum); }
.pathway-card.bg-ink   { background: var(--ink); }
.pathway-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.pathway-title {
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 400;
  margin-bottom: 0.3rem; position: relative; line-height: 1.25;
}
.pathway-desc {
  font-size: 0.78rem; font-weight: 300;
  opacity: 0.75; position: relative; line-height: 1.5;
}
.pathway-arrow {
  position: absolute; top: 1.5rem; right: 1.5rem;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; transition: background 0.2s;
}
.pathway-card:hover .pathway-arrow { background: rgba(255,255,255,0.35); }
.pathway-illust {
  position: absolute;
  right: 20px;
  bottom: -12px;
  width: clamp(88px, 12vw, 140px);
  height: auto;
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
}
.pathway-illust--sm {
  transform: scale(0.9);
  transform-origin: right bottom;
}
.pathway-title, .pathway-desc, .pathway-arrow { z-index: 1; }

/* ── SERVICE CARD ── */
.svc-card {
  background: var(--white); border-radius: var(--radius-md);
  padding: 1.6rem; border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s; position: relative;
  /* button element resets */
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.svc-card:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}
.svc-card:active { transform: scale(0.99); }
.svc-illust {
  position: absolute;
  top: 40px;
  right: 30px;
  width: 56px;
  height: auto;
  opacity: 0.95;
  filter: grayscale(100%);
  pointer-events: none;
  z-index: 0;
}
.svc-num, .svc-bar, .svc-title, .svc-title-alt, .svc-desc { position: relative; z-index: 1; }
@media (hover: hover) {
  .svc-card:hover {
    border-color: var(--coral-soft);
    box-shadow: 0 4px 20px rgba(232,99,74,0.08);
  }
}
.svc-num {
  font-family: var(--font-display);
  font-size: 0.72rem; color: var(--ink-muted); margin-bottom: 0.8rem;
}
.svc-bar { width: 28px; height: 3px; border-radius: 2px; margin-bottom: 1rem; }
.svc-bar.coral { background: var(--coral); }
.svc-bar.plum  { background: var(--plum); }
.svc-bar.ink   { background: var(--ink); }
.svc-title {
  font-size: 0.95rem; font-weight: 500; color: var(--ink);
  margin-bottom: 2px; line-height: 1.3;
}
.svc-title-alt {
  font-family: var(--font-zh); font-size: 0.76rem; font-weight: 300;
  color: var(--ink-muted); margin-bottom: 0.7rem;
}
.svc-desc {
  font-size: 0.8rem; line-height: 1.7; color: var(--ink-soft);
}

/* ── MODALITY CELL ── */
.modality-cell {
  background: var(--off-white); border: 1px solid var(--border);
  border-radius: 6px; padding: 1rem 1.1rem;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  /* button element resets */
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.modality-cell:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
}
.modality-cell:active { transform: scale(0.99); }
@media (hover: hover) {
  .modality-cell:hover {
    border-color: var(--plum-soft); background: var(--plum-pale);
  }
}
.modality-name {
  font-size: 0.82rem; font-weight: 500; color: var(--ink);
  margin-bottom: 2px; line-height: 1.3;
}
.modality-alt {
  font-family: var(--font-zh); font-size: 0.7rem; font-weight: 300;
  color: var(--ink-muted);
}
.modality-tag {
  display: inline-block; font-size: 0.56rem; font-weight: 600;
  letter-spacing: 0.08em; color: var(--plum);
  background: var(--plum-pale); border-radius: 3px;
  padding: 2px 6px; margin-top: 6px;
}

/* ── PRICE CARD ── */
.price-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 2rem 1.6rem;
  text-align: center; transition: border-color 0.2s;
}
.price-card.featured { border-color: var(--coral); position: relative; }
.price-card.featured::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--coral);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.price-card:hover { border-color: var(--coral-soft); }
.price-type {
  font-size: 0.65rem; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 0.5rem;
}
.price-amount {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 400; color: var(--ink);
  margin-bottom: 0.3rem;
}
.price-duration { font-size: 0.78rem; color: var(--ink-muted); margin-bottom: 1rem; }
.price-divider {
  width: 24px; height: 1px; background: var(--border-strong); margin: 1rem auto;
}
.price-note { font-size: 0.75rem; color: var(--ink-soft); line-height: 1.7; }

/* ── FAQ ACCORDION ── */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem 0; cursor: pointer;
  font-size: 0.92rem; font-weight: 500; color: var(--ink);
  background: none; border: none; width: 100%; text-align: left;
  font-family: var(--font-body); line-height: 1.4; gap: 1rem;
}
.faq-q:hover { color: var(--coral); }
.faq-chevron {
  flex-shrink: 0; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--ink-muted); transition: transform 0.25s;
}
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-a {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  font-size: 0.85rem; line-height: 1.8; color: var(--ink-soft);
}
.faq-item.open .faq-a { max-height: 300px; padding: 0 0 1.2rem 0; }

/* ── ARTICLE CARD ── */
.article-card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  text-decoration: none; color: var(--ink); display: block;
}
.article-card:hover {
  border-color: var(--coral-soft); transform: translateY(-2px);
}
.article-img { height: 140px; }
.article-img.coral { background: var(--coral-pale); }
.article-img.plum  { background: var(--plum-pale); }
.article-img.gray  { background: var(--warm-gray); }
.article-body { padding: 1.2rem; }
.article-cat {
  font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--coral); margin-bottom: 0.4rem;
}
.article-title {
  font-size: 0.9rem; font-weight: 500; color: var(--ink);
  line-height: 1.4; margin-bottom: 0.3rem;
}
.article-date { font-size: 0.7rem; color: var(--ink-muted); }

/* ── SERVICE / MODALITY DETAIL MODAL ── */
.svc-modal[hidden] {
  display: none;
}

.svc-modal {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--modal-vv-top, 0px);
  height: var(--modal-vv-height, 100dvh);
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    max(1rem, env(safe-area-inset-top))
    1rem
    max(1rem, env(safe-area-inset-bottom))
    1rem;

  box-sizing: border-box;
  overflow: hidden;
}

.svc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.svc-modal.is-open .svc-modal-backdrop {
  opacity: 1;
}

.svc-modal-panel {
  position: relative;
  z-index: 1;

  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: min(100%, 560px);

  max-height: calc(var(--modal-vv-height, 100dvh) - 2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  padding: clamp(1.75rem, 4vw, 2.5rem);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.35);

  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition:
    transform 0.22s cubic-bezier(.2,.8,.2,1),
    opacity 0.18s ease;
}

.svc-modal.is-open .svc-modal-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.svc-modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.85rem;
  width: 36px;
  height: 36px;

  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.svc-modal-close:hover {
  background: var(--off-white);
  color: var(--ink);
}

.svc-modal-close:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.svc-modal-num {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-bottom: 0.6rem;
}

.svc-modal-bar {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  margin-bottom: 1rem;
}

.svc-modal-bar.coral {
  background: var(--coral);
}

.svc-modal-bar.plum {
  background: var(--plum);
}

.svc-modal-bar.ink {
  background: var(--ink);
}

.svc-modal-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--plum);
  background: var(--plum-pale);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 1rem;
}

.svc-modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 0.3rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

[data-lang="zh"] .svc-modal-title {
  font-family: var(--font-zh);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.svc-modal-subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 1.5rem;
}

.svc-modal-body p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink-mid);
  margin: 0 0 1rem;
}

.svc-modal-body p:last-child {
  margin-bottom: 0;
}

[data-lang="zh"] .svc-modal-body p {
  font-family: var(--font-zh);
  font-weight: 300;
  line-height: 1.95;
  letter-spacing: 0.02em;
}

.svc-modal-cta {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.svc-modal-cta .btn-primary {
  display: inline-block;
  text-align: center;
}

/* Stronger scroll lock than overflow:hidden; prevents iOS Chrome visual viewport drift */
body.svc-modal-open {
  overflow: hidden;
  touch-action: none;
}

/* Mobile modal: compact enough that CTA stays visible */
@media (max-width: 560px) {
  .svc-modal {
    align-items: center;
    justify-content: center;
    padding:
      max(0.75rem, env(safe-area-inset-top))
      1rem
      max(0.75rem, env(safe-area-inset-bottom))
      1rem;
  }

  .svc-modal-panel {
    width: 100%;
    max-height: calc(var(--modal-vv-height, 100dvh) - 1.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 1.35rem 1.2rem;
    border-radius: 18px;
    transform: translateY(8px) scale(0.98);
  }

  .svc-modal.is-open .svc-modal-panel {
    transform: translateY(0) scale(1);
  }

  .svc-modal-body p {
    font-size: 0.92rem;
    line-height: 1.75;
  }

  [data-lang="zh"] .svc-modal-body p {
    line-height: 1.85;
  }

  .svc-modal-cta {
    margin-top: 1.2rem;
    padding-top: 1rem;
  }

  .svc-modal-cta .btn-primary {
    width: 100%;
  }
}

/* ─────────────────────────────────────
   PATHWAY DETAIL MODAL
   ───────────────────────────────────── */

.pathway-modal-panel {
  max-width: 760px;
}

.pathway-modal-body {
  margin-top: 1.25rem;
}

.pathway-modal-body p {
  color: var(--ink-soft);
  line-height: 1.85;
}

[data-lang="zh"] .pathway-modal-body p {
  line-height: 2;
}

.pathway-modal-section {
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}

.pathway-modal-section:first-child {
  border-top: none;
  padding-top: 0;
}

.pathway-modal-section h4 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

[data-lang="zh"] .pathway-modal-section h4 {
  font-family: var(--font-zh);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

/* Three-step process */
.pathway-modal-steps {
  display: grid;
  gap: 0.8rem;
}

.pathway-modal-step {
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--off-white);
}

.pathway-modal-step strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.pathway-modal-step p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

[data-lang="zh"] .pathway-modal-step p {
  line-height: 1.85;
}

/* Notes */
.pathway-modal-notes {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem 1rem 1.4rem;
}

.pathway-modal-notes li:last-child {
  margin-bottom: 0;
}

[data-lang="zh"] .pathway-modal-notes li {
  line-height: 1.9;
}

/* Explore further cards */
.pathway-modal-linkgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.pathway-modal-linkcard {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.pathway-modal-linkcard:hover {
  border-color: var(--coral-soft);
  background: var(--coral-pale);
  transform: translateY(-1px);
}

.pathway-modal-linkcard strong {
  display: block;
  color: var(--ink);
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.pathway-modal-linkcard span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.65;
}

/* CTA note */
.pathway-modal-cta-note {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* Make pathway card work cleanly when rendered as <button> */
.pathway-card {
  border: none;
  font-family: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

/* Mobile */
@media (max-width: 560px) {
  .pathway-modal-panel {
    max-width: 100%;
  }

  .pathway-modal-body {
    margin-top: 1rem;
  }

  .pathway-modal-section {
    padding: 1rem 0;
  }

  .pathway-modal-linkgrid {
    grid-template-columns: 1fr;
  }

  .pathway-modal-step {
    padding: 0.85rem 0.9rem;
  }

  .pathway-modal-step strong {
    font-size: 0.86rem;
  }

  .pathway-modal-step p,
  .pathway-modal-notes li {
    font-size: 0.84rem;
  }

  .pathway-modal-linkcard {
    padding: 0.9rem;
  }
}