/* =============================================================================
   RESEARCH NOTEBOOK — CUSTOM STYLES
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS VARIABLES
   ----------------------------------------------------------------------------- */

:root {
  --accent: #0c6b7c;
  --accent-strong: #095665;
  color: var(--text-muted);
  --line-color: #e0e0e0;
  --card-bg: rgba(250, 250, 250, 0.4);
  --card-border: rgba(229, 229, 229, 0.6);
  --bg-surface: transparent;
}

[data-bs-theme="dark"],
[data-theme="dark"] {
  /* 4-layer architecture (no transparencies) */
  --bg-main: #0b0d0f;          /* page background */
  --bg-surface: #101317;       /* content surface */
  --bg-card: #14181c;          /* cards */
  --border-subtle: #24282e;

  /* Text hierarchy */
  --text-heading: #eaecef;
  --text-main: #d1d5db;
  --text-muted: #9ca3af;

  /* Accent */
  --accent: #7aa2b2;
  --accent-strong: #8fb7c6;

  /* Legacy compatibility for existing variables */
  --muted: #9ca3af;
  --line-color: #24282e;
  --card-bg: #14181c;
  --card-border: #24282e;
  --bg-surface-legacy: #101317;
}

/* =============================================================================
   GLOBAL DARK MODE RULES
   ============================================================================= */

[data-bs-theme="dark"] a,
[data-theme="dark"] a {
  color: var(--accent);
}

[data-bs-theme="dark"] a:hover,
[data-theme="dark"] a:hover {
  color: var(--accent-strong);
}

/* =============================================================================
   GLOBAL LAYOUT — PAGE-LAYOUT-FULL (BLOG / ARCHIVE)
   ============================================================================= */

.page-layout-full {
  display: grid !important;
  grid-template-columns: minmax(500px, 700px) 220px;
  column-gap: 48px;
  align-items: start;
  margin: 0 auto;
}

/* -----------------------------------------------------------------------------
   SIDEBAR - CATEGORIES (Quarto auto-generated)
   ----------------------------------------------------------------------------- */

.quarto-listing-category {
  grid-column: 2;
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 24px 20px;
  background: #f5f5f5;
  border: 1px solid var(--line-color);
  border-radius: 4px;
  display: flex !important;
  flex-direction: column;
}

/* -----------------------------------------------------------------------------
   MAIN CONTENT AREA - BLOG
   ----------------------------------------------------------------------------- */

#quarto-margin-sidebar {
  display: none !important;
}

#quarto-content,
.page-layout-full .quarto-title-block,
.page-layout-full .quarto-listing-filter,
.page-layout-full .quarto-listing-sort,
.quarto-listing-container {
  grid-column: 1 !important;
}

/* Asegura que el contenido del listing use todo el ancho de su columna */
.page-layout-full .page-content {
  grid-column: 1;
  width: 100%;
  padding-top: 24px;
  padding-bottom: 0;
}
.page-layout-full .quarto-listing-filter,
.page-layout-full .quarto-listing-sort {
  max-width: none; /* Permitido aquí, es el layout del listado */
}

/* -----------------------------------------------------------------------------
/* SEARCH & FILTER CONTROLS */

#quarto-listing-filter-input,
.quarto-listing-sort select,
.page-layout-full .form-control {
  padding: 11px 16px;
  border: 1px solid var(--line-color);
  border-radius: 4px;
  font-size: 0.94rem;
}


/* =============================================================================
/* HOME PAGE RESET (index.qmd only) */

body.home {
  background: #f9f9f9;
}

[data-bs-theme="dark"] body.home,
[data-theme="dark"] body.home {
  background-color: var(--bg-main);
  color: var(--text-main);
}

body.home main.content {
  max-width: none;
  padding: 0 !important;
}

body.home #quarto-content,
body.home .page-columns {
  margin: 0 !important;
  padding: 0 !important;
}

body.home main.content > header,
body.home .quarto-title-block {
  display: none !important;
}

