/*
  Project Syrup Wiki — styled to match projectsyrup.app
  Warm dark theme: near-black background, syrupy amber accents, glassmorphism
*/

:root {
  --bg:           #0f0c0a;
  --bg-elev:      #1a1612;
  --bg-glass:     rgba(26, 22, 18, 0.82);
  --surface:      #241f1a;
  --surface-2:    #2e2720;
  --text:         #e8e0d3;
  --text-dim:     #a89d8c;
  --text-muted:   #6b6058;
  --accent:       #f59e0b;
  --accent-dark:  #d97706;
  --accent-burn:  #c2410c;
  --accent-glow:  rgba(245, 158, 11, 0.22);
  --accent-subtle:rgba(245, 158, 11, 0.08);
  --border:       rgba(163, 140, 110, 0.18);
  --border-hover: rgba(245, 158, 11, 0.35);
  --success:      #4ade80;
  --success-dim:  rgba(74, 222, 128, 0.12);
  --warn:         #fb923c;
  --warn-dim:     rgba(251, 146, 60, 0.12);
  --info:         #60a5fa;
  --info-dim:     rgba(96, 165, 250, 0.10);
  --danger:       #f87171;
  --danger-dim:   rgba(248, 113, 113, 0.10);
  --tip:          #34d399;
  --tip-dim:      rgba(52, 211, 153, 0.10);
  --sidebar-w:    260px;
  --radius-sm:    6px;
  --radius:       12px;
  --radius-lg:    18px;
  --radius-xl:    24px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
}

/* ── Top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 22, 18, 0.90);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), var(--accent-burn));
  opacity: 0.7;
}

.topbar-logo {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-logo .logo-emoji {
  font-size: 1.3rem;
  line-height: 1;
}
.topbar-logo .logo-sub {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-top: -2px;
  font-weight: 400;
}

.topbar-nav {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.topbar-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: .82rem;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all .15s ease;
  letter-spacing: -0.01em;
}
.topbar-nav a:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--surface);
}
.topbar-nav a.active {
  color: var(--accent);
  background: var(--accent-subtle);
  border-color: rgba(245,158,11,0.25);
}

/* ── Layout ── */
.layout {
  flex: 1;
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0 0 80px;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 28px 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section { margin-bottom: 28px; }
.sidebar-section-title {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 20px 8px;
}
.sidebar-link {
  display: block;
  padding: 6px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: .85rem;
  border-left: 2px solid transparent;
  transition: all .12s ease;
  letter-spacing: -0.01em;
}
.sidebar-link:hover {
  color: var(--accent);
  background: var(--accent-subtle);
  border-left-color: rgba(245,158,11,0.3);
}
.sidebar-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-subtle);
  font-weight: 600;
}
.sidebar-link.sub {
  padding-left: 34px;
  font-size: .8rem;
  color: var(--text-muted);
}
.sidebar-link.sub:hover, .sidebar-link.sub.active { color: var(--accent); }

