/* ===== CSS Variables: Nanyang Warm Palette ===== */
:root {
  --color-primary: #C67B44;
  --color-primary-hover: #B0693A;
  --color-primary-light: #F5E6D8;
  --color-primary-bg: #FFF5ED;
  --color-accent: #4A3728;
  --color-accent-light: #6B5A4E;
  --color-bg: #FEF9F3;
  --color-bg-warm: #FDF2E5;
  --color-bg-card: #FFFFFF;
  --color-text: #3C2A1C;
  --color-text-muted: #7A6A5C;
  --color-text-light: #A89888;
  --color-border: #E8D5C0;
  --color-border-light: #F0E4D6;
  --color-success: #4CAF50;
  --color-error: #D9534F;
  --color-disclaimer-bg: #FFF8E7;
  --color-disclaimer-text: #8B6914;
  --color-disclaimer-border: #F0D78C;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Courier, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(74,55,40,0.06);
  --shadow-md: 0 4px 12px rgba(74,55,40,0.08);
  --shadow-lg: 0 8px 30px rgba(74,55,40,0.10);
  --shadow-xl: 0 16px 48px rgba(74,55,40,0.12);

  --max-width: 1100px;
  --nav-height: 60px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-primary-hover); }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; font-size: inherit; }

/* ===== Utility ===== */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===== Disclaimer Banner (Permanent) ===== */
.disclaimer-banner {
  background: var(--color-disclaimer-bg);
  border-bottom: 1px solid var(--color-disclaimer-border);
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-disclaimer-text);
  line-height: 1.5;
}
.disclaimer-banner .container { display: flex; align-items: center; justify-content: center; gap: 6px; }
.disclaimer-banner .icon { flex-shrink: 0; font-size: 15px; }

/* ===== Navigation ===== */
.site-nav {
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border-light);
  height: var(--nav-height);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo:hover { color: var(--color-primary); }
.nav-logo .logo-dot {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--color-primary), #D4895A);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  font-size: 14px;
  font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
  background: var(--color-bg-warm);
}
.lang-switch {
  margin-left: 8px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-card);
  cursor: pointer;
  transition: all 0.2s;
}
.lang-switch:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.lang-switch.active { background: var(--color-primary); color: #FFF; border-color: var(--color-primary); }

/* Mobile nav */
.mobile-menu-btn { display: none; flex-direction: column; gap: 4px; padding: 8px; }
.mobile-menu-btn span { width: 20px; height: 2px; background: var(--color-accent); border-radius: 1px; transition: 0.2s; }
.nav-links.mobile-open { display: flex; }

/* ===== Hero Section ===== */
.hero {
  padding: 56px 0 40px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-block;
  background: var(--color-disclaimer-bg);
  color: var(--color-disclaimer-text);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 20px;
  border: 1px solid var(--color-disclaimer-border);
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1.25;
  letter-spacing: -0.5px;
  max-width: 700px;
  margin: 0 auto 8px;
}
.hero-subtitle {
  font-size: 17px;
  color: var(--color-text-muted);
  margin-bottom: 32px;
}

/* ===== Chat Tool (Inline) ===== */
.chat-tool {
  max-width: 680px;
  margin: 0 auto;
}
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 10px 10px 10px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(198,123,68,0.12);
}
.chat-input-wrap textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: transparent;
  padding: 6px 0;
  min-height: 48px;
  max-height: 160px;
}
.chat-input-wrap textarea::placeholder { color: var(--color-text-light); }
.chat-send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}
.chat-send-btn:hover { background: var(--color-primary-hover); }
.chat-send-btn:active { transform: scale(0.95); }
.chat-send-btn:disabled { background: var(--color-text-light); cursor: not-allowed; }
.chat-send-btn svg { width: 18px; height: 18px; }

/* Chat panel */
.chat-panel {
  margin-top: 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: none;
  max-height: 500px;
  overflow-y: auto;
}
.chat-panel.open { display: block; }
.chat-messages { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.55;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.user {
  align-self: flex-end;
  background: var(--color-primary-bg);
  color: var(--color-text);
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--color-bg-warm);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}
.chat-msg .msg-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.chat-msg.user .msg-label { color: var(--color-primary); }
.chat-msg.assistant .msg-label { color: var(--color-accent); }
.chat-msg .msg-content { white-space: pre-wrap; word-break: break-word; }
.chat-msg .msg-content p { margin-bottom: 8px; }
.chat-msg .msg-content p:last-child { margin-bottom: 0; }
.chat-msg .msg-disclaimer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-light);
  font-size: 11px;
  color: var(--color-text-muted);
  font-style: italic;
}
.chat-msg.loading { align-self: flex-start; background: var(--color-bg-warm); }
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: dotBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ===== Question Chips ===== */
.question-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}
.chip {
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg-card);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
}

