/* Article Page Styles */

.article-main {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}

.wiki-article {
  background: var(--card-bg, var(--bg));
  border-radius: var(--radius-lg, 1rem);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--glass-border, var(--border));
}

.article-header {
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
}

.article-title {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.article-content {
  padding: 2rem;
}

/* Wiki Content Styling */
.wiki-content {
  font-size: 1.0625rem;
  line-height: 1.75;
}

.wiki-content p {
  margin-bottom: 1.25rem;
}

.wiki-content h1, .wiki-content h2, .wiki-content h3,
.wiki-content h4, .wiki-content h5, .wiki-content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.wiki-content h1 { font-size: 2rem; }
.wiki-content h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.wiki-content h3 { font-size: 1.25rem; }
.wiki-content h4 { font-size: 1.125rem; }

.wiki-content a {
  color: var(--primary);
  text-decoration: underline;
}

.wiki-content ul, .wiki-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.wiki-content li {
  margin-bottom: 0.5rem;
}

.wiki-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.wiki-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.wiki-content code {
  font-family: 'Fira Code', 'Monaco', monospace;
  font-size: 0.875em;
}

.wiki-content p code {
  background: var(--bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: #be185d;
}

.wiki-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.wiki-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.wiki-content th, .wiki-content td {
  padding: 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.wiki-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}

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

/* Article Footer */
.article-footer {
  padding: 1.5rem 2rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.article-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--glass-bg, var(--bg));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border, var(--border));
  border-radius: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.25s cubic-bezier(.4,0,.2,1);
}

.tag:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  text-decoration: none;
  transform: scale(1.05);
}

.article-actions {
  display: flex;
  gap: 0.5rem;
}

/* Sidebar */
.article-sidebar {
  position: sticky;
  top: 80px;
}

.toc-section {
  background: var(--glass-bg, var(--bg));
  backdrop-filter: blur(var(--glass-blur, 20px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 20px));
  border-radius: var(--radius-lg, 1rem);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--glass-border, var(--border));
}

.toc-section h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

#toc {
  font-size: 0.875rem;
}

#toc ul {
  list-style: none;
  padding-left: 0;
}

#toc li {
  margin-bottom: 0.5rem;
}

#toc a {
  color: var(--text);
  display: block;
  padding: 0.25rem 0;
}

#toc a:hover {
  color: var(--primary);
}

#toc .toc-h3 {
  padding-left: 1rem;
}

/* Responsive */
@media (max-width: 968px) {
  .article-main {
    grid-template-columns: 1fr;
  }
  
  .article-sidebar {
    display: none;
  }
}

@media (max-width: 640px) {
  .article-header, .article-content, .article-footer {
    padding: 1rem;
  }
  
  .article-title {
    font-size: 1.75rem;
  }
}

/* Article Copyright & Licensing Notice (GitHub-Inspired) */
.article-copyright-notice {
  margin: 2.25rem 0 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
}

.gh-license-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg, #ffffff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gh-license-card:hover {
  border-color: rgba(9, 105, 218, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
}

.gh-license-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  background: var(--bg-hover, rgba(0, 0, 0, 0.025));
  border-bottom: 1px solid var(--border);
}

.gh-license-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.gh-license-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(9, 105, 218, 0.1);
  color: var(--primary, #0969da);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  border: 1px solid rgba(9, 105, 218, 0.15);
}

.gh-license-meta-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.gh-license-author-line {
  font-size: 0.88rem;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  line-height: 1.35;
}

.gh-copy-symbol {
  font-weight: 600;
  color: var(--text-muted);
}

.gh-copy-year {
  color: var(--text-muted);
  font-weight: 550;
}

.gh-copy-author {
  font-weight: 700;
  color: var(--text);
}

.gh-copy-dot {
  color: var(--text-muted);
  opacity: 0.6;
}

