@import url("/assets/merak/style.css");

:root {
  --site-header-height: 72px;
  --site-content-width: 1440px;
  scroll-padding-top: calc(var(--site-header-height) + 24px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--mp-bg-canvas);
}

a { color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

svg {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  color: var(--mp-text-inverse);
  background: var(--mp-accent-strong);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  height: var(--site-header-height);
  background: rgb(24 30 42 / 0.94);
  border-bottom: 1px solid var(--mp-line-muted);
  backdrop-filter: blur(18px);
}

.site-header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(100% - 48px, var(--site-content-width));
  height: 100%;
  margin: 0 auto;
  gap: 36px;
}

.site-brand {
  color: var(--mp-text-primary);
  font-family: var(--font-sans);
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.08em;
  text-decoration: none;
}

.site-brand--small { font-size: 1.65rem; }

.top-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 28px;
}

.top-nav a {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--mp-text-tertiary);
  font-size: 0.93rem;
  font-weight: 550;
  text-decoration: none;
  transition: color 150ms var(--ease-system);
}

.top-nav a:hover { color: var(--mp-text-primary); }

.top-nav a[aria-current="page"] { color: var(--mp-accent-200); }

.top-nav a[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--mp-accent-line);
  content: "";
}

.header-github { gap: 8px; }

.header-github svg {
  fill: currentColor;
  stroke: none;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 9px;
  color: var(--mp-text-secondary);
  background: var(--mp-bg-interactive);
  border: 0;
  border-radius: var(--radius-md);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(100% - 48px, 1320px);
  min-height: 116px;
  margin: 0 auto;
  color: var(--mp-text-muted);
  border-top: 1px solid var(--mp-line-muted);
}

.site-footer > div { display: flex; align-items: center; gap: 24px; }
.site-footer a { color: var(--mp-text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--mp-text-primary); }

/* Home */
.hero {
  display: grid;
  grid-template-columns: minmax(520px, 0.98fr) minmax(560px, 1.02fr);
  align-items: center;
  width: min(100% - 48px, 1392px);
  min-height: 540px;
  margin: 0 auto;
  gap: 76px;
  padding: 64px 0 56px;
}

