/* ==========================================================================
   Zene Portal Stylesheet — Aligned with console-kit Design System (Light Theme)
   Specification: docs/design.md, design/tokens.md, admin/src/index.css
   ========================================================================== */

:root {
  /* Surface Tokens (Console-Kit Light Baseline) */
  --brand: #2744a5;
  --background: #fafafa;
  --foreground: #22222a;
  --card: #ffffff;
  --card-foreground: #22222a;
  --popover: #ffffff;
  --popover-foreground: #22222a;

  /* Primary Interactive Accent (Console-Kit Light Mode: #2744A5) */
  --primary: #2744a5;
  --primary-foreground: #ffffff;
  --primary-hover: #1f3a89;
  --primary-active: #182f70;
  --primary-subtle: rgba(39, 68, 165, 0.08);
  --primary-light: #e8f0ff;

  /* Secondary & Muted Surfaces */
  --secondary: #f4f4f5;
  --secondary-foreground: #454554;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #22222a;

  /* Borders & Inputs */
  --border: #e4e4e7;
  --border-subtle: #eeeeef;
  --border-focus: rgba(39, 68, 165, 0.25);
  --input: #e4e4e7;
  --ring: #2744a5;

  /* Status Colors (Semantic + Alpha) */
  --success: #21c45d;
  --success-foreground: #e9fbf0;
  --success-subtle: rgba(33, 196, 93, 0.12);
  --warning: #ffa71a;
  --warning-foreground: #fff5e5;
  --warning-subtle: rgba(255, 167, 26, 0.12);
  --destructive: #ef4343;
  --destructive-foreground: #ffffff;
  --destructive-subtle: rgba(239, 67, 67, 0.12);
  --info: #3b82f6;
  --info-subtle: rgba(59, 130, 246, 0.12);

  /* Code Syntax Surface Tokens (Console-Kit Terminal Workbench) */
  --code-background: #0d1117;
  --code-border: #1f242c;
  --code-foreground: #c9d1d9;
  --code-muted: #8b949e;
  --code-blue: #58a6ff;
  --code-cyan: #56d4dd;
  --code-green: #3fb950;
  --code-yellow: #d29922;
  --code-orange: #f0883e;

  /* Typography & Layout Spacing */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

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

  --topbar-height: 56px;
  --max-width: 1120px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Scale (Console-Kit visual spec v1.0: 400 / 500 / 600 only) */
h1, h2, h3, h4 {
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.015em;
}

p {
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 20px;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================================================
   Header & Top Navigation (Console-Kit SiteHeader)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-height);
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
  color: var(--foreground);
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background-color: var(--brand);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.brand-separator {
  width: 1px;
  height: 16px;
  background-color: var(--border);
}

.version-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: var(--foreground);
  background-color: var(--secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons (Console-Kit buttonVariants) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  height: 32px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: transparent;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}
.btn-primary:active {
  background-color: var(--primary-active);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.btn-secondary:hover {
  background-color: var(--secondary);
  color: var(--foreground);
  border-color: #d4d4d8;
}

.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover {
  background-color: var(--secondary);
  border-color: var(--border);
}

/* ==========================================================================
   Operational Ribbon (System Diagnostics)
   ========================================================================== */
.status-ribbon {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 6px 24px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
}

.ribbon-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.ribbon-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 6px rgba(33, 196, 93, 0.4);
}

.ribbon-link {
  color: var(--primary);
}
.ribbon-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Main Layout Shell
   ========================================================================== */
.main-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ==========================================================================
   Console Hero Section (Controlled & Technical)
   ========================================================================== */
.console-hero {
  padding: 16px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.hero-header-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid rgba(39, 68, 165, 0.2);
}

.hero-title {
  font-size: 28px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin-bottom: 10px;
}

.hero-description {
  font-size: 15px;
  line-height: 24px;
  color: var(--muted-foreground);
  max-width: 780px;
  margin-bottom: 20px;
}

.hero-actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.install-command-bar {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 6px 4px 12px;
  height: 36px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.install-prompt {
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-right: 8px;
  user-select: none;
}

.install-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground);
  margin-right: 12px;
}

