/* ── WSO2 MI Language Server — Apple Clean Dark Theme ─────────────────── */

:root {
  --bg:           #000000;
  --bg-alt:       #1c1c1e;
  --bg-elev:      #2c2c2e;
  --border:       #38383a;
  --text:         #f5f5f7;
  --text-dim:     #86868b;
  --text-bright:  #ffffff;
  --accent:       #0a84ff;
  --accent-soft:  #0a84ff20;
  --blue:         #0a84ff;
  --green:        #30d158;
  --red:          #ff453a;
  --purple:       #bf5af2;
  --yellow:       #ffd60a;

  --sidebar-w:    280px;
  --topbar-h:     54px;
  --ease:         cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur:          250ms;
  --radius:       14px;
  --maxw:         800px;
  --font:         -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono:         "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
}

.topbar-toggle {
  width: 36px; height: 36px; flex-shrink: 0;
  border: none; border-radius: 8px;
  background: transparent; color: var(--text-dim);
  display: grid; place-items: center; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  padding: 0;
}
.topbar-toggle:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.topbar-toggle svg { display: block; width: 20px; height: 20px; }

.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0; user-select: none;
}
.topbar-brand .logo {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--accent);
  display: grid; place-items: center;
  font-weight: 600; color: #ffffff; font-size: 11px;
  flex-shrink: 0;
}
.topbar-brand .name {
  font-size: 15px; font-weight: 600; color: var(--text-bright);
  letter-spacing: -0.01em; white-space: nowrap;
}

