/* ============================================
   OPOLEVEL — Design tokens (LIGHT default, dark optional)
   Institutional, authoritative, monochrome + 1 accent.
   Default = papel cool de alto contraste. NO beige/crema.
   ============================================ */

:root {
  /* ——— Surfaces (light paper — cool, not warm) ——— */
  --ink-0:  oklch(0.955 0.005 250);   /* sunken: sidebars, sub-canvas */
  --ink-1:  oklch(0.982 0.004 250);   /* page bg */
  --ink-2:  oklch(1.000 0.000 0);     /* elevated surface / cards */
  --ink-3:  oklch(0.945 0.006 250);   /* hover state, nested cards */
  --ink-4:  oklch(0.930 0.007 250);   /* input bg / hover */

  /* ——— Lines ——— */
  --rule:        oklch(0.880 0.006 250);
  --rule-strong: oklch(0.760 0.008 250);
  --rule-faint:  oklch(0.930 0.006 250);

  /* ——— Type colors (deep cool ink) ——— */
  --ivory-0: oklch(0.130 0.008 260);   /* deepest text / display */
  --ivory-1: oklch(0.200 0.008 260);   /* primary body */
  --ivory-2: oklch(0.380 0.010 260);   /* secondary */
  --ivory-3: oklch(0.520 0.010 260);   /* tertiary / labels */
  --ivory-4: oklch(0.620 0.010 260);   /* muted */
  --ivory-5: oklch(0.760 0.008 260);   /* disabled */

  /* ——— Accent (oxblood) — calibrado para AAA en blanco ——— */
  --accent:        oklch(0.515 0.180 27);
  --accent-hover:  oklch(0.460 0.170 27);
  --accent-deep:   oklch(0.380 0.140 27);
  --accent-soft:   oklch(0.945 0.035 27);  /* fondo teñido sutil */
  --accent-ink:    oklch(0.995 0.000 0);   /* texto sobre acento */

  /* Accent washes — para fondos tintados (banners, callouts, AI msgs) */
  --accent-wash:   oklch(0.965 0.024 27);
  --accent-wash-2: oklch(0.940 0.040 27);

  /* Neutral wash — para mensajes AI / banners no-acentuados */
  --tint-cool:     oklch(0.970 0.010 250);
  --tint-cool-2:   oklch(0.945 0.015 250);

  /* ——— Status (sober, calibrado para light) ——— */
  --ok:        oklch(0.500 0.130 152);
  --ok-soft:   oklch(0.945 0.040 152);
  --warn:      oklch(0.560 0.130 78);
  --warn-soft: oklch(0.945 0.040 78);
  --err:       var(--accent);

  /* ——— Type ——— */
  --font-display: "Newsreader", "Source Serif Pro", Georgia, serif;
  --font-sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;

  /* ——— Radii ——— */
  --r-1: 2px;
  --r-2: 4px;
  --r-3: 6px;
  --r-4: 10px;
  --r-pill: 999px;

  /* ——— Shadows (print-like, subtle) ——— */
  --shadow-1:   0 1px 0 oklch(0.85 0.005 250 / 0.6), 0 1px 2px oklch(0.15 0.01 250 / 0.05);
  --shadow-2:   0 1px 0 oklch(0.85 0.005 250 / 0.7), 0 12px 32px oklch(0.15 0.01 250 / 0.06);
  --shadow-pop: 0 30px 80px -20px oklch(0.15 0.01 250 / 0.20), 0 1px 0 oklch(0.85 0.005 250 / 0.8);

  /* ——— Layout ——— */
  --maxw: 1240px;
  --gutter: 32px;

  /* Topbar / overlay backgrounds (themed) */
  --overlay-bg: oklch(1.000 0 0 / 0.86);
  --overlay-bg-strong: oklch(1.000 0 0 / 0.94);

  /* Subtle radial glow for hero / page heads */
  --glow-neutral: oklch(0.965 0.008 250);
}

/* Utilities */
.container {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  width: 100%;
}
.container--reading {
  max-width: 800px;
}

/* ——— DARK theme (opt-in via [data-theme="dark"]) ——— */
[data-theme="dark"] {
  --ink-0:  oklch(0.135 0.006 250);
  --ink-1:  oklch(0.170 0.007 250);
  --ink-2:  oklch(0.205 0.008 250);
  --ink-3:  oklch(0.240 0.009 250);
  --ink-4:  oklch(0.290 0.010 250);

  --rule:        oklch(0.290 0.010 250);
  --rule-strong: oklch(0.380 0.012 250);
  --rule-faint:  oklch(0.230 0.008 250);

  --ivory-0: oklch(0.985 0.004 80);
  --ivory-1: oklch(0.945 0.005 82);
  --ivory-2: oklch(0.820 0.007 82);
  --ivory-3: oklch(0.660 0.010 82);
  --ivory-4: oklch(0.500 0.012 82);
  --ivory-5: oklch(0.380 0.012 82);

  --accent:        oklch(0.575 0.190 27);
  --accent-hover:  oklch(0.640 0.200 27);
  --accent-deep:   oklch(0.430 0.150 27);
  --accent-soft:   oklch(0.260 0.060 27);
  --accent-ink:    oklch(0.985 0.004 80);

  --accent-wash:   oklch(0.225 0.040 27);
  --accent-wash-2: oklch(0.260 0.060 27);

  --tint-cool:     oklch(0.205 0.012 250);
  --tint-cool-2:   oklch(0.230 0.015 250);

  --ok:        oklch(0.700 0.110 152);
  --ok-soft:   oklch(0.290 0.040 152);
  --warn:      oklch(0.780 0.130 78);
  --warn-soft: oklch(0.300 0.045 78);

  --overlay-bg: oklch(0.135 0.006 250 / 0.86);
  --overlay-bg-strong: oklch(0.135 0.006 250 / 0.94);
  --glow-neutral: oklch(0.22 0.012 250);

  --shadow-1:   0 1px 0 oklch(0.10 0.006 250 / 0.7), 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-2:   0 2px 0 oklch(0.10 0.006 250 / 0.5), 0 8px 24px oklch(0 0 0 / 0.35);
  --shadow-pop: 0 24px 60px -12px oklch(0 0 0 / 0.6), 0 2px 0 oklch(0 0 0 / 0.4);
}