/* ── Main content ── */
.content {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 0 48px;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.page-header .subtitle {
  color: var(--text-dim);
  margin-top: 8px;
  font-size: .95rem;
}

/* ── Section headings ── */
h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 44px 0 14px;
  letter-spacing: -0.025em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
h3 {
  font-size: 1.0rem;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 8px;
  letter-spacing: -0.015em;
}
h4 {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 20px 0 6px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

p { margin: 0 0 12px; color: var(--text-dim); }
p:last-child { margin-bottom: 0; }
strong { color: var(--text); font-weight: 600; }
a { color: var(--accent); text-decoration: none; transition: opacity .12s; }
a:hover { opacity: .8; }

/* ── Lists ── */
ul, ol { margin: 0 0 14px 20px; }
li { margin-bottom: 5px; color: var(--text-dim); }
li strong { color: var(--text); }

/* ── Code ── */
code {
  background: var(--surface);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: .83em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  border: 1px solid var(--border);
}
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px 22px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
  font-size: .84rem;
  line-height: 1.65;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
pre code {
  background: none;
  color: var(--text);
  padding: 0;
  font-size: 1em;
  border: none;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  background: var(--surface-2);
  color: var(--text-dim);
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(163,140,110,0.10);
  color: var(--text-dim);
  vertical-align: top;
}
td strong { color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(245,158,11,0.03); }

/* ── Callouts ── */
.callout {
  border-left: 3px solid;
  padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 18px 0;
  font-size: .9rem;
}
.callout p { margin-bottom: 4px; }
.callout p:last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin-bottom: 5px; }

.callout.info    { border-color: var(--info);    background: var(--info-dim);    color: #93c5fd; }
.callout.info    .callout-title { color: var(--info); }
.callout.warn    { border-color: var(--warn);    background: var(--warn-dim);    color: #fdba74; }
.callout.warn    .callout-title { color: var(--warn); }
.callout.danger  { border-color: var(--danger);  background: var(--danger-dim);  color: #fca5a5; }
.callout.danger  .callout-title { color: var(--danger); }
.callout.tip     { border-color: var(--tip);     background: var(--tip-dim);     color: #6ee7b7; }
.callout.tip     .callout-title { color: var(--tip); }

/* ── Role / method badges ── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.6;
}
.badge-super  { background: rgba(139,92,246,.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3); }
.badge-admin  { background: var(--accent-subtle); color: var(--accent); border: 1px solid rgba(245,158,11,.3); }
.badge-wm     { background: var(--success-dim);  color: var(--success); border: 1px solid rgba(74,222,128,.3); }
.badge-get    { background: rgba(96,165,250,.12); color: #93c5fd; border: 1px solid rgba(96,165,250,.3); }
.badge-post   { background: var(--success-dim);  color: var(--success); border: 1px solid rgba(74,222,128,.3); }
.badge-patch  { background: var(--warn-dim);     color: var(--warn);    border: 1px solid rgba(251,146,60,.3); }
.badge-delete { background: var(--danger-dim);   color: var(--danger);  border: 1px solid rgba(248,113,113,.3); }

/* ── Home page cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 24px 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: transform .2s cubic-bezier(.23,1,.32,1), box-shadow .2s cubic-bezier(.23,1,.32,1), border-color .15s ease;
  display: block;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), var(--accent-burn));
  opacity: 0;
  transition: opacity .2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 24px -6px rgba(0,0,0,.4), 0 0 0 1px var(--border-hover);
  border-color: var(--border-hover);
}
.card:hover::before { opacity: 1; }
.card-icon { font-size: 1.6rem; margin-bottom: 12px; line-height: 1; }
.card h3 { margin: 0 0 6px; font-size: .95rem; color: var(--text); letter-spacing: -0.02em; }
.card p  { font-size: .83rem; color: var(--text-muted); margin: 0; line-height: 1.5; }

/* ── Steps ── */
.steps { counter-reset: step; list-style: none; margin-left: 0; }
.steps li {
  counter-increment: step;
  padding: 12px 0 12px 56px;
  position: relative;
  border-left: 2px solid var(--border);
  margin-left: 16px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: -17px;
  top: 10px;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #0a0b12;
  font-weight: 700;
  font-size: .8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps li:last-child { border-left-color: transparent; }
.steps li p, .steps li ul { color: var(--text-dim); }

/* ── API endpoint blocks ── */
.endpoint {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 0;
  overflow: hidden;
  transition: border-color .15s ease;
}
.endpoint:hover { border-color: var(--border-hover); }
.endpoint-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .84rem;
}
.endpoint-path { color: var(--text); font-weight: 500; }
.endpoint-desc { padding: 12px 16px; font-size: .875rem; color: var(--text-dim); }
.endpoint-desc pre { margin: 10px 0 0; }
.endpoint-desc ul  { margin-top: 8px; }

/* ── Divider rule ── */
.section-rule { border: none; border-top: 1px solid var(--border); margin: 48px 0 8px; opacity: .5; }

/* ── Inline tags / code chips ── */
.tag {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .78rem;
  font-family: 'SF Mono','Fira Code',monospace;
  color: var(--text-dim);
}
.action-list { list-style: none; margin-left: 0; }
.action-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(163,140,110,0.08);
  font-size: .875rem;
  color: var(--text-dim);
}
.action-list li:last-child { border-bottom: none; }
.action-code {
  display: inline-block;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid rgba(245,158,11,0.2);
  padding: 1px 7px;
  border-radius: 4px;
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: .78rem;
  margin-right: 6px;
}

/* ── Platform tag list ── */
.platform-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.platform-list span {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: .8rem;
  font-family: 'SF Mono','Fira Code',monospace;
  color: var(--text-dim);
}

/* ── Field table ── */
.field-table td:first-child {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: .8rem;
  color: var(--accent);
  white-space: nowrap;
}

/* ── Changelog specific ── */
.release { margin-bottom: 44px; }
.release-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.release-header h2 { margin: 0; border: none; padding: 0; font-size: 1.2rem; }
.release-date { color: var(--text-muted); font-size: .82rem; }
.release-tag {
  display: inline-block;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-sm);
  padding: 2px 9px;
  font-size: .75rem;
  font-family: 'SF Mono','Fira Code',monospace;
  font-weight: 600;
  text-decoration: none;
}
.release-tag:hover { background: var(--accent-subtle); opacity: 1; }
.change-section { margin: 10px 0; }
.change-kind { font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 5px; }
.kind-added   { color: var(--success); }
.kind-fixed   { color: var(--info); }
.kind-changed { color: var(--warn); }
.kind-removed { color: var(--danger); }
.change-list { margin-left: 18px; }
.change-list li { font-size: .88rem; margin-bottom: 3px; }
.change-list strong { color: var(--text); }
.divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; opacity: .4; }

/* ── Footer ── */
footer {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  font-size: .78rem;
  letter-spacing: -0.01em;
}
footer a { color: var(--text-dim); }
footer a:hover { color: var(--accent); opacity: 1; }

/* ── Stats bar (home page) ── */
.stats-bar {
  background: rgba(0,0,0,.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 24px 0;
  overflow: hidden;
}
.stats-bar-item {
  padding: 18px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stats-bar-item:last-child { border-right: none; }
.stats-bar-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stats-bar-label {
  display: block;
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .stats-bar-item:nth-child(2) { border-right: none; }
  .stats-bar-item:nth-child(3) { border-top: 1px solid var(--border); }
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    padding: 16px 0;
  }
  .sidebar-section { width: 50%; margin-bottom: 12px; }
  .content { padding: 28px 20px 0; }
  .topbar-nav { display: none; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .sidebar-section { width: 100%; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card:hover { transform: none; }
}