.topbar-crumb {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.topbar-crumb .sep { color: var(--border); font-size: 16px; flex-shrink: 0; }
.topbar-crumb .page {
  font-size: 14px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Sidebar overlay (mobile) ────────────────────────────────────────────── */

.sidebar-overlay {
  display: none; position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 70;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body.sidebar-open .sidebar-overlay { display: block; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.layout { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }

.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 80;
  width: var(--sidebar-w);
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  padding: 24px 16px 48px;
  overflow-y: auto; overflow-x: hidden;
  transition:
    width var(--dur) var(--ease),
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

.content {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 64px 80px 120px;
  transition: margin-left var(--dur) var(--ease);
}
.content .inner { max-width: var(--maxw); margin: 0 auto; }

/* collapsed state — desktop */
body.sidebar-hidden .sidebar  { width: 0; opacity: 0; pointer-events: none; }
body.sidebar-hidden .content  { margin-left: 0; }

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */

.sidebar nav { margin-top: 4px; }

.sidebar nav .group-label {
  font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  font-weight: 600; color: var(--text-dim);
  margin: 28px 0 8px 12px; opacity: 0.8;
}

.sidebar nav a {
  display: block; padding: 8px 12px; margin: 2px 0;
  color: var(--text); text-decoration: none; border-radius: 8px;
  font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); }

.sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar nav a .sub {
  display: block; font-size: 12px; color: var(--text-dim);
  font-weight: 400; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar nav a.active .sub {
  color: var(--accent); opacity: 0.8;
}

/* section anchor links — indented */
.sidebar nav a[href*="#"] { padding-left: 24px; font-size: 13.5px; color: var(--text-dim); }
.sidebar nav a[href*="#"]:hover { color: var(--text); }

/* ── Typography ──────────────────────────────────────────────────────────── */

h1 {
  font-size: 40px; color: var(--text-bright); margin: 0 0 16px;
  letter-spacing: -0.04em; font-weight: 700; line-height: 1.1;
}
h2 {
  font-size: 28px; color: var(--text-bright); margin: 64px 0 20px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em; font-weight: 600;
}
h3  { font-size: 20px; color: var(--text-bright); margin: 40px 0 12px; font-weight: 600; letter-spacing: -0.01em; }
h4  {
  font-size: 13px; color: var(--text-dim); margin: 32px 0 8px;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
p   { margin: 16px 0; }
.lead { font-size: 20px; color: var(--text-dim); margin-bottom: 40px; line-height: 1.5; font-weight: 400; letter-spacing: -0.015em; }
a   { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--text-bright); font-weight: 600; }
ul, ol { padding-left: 24px; }
li  { margin: 8px 0; }
hr  { border: none; border-top: 1px solid var(--border); margin: 56px 0; }

code {
  font-family: var(--mono); font-size: 0.85em;
  background: rgba(255,255,255,0.1); padding: 3px 6px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05); color: var(--text-bright);
}
pre {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 24px; overflow-x: auto;
  font-family: var(--mono); font-size: 14px; line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; color: var(--text); font-size: inherit; }

/* ── Kicker ──────────────────────────────────────────────────────────────── */

.kicker {
  display: inline-block;
  font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600; margin-bottom: 16px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px; margin: 32px 0;
}
.card {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.2);
}
.card h3 { margin: 0 0 8px; font-size: 18px; color: var(--text-bright); }
.card p  { margin: 0; color: var(--text-dim); font-size: 15px; line-height: 1.5; }
.card .ico { font-size: 28px; margin-bottom: 16px; display: block; }
a.card { text-decoration: none; color: inherit; display: block; }
a.card:hover { text-decoration: none; }

/* ── Callouts ────────────────────────────────────────────────────────────── */

.callout {
  background: #1c1c1e;
  padding: 18px 24px; border-radius: 12px; margin: 32px 0;
  border-left: none;
}
.callout.info   { background: rgba(10,132,255,0.15); }
.callout.warn   { background: rgba(255,214,10,0.15); }
.callout.danger { background: rgba(255,69,58,0.15);  }
.callout p:first-child { margin-top: 0; }
.callout p:last-child  { margin-bottom: 0; }
.callout .label { font-weight: 600; color: var(--text-bright); display: block; margin-bottom: 6px;}

/* ── Cache detail list ───────────────────────────────────────────────────── */

dl.cache-detail { margin: 24px 0; }
dl.cache-detail dt {
  color: var(--text-bright); font-weight: 600;
  margin-top: 18px; line-height: 1.5;
}
dl.cache-detail dt:first-child { margin-top: 0; }
dl.cache-detail dt em { color: var(--text-dim); font-weight: 400; }
dl.cache-detail dd {
  margin: 8px 0 0 0; padding: 10px 16px;
  background: var(--bg-alt); border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
dl.cache-detail dd .note {
  margin: 10px 0 0 0; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-dim);
}
dl.cache-detail dd .note strong { color: var(--text); }

/* ── Tables ──────────────────────────────────────────────────────────────── */

table {
  width: 100%; border-collapse: collapse; margin: 24px 0;
  font-size: 15px; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
th, td { text-align: left; padding: 14px 20px; border-bottom: 1px solid var(--border); vertical-align: top; }
th {
  background: var(--bg-alt); color: var(--text-dim);
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
tr:hover td { background: rgba(255,255,255,0.04); }

/* ── Tags ────────────────────────────────────────────────────────────────── */

.tag {
  display: inline-block; font-size: 12px; font-weight: 500; padding: 4px 12px;
  border-radius: 20px; background: rgba(255,255,255,0.1); color: var(--text-bright);
  margin: 2px 6px 2px 0; letter-spacing: 0.01em;
}

/* ── Mermaid ─────────────────────────────────────────────────────────────── */

.mermaid {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 16px; padding: 48px 24px 32px; margin: 32px 0;
  text-align: center; overflow-x: auto; position: relative;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
figcaption {
  text-align: center; color: var(--text-dim); font-size: 14px;
  margin-top: -16px; margin-bottom: 32px; font-style: italic;
}

/* ── Diagram zoom toolbar ────────────────────────────────────────────────── */

.dz-bar {
  position: absolute; top: 12px; right: 16px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(28,28,30,0.8); border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  border-radius: 8px; padding: 4px 6px; z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.dz-btn {
  width: 28px; height: 28px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-dim);
  display: grid; place-items: center; cursor: pointer;
  font-size: 16px; line-height: 1;
  transition: background .15s, color .15s;
  padding: 0;
}
.dz-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-bright); }
.dz-pct {
  font-size: 12px; color: var(--text-dim); font-family: var(--mono);
  min-width: 44px; text-align: center; user-select: none;
}
.dz-hint {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--text-dim); opacity: 0; pointer-events: none;
  white-space: nowrap; transition: opacity .2s;
}
.mermaid:hover .dz-hint { opacity: 0.6; }

/* ── Text review blur ────────────────────────────────────────────────────── */
/* Active when <body data-text-review> is set on the page.                   */
/* Diagrams (figure.mermaid) and headings (h2, h4) stay fully visible.       */
/* To remove: delete data-text-review from <body>.                           */

[data-text-review] .content p,
[data-text-review] .content .lead,
[data-text-review] .content .callout,
[data-text-review] .content table,
[data-text-review] .content .steps,
[data-text-review] .content .footer-nav {
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
}

/* ── Home notice banner ──────────────────────────────────────────────────── */

.notice-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--yellow);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 36px 0;
}

