/* =========================================================================
   Yoja Framework docs — single stylesheet, pure CSS, no JS.
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:ital,wght@1,700&display=swap');

/* ---------- design tokens ---------- */
:root {
  --bg:           #fbfbfd;
  --bg-elev:      #ffffff;
  --bg-code:      #1d2230;
  --fg:           #18181b;
  --fg-muted:     #52525b;
  --fg-subtle:    #a1a1aa;
  --border:       #e4e4e7;
  --border-soft:  #efeff2;
  --accent:       #8b5cf6;
  --accent-soft:  #f5f3ff;
  --accent-strong:#7c3aed;
  --warn:         #b45309;
  --warn-soft:    #fef3c7;
  --code-fg:      #e5e7eb;
  --code-comment: #94a3b8;
  --code-keyword: #c084fc;
  --code-string:  #86efac;
  --code-number:  #fbbf24;

  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 14px rgba(0,0,0,.06);

  --sidebar-w:    260px;
  --content-max:  860px;

  --font-sans:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ---------- dark mode ---------- */
html[data-theme="dark"] {
  --bg:           #0d0d0f;
  --bg-elev:      #18181b;
  --bg-code:      #1c1c22;
  --fg:           #fafaf9;
  --fg-muted:     #b4b0aa;
  --fg-subtle:    #6b6866;
  --border:       #2e2c2a;
  --border-soft:  #1f1e1c;
  --accent:       #a78bfa;
  --accent-soft:  #1a0a38;
  --accent-strong:#8b5cf6;
  --warn:         #fb923c;
  --warn-soft:    #1c0d00;
  --code-fg:      #f0ece8;
  --code-comment: #78716c;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.6);
  --shadow-md:    0 4px 24px rgba(0,0,0,.7);
}
html[data-theme="dark"] .top-nav__brand-dot {
  background: linear-gradient(135deg, #a78bfa, #f472b6);
}
html[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
  background-clip: text;
  -webkit-background-clip: text;
}
html[data-theme="dark"] .btn--primary {
  background: var(--accent-strong);
  color: #fff;
  box-shadow: 0 2px 12px rgba(139, 92, 246, .4);
}
html[data-theme="dark"] .btn--primary:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 14px rgba(167, 139, 250, .3);
}
html[data-theme="dark"] .warn { color: #fdba74; }
html[data-theme="dark"] .tip  { background: #001a0a; border-left-color: #16a34a; color: #4ade80; }
html[data-theme="dark"] .note { color: var(--fg-muted); }
html[data-theme="dark"] pre { box-shadow: none; }

/* ---------- theme toggle button ---------- */
.theme-toggle-button {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.theme-toggle-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.theme-toggle-button svg { display: block; transition: transform .3s; }
.theme-toggle-button:hover svg { transform: rotate(20deg); }
.theme-toggle-button .icon-sun  { display: none; }
.theme-toggle-button .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle-button .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle-button .icon-moon { display: none; }

/* ---------- reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
.main h2[id] {
  padding-top: 56px;
  margin-top: calc(3rem - 56px);
  background-color: var(--bg);
}
.main h3[id] {
  padding-top: 56px;
  margin-top: calc(2rem - 56px);
  background-color: var(--bg);
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; height: auto; display: block; }
a {
  color: var(--accent-strong);
  text-decoration: none;
  transition: color .15s;
}
a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- top nav ---------- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  box-shadow: var(--shadow-sm);
}
.top-nav__brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.top-nav__brand:hover { text-decoration: none; }
.top-nav__brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
}
.brand-yoja {
  font-family: 'Chakra Petch', var(--font-sans);
  font-weight: 700;
  font-style: italic;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--accent);
}
.brand-yoja { display: inline-block; }

.top-nav__links {
  margin-left: auto;
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.top-nav__links a {
  color: var(--fg-muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.top-nav__links a:hover { color: var(--fg); text-decoration: none; }
.top-nav__links a.is-active { color: var(--accent-strong); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 0;
  max-width: 1280px;
  margin: 0 auto;
}
.sidebar {
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem 3rem 1.5rem;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: var(--bg); }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--fg-subtle); }
.sidebar h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-subtle);
  margin: 1.5rem 0 .5rem;
  font-weight: 600;
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar li { margin: 0; }
.sidebar a {
  display: block;
  padding: .35rem .75rem;
  margin-left: -.75rem;
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 0.92rem;
  border-left: 2px solid transparent;
}
.sidebar a:hover { background: var(--border-soft); color: var(--fg); text-decoration: none; }
.sidebar a.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 600;
}
.sidebar .nav-group {
  margin-top: .75rem;
}
.sidebar .nav-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-subtle);
  font-weight: 700;
  padding: .2rem 0 .2rem .05rem;
  display: block;
}
.sidebar .nav-sub {
  padding-left: .85rem;
  border-left: 1px solid var(--border-soft);
  margin-left: .1rem;
}
.sidebar .nav-sub a {
  font-size: 0.86rem;
  margin-left: 0;
}
.main {
  padding: 2.5rem 3rem 5rem;
  min-width: 0;
  max-width: calc(var(--content-max) + 6rem);
}
.main__inner { max-width: var(--content-max); }

/* ---------- typography ---------- */
.main h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 .5rem;
  line-height: 1.2;
}
.main h2 {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 3rem 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border-soft);
}
.main h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 .75rem;
}
.main h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 .5rem;
  color: var(--fg);
}
.main p { margin: 0 0 1rem; }
.main ul, .main ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}
.main li { margin-bottom: .3rem; }
.lead {
  font-size: 1.15rem;
  color: var(--fg-muted);
  margin: 0 0 2rem;
  line-height: 1.55;
}

