/* ==========================================================================
   RailsPress Documentation - Layout
   ==========================================================================
   Navigation, landing page, and documentation page layouts.
   All values reference --rp-* variables from variables.css.
   ========================================================================== */


/* ==========================================================================
   1. Navigation (shared across all pages)
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--rp-nav-height);
  background: rgba(248, 247, 245, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rp-border);
  z-index: 100;
  transition: background var(--rp-transition-base);
}

[data-theme="dark"] .nav {
  background: rgba(26, 29, 33, 0.85);
}

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

.logo {
  font-family: var(--rp-font-display);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: opacity var(--rp-transition-fast);
}

.logo:hover {
  opacity: 0.8;
}

.logo-bracket {
  color: var(--rp-primary);
}

.logo-text {
  color: var(--rp-text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--rp-space-xl);
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--rp-text-muted);
  transition: color var(--rp-transition-fast);
}

.nav-links a:hover {
  color: var(--rp-text);
}

.nav-github {
  display: flex;
  align-items: center;
  gap: var(--rp-space-sm);
}

.nav-github svg {
  opacity: 0.7;
  transition: opacity var(--rp-transition-fast);
}

.nav-github:hover svg {
  opacity: 1;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--rp-bg-subtle);
  border: 1px solid var(--rp-border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--rp-text-muted);
  transition: all var(--rp-transition-fast);
}

.theme-toggle:hover {
  color: var(--rp-text);
  border-color: var(--rp-text-light);
  background: var(--rp-bg-elevated);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

/* Default (light): show moon icon (to switch to dark) */
.theme-toggle .icon-moon {
  display: block;
}

/* Dark mode: show sun icon (to switch to light) */
[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}


/* ==========================================================================
   2. Mobile Menu
   ========================================================================== */

/* Hamburger button - hidden on desktop */
.mobile-menu-toggle {
  display: none;
  width: 48px;
  height: 48px;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--rp-border);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  transition: all var(--rp-transition-fast);
}

.mobile-menu-toggle:hover {
  border-color: var(--rp-text-light);
  background: var(--rp-bg-subtle);
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--rp-text);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Hamburger to X animation */
.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu drawer */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: var(--rp-bg-elevated);
  border-right: 1px solid var(--rp-border);
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 1001;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.mobile-menu.is-open {
  transform: translateX(0);
}

/* Mobile menu header */
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--rp-space-lg) var(--rp-space-xl);
  border-bottom: 1px solid var(--rp-border);
  flex-shrink: 0;
}

.mobile-menu-title {
  font-family: var(--rp-font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rp-text);
}

/* Mobile menu content */
.mobile-menu-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.mobile-menu-section {
  display: flex;
  flex-direction: column;
  padding: var(--rp-space-md) 0;
}

.mobile-menu-section a {
  display: flex;
  align-items: center;
  gap: var(--rp-space-sm);
  padding: var(--rp-space-md) var(--rp-space-xl);
  color: var(--rp-text-muted);
  font-size: 1rem;
  font-weight: 500;
  transition: all var(--rp-transition-fast);
  min-height: 48px;
}

.mobile-menu-section a:hover {
  color: var(--rp-text);
  background: var(--rp-bg-subtle);
}

.mobile-menu-section a.active {
  color: var(--rp-primary);
}

.mobile-menu-github {
  display: flex;
  align-items: center;
  gap: var(--rp-space-sm);
}

.mobile-menu-github svg {
  opacity: 0.7;
}

/* Mobile menu section label */
.mobile-menu-section-label {
  font-family: var(--rp-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rp-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--rp-space-lg) var(--rp-space-xl) var(--rp-space-sm);
}

/* Mobile menu footer */
.mobile-menu-footer {
  margin-top: auto;
  padding: var(--rp-space-lg) var(--rp-space-xl);
  border-top: 1px solid var(--rp-border);
  flex-shrink: 0;
}

.mobile-menu-footer .theme-toggle {
  width: 100%;
  justify-content: flex-start;
  gap: var(--rp-space-sm);
  padding: var(--rp-space-md);
}

.mobile-menu-footer .theme-toggle span {
  font-size: 0.875rem;
  color: var(--rp-text-muted);
}

/* Backdrop */
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 1000;
}

.mobile-menu-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Body scroll lock */
body.mobile-menu-open {
  overflow: hidden;
}

