/**
 * docs.illanes00.cl - Quarto Theme
 * Uses illanes design system (html[data-theme] attributes)
 */

/* ============================================
   CSS Variables - Light Mode (Default)
   ============================================ */
:root {
  --bg: #f6f7f8;
  --paper: #ffffff;
  --ink: #0f1113;
  --line: #d5dbe3;
  --muted: #6b7280;
  --link: #0066cc;
  --link-visited: #551a8b;
  --accent: #0ea5e9;
  --code-bg: #f3f4f6;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", "Menlo", "Monaco", monospace;
}

/* ============================================
   Dark Mode - illanes system (data-theme attribute)
   ============================================ */
html[data-theme="dark"] {
  --bg: #0f1113;
  --paper: #1a1d21;
  --ink: #e5e7eb;
  --line: #374151;
  --muted: #9ca3af;
  --link: #60a5fa;
  --link-visited: #a78bfa;
  --accent: #38bdf8;
  --code-bg: #1f2937;
}

/* Also support prefers-color-scheme for auto mode */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0f1113;
    --paper: #1a1d21;
    --ink: #e5e7eb;
    --line: #374151;
    --muted: #9ca3af;
    --link: #60a5fa;
    --link-visited: #a78bfa;
    --accent: #38bdf8;
    --code-bg: #1f2937;
  }
}

/* Force light mode when explicitly set */
html[data-theme="light"] {
  --bg: #f6f7f8 !important;
  --paper: #ffffff !important;
  --ink: #0f1113 !important;
  --line: #d5dbe3 !important;
  --muted: #6b7280 !important;
  --link: #0066cc !important;
  --link-visited: #551a8b !important;
  --accent: #0ea5e9 !important;
  --code-bg: #f3f4f6 !important;
}

/* ============================================
   Base Styles
   ============================================ */
html, body {
  background-color: var(--bg) !important;
  color: var(--ink) !important;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   Brandbar (Top Navigation)
   ============================================ */
.brandbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brandbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-title:hover {
  color: var(--link);
}

.brand-chips {
  display: inline-flex;
  gap: 3px;
}

.brand-chips i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, var(--accent));
}