.hero__copy h1 {
  max-width: 640px;
  margin: 0;
  color: var(--mp-text-primary);
  font-size: clamp(3.2rem, 4.2vw, 4rem);
  font-weight: 780;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.hero__copy p {
  max-width: 620px;
  margin: 26px 0 0;
  color: var(--mp-text-tertiary);
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  line-height: 1.55;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 38px;
}

.hero__actions .mp-button {
  min-height: 48px;
  padding-inline: 20px;
  font-size: 0.98rem;
}

.terminal {
  overflow: hidden;
  background: var(--mp-bg-inset);
  border-radius: var(--radius-lg);
  box-shadow: var(--mp-shadow-panel);
}

.terminal__bar {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  color: var(--mp-text-muted);
  background: var(--mp-bg-base);
  border-bottom: 1px solid var(--mp-line-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.terminal__lights { display: flex; gap: 8px; margin-right: 18px; }
.terminal__lights i { width: 10px; height: 10px; background: var(--mp-neutral-base); border-radius: 50%; }
.terminal__lights i:first-child { background: var(--mp-danger-base); }
.terminal__lights i:nth-child(2) { background: var(--mp-warning-base); }
.terminal__lights i:nth-child(3) { background: var(--mp-success-base); }

.terminal__copy {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 7px 9px;
  color: var(--mp-text-tertiary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
}

.terminal__copy:hover { color: var(--mp-text-primary); background: var(--mp-bg-hover); }

.terminal__body { padding: 22px 24px 24px; }

.terminal__command {
  margin-bottom: 24px;
  color: var(--mp-text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.terminal__command span { color: var(--mp-accent-line); }

.trace-list { display: grid; gap: 0; }

.trace-row {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 58px;
}

.trace-row:not(:last-child)::after {
  position: absolute;
  top: 22px;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--mp-line-muted);
  content: "";
}

.trace-row.is-done:not(:last-child)::after { background: var(--mp-success-base); }
.trace-row.is-active:not(:last-child)::after { background: var(--mp-accent-deep); }

.trace-row__dot {
  z-index: 1;
  width: 15px;
  height: 15px;
  margin-top: 3px;
  background: var(--mp-bg-inset);
  border: 2px solid var(--mp-neutral-base);
  border-radius: 50%;
}

.trace-row.is-done .trace-row__dot { background: var(--mp-success-base); border-color: var(--mp-success-text); box-shadow: 0 0 0 5px var(--mp-success-weak); }
.trace-row.is-active .trace-row__dot { background: var(--mp-accent-deep); border-color: var(--mp-accent-200); box-shadow: 0 0 0 5px var(--mp-signal-ring); }

.trace-row__body strong { display: block; color: var(--mp-text-primary); font-family: var(--font-mono); font-size: 0.82rem; }
.trace-row__body span { display: block; margin-top: 3px; color: var(--mp-text-muted); font-family: var(--font-mono); font-size: 0.72rem; }
.trace-row__status { color: var(--mp-text-muted); font-family: var(--font-mono); font-size: 0.68rem; }
.trace-row.is-done .trace-row__status { color: var(--mp-success-text); }
.trace-row.is-active .trace-row__status { color: var(--mp-accent-200); }

.feature-band {
  background: var(--mp-bg-base);
  border-top: 1px solid var(--mp-line-soft);
  border-bottom: 1px solid var(--mp-line-soft);
}

.feature-band__inner {
  width: min(100% - 48px, 1392px);
  margin: 0 auto;
  padding: 64px 0 72px;
}

.feature-band h2, .workflow-section h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-transform: none;
}

.feature-band__lead {
  max-width: 620px;
  margin: 14px 0 42px;
  color: var(--mp-text-tertiary);
  font-size: 1.05rem;
}

.feature-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.feature-item { min-height: 190px; padding: 0 42px; }
.feature-item:first-child { padding-left: 0; }
.feature-item + .feature-item { border-left: 1px solid var(--mp-line-muted); }

.feature-item__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 24px;
  color: var(--mp-accent-300);
  background: var(--mp-bg-interactive);
  border-radius: var(--radius-md);
}

.feature-item h3 { margin: 0 0 10px; font-size: 1.2rem; }
.feature-item p { margin: 0; color: var(--mp-text-tertiary); line-height: 1.65; }

.workflow-section {
  width: min(100% - 48px, 1120px);
  margin: 0 auto;
  padding: 88px 0 96px;
}

.workflow-section > p { max-width: 650px; color: var(--mp-text-tertiary); font-size: 1.05rem; }

.workflow-rail {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 44px;
  background: var(--mp-bg-inset);
  border-radius: var(--radius-lg);
  box-shadow: var(--mp-shadow-soft);
}

.workflow-rail > div { position: relative; padding: 24px; }
.workflow-rail > div + div { border-left: 1px solid var(--mp-line-muted); }
.workflow-rail span { display: block; margin-bottom: 10px; color: var(--mp-accent-line); font-family: var(--font-mono); font-size: 0.72rem; }
.workflow-rail strong { font-size: 0.95rem; }

.home-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  margin-top: 56px;
  padding: 28px 32px;
  background: var(--mp-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--mp-shadow-soft);
}

.home-cta h3 { margin: 0 0 5px; font-size: 1.35rem; }
.home-cta p { margin: 0; color: var(--mp-text-tertiary); }

/* Documentation */
.docs-mobile-toggle { display: none; }

.docs-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  width: min(100%, 1536px);
  min-height: calc(100vh - var(--site-header-height));
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: var(--site-header-height);
  align-self: start;
  height: calc(100vh - var(--site-header-height));
  overflow-y: auto;
  padding: 28px 20px 48px 28px;
  border-right: 1px solid var(--mp-line-soft);
}

.docs-nav__group + .docs-nav__group { margin-top: 28px; }

.docs-nav__group h2 {
  margin: 0 0 9px 14px;
  color: var(--mp-text-secondary);
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.docs-nav__group ul { padding: 0; margin: 0; list-style: none; }

.docs-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px 7px 14px;
  color: var(--mp-text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  text-decoration: none;
}

.docs-nav__link:hover { color: var(--mp-text-primary); background: var(--mp-bg-hover); }
.docs-nav__link.is-active { color: var(--mp-accent-200); background: transparent; }
.docs-nav__link.is-active::before { position: absolute; top: 6px; bottom: 6px; left: 0; width: 2px; background: var(--mp-accent-line); content: ""; }

.docs-nav__icon { display: grid; place-items: center; width: 18px; margin-right: 10px; }
.docs-nav__icon svg { width: 16px; height: 16px; }

.doc-article {
  min-width: 0;
  padding: 24px clamp(32px, 2.5vw, 40px) 72px;
}

.doc-breadcrumb { margin-bottom: 22px; }

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 32px;
}

.doc-header__copy h1 {
  margin: 0;
  color: var(--mp-text-primary);
  font-size: clamp(2.3rem, 3.5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.doc-header__copy p {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--mp-text-tertiary);
  font-size: 1rem;
  line-height: 1.55;
}

.doc-actions { display: flex; flex: 0 0 auto; gap: 10px; }
.doc-actions .mp-button { white-space: nowrap; }
.doc-actions svg { width: 16px; height: 16px; }

.doc-content { max-width: none; }
.doc-content h2, .doc-content h3 { scroll-margin-top: calc(var(--site-header-height) + 24px); }
.doc-content h2 { margin-top: 44px; font-size: 1.65rem; letter-spacing: -0.025em; }
.doc-content h3 { margin-top: 32px; font-size: 1.2rem; }
.doc-content p, .doc-content li { color: var(--mp-text-secondary); line-height: 1.72; }
.doc-content a { color: var(--mp-accent-300); text-underline-offset: 3px; }
.doc-content code:not(.mp-command-result__value) { padding: 2px 5px; color: var(--mp-accent-200); background: var(--mp-bg-inset); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.88em; }
.doc-content .mp-alert { margin: 24px 0; }

.doc-code { position: relative; margin: 20px 0 26px; padding-top: 0; }
.doc-code__bar { display: flex; justify-content: space-between; align-items: center; min-height: 38px; padding: 0 8px 0 14px; background: var(--mp-bg-base); }
.doc-code .mp-command-result__label { position: static; padding: 0; background: transparent; }
.doc-code .mp-command-result__value { display: block; padding: 18px 20px 20px; white-space: pre; overflow-x: auto; }

.code-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  color: var(--mp-text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.73rem;
}
.code-copy:hover { color: var(--mp-text-primary); background: var(--mp-bg-hover); }
.code-copy svg { width: 14px; height: 14px; }

.doc-toc {
  position: sticky;
  top: var(--site-header-height);
  align-self: start;
  height: calc(100vh - var(--site-header-height));
  padding: 36px 0 48px 24px;
  border-left: 1px solid var(--mp-line-soft);
}

.doc-toc strong { color: var(--mp-text-secondary); font-size: 0.78rem; }
.doc-toc ol { margin: 14px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--mp-line-muted); list-style: none; }
.doc-toc li + li { margin-top: 10px; }
.doc-toc a { color: var(--mp-text-muted); font-size: 0.78rem; line-height: 1.45; text-decoration: none; }
.doc-toc a:hover { color: var(--mp-accent-200); }

.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: none;
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--mp-line-muted);
}

