/* ============================================
   ARCANE CODEX - COMPLETE THEME SYSTEM (ShadCN)
   ============================================ */

/* ============================================
   GOOGLE FONTS - Inter (ShadCN default)
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================
   CUSTOM FONTS - Akzidenz-GroteskPro & ITCAvantGardeStd (optional)
   ============================================ */

/* Akzidenz-GroteskPro - Body Text */
@font-face {
  font-family: 'Akzidenz-GroteskPro';
  src: url('fonts/Akzidenz-GroteskPro/akzidenzgroteskpro_light.woff2') format('woff2'),
       url('fonts/Akzidenz-GroteskPro/akzidenzgroteskpro_light.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Akzidenz-GroteskPro';
  src: url('fonts/Akzidenz-GroteskPro/akzidenzgroteskpro_regular.woff2') format('woff2'),
       url('fonts/Akzidenz-GroteskPro/akzidenzgroteskpro_regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Akzidenz-GroteskPro';
  src: url('fonts/Akzidenz-GroteskPro/akzidenzgroteskpro_md.woff2') format('woff2'),
       url('fonts/Akzidenz-GroteskPro/akzidenzgroteskpro_md.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Akzidenz-GroteskPro';
  src: url('fonts/Akzidenz-GroteskPro/akzidenzgroteskpro_bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ITCAvantGardeStd - Headings */
@font-face {
  font-family: 'ITCAvantGardeStd';
  src: url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Bk.woff2') format('woff2'),
       url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Bk.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ITCAvantGardeStd';
  src: url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Md.woff2') format('woff2'),
       url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Md.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ITCAvantGardeStd';
  src: url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Demi.woff2') format('woff2'),
       url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Demi.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'ITCAvantGardeStd';
  src: url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Bold.woff2') format('woff2'),
       url('fonts/ITCAvantGardeStd/ITCAvantGardeStd-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Hack Font - Code/Monospace */
@font-face {
  font-family: 'Hack';
  src: url('fonts/HackFont/Hack-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Hack';
  src: url('fonts/HackFont/Hack-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Hack';
  src: url('fonts/HackFont/Hack-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Hack';
  src: url('fonts/HackFont/Hack-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================
   ROOT CSS VARIABLES - DEFAULT FONTS
   Stylesheet will override via --arcane-style-font-*
   ============================================ */
:root {
  /* Fallback fonts - stylesheet CSS vars take precedence */
  --font-sans: var(--arcane-font-sans, 'Akzidenz-GroteskPro', -apple-system, BlinkMacSystemFont, sans-serif);
  --font-heading: var(--arcane-font-heading, 'ITCAvantGardeStd', 'Akzidenz-GroteskPro', sans-serif);
  --font-mono: var(--arcane-font-mono, 'Hack', 'Fira Code', monospace);
}

/* ============================================
   BASE STYLES
   ============================================ */
html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  background-color: var(--arcane-background);
  color: var(--arcane-on-background);
}

body {
  min-height: 100vh;
  background-color: var(--arcane-background);
  color: var(--arcane-on-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   PROSE CONTENT STYLES
   ============================================ */
.prose {
  max-width: 65ch;
  color: var(--arcane-on-surface);
}

.prose h1, .prose h2, .prose h3,
.prose h4, .prose h5, .prose h6 {
  font-family: var(--font-heading);
  color: var(--arcane-on-surface);
  font-weight: 600;
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.prose h1 { font-size: 2.25rem; margin-top: 0; }
.prose h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--arcane-border);
  padding-bottom: 0.5rem;
}
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1rem; }

.prose p {
  color: var(--arcane-on-surface-variant);
  margin-bottom: 1rem;
}

.prose li {
  color: var(--arcane-on-surface-variant);
  margin-bottom: 0.25rem;
}

.prose a {
  color: var(--arcane-primary);
  text-decoration: none;
  transition: color var(--arcane-transition-fast);
}

.prose a:hover {
  color: var(--arcane-primary);
  text-decoration: underline;
  opacity: 0.8;
}

.prose strong, .prose b {
  color: var(--arcane-on-surface);
  font-weight: 600;
}

.prose em {
  font-style: italic;
}

.prose ul, .prose ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.prose li::marker {
  color: var(--arcane-muted-foreground);
}

.prose blockquote {
  border-left: 4px solid var(--arcane-border);
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: var(--arcane-muted-foreground);
}

.prose pre {
  background-color: oklch(0.97 0 0);
  border: 1px solid var(--arcane-border);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

/* Dark mode code blocks */
.dark .prose pre {
  background-color: oklch(0.145 0 0);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: #c9d1d9;
}

/* Light mode code text */
:not(.dark) .prose code {
  color: #24292f;
}

/* Vibrant syntax highlighting - Dark mode (GitHub Dark inspired) */
.dark .prose pre code {
  color: #c9d1d9;
}

.dark .prose .hljs-keyword,
.dark .prose .hljs-selector-tag,
.dark .prose .hljs-literal,
.dark .prose .hljs-section,
.dark .prose .hljs-link {
  color: #ff7b72;
}

.dark .prose .hljs-string,
.dark .prose .hljs-attr {
  color: #a5d6ff;
}

.dark .prose .hljs-number,
.dark .prose .hljs-type {
  color: #79c0ff;
}

.dark .prose .hljs-function,
.dark .prose .hljs-title {
  color: #d2a8ff;
}

.dark .prose .hljs-comment {
  color: #8b949e;
  font-style: italic;
}

.dark .prose .hljs-variable,
.dark .prose .hljs-params {
  color: #ffa657;
}

.dark .prose .hljs-class,
.dark .prose .hljs-built_in {
  color: #7ee787;
}

/* Vibrant syntax highlighting - Light mode (GitHub Light inspired) */
.prose pre code {
  color: #24292f;
}

.prose .hljs-keyword,
.prose .hljs-selector-tag,
.prose .hljs-literal,
.prose .hljs-section,
.prose .hljs-link {
  color: #cf222e;
}

.prose .hljs-string,
.prose .hljs-attr {
  color: #0a3069;
}

.prose .hljs-number,
.prose .hljs-type {
  color: #0550ae;
}

.prose .hljs-function,
.prose .hljs-title {
  color: #8250df;
}

.prose .hljs-comment {
  color: #6e7781;
  font-style: italic;
}

.prose .hljs-variable,
.prose .hljs-params {
  color: #953800;
}

.prose .hljs-class,
.prose .hljs-built_in {
  color: #116329;
}

/* Inline code - Light mode (default) */
.prose :not(pre) > code {
  background-color: rgba(175, 184, 193, 0.3);
  color: #1f2328;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.875em;
  font-weight: 500;
}

/* Inline code - Dark mode */
.dark .prose :not(pre) > code {
  background-color: rgba(110, 118, 129, 0.4);
  color: #e6edf3;
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

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

.prose th {
  background-color: var(--arcane-surface-variant);
  color: var(--arcane-on-surface);
  font-weight: 600;
}

.prose td {
  color: var(--arcane-on-surface-variant);
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--arcane-radius-md);
}

/* ============================================
   CONTENT SECTION STYLING
   ============================================ */
.content, section.content {
  color: var(--arcane-on-surface-variant);
}

.content h1, .content h2, .content h3,
.content h4, .content h5, .content h6,
section h1, section h2, section h3,
section h4, section h5, section h6 {
  color: var(--arcane-on-surface);
}

.content p, section p {
  color: var(--arcane-on-surface-variant);
}

.content a, section a {
  color: var(--arcane-primary);
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */
.toc-content ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.toc-content ul ul {
  padding-left: 12px;
  border-left: 1px solid var(--arcane-border);
  margin-left: 8px;
}

.toc-content a {
  color: var(--arcane-muted-foreground);
  text-decoration: none;
  font-size: 13px;
  display: block;
  padding: 6px 10px;
  margin: 2px 0;
  border-radius: var(--arcane-radius-sm);
  transition: all var(--arcane-transition-fast);
}

.toc-content a:hover {
  color: var(--arcane-on-surface);
  background: var(--arcane-surface-variant);
}

/* ============================================
   HEADING ANCHORS
   ============================================ */
.prose h1 a, .prose h2 a, .prose h3 a,
.prose h4 a, .prose h5 a, .prose h6 a {
  color: inherit;
  text-decoration: none;
}

.anchor-link {
  opacity: 0;
  margin-left: 0.5rem;
  color: var(--arcane-muted-foreground);
  transition: opacity var(--arcane-transition-fast);
}

.prose h1:hover .anchor-link,
.prose h2:hover .anchor-link,
.prose h3:hover .anchor-link {
  opacity: 1;
}

/* ============================================
   CODE BLOCKS
   ============================================ */
.code-block-wrapper {
  position: relative !important;
  margin: 1.5rem 0;
}

.code-block-wrapper pre {
  margin: 0;
  padding-right: 50px;
}

.copy-code-btn {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--arcane-muted-foreground);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.code-block-wrapper:hover .copy-code-btn {
  opacity: 0.7;
}

.copy-code-btn:hover {
  opacity: 1 !important;
  background: rgba(0, 0, 0, 0.05);
  color: var(--arcane-foreground);
}

.dark .copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.copy-code-btn.copied {
  color: var(--arcane-success);
  opacity: 1 !important;
}

.copy-code-btn svg {
  width: 14px;
  height: 14px;
}

/* Demo code block copy buttons */
.demo-code-block button:hover {
  background: var(--arcane-surface-variant) !important;
  color: var(--arcane-foreground) !important;
}

/* ============================================
   SELECTION
   ============================================ */
::selection {
  background-color: rgba(var(--arcane-accent-rgb), 0.5);
  color: var(--arcane-foreground);
}

/* ============================================
   FOCUS STATES
   ============================================ */
button:focus-visible {
  outline: 2px solid var(--arcane-ring);
  outline-offset: 2px;
}

/* ============================================
   SEARCH
   ============================================ */
#docs-search:focus {
  border-color: var(--arcane-ring);
  box-shadow: 0 0 0 3px rgba(var(--arcane-foreground-rgb), 0.1);
}

#docs-search::placeholder {
  color: var(--arcane-muted-foreground);
  opacity: 0.7;
}

#search-results a:last-child {
  border-bottom: none;
}

/* ============================================
   HEADER CONTROLS
   ============================================ */
#theme-toggle:hover {
  background: var(--arcane-muted);
  border-color: var(--arcane-border);
}

#theme-toggle:active {
  transform: scale(0.98);
}

#search-trigger:hover {
  background: var(--arcane-muted);
  border-color: var(--arcane-muted-foreground);
}

#preset-select:hover {
  border-color: var(--arcane-muted-foreground);
}

#preset-select:focus {
  border-color: var(--arcane-ring);
  outline: none;
}

/* ============================================
   SIDEBAR HOVER
   ============================================ */
aside a:hover {
  background: var(--arcane-surface-variant) !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .prose {
    font-size: 15px;
  }

  #docs-search {
    display: none;
  }
}

/* ============================================
   LOADING & ANIMATIONS
   ============================================ */
#loading {
  display: none;
}

/* Spinner loader animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Alias for arcane-spin used by ArcaneLoadingSpinner */
@keyframes arcane-spin {
  to { transform: rotate(360deg); }
}

/* Dots loader animation */
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Pulse loader animation */
@keyframes pulseGrow {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.2; }
}

/* Generic pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.2; transform: scale(1.3); }
}

/* Skeleton loading animation - arcane-shimmer used by ArcaneSkeleton component */
@keyframes arcane-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Alias for backward compatibility */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Fade in animation for popups/hovercards */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dropdown fade animation */
@keyframes arcane-dropdown-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tooltip fade animation - used by ArcaneTooltip component */
@keyframes arcane-tooltip-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(0.95); }
  100% { opacity: 1; transform: translateX(-50%) translateY(-8px) scale(1); }
}
