/* Trang /thuc-hanh/ — danh sách gói. Màu, chữ, thanh trên lấy từ base.css (sáng/tối). */

.space-main { flex: 1; width: min(100%, 760px); margin: 0 auto; padding: 0 16px 56px; }
.space-intro { padding: clamp(36px, 8vh, 88px) 0 clamp(28px, 5vh, 48px); text-align: center; }
.space-whisper { color: var(--accent); font-size: .8125rem; letter-spacing: .6em; text-indent: .6em; }
.space-intro h1 { margin-top: 12px; font-size: clamp(2.5rem, 9vw, 4rem); line-height: 1.1; }
.space-lead { margin-top: 16px; color: var(--text-2); font-size: 1.0625rem; line-height: 1.7; }

.group + .group { margin-top: 48px; }
.group-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; padding: 0 8px; }
.group-ja { color: var(--text-3); font-size: .8125rem; letter-spacing: .24em; }
.group-count { margin-left: auto; color: var(--text-3); font-size: .8125rem; }
.packs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

/* Mỗi gói là một viên thuốc: biểu tượng · tên · một câu mô tả. */
.pack {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 0 18px;
  min-height: 84px; padding: 16px 24px 16px 18px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: inherit; text-decoration: none;
  transition: border-color .3s, background-color .3s;
}
a.pack:hover { border-color: var(--accent); }
a.pack:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 999px; }
.pack-mark {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--accent); font-family: var(--ja); font-size: .8125rem; font-weight: 500; letter-spacing: .06em;
}
.pack-text { display: grid; gap: 3px; min-width: 0; }
.pack-name { font-weight: 500; font-size: clamp(1rem, 2.8vw, 1.125rem); line-height: 1.4; letter-spacing: -.01em; color: var(--text); }
.pack-summary { color: var(--text-2); font-size: .9375rem; line-height: 1.55; }
.pack-end { color: var(--accent); font-size: .8125rem; white-space: nowrap; }
.pack-end svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
a.pack:hover .pack-end svg { transform: translateX(4px); }
/* Gói sắp có: lùi lại một bậc (không nền, chữ phụ), vẫn đủ tương phản để đọc. */
.pack.is-planned { background: transparent; border-color: var(--line-soft); }
.pack.is-planned .pack-mark { border-color: var(--line-soft); color: var(--text-3); }
.pack.is-planned .pack-name { color: var(--text-2); }
.pack.is-planned .pack-summary, .pack.is-planned .pack-end { color: var(--text-3); }

@media (max-width: 519px) {
  .pack { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 0 14px; padding: 14px 18px 14px 14px; border-radius: 40px; }
  .pack-mark { width: 40px; height: 40px; font-size: .6875rem; }
  .pack.is-planned { grid-template-columns: 40px minmax(0, 1fr); }
  .pack.is-planned .pack-mark { grid-row: 1 / span 2; }
  .pack.is-planned .pack-end { grid-column: 2; margin-top: 6px; }
}