.doc-pager__link {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 14px 18px;
  color: var(--mp-text-primary);
  background: var(--mp-bg-interactive);
  border-radius: var(--radius-md);
  text-decoration: none;
}

.doc-pager__link:hover { background: var(--mp-bg-hover); }
.doc-pager__link span { color: var(--mp-text-muted); font-size: 0.72rem; }
.doc-pager__link strong { font-size: 0.9rem; }
.doc-pager__link--next { text-align: right; }

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .doc-toc { display: none; }
  .hero { grid-template-columns: 0.9fr 1.1fr; gap: 40px; }
}

@media (max-width: 900px) {
  .site-header__inner { width: min(100% - 32px, var(--site-content-width)); gap: 20px; }
  .top-nav { display: none; position: absolute; top: calc(100% + 8px); right: 16px; left: 16px; height: auto; padding: 10px; background: var(--mp-bg-elevated); border-radius: var(--radius-md); box-shadow: var(--mp-shadow-float); }
  .top-nav.is-open { display: grid; }
  .top-nav a { justify-items: start; min-height: 42px; padding: 0 12px; border-radius: var(--radius-sm); }
  .top-nav a[aria-current="page"]::after { display: none; }
  .header-github { display: none; }
  .nav-toggle { display: block; grid-column: 3; }
  .hero { grid-template-columns: 1fr; padding-top: 72px; }
  .hero__copy { max-width: 680px; }
  .feature-columns { grid-template-columns: 1fr; }
  .feature-item { min-height: 0; padding: 28px 0; }
  .feature-item + .feature-item { border-top: 1px solid var(--mp-line-muted); border-left: 0; }
  .workflow-rail { grid-template-columns: 1fr 1fr; }
  .workflow-rail > div + div { border-left: 0; }
  .workflow-rail > div:nth-child(even) { border-left: 1px solid var(--mp-line-muted); }
  .workflow-rail > div:nth-child(n+3) { border-top: 1px solid var(--mp-line-muted); }

  .docs-mobile-toggle { display: flex; position: fixed; z-index: 42; right: 16px; bottom: 16px; gap: 8px; box-shadow: var(--mp-shadow-float); }
  .docs-mobile-toggle svg { width: 16px; height: 16px; }
  .docs-shell { display: block; }
  .docs-sidebar { position: fixed; z-index: 41; top: var(--site-header-height); bottom: 0; left: 0; width: min(300px, 86vw); height: auto; padding: 24px 18px 80px; background: var(--mp-bg-elevated); box-shadow: var(--mp-shadow-float); transform: translateX(-105%); transition: transform 180ms var(--ease-system); }
  .docs-nav-open .docs-sidebar { transform: translateX(0); }
  .doc-article { width: min(100%, 860px); margin: 0 auto; }
}

