/* ================================================
   HGE 2D Engine - Documentation Portal Styles
   ================================================ */

/* ------------------------------------------------
   HGE Layout
   ------------------------------------------------ */
.hge-site {
  --sidebar-width: 280px;
}

.hge-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 29, 33, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.hge-header .header-container {
  max-width: none;
  padding: 0 var(--space-lg);
}

.hge-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

/* ------------------------------------------------
   Sidebar
   ------------------------------------------------ */
.hge-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-bg-base);
  border-right: 1px solid var(--color-border);
  padding: var(--space-xl) 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.sidebar-nav {
  padding: 0 var(--space-lg);
}

.sidebar-section {
  margin-bottom: var(--space-xl);
}

.sidebar-section h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-section ul {
  list-style: none;
  margin: 0;
}

.sidebar-section li {
  margin-bottom: 2px;
}

.sidebar-section a {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sidebar-section a:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
}

.sidebar-section a.active {
  color: var(--color-accent-gold);
  background: rgba(212, 168, 67, 0.1);
}

/* ------------------------------------------------
   Main Content Area
   ------------------------------------------------ */
.hge-main {
  flex: 1;
  padding: var(--space-2xl) var(--space-2xl);
  max-width: 1000px;
}

.hge-main.full-width {
  max-width: none;
}

/* ------------------------------------------------
   Doc Page Styles
   ------------------------------------------------ */
.doc-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.doc-title {
  font-size: 2.25rem;
  margin-bottom: var(--space-sm);
}

.doc-description {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  margin-bottom: 0;
}

.doc-content h2 {
  font-size: 1.5rem;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.doc-content h3 {
  font-size: 1.25rem;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  color: var(--color-accent-gold);
}

.doc-content h4 {
  font-size: 1.125rem;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

/* ------------------------------------------------
   Quick Start Panel
   ------------------------------------------------ */
.quick-start {
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.1) 0%, rgba(157, 179, 58, 0.1) 100%);
  border: 1px solid var(--color-accent-gold);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.quick-start h2 {
  color: var(--color-accent-gold);
  margin-top: 0;
  border: none;
  padding: 0;
}

.quick-start ol {
  margin-bottom: 0;
}

.quick-start li {
  margin-bottom: var(--space-sm);
}

/* ------------------------------------------------
   API Reference Cards
   ------------------------------------------------ */
.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.api-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
}

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

.api-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.api-card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-gold);
  color: var(--color-bg-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
}

.api-card-title {
  font-size: 1rem;
  font-family: var(--font-mono);
  margin: 0;
}

.api-card-title a {
  color: var(--color-text-primary);
}

.api-card-title a:hover {
  color: var(--color-accent-gold);
}

.api-card-description {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* ------------------------------------------------
   Code Blocks (Enhanced for docs)
   ------------------------------------------------ */
.hge-site pre {
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
}

.hge-site code {
  font-family: var(--font-mono);
}

.hge-site pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Syntax highlighting colors */
.hge-site .highlight .k { color: #c678dd; }  /* keyword */
.hge-site .highlight .n { color: #abb2bf; }  /* name */
.hge-site .highlight .s { color: #98c379; }  /* string */
.hge-site .highlight .c { color: #5c6370; }  /* comment */
.hge-site .highlight .o { color: #56b6c2; }  /* operator */
.hge-site .highlight .m { color: #d19a66; }  /* number */

/* Function signature box */
.signature {
  background: var(--color-bg-elevated);
  border-left: 3px solid var(--color-accent-gold);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  overflow-x: auto;
}

/* Parameter table */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
}

.param-table th,
.param-table td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.param-table th {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--color-bg-elevated);
}

.param-table code {
  font-size: 0.875rem;
}

/* ------------------------------------------------
   Download Cards
   ------------------------------------------------ */
.download-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
}

.download-card-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background: linear-gradient(135deg, var(--color-accent-gold) 0%, var(--color-accent-lime) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-card-icon svg {
  width: 32px;
  height: 32px;
  fill: var(--color-bg-dark);
}

.download-card-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.download-card-description {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

/* ------------------------------------------------
   Demo Gallery
   ------------------------------------------------ */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-xl);
}

.demo-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.demo-thumbnail {
  aspect-ratio: 16 / 9;
  background: var(--color-bg-elevated);
  overflow: hidden;
}

.demo-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.demo-info {
  padding: var(--space-lg);
}

.demo-title {
  font-size: 1.125rem;
  margin-bottom: var(--space-xs);
}

.demo-description {
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 0;
}

/* ------------------------------------------------
   Notice/Alert Boxes
   ------------------------------------------------ */
.notice {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  border-left: 4px solid;
}

.notice-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
}

.notice-warning {
  background: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
}

.notice-tip {
  background: rgba(52, 211, 153, 0.1);
  border-color: #34d399;
}

.notice-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.notice p:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------
   HGE Footer
   ------------------------------------------------ */
.hge-footer {
  background: var(--color-bg-base);
  border-top: 1px solid var(--color-border);
  padding: var(--space-2xl) 0 0;
}

.hge-footer .footer-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-2xl);
}

.hge-footer .footer-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.hge-footer .footer-bottom {
  margin-top: var(--space-2xl);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-border);
}

.hge-footer .footer-bottom .footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-link {
  margin: 0;
}

.back-link a {
  color: var(--color-text-muted);
}

.back-link a:hover {
  color: var(--color-accent-gold);
}

/* ------------------------------------------------
   Responsive
   ------------------------------------------------ */
@media (max-width: 1024px) {
  .hge-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: 50;
  }
  
  .hge-sidebar.open {
    transform: translateX(0);
  }
  
  .hge-main {
    padding: var(--space-xl);
  }
  
  .hge-footer .footer-container {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
}

@media (max-width: 768px) {
  .hge-main {
    padding: var(--space-lg);
  }
  
  .doc-title {
    font-size: 1.75rem;
  }
  
  .api-grid {
    grid-template-columns: 1fr;
  }
  
  .hge-footer .footer-nav {
    grid-template-columns: 1fr 1fr;
  }
  
  .hge-footer .footer-bottom .footer-container {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}