/* =============================================================================
   HOME PAGE — LAYOUT & SIDEBAR
   ============================================================================= */

.home-wrapper {
  display: grid;
  grid-template-columns: 1fr 2.4fr;
  column-gap: 48px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  align-items: start;
}

[data-bs-theme="dark"] .home-wrapper,
[data-theme="dark"] .home-wrapper {
  background-color: var(--bg-main);
}

.home-wrapper .home-sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  border-radius: 6px;
}

[data-bs-theme="dark"] .home-wrapper .home-sidebar,
[data-theme="dark"] .home-wrapper .home-sidebar {
  background-color: var(--bg-surface-legacy);
  border-color: var(--border-subtle);
}

[data-bs-theme="dark"] .home-main,
[data-theme="dark"] .home-main {
  background-color: var(--bg-surface);
  padding: 24px;
  border-radius: 6px;
}

.home-name {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
  color: #1a1a1a;
  letter-spacing: -0.3px;
}

[data-bs-theme="dark"] .home-name,
[data-theme="dark"] .home-name {
  color: #f5f5f5;
}

.home-role {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 6px;
  color: #3a3a3a;
}

[data-bs-theme="dark"] .home-role,
[data-theme="dark"] .home-role {
  color: #d0d0d0;
}

.home-institution {
  font-size: 0.82rem;
  line-height: 1.3;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-color);
  color: #626262;
}

[data-bs-theme="dark"] .home-institution,
[data-theme="dark"] .home-institution {
  color: #a8a8a8;
}

.home-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-link {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 6px 0;
}

.home-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

[data-bs-theme="dark"] .home-main,
[data-theme="dark"] .home-main {
  background-color: transparent;
}

/* Main content area */
.home-main h2 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #2a2a2a;
  margin-bottom: 16px;
  margin-top: 28px;
}

[data-bs-theme="dark"] .home-main h2,
[data-theme="dark"] .home-main h2 {
  color: #f5f7fa !important;
}

.home-main h2:first-child {
  margin-top: 0;
}

/* Subtitles (Physics Notes / Active Research) */
.home-main h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #3a3a3a;
  margin-bottom: 12px;
  margin-top: 16px;
}

[data-bs-theme="dark"] .home-main h3,
[data-theme="dark"] .home-main h3 {
  color: var(--text-heading);
}

[data-bs-theme="dark"] .home-main p,
[data-theme="dark"] .home-main p {
  color: var(--text-main);
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

[data-bs-theme="dark"] .muted,
[data-theme="dark"] .muted {
  color: var(--text-muted);
}

.section-card {
  margin-top: 24px;
  padding: 22px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 5px;
}

[data-bs-theme="dark"] .section-card,
[data-theme="dark"] .section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.badge-stable {
  background: #d4edda;
  color: #155724;
}

[data-bs-theme="dark"] .badge-stable,
[data-theme="dark"] .badge-stable {
  background: #1f5a2d;
  color: #b0f0b0;
}

.badge-progress {
  background: #fff3cd;
  color: #856404;
}

[data-bs-theme="dark"] .badge-progress,
[data-theme="dark"] .badge-progress {
  background: #5a5014;
  color: #f5e0a0;
}

/* =============================================================================
   HOME PAGE — MOBILE
   ============================================================================= */

@media (max-width: 900px) {
  .home-wrapper {
    grid-template-columns: 1fr;
    row-gap: 32px;
    padding: 48px 20px 72px;
  }

  .home-wrapper .home-sidebar {
    position: static;
    top: auto;
    width: 100%;
    padding: 24px;
    margin-bottom: 40px;
    border: 1px solid var(--line-color);
    border-radius: 6px;
    background: var(--bg-surface);
  }
  
  .home-name {
    font-size: 1.75rem;
  }
}

/* =============================================================================
   HOME — LARGE SCREENS (1600px+)
   ============================================================================= */

@media (min-width: 1600px) {
  .home-wrapper {
    max-width: 1400px;
    grid-template-columns: 1.1fr 2.6fr;
  }
}