@media (max-width: 640px) {
  :root { --site-header-height: 64px; }
  .site-header__inner, .hero, .feature-band__inner, .workflow-section, .site-footer { width: min(100% - 32px, 1320px); }
  .site-brand { font-size: 2rem; }
  .hero { min-height: 0; gap: 44px; padding: 52px 0; }
  .hero__copy h1 { font-size: clamp(2.75rem, 14vw, 4rem); }
  .hero__copy p { font-size: 1.05rem; }
  .terminal__body { padding: 18px 16px 20px; }
  .trace-row { grid-template-columns: 18px minmax(0, 1fr); }
  .trace-row__status { display: none; }
  .feature-band__inner, .workflow-section { padding-block: 56px; }
  .workflow-rail { grid-template-columns: 1fr; }
  .workflow-rail > div:nth-child(even) { border-left: 0; }
  .workflow-rail > div + div { border-top: 1px solid var(--mp-line-muted); }
  .home-cta { align-items: flex-start; flex-direction: column; padding: 24px; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 14px; }

  .doc-article { padding: 26px 18px 96px; }
  .doc-header { display: block; margin-bottom: 34px; }
  .doc-header__copy h1 { font-size: 2.45rem; }
  .doc-actions { margin-top: 22px; }
  .doc-actions .mp-button { flex: 1; justify-content: center; }
  .doc-pager { grid-template-columns: 1fr; }
}

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