/* Reduced motion for mobile menu */
@media (prefers-reduced-motion: reduce) {
  .mobile-menu,
  .mobile-menu-backdrop,
  .hamburger-line {
    transition: none;
  }
}


/* ==========================================================================
   3. Landing Page Layout
   ========================================================================== */

/* -----------------------------------------------------------------------
   3a. Hero Section
   ----------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: 100vh;
  padding: calc(var(--rp-nav-height) + var(--rp-space-4xl)) var(--rp-space-xl) var(--rp-space-4xl);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--rp-space-4xl);
  align-items: center;
  max-width: var(--rp-max-width);
  margin: 0 auto;
}

.hero-glow {
  position: absolute;
  top: 20%;
  left: 30%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(61, 90, 128, 0.3) 0%, transparent 70%);
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.15;
}

[data-theme="dark"] .hero-glow {
  background: radial-gradient(circle, rgba(91, 138, 181, 0.4) 0%, transparent 70%);
  opacity: 0.25;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--rp-space-sm);
  padding: var(--rp-space-xs) var(--rp-space-md);
  background: var(--rp-primary-light);
  border: 1px solid var(--rp-primary);
  border-radius: 100px;
  font-family: var(--rp-font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--rp-primary);
  margin-bottom: var(--rp-space-xl);
  animation: fadeInUp 0.6s ease-out;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--rp-primary);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  font-family: var(--rp-font-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--rp-space-lg);
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero-accent {
  background: linear-gradient(135deg, var(--rp-primary) 0%, #7aa3c9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--rp-text-muted);
  max-width: 480px;
  margin-bottom: var(--rp-space-2xl);
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-actions {
  display: flex;
  gap: var(--rp-space-md);
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.hero-code {
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -----------------------------------------------------------------------
   3b. Sections (shared)
   ----------------------------------------------------------------------- */

section {
  padding: var(--rp-space-4xl) var(--rp-space-xl);
  max-width: var(--rp-max-width);
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: var(--rp-space-3xl);
}

.section-label {
  display: inline-block;
  font-family: var(--rp-font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--rp-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--rp-space-md);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  font-family: var(--rp-font-display);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--rp-text);
}

.section-description {
  color: var(--rp-text-muted);
  font-size: 1.125rem;
  max-width: 600px;
  margin: var(--rp-space-md) auto 0;
}

/* -----------------------------------------------------------------------
   3c. Features Grid
   ----------------------------------------------------------------------- */

.features {
  background: linear-gradient(180deg, var(--rp-bg) 0%, var(--rp-bg-subtle) 100%);
  padding-top: var(--rp-space-4xl);
  padding-bottom: var(--rp-space-4xl);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--rp-space-lg);
}

.features-grid-large {
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rp-space-xl);
}

.feature-code-preview {
  margin-top: var(--rp-space-md);
  padding: var(--rp-space-sm) var(--rp-space-md);
  background: var(--rp-code-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--rp-radius);
  font-family: var(--rp-font-mono);
  font-size: 0.75rem;
  color: var(--rp-primary);
  overflow-x: auto;
}

.feature-code-preview code {
  white-space: nowrap;
}

.feature-card em {
  color: var(--rp-primary);
  font-style: normal;
  font-weight: 500;
}

/* -----------------------------------------------------------------------
   3d. Installation Steps
   ----------------------------------------------------------------------- */

.install {
  position: relative;
}

.install-steps {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-xl);
  max-width: 700px;
  margin: 0 auto;
}

.install-step {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--rp-space-lg);
}

/* -----------------------------------------------------------------------
   3e. Entity Demo Section
   ----------------------------------------------------------------------- */

.entity-demo {
  background: var(--rp-bg);
  padding-top: var(--rp-space-4xl);
  padding-bottom: var(--rp-space-4xl);
}

.entity-demo .section-header {
  margin-bottom: var(--rp-space-3xl);
}

.entity-demo-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--rp-space-3xl);
  align-items: start;
}

.entity-demo-code {
  position: sticky;
  top: calc(var(--rp-nav-height) + var(--rp-space-xl));
}

.entity-demo-code .code-dots {
  display: none;
}

.entity-demo-features {
  display: flex;
  flex-direction: column;
  gap: var(--rp-space-xl);
  padding-top: var(--rp-space-md);
}

.entity-feature {
  display: flex;
  gap: var(--rp-space-md);
  align-items: flex-start;
}

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

.entity-feature-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--rp-space-xs);
  color: var(--rp-text);
}

