/* ===================================================================
   AKM — Agent Kit Manager — Dark Theme Stylesheet
   =================================================================== */

/* --- Design Tokens --- */
:root {
  /* Brand */
  --color-accent: #ff6b35;
  --color-accent-hover: #ff8c5a;
  --color-accent-subtle: rgba(255, 107, 53, 0.15);
  --color-teal: #2dd4a0;
  --color-teal-subtle: rgba(45, 212, 160, 0.15);

  /* Dark theme (default) */
  --color-bg: #0f1117;
  --color-bg-secondary: #161822;
  --color-bg-card: #1c1f2e;
  --color-bg-code: #0d0f16;
  --color-text: #e2e4e9;
  --color-text-secondary: #8b8fa3;
  --color-text-heading: #f0f1f3;
  --color-border: #2a2d3e;
  --color-border-subtle: #1e2130;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 56px;
  --content-max-width: 800px;
  --page-max-width: 1200px;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-heading);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-accent-hover);
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.35rem;
}

strong {
  color: var(--color-text-heading);
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--color-bg-code);
  color: var(--color-teal);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background-color: var(--color-bg-code);
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  color: var(--color-text);
  font-size: 0.85rem;
}

blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--color-text-secondary);
}

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

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  z-index: 100;
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-heading);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.site-logo:hover {
  color: var(--color-text-heading);
}

.site-logo img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--color-text-heading);
}

/* Hamburger menu (mobile) */
.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--color-text);
  position: relative;
  transition: background-color 0.2s ease;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background-color: var(--color-text);
  left: 0;
  transition: transform 0.2s ease;
}

.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

/* --- Main Content Area --- */
main {
  padding-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* --- Docs Layout --- */
.docs-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  max-width: var(--page-max-width);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}

.docs-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--color-border-subtle);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.sidebar-link:hover {
  color: var(--color-text-heading);
  background-color: var(--color-bg-card);
}

.sidebar-link.active {
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-left: 3px solid var(--color-accent);
}

.sidebar-group {
  margin-top: 0.75rem;
}

.sidebar-group-title {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.sidebar-group ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.sidebar-group li a {
  display: block;
  padding: 0.35rem 0.75rem 0.35rem 1.25rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.sidebar-group li a:hover {
  color: var(--color-text-heading);
  background-color: var(--color-bg-card);
}

.sidebar-group li a.active {
  color: var(--color-accent);
  background-color: var(--color-accent-subtle);
  border-left: 3px solid var(--color-accent);
}

.docs-content {
  padding: 2rem 2.5rem;
  max-width: var(--content-max-width);
}

.docs-content h1 {
  margin-top: 0;
  font-size: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: 1.5rem;
}

/* --- Home Layout --- */
.home-container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 5rem 1rem 4rem;
}

.hero-content {
  max-width: 700px;
  margin: 0 auto;
}

.hero-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  border-radius: 16px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--color-text-heading), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--color-accent-hover);
  color: #fff;
}

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

.btn-secondary:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text-heading);
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
}

.card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.card p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
  line-height: 1.6;
}

