/* PulseCore data pages: Nova Data, Crystals, Strings.
   Loaded after home.css (tokens, nav, footer) and book.css (crumbs, heads). */

.pc-data-main { padding-top: 38px; }

/* ---------- Sub-nav ---------- */
.data-tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 34px;
    padding-bottom: 0;
    border-bottom: 1px solid var(--line);
}
.data-tabs a {
    padding: 10px 14px 12px;
    font-size: 0.95rem;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s ease, border-color .15s ease;
}
.data-tabs a:hover { color: var(--text); }
.data-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--phase-1); }
.data-tabs-game { margin-left: auto; color: var(--phase-1) !important; }

/* ---------- Head ---------- */
.data-head { margin-bottom: 26px; }
.data-head .prose-summary { max-width: 70ch; }
.data-head .lede-links { margin: 12px 0 0; font-size: 0.9rem; color: var(--text-mute); }
.data-head .lede-links a { color: var(--phase-1); }

/* ---------- Figures ---------- */
.data-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 0 0 30px;
}
.stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.stat-v {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.stat:first-child .stat-v {
    background: linear-gradient(100deg, var(--phase-0), var(--phase-mid) 60%, var(--phase-1));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-k { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-mute); }
.stat-sub { font-size: 0.8rem; color: var(--text-dim); }

/* ---------- Sections ---------- */
.data-section { margin: 0 0 34px; }
.data-section > h2 {
    margin: 0 0 12px;
    font-size: 1.15rem;
    font-weight: 650;
}
.data-section > h2 small { font-weight: 400; color: var(--text-mute); font-size: 0.85rem; margin-left: 8px; }
.data-note { margin: 0 0 14px; color: var(--text-dim); font-size: 0.92rem; max-width: 76ch; }
.data-note a { color: var(--phase-1); }
.data-two { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 820px) { .data-two { grid-template-columns: 1fr 1fr; } }
.panel {
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.panel h3 { margin: 0 0 10px; font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--phase-1); }

/* ---------- Bar charts ---------- */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 6.5rem 1fr 6rem; align-items: center; gap: 10px; font-size: 0.88rem; }
.bar-label { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { position: relative; height: 12px; background: rgba(255,255,255,.05); border-radius: 999px; overflow: visible; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--phase-mid), var(--phase-1)); }
.bar-mark { position: absolute; top: -3px; width: 2px; height: 18px; margin-left: -1px; background: var(--phase-0); border-radius: 1px; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.legend { margin: 10px 0 0; font-size: 0.8rem; color: var(--text-mute); }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }
.legend .swatch.fill { background: linear-gradient(90deg, var(--phase-mid), var(--phase-1)); }
.legend .swatch.mark { width: 2px; height: 12px; background: var(--phase-0); margin-right: 9px; }

/* ---------- Filters ---------- */
.data-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 14px;
    margin: 0 0 18px;
    padding: 14px 16px;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.data-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); }
