/* Flatland3 spec — Soki Creative visual theme (see ../soki-creative/docs/BRAND.md) */

:root {
  --page: #07060c;
  --page-footer: #050408;
  --brand: #a78bfa;
  --brand-muted: #c4b5fd;
  --brand-dim: #5b21b6;
  --surface: #12101a;
  --surface-elevated: #1a1724;
  --text: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-dim: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(167, 139, 250, 0.4);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-hover: rgba(255, 255, 255, 0.05);
  --code-bg: rgba(0, 0, 0, 0.35);
  --font: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  --sidebar-width: 280px;
  --header-height: 64px;
  --landing-nav-height: 56px;
  --radius: 1rem;
  --radius-lg: 1.5rem;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.doc-page {
  scroll-padding-top: var(--landing-nav-height);
}

html.doc-page .landing-nav {
  position: sticky;
}

html.doc-page .layout {
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--landing-nav-height));
}

.doc-breadcrumb {
  margin: 0 0 1.5rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.doc-breadcrumb a {
  color: var(--brand-muted);
  font-weight: 600;
}

.sidebar__group + .sidebar__group {
  margin-top: 1.25rem;
}

.nav-list--compact a {
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
}

.nav-list--compact .nav-list__summary {
  display: none;
}

a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  color: var(--brand-muted);
}

/* Layout */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--page) 85%, transparent);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: var(--brand-muted);
}

.brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--brand-dim), var(--brand));
  box-shadow: 0 8px 24px rgba(91, 33, 182, 0.35);
  font-size: 0.85rem;
  font-weight: 900;
  color: #1e1035;
}

.brand__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__title {
  font-size: 1rem;
}

.brand__subtitle {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn--primary {
  background: var(--brand);
  color: #1e1035;
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.2);
}

.btn--primary:hover {
  background: var(--brand-muted);
  color: #1e1035;
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--card-bg);
  color: white;
  border-color: var(--border-hover);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}

.sidebar__label {
  margin: 0 0 0.75rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-list a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.nav-list a:hover {
  background: var(--card-bg);
  color: white;
}

.nav-list a.is-active {
  background: linear-gradient(135deg, rgba(91, 33, 182, 0.25), rgba(167, 139, 250, 0.08));
  border-color: rgba(167, 139, 250, 0.25);
  color: var(--brand-muted);
}

.nav-list__summary {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.35;
}

.main {
  padding: 2rem 2.5rem 4rem;
  min-width: 0;
}

/* Home */
.hero {
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: rgba(91, 33, 182, 0.15);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-muted);
}

.hero h1 {
  margin: 1rem 0 0.5rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(135deg, white, var(--brand-muted));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lead {
  max-width: 42rem;
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0;
}

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

.spec-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card-bg);
  transition: border-color 0.15s, background 0.15s;
}

.spec-card:hover {
  border-color: var(--border-hover);
  background: var(--card-hover);
}

.spec-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 900;
  color: white;
}

.spec-card h2 a {
  color: inherit;
}

.spec-card h2 a:hover {
  color: var(--brand-muted);
}

.spec-card p {
  flex: 1;
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.spec-card__link {
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--brand);
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.meta-strip strong {
  color: var(--text-muted);
}

/* Prose (markdown content) */
.prose {
  max-width: 52rem;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  line-height: 1.2;
}

.prose h2 {
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 1.35rem;
  font-weight: 900;
  color: white;
}

.prose h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand-muted);
}

.prose h4 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 800;
}

.prose p,
.prose li {
  color: var(--text-muted);
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--brand);
  border-radius: 0 0.5rem 0.5rem 0;
  background: rgba(91, 33, 182, 0.12);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.prose blockquote p {
  margin: 0.25rem 0;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

.prose li {
  margin: 0.35rem 0;
}

.prose li::marker {
  color: var(--brand);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.875rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.prose th,
.prose td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.prose th {
  background: var(--surface-elevated);
  font-weight: 800;
  color: white;
}

.prose tr:last-child td {
  border-bottom: none;
}

.prose tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  border-radius: 0.35rem;
  background: var(--code-bg);
  color: var(--brand-muted);
}

.prose pre {
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--code-bg);
  overflow-x: auto;
}

.prose pre code {
  padding: 0;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  line-height: 1.5;
}

.prose a {
  color: var(--brand);
}

.prose img {
  max-width: 100%;
  border-radius: var(--radius);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--page-footer);
  padding: 2rem 1.25rem;
  margin-top: auto;
}

.site-footer__inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.site-footer strong {
  display: block;
  color: white;
  font-weight: 900;
}

.build-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* Mobile */
.sidebar-toggle {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: min(var(--sidebar-width), 85vw);
    z-index: 40;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  }

  .sidebar.is-open {
    display: block;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .main {
    padding: 1.5rem 1.25rem 3rem;
  }
}

/* Mermaid diagrams (Furoshiki-style cards) */
.diagram-card {
  margin: 1.75rem 0;
  padding: 1.25rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(
    145deg,
    rgba(91, 33, 182, 0.08),
    rgba(255, 255, 255, 0.02)
  );
  overflow-x: auto;
}

.diagram-card .mermaid {
  display: flex;
  justify-content: center;
  min-height: 120px;
}

.diagram-card svg {
  max-width: 100%;
  height: auto !important;
}
