/* ============================================================================
   VibeRails Docs — Documentation Styles (extends style.css)
   ============================================================================ */

/* --- Docs Header --- */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 56px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.docs-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.docs-header__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.docs-header__logo img {
  height: 22px;
  width: auto;
}

.docs-header__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.docs-header__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.docs-header__label:hover {
  color: var(--text-primary);
}

.docs-header__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-width: 200px;
}

.docs-header__search:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

.docs-header__search kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.docs-header__spacer {
  flex: 1;
}

.docs-header__back {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.docs-header__back:hover {
  color: var(--text-primary);
}

.docs-header__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.docs-header__cta:hover {
  opacity: 0.9;
}

/* --- Docs Footer --- */
.docs-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  background: var(--bg-secondary);
}

.docs-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.docs-footer__links {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-footer__links a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.docs-footer__links a:hover {
  color: var(--text-primary);
}

/* --- Docs Layout --- */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-height: calc(100vh - 56px);
  padding-top: 56px;
}

/* --- Sidebar --- */
.docs-sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 32px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

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

.docs-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.docs-nav {
  padding: 0 24px;
}

.docs-nav__section {
  margin-bottom: 28px;
}

.docs-nav__heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  padding: 0 12px;
}

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

.docs-nav__list li {
  margin: 0;
}

.docs-nav__list a {
  display: block;
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.docs-nav__list a:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.docs-nav__list a.active,
.docs-nav__link--active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* --- Content Area --- */
.docs-content,
.docs-main {
  max-width: 820px;
  padding: 40px 60px 120px;
  line-height: 1.7;
}

/* --- Breadcrumbs --- */
.docs-breadcrumb,
.docs-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 32px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
}

.docs-breadcrumb__list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-breadcrumb__list li::after {
  content: '/';
  margin-left: 8px;
  color: var(--text-tertiary);
}

.docs-breadcrumb__list li:last-child::after {
  display: none;
}

.docs-breadcrumb a,
.docs-breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.docs-breadcrumb a:hover,
.docs-breadcrumbs a:hover {
  color: var(--accent);
}

.docs-breadcrumb__sep {
  color: var(--text-tertiary);
  user-select: none;
}

.docs-breadcrumb li:last-child,
.docs-breadcrumbs li:last-child,
.docs-breadcrumb__list li:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* --- Typography --- */
.docs-content h1,
.docs-main h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.docs-subtitle,
.docs-intro,
.docs-article__lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 640px;
}

.docs-content h2,
.docs-main h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 56px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-content h3,
.docs-main h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 36px;
  margin-bottom: 12px;
}

.docs-content p,
.docs-main p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.docs-content ul,
.docs-content ol,
.docs-main ul,
.docs-main ol {
  padding-left: 24px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.docs-content li,
.docs-main li {
  margin-bottom: 6px;
}

.docs-content strong,
.docs-main strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Inline code */
.docs-content code,
.docs-main code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
}

/* Code blocks */
.docs-content pre,
.docs-main pre,
.docs-code {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.docs-content pre code,
.docs-main pre code,
.docs-code code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Keyboard shortcut styling */
.docs-kbd,
.docs-content kbd,
.docs-main kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78em;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  white-space: nowrap;
}

/* --- Figures / Images --- */
.docs-figure {
  margin: 28px 0;
  position: relative;
}

.docs-img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.docs-figure figcaption {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 10px;
  text-align: center;
  font-style: italic;
}

.docs-figure--gif {
  position: relative;
}

.docs-figure--gif .docs-img {
  border-color: var(--border-accent);
}

.docs-img--gif {
  cursor: pointer;
}

/* --- Callout Boxes --- */
.docs-callout {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 20px 0;
  font-size: 0.9rem;
  line-height: 1.6;
  border: 1px solid;
}

.docs-callout strong {
  display: inline;
  margin-right: 4px;
}

.docs-callout--tip {
  background: rgba(40, 200, 64, 0.06);
  border-color: rgba(40, 200, 64, 0.15);
  color: var(--text-secondary);
}

.docs-callout--tip strong {
  color: #28c840;
}

.docs-callout--info {
  background: rgba(91, 156, 245, 0.06);
  border-color: rgba(91, 156, 245, 0.15);
  color: var(--text-secondary);
}

.docs-callout--info strong {
  color: #5b9cf5;
}

.docs-callout--warning {
  background: rgba(254, 188, 46, 0.06);
  border-color: rgba(254, 188, 46, 0.15);
  color: var(--text-secondary);
}

.docs-callout--warning strong {
  color: #febc2e;
}

.docs-callout--note {
  background: rgba(91, 156, 245, 0.06);
  border-color: rgba(91, 156, 245, 0.15);
  color: var(--text-secondary);
}

.docs-callout--note strong {
  color: #5b9cf5;
}

.docs-callout--danger {
  background: rgba(255, 0, 79, 0.06);
  border-color: rgba(255, 0, 79, 0.15);
  color: var(--text-secondary);
}

.docs-callout--danger strong {
  color: var(--accent);
}

/* --- Tables --- */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.88rem;
}

.docs-table th,
.docs-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.docs-table th {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.02);
}

.docs-table td {
  color: var(--text-secondary);
}

.docs-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Step Lists (numbered instructions) --- */
.docs-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.docs-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 24px;
}

.docs-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* --- Previous / Next Navigation --- */
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.docs-pager__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.docs-pager__link:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.docs-pager__link--next {
  text-align: right;
  grid-column: 2;
}

.docs-pager__label,
.docs-pager__dir,
.docs-pager__direction {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.docs-pager__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Docs Landing Cards --- */
.docs-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0 48px;
}

.docs-card {
  display: block;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease-out-expo);
}

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

.docs-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.docs-card__desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

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

  .docs-content,
  .docs-main {
    padding: 32px 40px 100px;
  }
}

@media (max-width: 768px) {
  .docs-header__search {
    display: none;
  }

  .docs-header__back {
    display: none;
  }

  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: relative;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
  }

  .docs-nav {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding: 0 16px;
    scrollbar-width: none;
  }

  .docs-nav::-webkit-scrollbar {
    display: none;
  }

  .docs-nav__section {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .docs-nav__list {
    display: flex;
    gap: 4px;
  }

  .docs-nav__list a {
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .docs-content,
  .docs-main {
    padding: 24px 20px 80px;
  }

  .docs-pager {
    grid-template-columns: 1fr;
  }

  .docs-pager__link--next {
    grid-column: 1;
    text-align: left;
  }

  .docs-section-grid {
    grid-template-columns: 1fr;
  }

  .docs-footer__inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