/* ---------- inline code + pre ---------- */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--border-soft);
  padding: .15em .35em;
  border-radius: 4px;
  color: var(--fg);
}
pre {
  background: var(--bg-code);
  color: var(--code-fg);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 1rem 0 1.5rem;
  box-shadow: var(--shadow-md);
}
pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
pre .c { color: var(--code-comment); font-style: italic; }
pre .k { color: var(--code-keyword); }
pre .s { color: var(--code-string); }
pre .n { color: var(--code-number); }
pre .a { color: #93c5fd; }

/* ---------- callouts ---------- */
.note, .warn, .tip {
  border-left: 3px solid;
  padding: .85rem 1rem .85rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}
.note { background: var(--accent-soft); border-left-color: var(--accent); }
.warn { background: var(--warn-soft); border-left-color: var(--warn); color: #92400e; }
.tip  { background: #ecfdf5; border-left-color: #059669; color: #065f46; }
.note p:last-child, .warn p:last-child, .tip p:last-child { margin-bottom: 0; }

/* ---------- hero (landing) ---------- */
.hero {
  text-align: center;
  padding: 4.5rem 1rem 2.5rem;
  background:
    radial-gradient(ellipse at top, var(--accent-soft) 0%, transparent 60%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #18181b 0%, var(--accent-strong) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  margin: 0 0 .75rem;
  line-height: 1.05;
}
.hero p {
  font-size: 1.25rem;
  color: var(--fg-muted);
  max-width: 640px;
  margin: 0 auto 2rem;
  line-height: 1.5;
}
.hero__buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: .65rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all .15s;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--accent-strong);
  color: white;
  box-shadow: 0 2px 10px rgba(124, 58, 237, .35);
}
.btn--primary:hover {
  background: var(--accent);
  color: white;
  box-shadow: 0 3px 12px rgba(139, 92, 246, .28);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn--secondary {
  background: var(--bg-elev);
  border-color: var(--border);
  color: var(--fg);
}
.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  text-decoration: none;
}

/* ---------- feature grid (landing) ---------- */
.section {
  max-width: 1080px;
  margin: 4rem auto;
  padding: 0 1.5rem;
}
.section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 .5rem;
  border: none;
  padding: 0;
}
.section__lead {
  text-align: center;
  color: var(--fg-muted);
  margin: 0 auto 2.5rem;
  max-width: 600px;
}
.hello-files {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 700px) {
  .hello-files { grid-template-columns: 1fr; }
}
.hello-file {}
.code-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  background: var(--border-soft);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: .2rem .6rem;
  border-radius: 4px 4px 0 0;
  display: inline-block;
  position: relative;
  top: 1px;
}
.hello-file pre { margin-top: 0; border-top-left-radius: 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all .15s;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card h3 {
  font-size: 1.1rem;
  margin: 0 0 .5rem;
  color: var(--fg);
}
.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--accent-strong); text-decoration: none; }
.card--link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.card--link:hover { text-decoration: none; color: inherit; }
.card p {
  color: var(--fg-muted);
  font-size: 0.93rem;
  margin: 0;
  line-height: 1.5;
}
.card__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: .15rem .5rem;
  border-radius: 4px;
  margin-bottom: .75rem;
}