/* ===== Jurisdiction Badge ===== */
.jurisdiction-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 28px 0 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.jurisdiction-badge .flag-dots { display: flex; gap: 4px; }
.jurisdiction-badge .flag-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.jurisdiction-badge .flag-dot:nth-child(1) { background: #C67B44; }
.jurisdiction-badge .flag-dot:nth-child(2) { background: #4A3728; }
.jurisdiction-badge .flag-dot:nth-child(3) { background: #D4895A; }
.jurisdiction-badge .flag-dot:nth-child(4) { background: #6B5A4E; }
.jurisdiction-badge .flag-dot:nth-child(5) { background: #E8A87C; }
.jurisdiction-badge .flag-dot:nth-child(6) { background: #8B7355; }

/* ===== Section Headers ===== */
.section {
  padding: 64px 0;
}
.section-alt {
  background: var(--color-bg-warm);
}
.section-header {
  text-align: center;
  margin-bottom: 40px;
}
.section-header h2 {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 8px;
}
.section-header p {
  font-size: 16px;
  color: var(--color-text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ===== Guide Cards ===== */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.guide-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guide-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.guide-card .card-difficulty {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  width: fit-content;
}
.guide-card .card-difficulty.low { background: #E8F5E9; color: #2E7D32; }
.guide-card .card-difficulty.medium { background: #FFF8E1; color: #F57F17; }
.guide-card .card-difficulty.high { background: #FFEBEE; color: #C62828; }
.guide-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.4;
}
.guide-card p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
  flex: 1;
}
.guide-card .card-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.guide-card .card-link:hover { gap: 8px; }

/* Featured guide cards (hot guides) */
.featured-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ===== How It Works ===== */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
}
.step-card {
  text-align: center;
  padding: 28px 20px;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
}
.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  margin: 0 auto 16px;
}
.step-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
}
.step-card p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ===== Trust Section ===== */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}
.trust-card {
  text-align: center;
  padding: 24px 20px;
}
.trust-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--color-primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
}
.trust-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
}
.trust-card p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--color-accent);
  color: rgba(255,255,255,0.75);
  padding: 48px 0 32px;
  font-size: 14px;
  line-height: 1.7;
}
.site-footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}
.site-footer h4 {
  color: #FFF;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}
.site-footer a { color: rgba(255,255,255,0.7); }
.site-footer a:hover { color: #FFF; }
.site-footer .footer-links { display: flex; flex-direction: column; gap: 6px; }
.site-footer .footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 20px;
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

/* ===== Content Pages (Inner) ===== */
.content-page {
  padding: 48px 0 64px;
}
.content-page .page-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 8px;
}
.content-page .page-subtitle {
  font-size: 17px;
  color: var(--color-text-muted);
  margin-bottom: 32px;
}
.content-page .prose {
  max-width: 720px;
}
.content-page .prose h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-accent);
  margin: 32px 0 12px;
}
.content-page .prose h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-accent);
  margin: 24px 0 8px;
}
.content-page .prose p {
  margin-bottom: 14px;
  line-height: 1.7;
  color: var(--color-text);
}
.content-page .prose ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 16px;
}
.content-page .prose ul li {
  margin-bottom: 8px;
  line-height: 1.6;
}
.content-page .prose a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs .sep { color: var(--color-text-light); }

/* ===== Floating Chat Bubble (Inner Pages) ===== */
.chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
}
.chat-bubble-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.chat-bubble-btn:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}
.chat-bubble-btn svg { width: 24px; height: 24px; }
.pulse-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-success);
  border: 2px solid #FFF;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(76,175,80,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(76,175,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,175,80,0); }
}

/* Bubble chat panel */
.chat-bubble-panel {
  position: fixed;
  bottom: 98px;
  right: 28px;
  width: 380px;
  max-height: 520px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: none;
  flex-direction: column;
  z-index: 199;
  overflow: hidden;
}
.chat-bubble-panel.open { display: flex; }
.chat-bubble-panel .bubble-panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-bubble-panel .bubble-panel-header span {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-accent);
}
.chat-bubble-panel .bubble-panel-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 18px;
  transition: all 0.2s;
}
.chat-bubble-panel .bubble-panel-close:hover {
  background: var(--color-bg-warm);
  color: var(--color-accent);
}
.chat-bubble-panel .chat-messages {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}
.chat-bubble-panel .chat-input-row {
  padding: 12px 14px;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-bubble-panel .chat-input-row textarea {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
  background: var(--color-bg);
}
.chat-bubble-panel .chat-input-row textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(198,123,68,0.1);
}
.chat-bubble-panel .chat-input-row button {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-bubble-panel .chat-input-row button:disabled {
  background: var(--color-text-light);
  cursor: not-allowed;
}

/* ===== FAQ Accordion (Guide Pages) ===== */
.faq-section { margin-top: 40px; }
.faq-section h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 20px;
}
.faq-item {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-question {
  width: 100%;
  padding: 16px 20px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.2s;
}
.faq-question:hover { background: var(--color-bg-warm); }
.faq-question .faq-arrow {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.3s;
  color: var(--color-text-muted);
}
.faq-question.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text);
}
.faq-answer.open {
  max-height: 500px;
  padding: 4px 20px 20px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 16px;
    gap: 2px;
    box-shadow: var(--shadow-md);
  }
  .nav-links.mobile-open a { padding: 10px 12px; border-radius: var(--radius-sm); }
  .mobile-menu-btn { display: flex; }
  .hero { padding: 36px 0 28px; }
  .guides-grid { grid-template-columns: 1fr; }
  .featured-cards { grid-template-columns: 1fr; }
  .site-footer .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .chat-bubble-panel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 90px;
    max-height: 60vh;
  }
  .chat-bubble { bottom: 20px; right: 20px; }
  .question-chips { gap: 8px; }
  .chip { font-size: 13px; padding: 6px 12px; }
  .chat-input-wrap textarea { max-height: 120px; }
  .content-page { padding: 32px 0 48px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero h1 { font-size: 24px; }
  .hero-subtitle { font-size: 15px; }
  .section { padding: 40px 0; }
  .section-header h2 { font-size: 22px; }
  .steps-grid { grid-template-columns: 1fr; }
  .trust-grid { grid-template-columns: 1fr; }
  .chat-msg { max-width: 92%; }
}