.gh-copy-brand {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.gh-license-title-line {
  line-height: 1.3;
}

.gh-license-title-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.gh-license-title-link:hover {
  color: var(--primary, #0969da);
  text-decoration: underline;
}

.gh-license-badge-wrap {
  flex-shrink: 0;
}

.gh-license-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary, #0969da);
  background: rgba(9, 105, 218, 0.08);
  border: 1px solid rgba(9, 105, 218, 0.22);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.gh-license-pill .gh-ext-arrow {
  font-size: 0.68rem;
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.gh-license-pill:hover {
  background: rgba(9, 105, 218, 0.16);
  border-color: var(--primary, #0969da);
  transform: translateY(-1px);
}

.gh-license-pill:hover .gh-ext-arrow {
  transform: translate(1px, -1px);
  opacity: 1;
}

/* GitHub-style Permissions Matrix */
.gh-license-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg, #ffffff);
  border-bottom: 1px solid var(--border);
}

.gh-matrix-col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.gh-matrix-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.gh-matrix-label .text-success { color: #1a7f37; }
.gh-matrix-label .text-primary { color: #0969da; }
.gh-matrix-label .text-muted { color: var(--text-muted); }

.gh-matrix-items {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gh-matrix-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.77rem;
  font-weight: 550;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  line-height: 1.35;
  width: fit-content;
}

.gh-matrix-pill.is-allowed {
  background: #dafbe1;
  color: #1a7f37;
  border: 1px solid rgba(26, 127, 55, 0.22);
}

.gh-matrix-pill.is-condition {
  background: #ddf4ff;
  color: #0969da;
  border: 1px solid rgba(9, 105, 218, 0.22);
}

.gh-matrix-pill.is-limitation {
  background: rgba(175, 184, 193, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.gh-matrix-pill.is-neutral {
  background: rgba(175, 184, 193, 0.12);
  color: var(--text);
  border: 1px solid var(--border);
}

.gh-matrix-pill.is-restricted {
  background: #ffebe9;
  color: #cf222e;
  border: 1px solid rgba(207, 34, 46, 0.22);
}

/* Collapsible Details Drawer */
.gh-license-drawer {
  background: var(--card-bg, #ffffff);
}

.gh-drawer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  user-select: none;
  background: var(--bg-hover, rgba(0, 0, 0, 0.02));
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s ease;
  list-style: none;
}

.gh-drawer-summary::-webkit-details-marker {
  display: none;
}

.gh-drawer-summary:hover {
  background: rgba(9, 105, 218, 0.05);
}

.gh-summary-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
}

.gh-summary-left i {
  color: var(--primary, #0969da);
  font-size: 0.88rem;
}

.gh-summary-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.gh-drawer-chevron {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.75rem;
}

.gh-license-drawer[open] .gh-drawer-chevron {
  transform: rotate(90deg);
}

.gh-license-drawer[open] .gh-drawer-summary {
  border-bottom: 1px solid var(--border);
}

.gh-drawer-body {
  padding: 1.15rem 1.25rem 1.25rem;
  background: var(--card-bg, #ffffff);
}

.gh-license-desc {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text);
}

.gh-legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.gh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 550;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-hover, #f6f8fa);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(27, 31, 36, 0.04);
  transition: all 0.15s ease;
}

.gh-btn:hover {
  background: #f3f4f6;
  border-color: rgba(27, 31, 36, 0.25);
  color: var(--primary, #0969da);
  text-decoration: none;
}

.gh-btn-primary {
  background: #1f883d;
  color: #ffffff;
  border-color: rgba(27, 31, 36, 0.15);
  box-shadow: 0 1px 0 rgba(27, 31, 36, 0.1);
}

.gh-btn-primary:hover {
  background: #1a7f37;
  border-color: rgba(27, 31, 36, 0.2);
  color: #ffffff;
}

.gh-disclaimer-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.95rem;
  border-radius: 6px;
  background: rgba(234, 179, 8, 0.08);
  border-left: 3px solid #eab308;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.gh-disclaimer-callout i {
  color: #d97706;
  margin-top: 0.15rem;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.gh-disclaimer-callout p {
  margin: 0;
}

/* Dark Theme Overrides */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gh-license-card {
    background: #0d1117;
    border-color: #30363d;
    color: #c9d1d9;
  }
  :root:not([data-theme="light"]) .gh-license-header {
    background: #161b22;
    border-color: #30363d;
  }
  :root:not([data-theme="light"]) .gh-license-matrix {
    background: #0d1117;
    border-color: #30363d;
  }
  :root:not([data-theme="light"]) .gh-drawer-body {
    background: #0d1117;
    color: #c9d1d9;
  }
  :root:not([data-theme="light"]) .gh-license-author-line,
  :root:not([data-theme="light"]) .gh-copy-author,
  :root:not([data-theme="light"]) .gh-summary-left,
  :root:not([data-theme="light"]) .gh-drawer-summary,
  :root:not([data-theme="light"]) .gh-license-desc {
    color: #c9d1d9;
  }
}
[data-theme="dark"] .gh-license-card,
[data-er-theme="dark"] .gh-license-card,
html.dark .gh-license-card,
body.dark .gh-license-card {
  background: #0d1117;
  border-color: #30363d;
  color: #c9d1d9;
}

[data-theme="dark"] .gh-license-header {
  background: #161b22;
  border-color: #30363d;
}

[data-theme="dark"] .gh-license-icon-box {
  background: rgba(56, 139, 253, 0.15);
  color: #58a6ff;
  border-color: rgba(56, 139, 253, 0.25);
}

[data-theme="dark"] .gh-license-pill {
  color: #58a6ff;
  background: rgba(56, 139, 253, 0.15);
  border-color: rgba(56, 139, 253, 0.3);
}

[data-theme="dark"] .gh-license-matrix {
  background: #0d1117;
  border-color: #30363d;
}

[data-theme="dark"] .gh-matrix-pill.is-allowed {
  background: rgba(46, 160, 67, 0.15);
  color: #3fb950;
  border-color: rgba(46, 160, 67, 0.3);
}

[data-theme="dark"] .gh-matrix-pill.is-condition {
  background: rgba(56, 139, 253, 0.15);
  color: #58a6ff;
  border-color: rgba(56, 139, 253, 0.3);
}

[data-theme="dark"] .gh-matrix-pill.is-limitation {
  background: #161b22;
  color: #8b949e;
  border-color: #30363d;
}

[data-theme="dark"] .gh-matrix-pill.is-neutral {
  background: #161b22;
  color: #c9d1d9;
  border-color: #30363d;
}

[data-theme="dark"] .gh-matrix-pill.is-restricted {
  background: rgba(248, 81, 73, 0.15);
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.3);
}

[data-theme="dark"] .gh-drawer-summary {
  background: #161b22;
  color: #c9d1d9;
}

[data-theme="dark"] .gh-drawer-summary:hover {
  background: rgba(56, 139, 253, 0.08);
}

[data-theme="dark"] .gh-license-drawer[open] .gh-drawer-summary {
  border-color: #30363d;
}

[data-theme="dark"] .gh-drawer-body {
  background: #0d1117;
}

[data-theme="dark"] .gh-btn {
  background: #21262d;
  border-color: #363b42;
  color: #c9d1d9;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .gh-btn:hover {
  background: #30363d;
  border-color: #8b949e;
  color: #58a6ff;
}

[data-theme="dark"] .gh-btn-primary {
  background: #238636;
  border-color: rgba(240, 246, 252, 0.1);
  color: #ffffff;
}

[data-theme="dark"] .gh-btn-primary:hover {
  background: #2ea043;
  color: #ffffff;
}

[data-theme="dark"] .gh-disclaimer-callout {
  background: rgba(234, 179, 8, 0.1);
  border-color: #d29922;
  color: #c9d1d9;
}

[data-theme="dark"] .gh-disclaimer-callout i {
  color: #e3b341;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .gh-license-matrix {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .gh-license-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .gh-license-badge-wrap {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
}