.entity-feature-content p {
  font-size: 0.9375rem;
  color: var(--rp-text-muted);
  line-height: 1.5;
}

.entity-feature-content code {
  font-family: var(--rp-font-mono);
  font-size: 0.8125rem;
  background: var(--rp-bg-subtle);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--rp-primary);
}

/* -----------------------------------------------------------------------
   3f. Usage Section
   ----------------------------------------------------------------------- */

.usage {
  background: var(--rp-bg-subtle);
  border-top: 1px solid var(--rp-border);
  border-bottom: 1px solid var(--rp-border);
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.usage .section-header,
.usage .usage-grid {
  max-width: var(--rp-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--rp-space-xl);
  padding-right: var(--rp-space-xl);
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--rp-space-xl);
  align-items: stretch;
}

.usage-card {
  background: var(--rp-code-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.usage-card h3,
.usage-card h4 {
  font-family: var(--rp-font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  padding: var(--rp-space-md) var(--rp-space-lg);
  margin: 0;
  background: var(--rp-code-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.usage-card .code-block {
  border: none;
  border-radius: 0;
  flex: 1;
}

/* -----------------------------------------------------------------------
   3g. Config Section
   ----------------------------------------------------------------------- */

.config {
  position: relative;
}

/* -----------------------------------------------------------------------
   3h. CTA Section
   ----------------------------------------------------------------------- */

.cta {
  text-align: center;
  padding: var(--rp-space-4xl) var(--rp-space-xl);
}

.cta-content {
  max-width: 500px;
  margin: 0 auto;
}

.cta h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  font-family: var(--rp-font-display);
  margin-bottom: var(--rp-space-md);
  color: var(--rp-text);
}

.cta p {
  color: var(--rp-text-muted);
  margin-bottom: var(--rp-space-xl);
}

.cta-actions {
  display: flex;
  gap: var(--rp-space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* -----------------------------------------------------------------------
   3i. Footer
   ----------------------------------------------------------------------- */

.footer {
  padding: var(--rp-space-3xl) var(--rp-space-xl);
  border-top: 1px solid var(--rp-border);
  text-align: center;
}

.footer-inner {
  max-width: var(--rp-max-width);
  margin: 0 auto;
}

.footer-logo {
  font-family: var(--rp-font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--rp-space-md);
  color: var(--rp-text);
}

.footer-text {
  font-size: 0.875rem;
  color: var(--rp-text-muted);
  line-height: 1.6;
}

.footer-text a {
  color: var(--rp-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-text a:hover {
  color: var(--rp-primary);
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--rp-text-muted);
  opacity: 0.7;
  line-height: 1.5;
  max-width: 400px;
  margin: 0.75rem auto 0;
}

/* -----------------------------------------------------------------------
   3j. Grain Overlay
   ----------------------------------------------------------------------- */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

[data-theme="dark"] .grain {
  opacity: 0.03;
}


/* ==========================================================================
   4. Documentation Layout
   ========================================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--rp-space-3xl);
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(var(--rp-nav-height) + var(--rp-space-2xl)) var(--rp-space-xl) var(--rp-space-4xl);
  min-height: 100vh;
}

/* -----------------------------------------------------------------------
   4a. Sidebar Navigation
   ----------------------------------------------------------------------- */

.docs-sidebar {
  position: sticky;
  top: calc(var(--rp-nav-height) + var(--rp-space-xl));
  height: fit-content;
  max-height: calc(100vh - var(--rp-nav-height) - var(--rp-space-2xl));
  overflow-y: auto;
  padding-right: var(--rp-space-md);
}

.docs-sidebar nav h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rp-text-light);
  margin-top: var(--rp-space-lg);
  margin-bottom: var(--rp-space-sm);
}

.docs-sidebar nav h2:first-child {
  margin-top: 0;
}

.docs-sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-sidebar nav li {
  margin: 0;
}

.docs-sidebar nav a {
  display: block;
  padding: var(--rp-space-xs) 0;
  color: var(--rp-text-muted);
  font-size: 0.875rem;
  border-left: 2px solid transparent;
  padding-left: var(--rp-space-md);
  margin-left: -2px;
  transition: all var(--rp-transition-fast);
  text-decoration: none;
}

.docs-sidebar nav a:hover {
  color: var(--rp-text);
}

.docs-sidebar nav a[aria-current="page"],
.docs-sidebar nav a.active {
  color: var(--rp-text);
  border-left-color: var(--rp-primary);
  font-weight: 500;
}

/* -----------------------------------------------------------------------
   4b. Main Content Area
   ----------------------------------------------------------------------- */

.docs-content {
  min-width: 0;
}

/* -----------------------------------------------------------------------
   4c. Docs Home Page
   ----------------------------------------------------------------------- */

.docs-home {
  padding: calc(var(--rp-nav-height) + var(--rp-space-3xl)) var(--rp-space-xl) var(--rp-space-4xl);
  max-width: 1000px;
  margin: 0 auto;
}

.docs-home h1 {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--rp-font-display);
  margin-bottom: var(--rp-space-md);
  letter-spacing: -0.02em;
  color: var(--rp-text);
}

.docs-home .lead {
  font-size: 1.25rem;
  color: var(--rp-text-muted);
  margin-bottom: var(--rp-space-3xl);
  max-width: 600px;
}

.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--rp-space-lg);
  margin-bottom: var(--rp-space-3xl);
}

.docs-card {
  background: var(--rp-bg-elevated);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
  padding: var(--rp-space-xl);
  text-decoration: none;
  transition: border-color var(--rp-transition-base),
              transform var(--rp-transition-base),
              box-shadow var(--rp-transition-base);
}

.docs-card:hover {
  border-color: var(--rp-border-light);
  transform: translateY(-2px);
  box-shadow: var(--rp-shadow-md);
}

.docs-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--rp-text);
  margin-bottom: var(--rp-space-sm);
  display: flex;
  align-items: center;
  gap: var(--rp-space-sm);
}

