/* ==========================================================================
   Bidi-1 Guide — Stylesheet
   ========================================================================== */

:root {
  --color-bg: #f8f9fb;
  --color-surface: #ffffff;
  --color-text: #1a1d26;
  --color-text-muted: #5c6370;
  --color-border: #e2e6ee;
  --color-accent: #10a37f;
  --color-accent-dark: #0d8c6d;
  --color-accent-soft: #e7f7f2;
  --color-hero-start: #0f172a;
  --color-hero-end: #1e3a5f;
  --color-tag-bg: rgba(255, 255, 255, 0.12);
  --color-tag-border: rgba(255, 255, 255, 0.2);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: "Inter", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --header-height: 64px;
  --content-max: 720px;
  --sidebar-width: 280px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body.lang-zh {
  font-family: "Noto Sans SC", "Inter", system-ui, sans-serif;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 16px;
}

/* Container */
.container {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  flex-shrink: 0;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-accent), #0ea5e9);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
}

.logo-text {
  font-size: 0.95rem;
}

.header-nav {
  display: none;
}

.nav-list {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-list a:hover {
  color: var(--color-text);
}

/* Language switcher */
.lang-switcher {
  display: flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px;
  flex-shrink: 0;
}

.lang-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.lang-btn:hover {
  color: var(--color-text);
}

.lang-btn.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* Hero */
.hero {
  background: linear-gradient(145deg, var(--color-hero-start) 0%, var(--color-hero-end) 100%);
  color: #fff;
  padding: 56px 0 64px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.hero h1 {
  margin: 0 0 20px;
  max-width: 820px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-lead {
  margin: 0 0 28px;
  max-width: 680px;
  font-size: 1.125rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--color-tag-bg);
  border: 1px solid var(--color-tag-border);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
}

/* Layout */
.content-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  padding: 48px 0 80px;
}

.article-body {
  min-width: 0;
}

/* Sections */
.content-section {
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--color-border);
}

.content-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.content-section h2 {
  margin: 0 0 16px;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.content-section h3 {
  margin: 32px 0 12px;
  font-size: 1.125rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--color-text);
}

.content-section h4 {
  margin: 20px 0 8px;
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--color-text-muted);
}

.content-section p {
  margin: 0 0 16px;
  color: var(--color-text-muted);
}

.content-section > p:first-of-type {
  font-size: 1.0625rem;
  color: var(--color-text);
}

/* Source list */
.source-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  margin-bottom: 10px;
}

.source-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.source-list a::after {
  content: "↗";
  font-size: 0.75rem;
  opacity: 0.6;
}

/* FAQ */
.faq-section h2 {
  margin-bottom: 24px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.faq-item[open] {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}

.faq-item summary {
  padding: 18px 20px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-text);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--color-bg);
  border-radius: 50%;
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--color-text-muted);
  transition: transform var(--transition), background var(--transition);
}

.faq-item[open] summary::after {
  content: "−";
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
}

.faq-item p {
  margin: 0;
  padding: 0 20px 18px;
  font-size: 0.9375rem;
}

/* Sidebar */
.sidebar {
  display: none;
}

.toc {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.toc-title {
  margin: 0 0 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc-list li {
  margin-bottom: 4px;
}

.toc-list a {
  display: block;
  padding: 6px 10px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.toc-list a:hover,
.toc-list a.is-active {
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  border-left-color: var(--color-accent);
}

.sidebar-card {
  margin-top: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.sidebar-card-title {
  margin: 0 0 16px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
}

.fact-list {
  margin: 0;
}

.fact-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.fact-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.fact-item dt {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.fact-item dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: right;
}

/* Footer */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 32px 0;
}

.footer-inner {
  text-align: center;
}

.footer-note {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  max-width: 560px;
  margin-inline: auto;
}

.footer-copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Responsive */
@media (min-width: 768px) {
  .header-nav {
    display: block;
  }
}

@media (min-width: 1024px) {
  .content-layout {
    grid-template-columns: minmax(0, var(--content-max)) var(--sidebar-width);
    gap: 48px;
    align-items: start;
  }

  .sidebar {
    display: block;
  }
}

@media (max-width: 767px) {
  .hero {
    padding: 40px 0 48px;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .content-layout {
    padding: 32px 0 56px;
  }

  .content-section {
    margin-bottom: 36px;
    padding-bottom: 36px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