.btn-copy-bar {
  background-color: var(--secondary);
  border: 1px solid var(--border);
  color: var(--secondary-foreground);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-copy-bar:hover {
  background-color: #e4e4e7;
  color: var(--foreground);
}

/* ==========================================================================
   StatCard Grid (Console-Kit StatCard Specification)
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.stat-card:hover {
  border-color: #c7c7cc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.stat-icon-wrapper {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.stat-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Workbench & Code Showcase (Fixed-Height Tab Container)
   ========================================================================== */
.section-intro {
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  color: var(--foreground);
}

.section-desc {
  font-size: 13px;
  color: var(--muted-foreground);
}

.workbench-card {
  background-color: var(--code-background);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.workbench-tabbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #090d13;
  border-bottom: 1px solid var(--code-border);
  padding: 0 12px;
}

.tab-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.wb-tab {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 14px;
  color: var(--code-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.wb-tab:hover {
  color: var(--code-foreground);
}

.wb-tab.active {
  color: var(--code-blue);
  border-bottom-color: var(--code-blue);
  background-color: rgba(88, 166, 255, 0.05);
}

.tab-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workbench-pane {
  display: none;
  padding: 16px 20px;
  max-height: 320px;
  overflow-y: auto;
}

.workbench-pane.active {
  display: block;
}

.workbench-pane pre {
  margin: 0;
  color: var(--code-foreground);
  overflow-x: auto;
}

/* Syntax Token Highlighting */
.syn-comment { color: var(--code-muted); font-style: italic; }
.syn-cmd { color: var(--code-green); font-weight: 500; }
.syn-flag { color: var(--code-cyan); }
.syn-arg { color: var(--code-yellow); }
.syn-key { color: var(--code-blue); }
.syn-val { color: var(--code-orange); }

/* ==========================================================================
   Architecture & Capabilities (SectionCard Grid)
   ========================================================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.feature-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.feature-card:hover {
  border-color: #c7c7cc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.feature-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.feature-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}

.feature-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
}

.feature-description {
  font-size: 13px;
  line-height: 20px;
  color: var(--muted-foreground);
}

/* ==========================================================================
   Changelog & Audit History (ReleaseAccordion Specification)
   ========================================================================== */
.changelog-section {
  margin-bottom: 64px;
}

.changelog-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.releases-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.release-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.release-card[open] {
  border-color: #c7c7cc;
}

.release-summary {
  list-style: none;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background-color: var(--card);
  transition: background-color 0.15s ease;
}

.release-summary::-webkit-details-marker {
  display: none;
}

.release-summary:hover {
  background-color: #fbfbfc;
}

.release-summary-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.release-version {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(39, 68, 165, 0.2);
}

.release-date {
  font-size: 12px;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
}

.release-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.pill-added, .pill-feat, .pill-features {
  background-color: var(--success-subtle);
  color: var(--success);
  border-color: rgba(33, 196, 93, 0.25);
}

.pill-fixed, .pill-fix, .pill-bugfixes {
  background-color: var(--warning-subtle);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.25);
}

.pill-docs, .pill-documentation {
  background-color: var(--info-subtle);
  color: var(--info);
  border-color: rgba(59, 130, 246, 0.25);
}

.chevron-icon {
  font-size: 16px;
  color: var(--muted-foreground);
  transition: transform 0.2s ease;
  display: inline-block;
  line-height: 1;
}

.release-card[open] .chevron-icon {
  transform: rotate(90deg);
  color: var(--foreground);
}

.changelog-content {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  background-color: #fafafc;
}

.changelog-group {
  margin-bottom: 16px;
}

.changelog-group:last-child {
  margin-bottom: 0;
}

.changelog-group h3 {
  font-size: 12px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}

.changelog-group ul {
  list-style: none;
  padding-left: 0;
}

.changelog-group li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 20px;
  color: var(--foreground);
}

.changelog-group li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--muted-foreground);
}

.changelog-group li code {
  background-color: #f1f1f4;
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  color: #0f172a;
}

.changelog-group li a {
  color: var(--primary);
  text-decoration: none;
}
.changelog-group li a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Footer (Console-Kit Operational Footer)
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  background-color: #ffffff;
  padding: 32px 24px;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links a {
  color: var(--muted-foreground);
  transition: color 0.15s ease;
}
.footer-links a:hover {
  color: var(--foreground);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 960px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
  .header-container {
    padding: 0 16px;
  }
  .main-shell {
    padding: 24px 16px 48px;
  }
}