/* ---------- API listing ---------- */
.api-class {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.api-class > h3 {
  margin-top: 0;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--accent-strong);
  display: flex;
  align-items: baseline;
  gap: .75rem;
}
.api-class > h3 .kind {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--border-soft);
  color: var(--fg-muted);
  padding: .15rem .5rem;
  border-radius: 4px;
  font-weight: 600;
}
.api-class > p {
  color: var(--fg-muted);
  margin: 0 0 .75rem;
}
.api-members {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px dashed var(--border-soft);
  padding-top: .75rem;
}
.api-members li {
  padding: .35rem 0;
  font-size: 0.92rem;
}
.api-members code {
  background: transparent;
  color: var(--fg);
  font-weight: 500;
  padding: 0;
  font-size: 0.92rem;
}
.api-members .desc {
  color: var(--fg-muted);
  font-size: 0.88rem;
}
.api-members .api-group-label {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--fg-muted);
  padding: .9rem 0 .2rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: .15rem;
}

/* ---------- api table ---------- */
.api-table-group {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--fg-muted);
  display: block;
  padding: 1rem 0 .3rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: .1rem;
}
.api-table-group:first-child { padding-top: .25rem; }
.api-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: .5rem;
  font-size: 0.88rem;
}
.api-table th {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-subtle);
  font-weight: 600;
  padding: .35rem .75rem .35rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.api-table td {
  padding: .45rem .75rem .45rem 0;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  line-height: 1.45;
}
.api-table tr:last-child td { border-bottom: none; }
.api-table td:first-child { white-space: nowrap; }
.api-table td code {
  background: transparent;
  padding: 0;
  font-size: 0.88rem;
  color: var(--fg);
  font-weight: 500;
}
.api-table td.ret { white-space: nowrap; }
.api-table td.ret code {
  color: var(--accent-strong);
  font-size: 0.82rem;
}
.api-table td.desc { color: var(--fg-muted); }
.api-table td.desc code {
  color: var(--fg);
  font-size: 0.82rem;
}

/* ---------- breadcrumb ---------- */
.crumb {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin: 0 0 1rem;
}
.crumb a { color: var(--fg-muted); }
.crumb a:hover { color: var(--accent-strong); text-decoration: none; }
.crumb span { color: var(--fg-subtle); margin: 0 .35rem; }

/* ---------- summary table ---------- */
.summary-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.summary-table thead th {
  background: var(--bg-elev);
  color: var(--fg-subtle);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  padding: .75rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.summary-table thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.summary-table thead th:last-child  { border-radius: 0 var(--radius-lg) 0 0; }
.summary-table tbody tr { transition: background .12s; }
.summary-table tbody tr:hover { background: var(--bg-elev); }
.summary-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--border-soft); }
.summary-table td {
  padding: .7rem 1.1rem;
  vertical-align: top;
  line-height: 1.5;
  color: var(--fg-muted);
}
.summary-table td:first-child {
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.summary-table td:nth-child(2) { color: var(--fg-subtle); }
.summary-table td:last-child { color: var(--fg-muted); }
.summary-table td code {
  background: transparent;
  padding: 0;
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--fg-muted);
}
.footer a { color: var(--fg-muted); }
.footer a:hover { color: var(--accent-strong); text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
  }
  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
  }
  .sidebar h4 { margin: 1rem 0 .25rem; }
  .sidebar a { margin-left: 0; padding: .25rem .6rem; font-size: 0.85rem; }
  .main {
    padding: 2rem 1.5rem 4rem;
  }
  .main h1 { font-size: 1.85rem; }
  .hero { padding: 3rem 1rem 2rem; }
  .hero h1 { font-size: 2.25rem; }
  .hero p { font-size: 1.05rem; }
  .top-nav { padding: 0 1rem; }
  .top-nav__links { gap: .75rem; }
  .top-nav__links a { font-size: 0.85rem; }
}

@media (max-width: 520px) {
  .top-nav__brand { font-size: 0.95rem; }
  .top-nav__links a:not(.btn) { display: none; }
  pre { padding: .75rem; font-size: 0.78rem; }
  .main { padding: 1.5rem 1rem 3rem; }
}
