:root {
  --accent: #cc785c;
  --accent-dark: #b75f45;
  --accent-light: #e0876a;
  --accent-soft: #fbf1ec;
  --bg: #faf9f7;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5f5952;
  --border: #eee7e1;
  --radius: 14px;
  --l1: #6b9e78;
  --l1-soft: #edf5ee;
  --l2: #4f86c6;
  --l2-soft: #eaf1fa;
  --l3: #b8863e;
  --l3-soft: #f8f1e6;
  --l4: #a1548f;
  --l4-soft: #f6ecf4;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.prose-wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 249, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
}

.brand img { width: 30px; height: 30px; }

.brand-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-left: 1px solid var(--border);
  padding-left: 0.6rem;
  margin-left: 0.1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.3rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.nav-links a.plain {
  text-decoration: none;
  color: var(--muted);
}

.nav-links a.plain:hover { color: var(--accent-dark); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none !important;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
}

.btn:hover { background: var(--accent-dark); }

/* Hero */

.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 2.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid #f0d9cd;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.9rem;
}

.hero h1 span { color: var(--accent); }

.hero p.lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto;
}

.hero .meta-line {
  margin-top: 1.6rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

/* Level sections */

.level-section {
  padding: 2.6rem 1.5rem;
  max-width: 1040px;
  margin: 0 auto;
}

.level-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.level-num {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.level-head h2 {
  font-size: 1.6rem;
  margin: 0;
}

.level-desc {
  color: var(--muted);
  margin: 0.3rem 0 1.4rem;
  font-size: 0.98rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.guide-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  text-decoration: none !important;
  color: var(--text) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.guide-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(204, 120, 92, 0.12);
  transform: translateY(-2px);
}

.guide-card .arrow {
  color: var(--accent);
  font-weight: 700;
}

.guide-card h3 {
  font-size: 1.08rem;
  margin: 0.3rem 0 0.4rem;
}

.guide-card p {
  margin: 0 0 0.8rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}

.card-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.pill-l1 { background: var(--l1-soft); color: var(--l1); }
.pill-l2 { background: var(--l2-soft); color: var(--l2); }
.pill-l3 { background: var(--l3-soft); color: var(--l3); }
.pill-l4 { background: var(--l4-soft); color: var(--l4); }

.time-tag { color: var(--muted); font-weight: 600; }

.divider-icon {
  display: flex;
  justify-content: center;
  margin: 0.6rem 0 1.4rem;
  opacity: 0.5;
}

/* Mid-page CTA */

.mid-cta {
  max-width: 1040px;
  margin: 1rem auto 2.6rem;
  padding: 0 1.5rem;
}

.mid-cta-inner {
  background: linear-gradient(120deg, #1c1613, #241a15);
  border-radius: 20px;
  padding: 2.2rem 2rem;
  text-align: center;
  color: #f5efe9;
}

.mid-cta-inner h3 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.mid-cta-inner p {
  color: #cbbdb2;
  margin: 0 0 1.3rem;
  font-size: 1rem;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding: 2.5rem 1.5rem 2rem;
}

.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.4rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.footer-links a { text-decoration: none; color: var(--muted); }
.footer-links a:hover { color: var(--accent-dark); }

.footer-disclaimer {
  max-width: 1040px;
  margin: 1.2rem auto 0;
  padding: 0 1.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.85;
}

/* Article / guide pages */

.breadcrumb {
  max-width: 740px;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--accent-dark); }

.article-header {
  max-width: 740px;
  margin: 0.8rem auto 0;
  padding: 0 1.5rem;
}

.article-header h1 {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0.4rem 0 0.8rem;
}

.article-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.6rem;
}

article.prose {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  font-size: 1.06rem;
}

article.prose h2 {
  font-size: 1.5rem;
  margin: 2.2rem 0 0.8rem;
  letter-spacing: -0.01em;
}

article.prose h3 {
  font-size: 1.2rem;
  margin: 1.6rem 0 0.6rem;
}

article.prose p { margin: 0 0 1.1rem; color: var(--text); opacity: 0.92; }

article.prose ul, article.prose ol {
  margin: 0 0 1.2rem;
  padding-left: 1.4rem;
}

article.prose li { margin-bottom: 0.5rem; color: var(--text); opacity: 0.92; }

article.prose strong { color: var(--text); }

article.prose code {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1rem 1.3rem;
  margin: 1.4rem 0;
  font-size: 0.98rem;
}

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

.end-cta {
  max-width: 740px;
  margin: 2.4rem auto 0;
  padding: 0 1.5rem;
}

.end-cta-inner {
  background: linear-gradient(120deg, #1c1613, #241a15);
  border-radius: 18px;
  padding: 2rem;
  text-align: center;
  color: #f5efe9;
}

.end-cta-inner h3 { margin: 0 0 0.5rem; font-size: 1.35rem; }
.end-cta-inner p { color: #cbbdb2; margin: 0 0 1.2rem; }

.guide-nav {
  max-width: 740px;
  margin: 2.4rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1.6rem;
}

.guide-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  max-width: 45%;
}

.guide-nav .dir {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.guide-nav .next { text-align: right; margin-left: auto; }

@media (max-width: 640px) {
  .hero h1 { font-size: 2.2rem; }
  .article-header h1 { font-size: 1.8rem; }
  .nav-links { gap: 0.8rem; }
  .brand-sub { display: none; }
}

/* ---------- Dark mode ---------- */

:root {
  --nav-bg: rgba(250, 249, 247, 0.9);
  --accent-border-soft: #f0d9cd;
}

[data-theme="dark"] {
  --accent: #e0876a;
  --accent-dark: #cc785c;
  --accent-light: #f2c6b4;
  --accent-soft: rgba(224, 135, 106, 0.14);
  --accent-border-soft: rgba(224, 135, 106, 0.35);
  --bg: #171513;
  --surface: #1e1b19;
  --text: #f1eee9;
  --muted: #a89f97;
  --border: #2d2926;
  --nav-bg: rgba(23, 21, 19, 0.88);
  --l1: #8fc09c; --l1-soft: rgba(143, 192, 156, 0.14);
  --l2: #7fb0e8; --l2-soft: rgba(127, 176, 232, 0.14);
  --l3: #d9ab5f; --l3-soft: rgba(217, 171, 95, 0.14);
  --l4: #d488c0; --l4-soft: rgba(212, 136, 192, 0.14);
}

body { transition: background-color 0.2s ease, color 0.2s ease; }
.nav, .guide-card, .site-footer, .callout, .hero-badge { transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; }

.nav { background: var(--nav-bg); }
.hero-badge { border-color: var(--accent-border-soft); }

/* ---------- Nav: right cluster, theme toggle, mobile hamburger ---------- */

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.icon-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

.theme-toggle, .nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle:hover, .nav-toggle:hover { border-color: var(--accent); color: var(--accent-dark); }

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: inline-flex; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline-flex; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle.open .icon-menu { display: none; }
.nav-toggle.open .icon-close { display: inline-flex; }

/* ---------- Mobile nav dropdown ---------- */

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    margin: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .nav-links.nav-open { max-height: 320px; }

  .nav-links a.plain,
  .nav-links a.btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border-radius: 0;
    margin: 0;
    padding: 0.95rem 1.5rem;
  }

  .nav-links a.plain { border-bottom: 1px solid var(--border); }
  .nav-links a.btn { justify-content: flex-start; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 1.1rem; }
  .footer-links { flex-wrap: wrap; gap: 0.9rem 1.3rem; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .guide-nav { flex-direction: column; gap: 1.2rem; }
  .guide-nav a, .guide-nav .next { max-width: 100%; text-align: left; margin-left: 0; }
}
