/* =========================================================
   怡途 PMS — knowledge base (guides hub + articles)
   Reuses the tokens and shell in styles.css
   ========================================================= */

.guide-main {
  position: relative;
  z-index: 1;
  padding-top: 110px;
}

.nav-links a.is-current {
  color: var(--ink);
}

.nav-links a.is-current::after {
  transform: scaleX(1);
}

/* ---------- breadcrumb ---------- */

.guide-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}

.guide-breadcrumb a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.guide-breadcrumb a:hover {
  color: var(--ink);
}

.guide-breadcrumb .sep {
  opacity: 0.55;
}

/* ---------- hub hero ---------- */

.guide-hero {
  position: relative;
  padding: 58px 0 46px;
}

.guide-hero::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -80px;
  width: 560px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 75, 155, 0.28), transparent 68%);
  pointer-events: none;
}

.guide-hero h1 {
  max-width: 17ch;
  margin: 18px 0 20px;
  font-size: clamp(2.3rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.guide-lede {
  max-width: 660px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.9;
}

.guide-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 26px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.guide-stats strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- featured guide ---------- */

.guide-featured {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 40px;
  margin-top: 42px;
  padding: clamp(26px, 3.6vw, 44px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(90, 75, 155, 0.3), transparent 58%),
    linear-gradient(155deg, rgba(20, 16, 35, 0.96), rgba(11, 8, 20, 0.94));
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.guide-featured:hover {
  border-color: rgba(195, 184, 255, 0.45);
  transform: translateY(-2px);
}

.guide-featured .guide-tag {
  margin-bottom: 16px;
}

.guide-featured h2 {
  margin-bottom: 14px;
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.guide-featured p {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.85;
}

.guide-featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 22px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
}

.guide-featured-meta .read {
  color: var(--violet-300);
}

.guide-featured-side {
  align-self: center;
  padding-left: 34px;
  border-left: 1px solid var(--line);
}

.guide-featured-side p {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.guide-featured-side ul {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.guide-featured-side li {
  position: relative;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.guide-featured-side li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
}

/* ---------- topic chips ---------- */

.guide-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 46px 0 0;
}

.guide-topics a {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.guide-topics a:hover {
  border-color: var(--line-strong);
  background: rgba(154, 140, 240, 0.1);
  color: var(--ink);
}

/* ---------- grouped lists ---------- */

.guide-group {
  margin-top: 62px;
  scroll-margin-top: 92px;
}

.guide-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.guide-group-head h2 {
  font-size: 1.42rem;
  letter-spacing: -0.02em;
}

.guide-group-head span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.guide-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 14, 31, 0.52);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.guide-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: rgba(24, 19, 42, 0.72);
}

.guide-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guide-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--violet-300);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.guide-card-arrow {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.guide-card:hover .guide-card-arrow {
  color: var(--mint);
  transform: translateX(3px);
}

.guide-card h3 {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.guide-card p {
  flex: 1;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
}

.guide-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.guide-card-meta .read {
  color: var(--violet-300);
}

/* ---------- hub CTA ---------- */

.guide-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 72px;
  padding: clamp(26px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(110% 130% at 0% 0%, rgba(90, 75, 155, 0.24), transparent 60%),
    rgba(16, 12, 28, 0.7);
}

.guide-cta h2 {
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  letter-spacing: -0.02em;
}

.guide-cta p {
  color: var(--muted);
  font-size: 0.9rem;
}

.guide-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- article shell ---------- */

.article-page {
  padding-bottom: 40px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 232px;
  justify-content: center;
  align-items: start;
  gap: 64px;
  padding-top: 34px;
}

.article-head h1 {
  margin: 16px 0 18px;
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.032em;
}

.article-lede {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.85;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.article-meta strong {
  color: var(--muted);
  font-weight: 500;
}

.article-body {
  margin-top: 40px;
}

.article-body > section + section {
  margin-top: 48px;
}

.article-body h2 {
  margin-bottom: 16px;
  padding-left: 14px;
  scroll-margin-top: 92px;
  border-left: 2px solid var(--violet-400);
  font-size: clamp(1.38rem, 2.3vw, 1.72rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.article-body h3 {
  margin: 26px 0 10px;
  color: var(--ink);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.5;
}

.article-body p {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.95;
}

.article-body strong {
  color: var(--ink);
  font-weight: 600;
}

.article-body a {
  color: var(--violet-300);
  border-bottom: 1px solid rgba(195, 184, 255, 0.35);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.article-body a:hover {
  border-color: var(--violet-300);
  color: var(--ink);
}

.article-body ul,
.article-body ol {
  margin: 0 0 18px;
  padding-left: 1.35em;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.9;
}

.article-body li + li {
  margin-top: 7px;
}

.article-body li::marker {
  color: var(--violet-400);
}

/* key takeaways */

.takeaways {
  margin: 4px 0 44px;
  padding: 24px 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(150deg, rgba(90, 75, 155, 0.2), rgba(18, 14, 31, 0.55));
}

.takeaways-title {
  margin-bottom: 12px !important;
  color: var(--violet-300) !important;
  font-family: var(--font-mono);
  font-size: 0.64rem !important;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.takeaways ul {
  margin: 0;
  padding-left: 1.1em;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.85;
}

.takeaways li + li {
  margin-top: 6px;
}

/* tables */

.table-wrap {
  margin: 20px 0 26px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.article-body table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.7;
}

.article-body th,
.article-body td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.article-body th {
  background: rgba(154, 140, 240, 0.09);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.article-body td {
  color: var(--muted);
}

.article-body tr:last-child td {
  border-bottom: 0;
}

/* numbered steps */

.article-body .steps {
  display: block;
  counter-reset: guide-step;
  margin: 18px 0 28px;
  padding: 0;
  list-style: none;
}

.article-body .steps li {
  position: relative;
  display: block;
  min-height: 36px;
  margin: 0;
  padding: 0 0 0 50px;
  border-top: 0;
  border-bottom: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.85;
}

.article-body .steps li + li {
  margin-top: 18px;
}

.article-body .steps li:last-child {
  border-bottom: 0;
}

.steps li::before {
  counter-increment: guide-step;
  content: counter(guide-step, decimal-leading-zero);
  position: absolute;
  top: 1px;
  left: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(154, 140, 240, 0.08);
  color: var(--violet-300);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.steps strong {
  display: block;
  color: var(--ink);
}

/* callout */

.callout {
  margin: 22px 0 26px;
  padding: 16px 18px 16px 20px;
  border-left: 2px solid var(--mint);
  border-radius: 0 12px 12px 0;
  background: rgba(103, 232, 200, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.85;
}

.callout strong {
  color: var(--ink);
}

.callout.is-warn {
  border-left-color: var(--amber);
  background: rgba(243, 199, 122, 0.07);
}

/* article FAQ */

.article-faq {
  margin-top: 54px;
  padding-top: 34px;
  scroll-margin-top: 92px;
  border-top: 1px solid var(--line);
}

.article-faq > h2 {
  margin-bottom: 1.125rem;
  padding-left: 0;
  border-left: 0;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
}

.article-faq .faq-list {
  border-top: 1px solid var(--line);
}

/* author */

.article-author {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 42px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 14, 31, 0.45);
}

.article-author .avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(154, 140, 240, 0.12);
  color: var(--violet-200);
  font-weight: 700;
}

.article-author h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.article-author p {
  margin: 0;
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.75;
}

/* aside */

.article-aside {
  position: sticky;
  top: 108px;
  display: grid;
  gap: 22px;
}

.toc {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.toc > p {
  margin-bottom: 12px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.toc a {
  display: block;
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
  transition: color 0.2s ease;
}

.toc a:hover {
  color: var(--violet-300);
}

.aside-cta {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(18, 14, 31, 0.6);
}

.aside-cta p {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.75;
}

.aside-cta .btn {
  width: 100%;
  margin-top: 14px;
  padding: 11px 16px;
  font-size: 0.8rem;
}

/* related + article CTA */

.article-related {
  margin-top: 72px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

.article-related-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.article-related-head h2 {
  font-size: 1.32rem;
  letter-spacing: -0.02em;
}

.article-related-head a {
  color: var(--violet-300);
  font-size: 0.8rem;
}

.article-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 52px;
  padding: clamp(24px, 3.6vw, 38px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(110% 140% at 100% 0%, rgba(90, 75, 155, 0.3), transparent 62%),
    rgba(18, 14, 31, 0.7);
}

.article-cta h2 {
  margin-bottom: 6px;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
  letter-spacing: -0.02em;
}

.article-cta p {
  color: var(--muted);
  font-size: 0.86rem;
}

.article-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- light theme ---------- */

[data-theme="light"] .guide-featured {
  border-color: rgba(90, 75, 155, 0.18);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(90, 75, 155, 0.1), transparent 58%),
    linear-gradient(155deg, #ffffff, #f7f4fd);
  box-shadow: 0 28px 60px -52px rgba(58, 47, 102, 0.5);
}

[data-theme="light"] .guide-featured:hover {
  border-color: rgba(90, 75, 155, 0.34);
}

[data-theme="light"] .guide-card {
  background: rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .guide-card:hover {
  background: #fff;
  box-shadow: 0 18px 40px -34px rgba(58, 47, 102, 0.45);
}

[data-theme="light"] .guide-topics a:hover {
  background: rgba(90, 75, 155, 0.08);
}

[data-theme="light"] .guide-cta {
  background:
    radial-gradient(110% 130% at 0% 0%, rgba(90, 75, 155, 0.1), transparent 60%),
    rgba(255, 255, 255, 0.78);
}

[data-theme="light"] .takeaways {
  background: linear-gradient(150deg, rgba(90, 75, 155, 0.08), #fff);
}

[data-theme="light"] .article-body th {
  background: rgba(90, 75, 155, 0.06);
}

[data-theme="light"] .article-body a {
  color: var(--violet-600);
  border-bottom-color: rgba(90, 75, 155, 0.3);
}

[data-theme="light"] .toc a:hover {
  color: var(--violet-600);
}

[data-theme="light"] .aside-cta {
  background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .article-author {
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="light"] .article-cta {
  background:
    radial-gradient(110% 140% at 100% 0%, rgba(90, 75, 155, 0.12), transparent 62%),
    rgba(255, 255, 255, 0.82);
}

[data-theme="light"] .steps li::before {
  background: rgba(90, 75, 155, 0.07);
}

[data-theme="light"] .callout {
  background: rgba(34, 160, 130, 0.07);
}

[data-theme="light"] .callout.is-warn {
  background: rgba(196, 140, 50, 0.09);
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .article-layout {
    grid-template-columns: minmax(0, 760px);
  }

  .article-aside {
    display: none;
  }
}

@media (max-width: 960px) {
  .guide-featured {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .guide-featured-side {
    padding: 24px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .guide-main {
    padding-top: 96px;
  }

  .guide-hero {
    padding: 42px 0 32px;
  }

  .guide-hero h1 {
    font-size: clamp(2rem, 10vw, 2.7rem);
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .guide-group {
    margin-top: 48px;
  }

  .guide-group-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
  }

  .guide-group-head h2 {
    font-size: 1.3rem;
  }

  .guide-cta,
  .article-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-layout {
    gap: 0;
    padding-top: 24px;
  }

  .article-body h2 {
    padding-left: 11px;
  }

  .takeaways {
    padding: 20px;
  }

  .article-meta {
    gap: 6px 14px;
  }

  .article-related-head {
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-featured,
  .guide-card,
  .guide-card-arrow {
    transition: none;
  }

  .guide-featured:hover,
  .guide-card:hover {
    transform: none;
  }
}
