/* Refined Obsidian — base */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-MediumItalic.ttf') format('truetype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/static/fonts/CormorantGaramond-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Manrope';
  src: url('/static/fonts/Manrope-Variable.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/static/fonts/JetBrainsMono-Variable.ttf') format('truetype');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* Reset moderno */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--t-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--text); }

/* Tipografía */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-style: italic;
  color: var(--gold);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
h1 { font-size: var(--t-40); }
h2 { font-size: var(--t-28); }
h3 { font-size: var(--t-22); }
h4 { font-size: var(--t-18); }

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.label {
  font-family: var(--font-mono);
  font-size: var(--t-10);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.subtitle { color: var(--text-muted); font-size: var(--t-13); }

/* Layout shell */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}
.app__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

/* Rail (desktop) */
.rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--s-4) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}
.rail__logo {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: var(--t-28);
  color: var(--gold);
  margin-bottom: var(--s-2);
}
.rail__spacer { flex: 1; }
.rail__ico {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--t-16);
  color: var(--text-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
}
.rail__ico:hover { color: var(--gold); background: var(--gold-soft); }
.rail__ico.is-active { color: var(--gold); background: var(--gold-soft); }
.rail__ico.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px; height: 24px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}
.rail__ico { position: relative; }

/* Bottom bar (mobile) */
.bottombar { display: none; }

/* Top bar de cada página */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  gap: var(--s-4);
}
.topbar__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--t-22);
  color: var(--gold);
  margin: 0;
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}

/* Filtros row */
.filterbar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-5);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  row-gap: var(--s-2);
}
.filterbar__sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 var(--s-2);
  flex-shrink: 0;
}

/* Main content area */
.content { padding: var(--s-5); }

/* Responsive */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .rail {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: var(--bottombar-h);
    border-right: 0;
    border-top: 1px solid var(--border);
    flex-direction: row;
    justify-content: space-around;
    padding: 0;
    z-index: 50;
  }
  .rail__logo, .rail__spacer { display: none; }
  .rail__ico::before { display: none; }
  .rail__ico.is-active { background: transparent; }
  .rail__ico.is-active::after {
    content: '';
    position: absolute;
    top: 0; left: 50%; transform: translateX(-50%);
    width: 24px; height: 2px; background: var(--gold);
  }
  .app__main { padding-bottom: var(--bottombar-h); }
  .filterbar { padding: var(--s-2) var(--s-3); overflow-x: auto; flex-wrap: nowrap; }
  .filterbar::-webkit-scrollbar { display: none; }
  .topbar { padding: var(--s-3) var(--s-4); }
  .topbar__title { font-size: var(--t-18); }
  .content { padding: var(--s-3); }
}

/* Animación de entrada */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp var(--t-med) var(--ease) both; }
.fade-up-stagger > * { animation: fadeUp var(--t-med) var(--ease) both; }
.fade-up-stagger > *:nth-child(1) { animation-delay: 0ms; }
.fade-up-stagger > *:nth-child(2) { animation-delay: 30ms; }
.fade-up-stagger > *:nth-child(3) { animation-delay: 60ms; }
.fade-up-stagger > *:nth-child(4) { animation-delay: 90ms; }
.fade-up-stagger > *:nth-child(5) { animation-delay: 120ms; }
.fade-up-stagger > *:nth-child(n+6) { animation-delay: 150ms; }

/* HTMX indicator */
.htmx-indicator { opacity: 0; transition: opacity var(--t-fast); }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }
