/* Features overview, "The core twelve" (features.dc.html): four
   cards, each opened by a small instrument for its family, and a map of the
   whole catalogue beside them. js/features-core.js builds the instruments and
   the map from the page's own data and runs them; the page mounts it on the
   section. Colours come from the page tokens, so both themes follow. */
.core { --core-ease: cubic-bezier(.2, .8, .2, 1); --core-warn: color-mix(in srgb, #eaa23c 82%, var(--text)); }

/* Heading column: the count, the catalogue map, and the way into it. */
.core-head { flex: 0 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.core-tally { margin-top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.core-count { margin: 0; display: flex; align-items: baseline; gap: 10px; font: 400 12px/1 var(--f-mono); color: var(--faint); }
.core-count b { font: 500 32px/1 var(--f-sans); letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; }
.core-map { box-sizing: border-box; max-width: 100%; margin-top: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.core-map:empty { display: none; }
.core-map svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.core-dot { fill: var(--line-2); transition: fill .3s ease, opacity .35s ease; }
.core-dot.is-core { fill: var(--accent); }
.core-row.is-on .core-dot:not(.is-core) { fill: color-mix(in srgb, var(--text) 46%, transparent); }
.core-dot.is-hot { filter: drop-shadow(0 0 2.5px var(--accent)); }
.core-pick { fill: none; stroke: var(--text); stroke-width: 1; opacity: 0; transition: opacity .2s ease, transform .35s var(--core-ease); }
.core-pick.is-on { opacity: 1; }
.core-map__caption { margin: 0; display: flex; flex-direction: column; gap: 2px; min-height: calc(2.9em + 2px); font: 400 11px/1.45 var(--f-mono); letter-spacing: .02em; color: var(--faint); }
.core-map__name { color: var(--muted); transition: color .25s ease; }
.core-map__caption.is-on .core-map__name { color: var(--text); }
.core-map__meta.is-key { display: inline-flex; align-items: center; gap: 8px; }
.core-map__meta.is-key::before { content: ''; width: 4px; height: 4px; border-radius: 1px; background: var(--accent); }
.core-browse { display: inline-flex; align-items: center; gap: 8px; height: 34px; margin-top: 2px; padding: 0 13px; box-sizing: border-box; border: 1px solid var(--line-2); border-radius: 8px; font: 500 13px/1 var(--f-sans); color: var(--text); transition: border-color .25s ease, background .25s ease; }
.core-browse:hover { border-color: var(--muted); background: var(--surface); color: var(--text); }

/* The grid: hairlines are the grid's own ground showing between the cards, so
   a light behind them reads as the borders catching the pointer. */
.core-grid { position: relative; isolation: isolate; flex: 1 1 600px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1px; padding: 1px; border-radius: 14px; overflow: hidden; background: var(--line); }
.core-grid::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(300px circle at var(--core-x, -999px) var(--core-y, -999px), color-mix(in srgb, var(--accent) 62%, transparent), transparent 70%); opacity: 0; transition: opacity .45s ease; }
.core-grid::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(420px circle at var(--core-x, -999px) var(--core-y, -999px), color-mix(in srgb, var(--accent) 5%, transparent), transparent 62%); opacity: 0; transition: opacity .45s ease; }
.core-grid[data-pointer]::before, .core-grid[data-pointer]::after { opacity: 1; }

.core-card { box-sizing: border-box; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 10px 10px 20px; background: var(--bg); }
.core-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 12px; }
.core-card__title { flex: 1 1 auto; min-width: 0; margin: 0; font-family: var(--f-sans); color: var(--text); text-wrap: balance; }
.core-card__range { flex: none; font: 400 11px/1 var(--f-mono); letter-spacing: .04em; color: var(--faint); transition: color .35s ease; }

.core-feats { margin: 0; padding: 0 12px; list-style: none; display: flex; flex-direction: column; }
.core-feat { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: baseline; margin: 0 -10px; padding: 8px 10px; border-radius: 8px; transition: background .25s ease; }
.core-feat:hover { background: color-mix(in srgb, var(--surface) 85%, transparent); }
.core-feat__num { font: 400 11px/1 var(--f-mono); color: var(--faint); transition: color .25s ease; }
.core-feat:hover .core-feat__num { color: var(--accent); }
.core-feat__body { display: flex; flex-direction: column; gap: 4px; }
.core-feat__body b { font: 500 14px/1.35 var(--f-sans); color: var(--text); }
.core-feat__body span { font: 400 13px/1.5 var(--f-sans); color: var(--muted); text-wrap: pretty; }

/* Plates: the instrument at the head of each card. */
.core-plate { position: relative; box-sizing: border-box; height: 88px; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 0) 0 0 / 12px 12px, linear-gradient(180deg, var(--surface), var(--bg)); transition: border-color .45s ease, box-shadow .45s ease; }
.core-plate__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 10px; font: 500 11px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.core-plate__top > :first-child { display: inline-flex; align-items: center; gap: 8px; transition: color .35s ease; }
.core-plate__top > :first-child::before { content: ''; width: 5px; height: 5px; border-radius: 1px; background: var(--accent); }
.core-plate__status { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-variant-numeric: tabular-nums; }
.core-plate__stage { position: relative; flex: 1; min-height: 0; }
.core-card[data-on] .core-plate { border-color: color-mix(in srgb, var(--accent) 36%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 5%, transparent); }
.core-card[data-on] .core-plate__top > :first-child, .core-card[data-on] .core-card__range { color: var(--text); }
.core-live { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.core-card[data-on] .core-live { animation: core-live 1.6s ease-out infinite; }
@keyframes core-live { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } to { box-shadow: 0 0 0 6px transparent; } }

/* Intake and triage: mail lands as tickets, newest on top. */
.core-q { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.core-q__row { flex: none; box-sizing: border-box; height: 22px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--bg) 72%, transparent); font: 400 9.5px/1 var(--f-mono); color: var(--faint); }
.core-q__row.is-new { animation: core-q-in .65s var(--core-ease) both, core-q-glow 2.4s ease-out both; }
.core-q__subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 11px/1 var(--f-sans); color: var(--text); }
.core-q__source, .core-q__p { padding: 3px 5px; border-radius: 3px; border: 1px solid var(--line-2); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; }
.core-q__p { color: var(--muted); }
.core-q__p[data-p='1'] { border-color: transparent; background: var(--teal-wash); color: var(--accent); }
.core-q__p[data-p='2'] { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
@keyframes core-q-in { from { margin-top: -26px; opacity: 0; } }
@keyframes core-q-glow { from { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background-color: color-mix(in srgb, var(--accent) 13%, var(--bg)); } }

/* SLAs and time: impact × urgency picks the priority; both clocks run. */
.core-m { position: absolute; inset: 0; display: flex; align-items: center; gap: 14px; }
.core-m__grid { position: relative; flex: none; display: grid; grid-template-columns: repeat(5, 7px); grid-auto-rows: 7px; gap: 2px; }
.core-m__cell { border-radius: 1.5px; background: var(--accent); }
.core-m__ring { position: absolute; left: -2px; top: -2px; box-sizing: border-box; width: 11px; height: 11px; border: 1px solid var(--text); border-radius: 3px; transition: transform .6s var(--core-ease); }
.core-m__chip { flex: none; display: grid; place-items: center; width: 30px; height: 30px; box-sizing: border-box; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 7px; background: color-mix(in srgb, var(--accent) 10%, transparent); font: 600 12px/1 var(--f-mono); color: var(--accent); }
.core-m__clocks { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.core-m__meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font: 500 8.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.core-m__pct { font-variant-numeric: tabular-nums; color: var(--muted); transition: color .35s ease; }
.core-m__track { display: block; height: 4px; overflow: hidden; border-radius: 2px; background: var(--line-2); }
.core-m__fill { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .35s ease, background-color .35s ease; }
.core-m__clock.is-warn .core-m__fill { background: var(--core-warn); }
.core-m__clock.is-warn .core-m__pct { color: var(--core-warn); }

/* Knowledge and collaboration: a ticket gathers its context. */
.core-g, .core-c { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.core-g__edge { fill: none; stroke: color-mix(in srgb, var(--text) 28%, transparent); stroke-width: 1; transition: stroke .45s ease, stroke-dashoffset .25s linear; }
.core-card[data-on] .core-g__edge { stroke: color-mix(in srgb, var(--accent) 60%, transparent); }
.core-g__node { fill: var(--bg); stroke: color-mix(in srgb, var(--text) 62%, transparent); stroke-width: 1; transform-box: fill-box; transform-origin: center; transition: transform .3s var(--core-ease); }
.core-g__ticket { fill: var(--accent); }
.core-g__halo { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0; transform-box: fill-box; transform-origin: center; }
.core-g__label { font: 500 8px var(--f-mono); letter-spacing: .06em; fill: var(--muted); transition: opacity .3s ease; }
.core-g__label--ticket { fill: var(--text); }
.core-g__pulse { fill: var(--accent); opacity: 0; }

/* Reporting and security: a week of volume, read day by day. */
.core-c__grid { stroke: var(--line); stroke-width: 1; }
.core-c__stop { stop-color: var(--accent); }
.core-c__area { transition: opacity .3s ease; }
.core-c__line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke-dashoffset .25s linear; }
.core-c__dot { fill: var(--bg); stroke: var(--accent); stroke-width: 1.2; transform-box: fill-box; transform-origin: center; transition: transform .3s var(--core-ease), fill .3s ease, opacity .25s ease; }
.core-c__dot.is-on { fill: var(--accent); transform: scale(1.45); }
.core-c__day { font: 500 8px var(--f-mono); fill: var(--faint); transition: fill .3s ease; }
.core-c__day.is-on { fill: var(--text); }
.core-c__value { font: 600 9px var(--f-mono); fill: var(--text); transition: opacity .25s ease; }

/* Entrance: only when the script has armed the section, so nothing is ever
   hidden without it. */
.core[data-core-armed] .core-card, .core[data-core-armed] .core-tally { transition: opacity .7s var(--core-ease) var(--core-delay, 0ms), transform .9s var(--core-ease) var(--core-delay, 0ms); }
.core[data-core-armed] .core-card:not([data-in]), .core[data-core-armed] .core-tally:not([data-in]) { opacity: 0; transform: translateY(18px); }
.core-map[data-armed] .core-dot { opacity: 0; }
.core-map[data-armed] .core-dot.is-core { fill: var(--line-2); }
.core-map[data-armed][data-in] .core-dot { opacity: 1; transition-delay: 0ms, calc(var(--d, 0) * 1ms); }
.core-map[data-armed][data-in] .core-dot.is-core { fill: var(--accent); transition-delay: calc(880ms + var(--k, 0) * 85ms), calc(var(--d, 0) * 1ms); }

/* Side by side, the heading and map stay in view while the cards pass. */
@media (min-width: 966px) and (min-height: 640px) {
  .core-head { position: sticky; top: 88px; align-self: flex-start; }
}
/* Stacked: the heading runs across, the map beside it. */
@media (max-width: 965px) {
  .core-head { flex-basis: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; gap: 16px 40px; }
  .core-tally { grid-column: 2; grid-row: 1 / 3; margin-top: 0; }
}
/* Phones: no pointer to read the map with, so the count and the way in stay. */
@media (max-width: 640px) {
  .core-head { display: flex; }
  .core-tally { margin-top: 8px; }
  .core-map, .core-map__caption { display: none; }
}