.docs-card h3::before {
  content: "";
  width: 4px;
  height: 1em;
  background: var(--rp-primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.docs-card p {
  font-size: 0.9375rem;
  color: var(--rp-text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Section labels */
.docs-section-label {
  font-family: var(--rp-font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--rp-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--rp-space-md);
}

/* -----------------------------------------------------------------------
   4d. Documentation Pagination
   ----------------------------------------------------------------------- */

.docs-pagination {
  display: flex;
  justify-content: space-between;
  gap: var(--rp-space-md);
  margin-top: var(--rp-space-3xl);
  padding-top: var(--rp-space-xl);
  border-top: 1px solid var(--rp-border);
}

.docs-pagination a {
  display: flex;
  flex-direction: column;
  padding: var(--rp-space-md) var(--rp-space-lg);
  background: var(--rp-bg-elevated);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
  text-decoration: none;
  transition: all var(--rp-transition-fast);
  min-width: 180px;
}

.docs-pagination a:hover {
  border-color: var(--rp-primary);
  box-shadow: var(--rp-shadow-sm);
}

.docs-pagination .prev {
  align-items: flex-start;
}

.docs-pagination .next {
  align-items: flex-end;
  margin-left: auto;
}

.docs-pagination .label {
  font-size: 0.75rem;
  color: var(--rp-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--rp-space-xs);
}

.docs-pagination .title {
  color: var(--rp-text);
  font-weight: 500;
}

/* -----------------------------------------------------------------------
   4e. Quick Reference
   ----------------------------------------------------------------------- */

.quick-reference {
  background: var(--rp-bg-elevated);
  border: 1px solid var(--rp-border);
  border-radius: 12px;
  padding: var(--rp-space-xl);
}

.quick-reference h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--rp-space-lg);
  color: var(--rp-text);
}

.quick-reference table {
  width: 100%;
  border-collapse: collapse;
}

.quick-reference th,
.quick-reference td {
  padding: var(--rp-space-sm) var(--rp-space-md);
  border-bottom: 1px solid var(--rp-border);
  text-align: left;
  font-size: 0.875rem;
}

.quick-reference th {
  color: var(--rp-text-light);
  font-weight: 500;
}

.quick-reference td {
  color: var(--rp-text-muted);
}

.quick-reference code {
  background: var(--rp-bg-subtle);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-family: var(--rp-font-mono);
}


/* ==========================================================================
   5. Light Theme Adjustments
   ==========================================================================
   Light mode is the default. Some elements that were originally designed for
   a dark theme need specific overrides in the light context.
   ========================================================================== */

.code-window {
  box-shadow: var(--rp-shadow-lg);
}

/* Light mode: softer code-window shadow */
:root:not([data-theme="dark"]) .code-window {
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 20px 50px -20px rgba(0, 0, 0, 0.15);
}

/* Light mode: softer feature-card hover shadow */
:root:not([data-theme="dark"]) .feature-card:hover {
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.15);
}

/* Light mode: more subtle hero glow */
:root:not([data-theme="dark"]) .hero-glow {
  opacity: 0.1;
}

/* Light mode: quieter grain */
:root:not([data-theme="dark"]) .grain {
  opacity: 0.012;
}

/* Smooth theme transitions on layout-related elements */
.code-window,
.code-block,
.feature-card,
.usage-card,
.code-header,
.hero-badge,
.docs-card {
  transition:
    background-color var(--rp-transition-base),
    border-color var(--rp-transition-base),
    box-shadow var(--rp-transition-base);
}


/* ==========================================================================
   6. Responsive
   ========================================================================== */

/* -----------------------------------------------------------------------
   768px: Mobile navigation breakpoint
   ----------------------------------------------------------------------- */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
  }

  /* Hide sidebar when mobile menu is available */
  .docs-sidebar {
    display: none;
  }

  .docs-layout {
    grid-template-columns: 1fr;
    padding-left: var(--rp-space-md);
    padding-right: var(--rp-space-md);
  }
}

