/* Premium, minimal editorial styling for buay.paiseh.sg */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color */
  --accent: #dc2626;
  --accent-strong: #991b1b;
  --highlight: #d4af37;

  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;

  --success: #16a34a;
  --warning: #f59e0b;

  /* Type */
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Layout */
  --container: 1100px;

  /* Radii */
  --r-8: 8px;
  --r-12: 12px;
  --r-16: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-subtle: #0f172a;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --border: #1f2937;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

a:hover {
  text-decoration-thickness: 2px;
}

*:focus-visible {
  outline: 3px solid rgba(212, 175, 55, 0.75);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 var(--r-8) 0;
}

.skip-link:focus {
  top: 0;
}

/* Progress */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--highlight);
  z-index: 100;
}

/* Top nav */
.sticky-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

[data-theme="dark"] .sticky-nav {
  background: rgba(11, 18, 32, 0.72);
  border-bottom-color: rgba(31, 41, 55, 0.7);
}

.sticky-nav.is-scrolled {
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.sticky-nav-content {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--r-8);
}

.brand:hover,
.brand:focus-visible {
  background: var(--bg-subtle);
}

.nav-links {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--r-8);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: var(--bg-subtle);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
button {
  font-family: inherit;
}

.theme-toggle,
.nav-menu-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--r-12);
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
  font-weight: 700;
}

.theme-toggle {
  padding: 8px 10px;
  font-size: 1.1rem;
}

.theme-toggle:hover,
.nav-menu-toggle:hover {
  background: var(--bg-subtle);
}

.audio-btn {
  border: 1px solid rgba(220, 38, 38, 0.8);
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-12);
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
  font-weight: 800;
  margin-top: 10px;
  margin-right: 8px;
}

.audio-btn:hover {
  background: var(--accent-strong);
  border-color: rgba(153, 27, 27, 0.9);
}

.copy-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--r-12);
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
  font-weight: 700;
  margin-top: 10px;
}

.copy-btn:hover {
  background: var(--bg-subtle);
}

/* Hero */
.hero {
  padding: 88px 16px 40px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.hero__content {
  max-width: 820px;
  margin: 0 auto;
}

.hero h1 {
  letter-spacing: -0.03em;
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.12;
}

.hero p {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.hero-learn {
  margin-top: 18px;
  display: inline-block;
  text-align: left;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(226, 232, 240, 0.75);
  border-radius: var(--r-16);
  padding: 12px 14px;
}

[data-theme="dark"] .hero-learn {
  background: rgba(11, 18, 32, 0.35);
  border-color: rgba(31, 41, 55, 0.7);
}

.hero-learn ul {
  padding-left: 18px;
}

.hero-learn li {
  margin-top: 6px;
  color: var(--text-muted);
}

/* Layout */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 40px 16px 80px;
}

section {
  margin-top: 56px;
}

.section-header {
  text-align: left;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  letter-spacing: -0.02em;
  font-weight: 800;
}

.section-header p {
  margin-top: 6px;
  color: var(--text-muted);
}

/* Cards */
.intro-card,
.lohei-tracker,
.lohei-step,
.situation-card,
.saying-box,
.pro-tip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  box-shadow: var(--shadow-sm);
}

.intro-card {
  padding: 24px;
}

.intro-card h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.intro-card p {
  margin-top: 10px;
  color: var(--text-muted);
}

.lohei-tracker {
  padding: 16px;
}

.lohei-tracker h3 {
  font-size: 1rem;
  font-weight: 700;
}

.tracker-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tracker-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
}

.tracker-dot.completed {
  background: var(--highlight);
  border-color: rgba(212, 175, 55, 0.7);
}

.lohei-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lohei-step {
  padding: 20px;
  position: relative;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), transform 150ms var(--ease);
}

.lohei-step:hover {
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.lohei-step.completed {
  border-color: rgba(212, 175, 55, 0.9);
}

.step-number {
  position: absolute;
  top: -14px;
  left: 20px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(220, 38, 38, 0.18);
}

.ingredient-name {
  margin-top: 8px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.saying-box {
  margin-top: 12px;
  padding: 16px;
}

.saying-chinese {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-block;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
}

.saying-chinese .pinyin-inline {
  margin-left: 8px;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 600;
  font-size: 0.95rem;
}

@media (max-width: 520px) {
  .saying-chinese {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .saying-chinese .pinyin-inline {
    margin-left: 0;
    margin-top: 4px;
  }
}

.saying-meaning {
  margin-top: 10px;
  color: var(--text-muted);
}

.pro-tip {
  padding: 16px;
  border-left: 4px solid var(--warning);
}

.pro-tip-title {
  font-weight: 800;
}

.pro-tip p {
  margin-top: 8px;
  color: var(--text-muted);
}

/* Situation grid */
.situation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.situation-card {
  padding: 16px;
}

.situation-title {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.saying-item {
  width: 100%;
  text-align: left;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--r-12);
  padding: 12px;
  margin-top: 10px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}

.saying-item:hover {
  background: var(--bg);
  border-color: var(--border);
}

.saying-item .chinese {
  display: block;
  font-weight: 800;
}

.saying-item .translation {
  display: block;
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 2px;
}

/* Animations */
.animate-in {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 400ms var(--ease), transform 400ms var(--ease);
}

.animate-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* FAQ Section */
#faq {
  margin-top: 64px;
}

.faq-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 32px;
}

.faq-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-12);
  padding: 24px 28px;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.faq-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.faq-item h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.5;
}

.faq-item p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.faq-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 150ms var(--ease);
}

.faq-item a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.faq-item strong {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 768px) {
  #faq {
    margin-top: 48px;
  }

  .faq-item {
    padding: 20px 24px;
  }

  .faq-item h3 {
    font-size: 1.05rem;
  }

  .faq-item p {
    font-size: 0.95rem;
  }
}

/* Footer */
footer {
  margin-top: 64px;
  padding: 40px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
}

footer p {
  margin-top: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  max-width: min(420px, calc(100vw - 2.5rem));
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 12px 14px;
  border-radius: var(--r-12);
  box-shadow: var(--shadow-md);
  transform: translateY(140%);
  transition: transform 220ms var(--ease);
  z-index: 100;
}

[data-theme="dark"] .toast {
  background: rgba(2, 6, 23, 0.92);
}

.toast.show {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .hero {
    padding-top: 72px;
  }

  .nav-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    flex-direction: column;
    gap: 6px;
  }

  [data-theme="dark"] .nav-links {
    background: rgba(11, 18, 32, 0.96);
    border-bottom-color: rgba(31, 41, 55, 0.8);
  }

  .sticky-nav.is-open .nav-links {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: 10px 12px;
  }

  .container {
    padding-top: 28px;
  }
}
