/* ==========================================================
   IMPERIO STUDIO — base.css
   Variables, reset, tipografía y temas
   ========================================================== */

/* ---------- Temas ---------- */
:root {
  /* Tipografía */
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Escala tipográfica fluida */
  --fs-xs: clamp(0.72rem, 0.70rem + 0.1vw, 0.78rem);
  --fs-sm: clamp(0.82rem, 0.80rem + 0.12vw, 0.90rem);
  --fs-base: clamp(0.94rem, 0.92rem + 0.14vw, 1.02rem);
  --fs-md: clamp(1.06rem, 1.02rem + 0.22vw, 1.18rem);
  --fs-lg: clamp(1.30rem, 1.22rem + 0.4vw, 1.55rem);
  --fs-xl: clamp(1.72rem, 1.5rem + 1vw, 2.35rem);
  --fs-hero: clamp(2.2rem, 1.7rem + 2.2vw, 3.6rem);

  /* Radios */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  /* Espaciado */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;
  --sp-10: 72px;

  /* Layout */
  --sidebar-w: 88px;
  --topbar-h: 72px;

  /* Transiciones */
  --t-fast: 140ms cubic-bezier(.2,.8,.2,1);
  --t-med: 260ms cubic-bezier(.2,.8,.2,1);
  --t-slow: 500ms cubic-bezier(.2,.8,.2,1);
}

/* ---------- Light theme ---------- */
:root,
[data-theme='light'] {
  --bg: #FAF8F4;          /* fondo cálido tipo papel */
  --bg-elev: #FFFFFF;     /* tarjetas */
  --bg-sunk: #F1EDE6;     /* zonas deprimidas */
  --surface: #FFFFFF;
  --surface-hover: #F5F1EA;

  --text: #1A1A1A;
  --text-soft: #4A4A4A;
  --text-muted: #8A8680;
  --text-ghost: #BEB9B0;

  --border: #E8E2D8;
  --border-strong: #D8D1C4;

  --accent: #C9A35C;          /* dorado imperial */
  --accent-hover: #B68D42;
  --accent-soft: #F5EBD5;
  --accent-contrast: #1A1A1A;

  --ink: #1A1A1A;              /* contraste fuerte */
  --ink-contrast: #FAF8F4;

  --shadow-sm: 0 1px 2px rgba(26, 20, 10, 0.04), 0 1px 1px rgba(26, 20, 10, 0.03);
  --shadow-md: 0 4px 16px rgba(26, 20, 10, 0.06), 0 2px 4px rgba(26, 20, 10, 0.04);
  --shadow-lg: 0 12px 40px rgba(26, 20, 10, 0.08), 0 4px 12px rgba(26, 20, 10, 0.04);

  --grid-line: rgba(26, 20, 10, 0.045);

  color-scheme: light;
}

/* ---------- Dark theme ---------- */
[data-theme='dark'] {
  --bg: #0E0C0A;           /* casi negro cálido */
  --bg-elev: #17140F;
  --bg-sunk: #0A0907;
  --surface: #1C1914;
  --surface-hover: #242018;

  --text: #F4F0E8;
  --text-soft: #C8C1B2;
  --text-muted: #8A8272;
  --text-ghost: #55504A;

  --border: #2A251D;
  --border-strong: #3A3428;

  --accent: #D4AF6A;
  --accent-hover: #E5C07C;
  --accent-soft: rgba(212, 175, 106, 0.15);
  --accent-contrast: #0E0C0A;

  --ink: #F4F0E8;
  --ink-contrast: #0E0C0A;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.3);

  --grid-line: rgba(244, 240, 232, 0.04);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-med), color var(--t-med);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

p {
  margin: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img, svg {
  display: block;
  max-width: 100%;
}

svg {
  flex-shrink: 0;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* Focus visible accesible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* Scrollbar refinado */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 2px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
