/* /research/fractality — own file per the "new CSS/JS go in their own
   files, not style.css/motion-charts.css" convention (see layout.tsx's
   hasFractality prop). Reuses style.css's design tokens (--border,
   --text-dim, --bg-raised, --font-mono, --motion-draw) — must load
   alongside style.css, never standalone. Six market line colors are new
   tokens local to this file (not a categorical palette used anywhere else
   on the site yet). */

:root {
  --frac-1: #4da3e6; /* ES */
  --frac-2: #6bd67a; /* NQ */
  --frac-3: #e0b04f; /* YM */
  --frac-4: #b58ce6; /* RTY */
  --frac-5: #e0789e; /* GC */
  --frac-6: #4fd1c5; /* CL */
  --frac-ref: #5b6270;
}

.frac-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 18px 0;
}

@media (min-width: 760px) {
  .frac-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.frac-panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.frac-panel-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.frac-panel-spread {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.frac-svg-wrap {
  width: 100%;
}

.frac-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.frac-svg-wide {
  max-width: 720px;
}

.frac-gridline {
  stroke: var(--instrument-border, var(--border));
  stroke-width: 1;
}

.frac-axis-text {
  fill: var(--text-dim);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
}

.frac-xtick {
  font-size: 8.5px;
}

.frac-line {
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.frac-line-ref {
  stroke: var(--frac-ref);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
}

.frac-line-1 { stroke: var(--frac-1); }
.frac-line-2 { stroke: var(--frac-2); }
.frac-line-3 { stroke: var(--frac-3); }
.frac-line-4 { stroke: var(--frac-4); }
.frac-line-5 { stroke: var(--frac-5); }
.frac-line-6 { stroke: var(--frac-6); }

.frac-dot {
  fill: var(--bg-raised);
  stroke-width: 1.4;
}
.frac-dot.frac-line-1 { stroke: var(--frac-1); fill: var(--frac-1); }
.frac-dot.frac-line-2 { stroke: var(--frac-2); fill: var(--frac-2); }
.frac-dot.frac-line-3 { stroke: var(--frac-3); fill: var(--frac-3); }
.frac-dot.frac-line-4 { stroke: var(--frac-4); fill: var(--frac-4); }
.frac-dot.frac-line-5 { stroke: var(--frac-5); fill: var(--frac-5); }
.frac-dot.frac-line-6 { stroke: var(--frac-6); fill: var(--frac-6); }

.frac-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 8px 0 18px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.frac-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.frac-legend-swatch {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.frac-legend-swatch.frac-line-1 { background: var(--frac-1); }
.frac-legend-swatch.frac-line-2 { background: var(--frac-2); }
.frac-legend-swatch.frac-line-3 { background: var(--frac-3); }
.frac-legend-swatch.frac-line-4 { background: var(--frac-4); }
.frac-legend-swatch.frac-line-5 { background: var(--frac-5); }
.frac-legend-swatch.frac-line-6 { background: var(--frac-6); }
.frac-legend-swatch.frac-line-ref { background: var(--frac-ref); }

.frac-table-wrap {
  overflow-x: auto;
  margin: 10px 0 22px;
}

table.frac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

table.frac-table th,
table.frac-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

table.frac-table th:first-child,
table.frac-table td:first-child {
  text-align: left;
}

.frac-session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 12px 0 24px;
}

.frac-session-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
}

.frac-session-card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

/* Pre-animation state -- JS adds/removes these; SSR markup never carries
   them, so the chart already shows its final state with no JS at all. */
.frac-line[data-drawin].frac-pre-anim {
  transition: none;
}
.frac-line[data-drawin].frac-drawn {
  transition: stroke-dashoffset var(--motion-draw, 1000ms) ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .frac-line[data-drawin] {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
  }
}