@media (prefers-reduced-motion: no-preference) {
  .space-intro > * { animation: rise .9s var(--ease) both; }
  .space-intro > :nth-child(2) { animation-delay: .06s; }
  .space-intro > :nth-child(3) { animation-delay: .12s; }
  .group-title { animation: rise .8s var(--ease) .15s both; }
  .packs li { animation: rise .8s var(--ease) both; animation-delay: calc(.2s + var(--i, 0) * 55ms); }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.space-note { margin-top: 40px; text-align: center; color: var(--text-3); font-size: .8125rem; }

/* Câu hỏi thường gặp: danh sách kẻ mảnh, câu trả lời trượt mở (grid 0fr → 1fr). */
.faq { margin-top: 64px; scroll-margin-top: 16px; }
.faq:focus { outline: none; }
.qa-list { border-top: 1px solid var(--line-soft); }
.qa { border-bottom: 1px solid var(--line-soft); }
.qa h3 { margin: 0; font: inherit; }
.qa-q {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  min-height: 60px; padding: 12px 8px; border: 0; background: none; text-align: left; cursor: pointer;
  color: var(--text); font-size: 1rem; font-weight: 500; line-height: 1.45;
}
.qa-q:hover { color: var(--accent); }
.qa-q:focus-visible { outline-offset: -2px; }
.qa-icon { position: relative; flex: none; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; transition: background-color .35s var(--ease), border-color .35s; }
.qa-icon::before, .qa-icon::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 1.5px; margin: -.75px 0 0 -5px;
  background: var(--accent); transition: transform .5s var(--ease), background-color .35s;
}
.qa-icon::after { transform: rotate(90deg); }
.qa.is-open .qa-icon { background: var(--accent); border-color: var(--accent); }
.qa.is-open .qa-icon::before, .qa.is-open .qa-icon::after { background: var(--bg); }
.qa.is-open .qa-icon::after { transform: rotate(0deg); }
.qa-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s var(--ease); }
.qa.is-open .qa-a { grid-template-rows: 1fr; }
.qa-a > div { overflow: hidden; min-height: 0; }
.qa-a p {
  padding: 0 52px 18px 8px; color: var(--text-2); line-height: 1.7;
  opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .5s var(--ease);
}
.qa.is-open .qa-a p { opacity: 1; transform: none; transition-delay: .08s; }
.qa-a a { color: var(--accent); overflow-wrap: anywhere; text-underline-offset: 3px; display: inline-block; padding: 12px 0; margin: -12px 0; }
.qa-a .tag { margin-right: 6px; }
@media (max-width: 519px) { .qa-a p { padding-right: 8px; } }

/* Nút thu gọn / mở toàn bộ phần câu hỏi (mặc định thu gọn) */
.faq-head { margin: 0; font: inherit; }
.faq-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 12px 18px 12px 20px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text);
  text-align: left; cursor: pointer; transition: border-color .3s, border-radius .5s var(--ease);
}
.faq-toggle:hover { border-color: var(--accent); }
.faq-toggle:focus-visible { outline-offset: 3px; border-radius: 999px; }
.faq-count { margin-left: auto; color: var(--text-3); font-size: .8125rem; }
.faq-chevron { position: relative; flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; transition: background-color .35s var(--ease), border-color .35s; }
.faq-chevron::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -6px 0 0 -4px;
  border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent);
  transform: rotate(45deg); transition: transform .5s var(--ease), border-color .35s;
}
.faq.is-open .faq-chevron { background: var(--accent); border-color: var(--accent); }
.faq.is-open .faq-chevron::before { border-color: var(--bg); transform: translateY(3px) rotate(225deg); }
.faq-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .6s var(--ease); }
.faq.is-open .faq-body { grid-template-rows: 1fr; }
.faq-body > div { overflow: hidden; min-height: 0; }
.faq-body .qa-list { margin-top: 14px; opacity: 0; transform: translateY(-6px); transition: opacity .4s, transform .6s var(--ease); }
.faq.is-open .faq-body .qa-list { opacity: 1; transform: none; transition-delay: .08s; }
@media (max-width: 519px) { .faq-toggle .group-ja { display: none; } }

/* Chuyển trang trong mỗi nhóm (tối đa 5 gói một trang) */
.packs { align-content: start; }
.packs.is-paging li { animation: page-in .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes page-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 14px)); } }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }
.pager-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--accent); cursor: pointer;
  transition: border-color .25s, opacity .25s, background-color .25s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface); }
.pager-btn:disabled { opacity: .35; cursor: default; }
.pager-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pager-prev svg { transform: rotate(180deg); }
.pager-dots { display: flex; gap: 6px; }
.pager-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width .4s var(--ease), background-color .3s; }
.pager-dots i.is-on { width: 18px; background: var(--accent); }
.pager-status { color: var(--text-3); font-size: .8125rem; font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: center; }
@media (prefers-reduced-motion: reduce) { .packs.is-paging li { animation: none; } }

/* Biểu tượng gói: ảnh mặt nạ alpha, tô bằng màu nhấn của nền đang dùng → hợp cả nền sáng lẫn tối */
.pack-mark.has-icon { border: 0; color: var(--accent); }
.pack-icon {
  display: block; width: 34px; height: 34px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
@media (max-width: 519px) { .pack-icon { width: 29px; height: 29px; } }