.brand-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.brand-nav a {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.brand-nav a:hover {
  color: var(--link);
  border-color: var(--line);
  background: var(--bg);
}

.brand-nav a.current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Theme toggle button */
[data-theme-toggle] {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

[data-theme-toggle]:hover {
  background: var(--paper);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   Content Area
   ============================================ */
#quarto-content,
.quarto-container {
  background-color: var(--paper) !important;
}

main.content,
.page-columns {
  background-color: var(--paper);
}

main.content {
  padding: 1.5rem 2rem;
  max-width: none;
}

/* ============================================
   Left Sidebar
   ============================================ */
#quarto-sidebar,
.sidebar,
nav.quarto-sidebar {
  background-color: var(--bg) !important;
  border-right: 1px solid var(--line);
  font-size: 14px;
}

.sidebar-title,
.sidebar-header .sidebar-title {
  color: var(--ink) !important;
  font-weight: 600;
  font-size: 0.95rem;
}

.sidebar-section .sidebar-section-title,
.sidebar-item-section .sidebar-item-section {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75em 0 0.5em;
  border-bottom: none;
  margin-top: 0.5em;
}

.sidebar-item a,
.sidebar-item-text {
  color: var(--ink) !important;
  padding: 0.35em 0;
  display: block;
}

.sidebar-item.active > a,
.sidebar-item a:hover {
  background-color: transparent !important;
  color: var(--link) !important;
}

.sidebar-item.active > a {
  font-weight: 600;
}

/* ============================================
   Right Sidebar (Table of Contents)
   ============================================ */
#quarto-margin-sidebar,
.quarto-margin-sidebar {
  position: sticky !important;
  top: 60px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  background-color: var(--bg);
  border-left: 1px solid var(--line);
  padding: 1rem;
}

#TOC,
.toc,
nav.toc {
  font-size: 13px;
  background-color: transparent;
}

#TOC a,
.toc a,
nav.toc a {
  color: var(--muted);
  text-decoration: none;
}

#TOC a:hover,
.toc a:hover {
  color: var(--link);
}

#TOC ul,
.toc ul {
  padding-left: 1em;
  list-style: none;
}

#TOC li,
.toc li {
  margin: 0.4em 0;
}

/* TOC active state */
.toc-active,
#TOC .active a {
  color: var(--ink) !important;
  font-weight: 600;
}

/* ============================================
   Typography
   ============================================ */
/* Links */
a {
  color: var(--link);
  text-decoration: none;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  text-decoration: underline;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--ink) !important;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

h1 {
  font-size: 1.75rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3em;
}

h2 {
  font-size: 1.4rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2em;
}

h3 {
  font-size: 1.2rem;
}

h4, h5, h6 {
  font-size: 1.05rem;
}

/* Page title */
.quarto-title h1.title,
h1.title {
  font-size: 1.9rem;
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
  color: var(--ink) !important;
}

/* Description */
.description,
.quarto-title .description {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 1.5em;
}

/* ============================================
   Code Blocks
   ============================================ */
pre, code {
  font-family: var(--font-mono) !important;
  font-size: 13px;
}

pre {
  background-color: var(--code-bg) !important;
  border: 1px solid var(--line) !important;
  padding: 1em;
  overflow-x: auto;
  border-radius: 0;
}

code {
  background-color: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--ink);
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Syntax highlighting compatibility */
.sourceCode {
  background-color: var(--code-bg) !important;
}

/* ============================================
   Tables
   ============================================ */
table,
.table,
.quarto-table table,
article table,
main table {
  border-collapse: collapse !important;
  margin: 1em 0 !important;
  width: 100% !important;
  background: var(--paper) !important;
}

th, td,
.table th, .table td,
.quarto-table th, .quarto-table td,
article table th, article table td,
main table th, main table td {
  border: 1px solid var(--line) !important;
  padding: 0.6em 0.9em !important;
  text-align: left !important;
  color: var(--ink) !important;
}

th,
.table th,
.quarto-table th,
article table th,
main table th {
  background-color: var(--bg) !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
}

tr:nth-child(even),
.table tr:nth-child(even),
article table tr:nth-child(even) {
  background-color: var(--code-bg) !important;
}

/* Table wrapper */
.table-responsive {
  overflow-x: auto;
}

/* ============================================
   Lists
   ============================================ */
ul, ol {
  padding-left: 1.6em;
  color: var(--ink);
}

li {
  margin: 0.3em 0;
}

/* ============================================
   Callouts / Alerts
   ============================================ */
.callout {
  border: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background-color: var(--bg) !important;
  margin: 1em 0;
}

.callout-header {
  background-color: var(--code-bg) !important;
  border-bottom: 1px solid var(--line);
  padding: 0.6em 1em;
  font-weight: 600;
}

.callout-body {
  padding: 1em;
}

.callout-warning {
  border-left: 3px solid #f59e0b !important;
}

.callout-important,
.callout-caution {
  border-left: 3px solid #ef4444 !important;
}

.callout-note,
.callout-tip {
  border-left: 3px solid var(--accent) !important;
}

/* ============================================
   Blockquote
   ============================================ */
blockquote {
  border-left: 3px solid var(--line);
  margin: 1em 0;
  padding-left: 1em;
  color: var(--muted);
  background: transparent;
}

/* ============================================
   Horizontal Rule
   ============================================ */
hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.5em 0;
}

/* ============================================
   Search
   ============================================ */
#quarto-search,
.aa-DetachedSearchButton {
  background-color: var(--paper) !important;
  border: 1px solid var(--line) !important;
  border-radius: 3px;
}

#quarto-search input {
  background-color: var(--paper);
  color: var(--ink);
}

/* ============================================
   Footer
   ============================================ */
footer,
.quarto-footer {
  background-color: var(--bg) !important;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

/* ============================================
   Secondary Navigation
   ============================================ */
.quarto-secondary-nav {
  background-color: var(--bg) !important;
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  background: transparent;
  margin: 0;
  padding: 0.5rem 0;
}

.breadcrumb-item a {
  color: var(--link);
}

/* ============================================
   Page Navigation (Prev/Next)
   ============================================ */
.page-navigation {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 2rem;
}

.page-navigation a {
  color: var(--link);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 991px) {
  .brandbar__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  #quarto-margin-sidebar {
    position: relative !important;
    top: auto;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--line);
    margin-top: 2rem;
    padding-top: 1rem;
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .brandbar,
  #quarto-sidebar,
  #quarto-margin-sidebar,
  .quarto-secondary-nav {
    display: none !important;
  }

  main.content {
    border: none;
    padding: 0;
  }

  body {
    background: white !important;
    color: black !important;
  }
}