.data-filters select, .data-filters input {
    min-width: 9rem;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.92rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.data-filters input[type="search"] { min-width: 12rem; }
.data-filters .btn { padding: 9px 18px; font-size: 0.9rem; }
.data-filters .clear { font-size: 0.85rem; color: var(--text-mute); padding-bottom: 10px; }
.data-filters .clear:hover { color: var(--phase-1); }
.data-count { margin: 0 0 12px; font-size: 0.88rem; color: var(--text-mute); }

/* ---------- Runs (a universe, or a legacy timeline) ---------- */
.runs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.run { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; }
.run > summary { list-style: none; cursor: pointer; padding: 14px 16px; border-radius: 12px; }
.run > summary::-webkit-details-marker { display: none; }
.run > summary:hover { background: rgba(255,255,255,.025); }
.run[open] > summary { border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.run-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 14px; }
.run-caret { color: var(--text-mute); font-size: 0.8rem; width: 1em; transition: transform .15s ease; }
.run[open] .run-caret { transform: rotate(90deg); }
.run-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.run-title strong { font-weight: 650; }
.run-title a { color: var(--phase-1); }
.run-nums { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: flex-end; font-size: 0.84rem; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.run-nums b { color: var(--text); font-weight: 600; }
.run-sub { grid-column: 2 / span 2; font-size: 0.82rem; color: var(--text-mute); }
.run-body { padding: 4px 16px 14px; }
.run-body .data-table { margin-top: 10px; }
.run-more { font-size: 0.86rem; color: var(--phase-1); }
@media (max-width: 640px) {
    .run-head { grid-template-columns: auto 1fr; }
    .run-nums { grid-column: 2; justify-content: flex-start; }
    .run-sub { grid-column: 2; }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-mute);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.data-table td { padding: 9px 10px; border-bottom: 1px solid rgba(35,38,46,.6); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: rgba(255,255,255,.025); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em; }
.data-table a { color: var(--phase-1); }
.data-table .dim { color: var(--text-mute); }
.data-table td.when { white-space: nowrap; color: var(--text-dim); }

/* ---------- Chips ---------- */
.chip {
    display: inline-block;
    padding: 2px 9px;
    font-size: 0.74rem;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--text-dim);
    background: rgba(255,255,255,.05);
    border: 1px solid var(--line);
    border-radius: 999px;
    vertical-align: middle;
}
.chip.level { color: #c6fbf8; background: rgba(53,232,224,.09); border-color: rgba(53,232,224,.32); }
.chip.legacy { color: var(--text-mute); }
.chip.done { color: #ffd6e1; background: rgba(255,51,102,.1); border-color: rgba(255,51,102,.35); }
.chip.live { color: #d8f5d0; background: rgba(120,220,120,.1); border-color: rgba(120,220,120,.35); }
.chip.tier-1 { --h: 330; } .chip.tier-2 { --h: 160; } .chip.tier-3 { --h: 200; } .chip.tier-4 { --h: 290; } .chip.tier-5 { --h: 48; }
.chip[class*="tier-"] { color: hsl(var(--h) 90% 80%); background: hsl(var(--h) 80% 60% / .12); border-color: hsl(var(--h) 80% 60% / .45); }
.chip.tier-5 { box-shadow: 0 0 12px hsl(48 90% 60% / .25); }
.chip.nova-micro { color: var(--text-dim); }
.chip.nova-standard { color: #c6fbf8; border-color: rgba(53,232,224,.32); }
.chip.nova-macro { color: #e9c7f5; border-color: rgba(176,92,196,.5); }
.chip.nova-hyper { color: #ffd6e1; border-color: rgba(255,51,102,.5); box-shadow: 0 0 12px rgba(255,51,102,.2); }
.player { color: var(--text); }
.player.anon { color: var(--text-mute); font-style: italic; }

/* ---------- Facts (a detail page) ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 0; }
.facts div { padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 9px; }
.facts dt { margin: 0 0 3px; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); }
.facts dd { margin: 0; font-size: 0.98rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.facts dd small { color: var(--text-mute); font-size: 0.8rem; }
.facts dd a { color: var(--phase-1); }
.detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.detail-hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; color: var(--text-mute); }

/* ---------- Grids drawn from the saved field ---------- */
.grids { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-card { padding: 12px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; }
.grid-card h3 { margin: 0 0 8px; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--phase-1); }
.grid-card canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; border-radius: 6px; background: #000; }
.grid-card p { margin: 8px 0 0; font-size: 0.82rem; color: var(--text-mute); }

/* ---------- Timeline of wells ---------- */
.well-line { position: relative; height: 26px; margin: 8px 0 4px; background: rgba(255,255,255,.05); border-radius: 6px; }
.well-line i { position: absolute; top: 4px; width: 3px; height: 18px; margin-left: -1px; background: var(--phase-1); border-radius: 2px; }
.well-line i.merger { background: var(--phase-0); }
.well-line-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-mute); }

/* ---------- Pager ---------- */
.pager-nums { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 22px 0 0; font-size: 0.9rem; }
.pg { padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--text-dim); }
.pg:hover { border-color: var(--phase-1); color: var(--text); }
.pg.is-here { color: var(--text); border-color: var(--phase-1); background: rgba(53,232,224,.08); }
.pg.is-spent { color: var(--text-mute); opacity: .5; }
.pg-gap { padding: 0 4px; color: var(--text-mute); }

/* ---------- Empty ---------- */
.empty { padding: 34px 18px; text-align: center; color: var(--text-dim); background: var(--bg-card); border: 1px dashed var(--line); border-radius: 12px; }
.empty a { color: var(--phase-1); }
.lineage { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.lineage li a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 0.88rem; }
.lineage li a:hover { border-color: var(--phase-1); }
.lineage-tree { list-style: none; margin: 6px 0 0 14px; padding: 0 0 0 12px; border-left: 1px solid var(--line); }
.lineage-tree li { padding: 4px 0; font-size: 0.9rem; }
.lineage-tree a { color: var(--phase-1); }
