:root {
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-pixel: "Pixelify Sans", system-ui, sans-serif;
  --sidebar-width: 280px;
  --header-height: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --border: 1px;
}

html[data-theme="light"],
html[data-theme="auto"] {
  --bg0: #ffffff;
  --bg1: #f8f9fa;
  --panel: #ffffff;
  --panel2: #f1f3f5;
  --sidebar-bg: #f8f9fa;
  --sidebar-hover: #e9ecef;
  --sidebar-active: #e2e6ea;
  --sidebar-border: #dee2e6;
  --text: #1a1a2e;
  --text-secondary: #495057;
  --muted: #6c757d;
  --faint: #adb5bd;
  --link: #0066cc;
  --link2: #0052a3;
  --accent: #ff4f40;
  --accent2: #00a67d;
  --frame-border: #dee2e6;
  --code-bg: #1e1e2e;
  --code-fg: #cdd6f4;
  --code-accent: #a6e3a1;
  --header-bg: #ffffff;
  --header-border: #e9ecef;
}

html[data-theme="dark"] {
  --bg0: #0f1117;
  --bg1: #13151a;
  --panel: #181a20;
  --panel2: #1e2028;
  --sidebar-bg: #13151a;
  --sidebar-hover: #1e2028;
  --sidebar-active: #252830;
  --sidebar-border: #2a2d35;
  --text: #e1e4e8;
  --text-secondary: #b0b8c1;
  --muted: #8b949e;
  --faint: #6e7681;
  --link: #58a6ff;
  --link2: #79c0ff;
  --accent: #ff6b5b;
  --accent2: #3fb950;
  --frame-border: #2a2d35;
  --code-bg: #0d1117;
  --code-fg: #c9d1d9;
  --code-accent: #7ee787;
  --header-bg: #13151a;
  --header-border: #21262d;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg0: #0f1117;
    --bg1: #13151a;
    --panel: #181a20;
    --panel2: #1e2028;
    --sidebar-bg: #13151a;
    --sidebar-hover: #1e2028;
    --sidebar-active: #252830;
    --sidebar-border: #2a2d35;
    --text: #e1e4e8;
    --text-secondary: #b0b8c1;
    --muted: #8b949e;
    --faint: #6e7681;
    --link: #58a6ff;
    --link2: #79c0ff;
    --accent: #ff6b5b;
    --accent2: #3fb950;
    --frame-border: #2a2d35;
    --code-bg: #0d1117;
    --code-fg: #c9d1d9;
    --code-accent: #7ee787;
    --header-bg: #13151a;
    --header-border: #21262d;
  }
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg0);
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-130%);
}

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

/* ── Header ── */
.shell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(12px);
}

.shell__frame {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
  max-width: none;
}

.shell__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__name {
  font-family: var(--font-pixel);
  letter-spacing: 0.1em;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
  color: var(--text);
  text-decoration: none;
}

.brand__hint {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

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

.titlebar__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid var(--frame-border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}

.titlebar__cta:hover {
  background: var(--sidebar-hover);
  border-color: var(--muted);
}

.titlebar__cta--accent {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

.titlebar__cta--accent:hover {
  opacity: 0.9;
  background: var(--accent2);
  border-color: var(--accent2);
}

.titlebar__cta-label {
  font-size: 13px;
  font-weight: 500;
}

.titlebar__cta-meta {
  display: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid var(--frame-border);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.theme-toggle:hover {
  background: var(--sidebar-hover);
}

.theme-toggle__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--code-accent);
  font-weight: 700;
  font-size: 11px;
  font-family: var(--font-mono);
}

.theme-toggle__label {
  font-size: 12px;
}

/* ── Hide old top nav bar (now in sidebar) ── */
.shell__nav {
  display: none;
}

/* ── Layout: sidebar + content ── */
.layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--faint);
  border-radius: 4px;
}

.sidebar__section {
  margin-bottom: 6px;
}

.sidebar__heading {
  display: block;
  padding: 6px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  user-select: none;
}

.sidebar__link {
  display: block;
  padding: 6px 20px 6px 28px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  line-height: 1.4;
}

.sidebar__link:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.sidebar__link--active {
  background: var(--sidebar-active);
  color: var(--link);
  border-left-color: var(--link);
  font-weight: 500;
}

/* ── Mobile sidebar toggle ── */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--frame-border);
  border-radius: 6px;
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

/* ── Content area ── */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 32px 48px 64px;
  max-width: 900px;
}

.terminal {
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.terminal__prompt {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--frame-border);
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 20px;
}

.prompt__user {
  color: var(--code-accent);
}

.prompt__host {
  color: var(--code-fg);
}

.prompt__path {
  color: var(--code-fg);
  opacity: 0.7;
}

.prompt__cmd {
  margin-left: 6px;
  opacity: 0.8;
}

.terminal__summary {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
}

.terminal__meta {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--frame-border);
  background: var(--panel2);
  color: var(--muted);
  font-size: 14px;
}

.terminal__meta summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.terminal__meta ul {
  margin: 8px 0 0 18px;
}

.terminal__footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--frame-border);
  color: var(--muted);
  font-size: 13px;
}

.footer__actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.terminal__footer a {
  color: var(--link);
  text-decoration: none;
}

.terminal__footer a:hover {
  text-decoration: underline;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--frame-border);
  background: var(--panel2);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 60;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }

  .sidebar-toggle {
    display: flex;
  }

  .content {
    margin-left: 0;
    padding: 24px 20px 48px;
    max-width: none;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 55;
  }

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

@media (max-width: 600px) {
  .content {
    padding: 16px 14px 40px;
  }

  .brand__hint {
    display: none;
  }
}