/* --- Sections (Landing Page) --- */
.domains,
.install,
.layers,
.tools,
.deps {
  padding: 4rem 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.domains h2,
.install h2,
.layers h2,
.tools h2,
.deps h2 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.domains > p,
.install > p,
.layers > p,
.tools > p,
.deps > p {
  text-align: center;
  color: var(--color-text-secondary);
}

/* --- Terminal Block --- */
.terminal {
  background-color: var(--color-bg-code);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 1.5rem;
}

.terminal-header {
  display: flex;
  gap: 6px;
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border-subtle);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot.red { background-color: #ff5f57; }
.terminal-dot.yellow { background-color: #febc2e; }
.terminal-dot.green { background-color: #28c840; }

.terminal pre {
  margin: 0;
  padding: 1.25rem;
  border: none;
  border-radius: 0;
  background: none;
}

.terminal code {
  font-size: 0.85rem;
  background: none;
  color: var(--color-text);
}

.terminal-prompt {
  color: var(--color-teal);
  font-weight: 600;
  -webkit-user-select: none;
  user-select: none;
}

.terminal-comment {
  color: #636d83;
}

/* --- Layers Diagram --- */
.layers-diagram {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.layer {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.layer:first-child {
  border-radius: 12px 12px 0 0;
}

.layer:last-child {
  border-radius: 0 0 12px 12px;
}

.layer + .layer {
  border-top: none;
}

.layer-core {
  background-color: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

.layer-project {
  background-color: var(--color-teal-subtle);
  border-color: var(--color-teal);
}

.layer-session {
  background-color: rgba(161, 161, 170, 0.1);
  border-color: var(--color-text-secondary);
}

.layer-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-heading);
}

.layer-desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.layer-desc code {
  font-size: 0.8rem;
}

/* --- Tool Cards --- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.25rem;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.tool-card:hover {
  border-color: var(--color-teal);
  transform: translateY(-2px);
}

.tool-card strong {
  font-size: 1rem;
  color: var(--color-text-heading);
}

.tool-card span {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

/* --- Dependencies Section --- */
.deps {
  text-align: center;
  padding-bottom: 5rem;
}

.deps code {
  font-size: 1rem;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-secondary);
  color: var(--color-text-heading);
  font-weight: 600;
  border-bottom: 2px solid var(--color-border);
}

tbody td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

tbody tr:hover {
  background-color: var(--color-bg-card);
}

/* --- Footer --- */
.site-footer {
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--color-border-subtle);
  text-align: center;
}

.footer-inner p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.35rem;
}

.footer-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-sep {
  margin: 0 0.5rem;
  color: var(--color-border);
}

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

.container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Rouge Syntax Highlighting (Dark Theme) --- */
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs { color: #636d83; }      /* Comments */
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .se,
.highlight .sh,
.highlight .sx { color: #2dd4a0; }      /* Strings */
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt { color: #ff6b35; }      /* Keywords */
.highlight .nf,
.highlight .nb,
.highlight .nc { color: #e2e4e9; }      /* Functions, builtins */
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo { color: #d19a66; }       /* Numbers */
.highlight .o,
.highlight .ow { color: #c0c5ce; }      /* Operators */
.highlight .na { color: #d19a66; }       /* Attributes */
.highlight .no { color: #e2e4e9; }       /* Constants */
.highlight .ni { color: #e2e4e9; }       /* Entities */
.highlight .ne { color: #ff6b35; }       /* Exceptions */
.highlight .gd { color: #ff5f57; }       /* Deleted */
.highlight .gi { color: #2dd4a0; }       /* Inserted */
.highlight .ge { font-style: italic; }   /* Emphasis */
.highlight .gs { font-weight: bold; }    /* Strong */
.highlight .err { color: #ff5f57; }      /* Errors */

/* --- Responsive --- */
@media (max-width: 1024px) {
  .docs-container {
    grid-template-columns: 220px 1fr;
  }

  .docs-content {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 768px) {
  /* Header: show hamburger */
  .nav-toggle-label {
    display: flex;
    align-items: center;
  }

  .site-nav {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 200px;
    height: calc(100vh - var(--header-height));
    background-color: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border-subtle);
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 99;
  }

  .nav-toggle:checked ~ .site-nav {
    transform: translateX(0);
  }

  .nav-toggle:checked ~ .nav-toggle-label .hamburger {
    background-color: transparent;
  }

  .nav-toggle:checked ~ .nav-toggle-label .hamburger::before {
    transform: rotate(45deg);
    top: 0;
  }

  .nav-toggle:checked ~ .nav-toggle-label .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
  }

  /* Docs: sidebar collapses */
  .docs-container {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 1rem;
  }

  .docs-content {
    padding: 1.5rem 1rem;
  }

  /* Cards stack */
  .card-grid,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  /* Hero adjustments */
  .hero h1 {
    font-size: 2rem;
  }

  .hero-tagline {
    font-size: 1rem;
  }

  .hero {
    padding: 3rem 1rem;
  }

  /* Layers diagram full width */
  .layers-diagram {
    max-width: 100%;
  }

  /* Tables scroll */
  table {
    display: block;
    overflow-x: auto;
  }
}
