/* TechCharts v2.1 — Modern CSS */
:root {
  --tc-bg: #ffffff;
  --tc-surface: #f7f8fa;
  --tc-border: rgba(0,0,0,0.1);
  --tc-text: #1a1a1a;
  --tc-text-muted: #6b7280;
  --tc-accent: #01696f;
  --tc-accent-hover: #0c4e54;
  --tc-radius: 10px;
  --tc-shadow: 0 2px 12px rgba(0,0,0,0.07);
  --tc-transition: 180ms cubic-bezier(0.16,1,0.3,1);
}

/* ── Dark mode — activado por el toggle del sitio (.mode--alt--b) ── */
.mode--alt--b {
  --tc-bg: #1c1b19;
  --tc-surface: #252422;
  --tc-border: rgba(255,255,255,0.1);
  --tc-text: #e0dfdd;
  --tc-text-muted: #9ca3af;
  --tc-accent: #4f98a3;
  --tc-accent-hover: #227f8b;
  --tc-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* ── Forzado por atributo del shortcode (darkmode="dark|light") ── */
.tc-wrap[data-darkmode="dark"] {
  --tc-bg: #1c1b19;
  --tc-surface: #252422;
  --tc-border: rgba(255,255,255,0.1);
  --tc-text: #e0dfdd;
  --tc-text-muted: #9ca3af;
  --tc-accent: #4f98a3;
  --tc-accent-hover: #227f8b;
  --tc-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.tc-wrap[data-darkmode="light"] {
  --tc-bg: #ffffff;
  --tc-surface: #f7f8fa;
  --tc-border: rgba(0,0,0,0.1);
  --tc-text: #1a1a1a;
  --tc-text-muted: #6b7280;
  --tc-accent: #01696f;
  --tc-accent-hover: #0c4e54;
  --tc-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

/* ── Wrapper ────────────────────────────────────── */
.tc-wrap {
  box-sizing: border-box;
  max-width: 100%;
  min-width: min(280px, 100%);
  background: var(--tc-bg);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow);
  padding: 20px 20px 14px;
  margin: 1.5rem 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--tc-text);
  transition: box-shadow var(--tc-transition);
}

.tc-wrap:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,0.11);
}

.tc-align-left   { float: left; margin-right: 1.5rem; }
.tc-align-right  { float: right; margin-left: 1.5rem; }
.tc-align-center { margin-inline: auto; }
.tc-align-none   { float: none; }

.tc-title {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  font-weight: 600;
  color: var(--tc-text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--tc-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Canvas ─────────────────────────────────────── */
.tc-canvas-wrap {
  position: relative;
  width: 100%;
}

.tc-canvas-wrap canvas {
  display: block;
  width: 100% !important;
}

/* ── Caption / Source ───────────────────────────── */
.tc-caption {
  font-size: 0.8rem;
  color: var(--tc-text-muted);
  margin-top: 10px;
  font-style: italic;
  text-align: center;
}

.tc-source {
  font-size: 0.75rem;
  color: var(--tc-text-muted);
  margin-top: 4px;
  text-align: right;
}

.tc-source a {
  color: var(--tc-accent);
  text-decoration: none;
}

.tc-source a:hover {
  text-decoration: underline;
}

/* ── Toolbar ─────────────────────────────────────── */
.tc-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.tc-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--tc-border);
  background: var(--tc-surface);
  color: var(--tc-text-muted);
  transition: all var(--tc-transition);
}

.tc-toolbar button:hover {
  background: var(--tc-accent);
  border-color: var(--tc-accent);
  color: #fff;
}

.tc-toolbar button:focus-visible {
  outline: 2px solid var(--tc-accent);
  outline-offset: 3px;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .tc-wrap { width: 100% !important; }
}

@media (max-width: 640px) {
  .tc-align-left,
  .tc-align-right {
    float: none;
    margin: 1.25rem 0;
    width: 100% !important;
  }
}

/* ── Loading skeleton ────────────────────────────── */
.tc-skeleton {
  background: linear-gradient(
    90deg,
    var(--tc-surface) 25%,
    var(--tc-border) 50%,
    var(--tc-surface) 75%
  );
  background-size: 200% 100%;
  animation: tcShimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes tcShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tc-skeleton { animation: none; }
}