/* Reset-ish */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--ink-1);
  color: var(--ivory-1);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv05", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Display heading defaults */
.h-display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 1.02;
  color: var(--ivory-0);
}
.h-display em { font-style: italic; color: var(--ivory-0); }

.mono { font-family: var(--font-mono); font-feature-settings: "zero", "ss01"; }
.upper { text-transform: uppercase; letter-spacing: 0.14em; }
.tnum  { font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  background: var(--ink-2);
  color: var(--ivory-1);
  border-radius: var(--r-2);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  box-shadow: var(--shadow-1);
}
.btn:hover { background: var(--ink-3); border-color: var(--rule-strong); }
.btn:active { transform: translateY(1px); }

/* Anchors usados como botones: color base (NO debe pisar las variantes que vienen después) */
a.btn { text-decoration: none; }
a.btn,
a.btn:visited { color: var(--ivory-1); }
a.btn:hover { color: var(--ivory-0); }

/* Variantes — DEBEN ir después de a.btn para ganar el cascade con misma specificity */
.btn--primary,
a.btn--primary,
.btn--primary:visited,
a.btn--primary:visited {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover,
a.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}
.btn--ghost,
a.btn--ghost,
a.btn--ghost:visited {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ivory-2);
}
.btn--ghost:hover,
a.btn--ghost:hover { background: var(--ink-3); border-color: var(--rule); color: var(--ivory-0); }
.btn--sm { padding: 6px 10px; font-size: 12.5px; }
.btn--lg { padding: 13px 22px; font-size: 14.5px; }
.btn--block { width: 100%; justify-content: center; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ivory-3);
  font-weight: 500;
}
.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--ink-2);
  color: var(--ivory-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  font-size: 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--rule-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--ink-2);
  box-shadow: 0 0 0 3px oklch(0.515 0.180 27 / 0.10);
}
.input::placeholder, .textarea::placeholder { color: var(--ivory-4); }

/* Cards */
.card {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-3);
}
.card--flat { background: transparent; }

/* Tags / chips */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 500;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  color: var(--ivory-2);
  background: var(--ink-2);
}
.tag--accent { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tag--ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.tag--warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.tag--solid { background: var(--ink-3); }

/* Divider */
.rule { height: 1px; background: var(--rule); border: 0; }
.rule--faint { background: var(--rule-faint); }

/* Hairline focusable cell */
.cell-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-2);
  color: var(--ivory-2);
  transition: background .12s, color .12s;
  cursor: pointer;
  font-size: 13.5px;
}
.cell-btn:hover { background: var(--ink-3); color: var(--ivory-1); }
.cell-btn.is-active { background: var(--ink-3); color: var(--ivory-0); }
.cell-btn .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: 0; }
.cell-btn.is-active .dot { opacity: 1; }

/* Utility */
.row { display: flex; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.grow { flex: 1; }
.muted { color: var(--ivory-4); }
.sec   { color: var(--ivory-3); }
.faint { color: var(--ivory-2); }

/* Logo mark */
.brand {
  display: inline-flex; align-items: baseline; gap: 0;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: 22px;
  color: var(--ivory-0);
}
.brand .dot { color: var(--accent); }
.brand small {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ivory-4);
  margin-left: 10px;
  align-self: center;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .brand small { display: none; }
}

/* Scrollbars (webkit) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 10px; }
*::-webkit-scrollbar-thumb:hover { background: var(--rule-strong); }

/* ── Bloques Gutenberg: mapear wp-element-button al design system ─────────── */
.wp-block-button__link.wp-element-button,
.wp-block-button__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--r-2);
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  /* Color corporativo: acento rojo-naranja sobre blanco puro */
  background: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  color: var(--accent-ink) !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.wp-block-button__link.wp-element-button:hover,
.wp-block-button__link:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
  color: var(--accent-ink) !important;
  transform: translateY(-1px);
}
.wp-block-button__link.wp-element-button:active,
.wp-block-button__link:active {
  transform: translateY(1px);
}
/* Alineación central cuando está dentro de wp-block-buttons */
.wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}
.wp-block-buttons.is-content-justification-center { justify-content: center; }
.wp-block-buttons.is-content-justification-right  { justify-content: flex-end; }