.notice-body {
  flex: 1;
  min-width: 0;
}

.notice-title {
  font-size: 18px;
  font-weight: 700;
  color: #000;
  margin: 0 0 5px;
  line-height: 1.3;
  filter: none !important;
}

.notice-sub {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
  margin: 0;
  filter: none !important;
}

.notice-btn {
  flex-shrink: 0;
  background: #000;
  color: var(--yellow);
  padding: 11px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: background var(--dur) var(--ease);
}

.notice-btn:hover {
  background: #1c1c1e;
}

/* keep notice content sharp even when data-text-review blur is active */
[data-text-review] .notice-banner,
[data-text-review] .notice-banner p {
  filter: none;
  user-select: auto;
  pointer-events: auto;
}

/* ── Home page focus mode ────────────────────────────────────────────────── */
/* Blurs everything in the page except the notice banner so first-time        */
/* visitors are directed straight to Flows. Remove data-home-focus to clear.  */

[data-home-focus] .content .inner > *:not(.notice-banner) {
  filter: blur(6px);
  opacity: 0.35;
  user-select: none;
  pointer-events: none;
}

[data-home-focus] .notice-banner {
  filter: none !important;
  opacity: 1 !important;
  user-select: auto !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 2;
}

/* ── Steps ───────────────────────────────────────────────────────────────── */

.steps { counter-reset: step; list-style: none; padding: 0; margin: 32px 0; }
.steps > li {
  position: relative; padding: 4px 0 24px 56px; margin: 0;
  border-left: 2px solid var(--border); margin-left: 18px;
}
.steps > li:last-child { border-left-color: transparent; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: -18px; top: 0;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-alt); color: var(--text-bright);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-weight: 600; font-size: 14px;
  box-shadow: 0 0 0 6px var(--bg);
}
.steps > li .st { font-weight: 600; color: var(--text-bright); display: block; font-size: 16px; margin-bottom: 4px; }

/* ── Misc ────────────────────────────────────────────────────────────────── */

.file-ref { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 40px; }

/* ── Footer nav ──────────────────────────────────────────────────────────── */

.footer-nav {
  display: flex; align-items: stretch; justify-content: space-between;
  gap: 16px; margin-top: 80px; padding-top: 32px; border-top: 1px solid var(--border);
}
.footer-nav a {
  display: flex; flex-direction: column; padding: 18px 24px;
  border: 1px solid var(--border); border-radius: 12px; min-width: 200px;
  transition: transform .2s, box-shadow .2s;
  background: var(--bg-alt);
}
.footer-nav a:hover { 
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); 
  text-decoration: none; 
}
.footer-nav a .dir { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.footer-nav a .lbl { color: var(--accent); font-weight: 600; font-size: 16px; }
.footer-nav a.next { text-align: right; align-items: flex-end; margin-left: auto; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .sidebar {
    width: var(--sidebar-w) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: none;
  }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.5); }
  .content { margin-left: 0 !important; padding: 40px 24px 100px; }
  .topbar-brand .name { display: none; }
  .topbar-crumb .sep  { display: none; }
}