/* -----------------------------------------------------------------------
   900px: Layout collapses to single column
   ----------------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--rp-space-3xl);
    min-height: auto;
    padding-top: calc(var(--rp-nav-height) + var(--rp-space-3xl));
  }

  .hero-content {
    text-align: center;
  }

  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-glow {
    left: 50%;
    transform: translateX(-50%);
  }

  .usage-grid {
    grid-template-columns: 1fr;
  }

  .entity-demo-grid {
    grid-template-columns: 1fr;
    gap: var(--rp-space-2xl);
  }

  .entity-demo-code {
    position: static;
  }

  /* Documentation layout collapses */
  .docs-layout {
    grid-template-columns: 1fr;
    gap: var(--rp-space-xl);
  }

  .docs-sidebar {
    position: relative;
    top: 0;
    max-height: none;
    padding-right: 0;
    border-bottom: 1px solid var(--rp-border);
    padding-bottom: var(--rp-space-lg);
    margin-bottom: var(--rp-space-lg);
  }

  .docs-sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rp-space-lg);
  }

  .docs-sidebar nav > div {
    flex: 1;
    min-width: 200px;
  }

  .docs-sidebar nav h2 {
    margin-top: 0;
  }

  .docs-sidebar nav a {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  .docs-sidebar nav a[aria-current="page"],
  .docs-sidebar nav a.active {
    color: var(--rp-primary);
    border-left: none;
  }

  .docs-pagination {
    flex-direction: column;
  }

  .docs-pagination .next {
    align-items: flex-start;
    margin-left: 0;
  }
}

/* -----------------------------------------------------------------------
   600px: Compact / small mobile
   ----------------------------------------------------------------------- */
@media (max-width: 600px) {
  :root {
    --rp-space-xl: 1.5rem;
    --rp-space-2xl: 2rem;
    --rp-space-3xl: 3rem;
    --rp-space-4xl: 4rem;
  }

  /* Prevent horizontal overflow on mobile */
  .hero,
  section,
  .features,
  .entity-demo,
  .install,
  .config,
  .cta,
  .footer {
    max-width: 100vw;
    padding-left: var(--rp-space-md);
    padding-right: var(--rp-space-md);
  }

  .hero-content,
  .hero-code {
    max-width: 100%;
  }

  .code-window {
    max-width: calc(100vw - 2 * var(--rp-space-md));
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .features-grid-large {
    grid-template-columns: 1fr;
  }

  .install-step {
    grid-template-columns: 1fr;
  }

  .install-step .step-number {
    padding-top: 0;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .btn {
    justify-content: center;
  }

  /* Documentation mobile adjustments */
  .docs-home {
    padding-left: var(--rp-space-md);
    padding-right: var(--rp-space-md);
  }

  .docs-home h1 {
    font-size: 2rem;
  }

  .docs-home .lead {
    font-size: 1.125rem;
  }

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

/* -----------------------------------------------------------------------
   Print
   ----------------------------------------------------------------------- */
@media print {
  .nav,
  .docs-sidebar,
  .docs-pagination,
  .skip-link,
  .grain,
  .mobile-menu,
  .mobile-menu-backdrop {
    display: none !important;
  }

  .docs-layout {
    display: block;
    padding: 0;
  }

  .hero {
    min-height: auto;
    padding-top: 0;
  }
}
