/* Cards, badges, charts and the section grids (design §6.2). Figures stand on panels that are solid with Material off and
   the panel's own colour at 88% from Flat on (tokens.css, round 21): no blur here, so the four blurred surfaces stay four. */
.section { display: flex; flex-direction: column; gap: 12px; }
.section-title { margin: 0; font: 600 15px/1.2 var(--font); letter-spacing: -.01em; color: var(--ink); } /* sentence case (round 21) */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-title { min-width: 0; }
.card-head h2 { margin: 0; font: 600 14px/1.3 var(--font-title); }
.card-head .sub { margin: 2px 0 0; font-size: 12px; color: var(--ink-2); }
.tile { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); color: var(--ink-2); }
.card-tools { margin-left: auto; display: flex; gap: 2px; }
.card-tools span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.figure-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.figure { font: 600 32px/1 var(--font); letter-spacing: -.02em; } .context { font-size: 12px; color: var(--ink-2); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.spark { width: 120px; height: 28px; }
.chart.iv { max-width: 340px; } /* the interval scale keeps its size in a wide card */
.split-bar { display: flex; gap: 2px; height: 10px; border-radius: 6px; overflow: hidden; }
.split ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.split li { display: flex; align-items: center; gap: 6px; } .split li i { width: 8px; height: 8px; border-radius: 2px; } .split b { color: var(--ink); font-weight: 600; }
.dots { display: inline-flex; gap: 3px; margin-right: 8px; } .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-grid); } .dots i.on { background: var(--c-ramp-4); }
.coverage { margin: 0; display: flex; align-items: center; font-size: 12px; color: var(--ink-2); }
.card-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; color: var(--ink-2); background: var(--panel-2); }
.legend { margin: 0; display: flex; align-items: center; gap: 6px 12px; font-size: 12px; color: var(--ink-2); } .legend i { width: 10px; height: 10px; border-radius: 3px; margin-right: -6px; }
@media (max-width: 1023px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .grid { grid-template-columns: 1fr; } }

/* Section 2 (§6.2): the trend in the left two columns with Keune vs miiki beside it, the promoter mix the full width
   under both. (19 Oct: Keune vs miiki spanned both rows, as §6.2 drew it, and its two charts filled only the top half;
   beside the trend alone the two are about as tall.) */
.section-moved .grid { grid-template-rows: auto auto; }
.section-moved #trend { grid-column: 1 / span 2; grid-row: 1; }
.section-moved #brands { grid-column: 3; grid-row: 1; }
.section-moved #bands { grid-column: 1 / span 3; grid-row: 2; }
.frames { display: flex; flex-direction: column; gap: 18px; }
.frame h3 { margin: 0 0 4px; font: 600 13px/1 var(--font); display: flex; align-items: center; gap: 6px; } .frame h3 i { width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 1023px) { .section-moved .grid { grid-template-columns: 1fr; } .section-moved #trend, .section-moved #bands, .section-moved #brands { grid-column: 1; grid-row: auto; } }

/* Section 3: the source panel two columns wide, NPS by channel one. */
.section-cameFrom #source { grid-column: span 2; }
.ranked { display: flex; flex-direction: column; gap: 9px; }
.rank-row { display: grid; grid-template-columns: minmax(120px, 32%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.rank-bar { height: 10px; border-radius: 5px; background: var(--panel-2); } .rank-bar i { display: block; height: 100%; border-radius: 5px; } /* no overflow: hidden, which clipped the bar's glow (review, 19 Oct) */
.rank-value { color: var(--ink); font-weight: 600; min-width: 4ch; text-align: right; }
@media (max-width: 1023px) { .section-cameFrom #source { grid-column: auto; } }

/* The insights page (§6.1, #99): the month at a glance, then the findings by section. The first finding is the month's:
   the fourth glass surface in every theme, with the gold label and the edge light under it (frame.css; round 25). */
/* It fills the page as the dashboard does (Rob, 19 Oct: "insights more responsive"): the glance and Amplify (with the
   month's finding) run full width; Fix and Watch sit side by side where two 520 px columns fit, and stack where they do
   not; the sentences stop at about 90 characters, so a wide screen never makes them hard to read. */
/* Two columns at most: a column is at least 520 px, and at least half the row, so a third never forms. */
body[data-page="insights"] { --two-cols: repeat(auto-fit, minmax(min(100%, max(520px, calc((100% - var(--main-gap)) / 2))), 1fr)); } /* half the row less the main's own gap (frame.css) */
body[data-page="insights"] .main { display: grid; grid-template-columns: var(--two-cols); align-items: start; }
body[data-page="insights"] .main > .glance, body[data-page="insights"] .main > .glance + .insight-section { grid-column: 1 / -1; } /* Amplify, right after the glance */
.sentence, .try { max-width: 90ch; }
.header-more p { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; } .header-more .notice { font-size: 13px; }
.glance > h2, .insight-section > h2 { margin: 0; font: 600 16px/1.3 var(--font-title); }
.insight-section > p { margin: 2px 0 0; color: var(--ink-2); }
.glance-grid, .findings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
/* The findings keep the page's two-column rhythm (Amplify's cards as wide as Fix and Watch), the month's finding
   across both; where one column is all there is, each card fills it. */
.findings-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, max(520px, calc((100% - 16px) / 2))), 1fr)); }
.headline, .finding-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.headline h3, .finding-card h3, .finding h3 { margin: 0; font: 600 14px/1.35 var(--font); display: flex; gap: 8px; align-items: center; }
.headline .responses { margin: 0; font-size: 13px; color: var(--ink-2); }
.kind { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-2); color: var(--ink-2); flex: none; }
.sentence { margin: 0; font-size: 14.5px; line-height: 1.5; }
.try { margin: 0; color: var(--ink-2); font-size: 13px; } .try b { color: var(--ink); font-weight: 600; margin-right: 4px; }
.try a, .evidence { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.finding-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.finding-foot .evidence { margin-left: auto; font-size: 13px; }
.finding { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; padding: 20px 22px; border-radius: var(--radius); border: 1px solid var(--line); }
/* (Until round 25 the finding was solid ink in light, with words, tiles and a focus ring of its own. Rob, 19 Oct: "also
   light but highlighted … a bit more subtle like the others … more uniform". It takes the page's own words in every theme
   now, and its glass, rim and whisper are one rule, frame.css's .finding.glass.) */
.finding .label { color: var(--gold-word); font: 700 11px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; }
.finding .sentence { font: 500 18px/1.45 var(--font-title); }
.finding.edge::after { left: 8%; right: 8%; } .finding.edge::before { left: 14%; right: 14%; bottom: -10px; height: 18px; filter: blur(8px); }
@media (max-width: 767px) { .glance-grid, .findings-grid { grid-template-columns: 1fr; } }

/* ---- The glow (round 8; Rob kept it, round 9: "let's make everything pop"; in every theme since round 18: "the dark
   has glass and glow while white not"): a soft glow in each mark's own colour on every data mark, from look.js's
   #kumii-glow filter. Only with Glass and glow on (it is the glow) and More contrast off (a halo softens an edge). Where
   segments touch, the stacked columns and the split bar, the whole column or bar glows, never one segment alone, so no
   colour bleeds onto its neighbour; the hatched, thin figures, drawn with a pattern, not a colour, get none. One-colour
   HTML marks take a drop-shadow of their colour. ---- */
:root[data-glass="on"]:not([data-contrast="more"]) :is(.chart polyline, .chart .point, .chart path[fill^="var(--c-"], .chart path.lit, .chart g:not(.col) > rect[fill^="var(--c-"], .chart g.col:not(.thin), .chart.iv circle, .split-bar) { filter: url(#kumii-glow); }
:root[data-glass="on"]:not([data-contrast="more"]) .rank-bar i { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--c-ramp-3) 60%, transparent)); }
:root[data-glass="on"]:not([data-contrast="more"]) .dots i.on { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c-ramp-4) 70%, transparent)); }
/* The main numbers' subtle light (Rob: "maybe the important main numbers have subtle light too"; moodboard 223, 229):
   in dark a soft light of their own and the gold faintly from beneath; in light the gold from beneath (tokens.css,
   --figure-light). A shadow behind the glyphs, so the numbers keep their contrast. */
:root[data-glass="on"]:not([data-contrast="more"]) .figure { text-shadow: var(--figure-light); }

/* ---- Round 2: colour vision (patterns and shapes) ---- */
/* Colour vision: a second signal besides colour on the split bar, the same patterns as in the charts. */
:root[data-cvd="patterns"] .p-detractor { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 1.5px, transparent 1.5px 5px); }
:root[data-cvd="patterns"] .p-passive { background-image: radial-gradient(rgba(0,0,0,.45) 1px, transparent 1.3px); background-size: 5px 5px; }
:root[data-cvd="patterns"] .split li i { width: 10px; height: 10px; }
/* (The Deco ornament on the month's finding was tried in round 2 and turned down on 19 Oct: "Ornament: None".) */
.figures-table { overflow-x: auto; } .figures-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.figures-table caption { text-align: left; color: var(--ink-2); padding-bottom: 6px; }
.figures-table th, .figures-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; } .figures-table td { text-align: right; }

/* ---- The three materials on a card (round 21; tokens.css has the tokens and the reasons): Off keeps the panel and its faint
   shadow; Flat turns the card see-through in dark, with one line of light; Tactile adds the layered depth. Glass and glow
   off keeps every card solid. A change is a short fade (none under Motion reduced, frame.css). ---- */
.card, .headline, .finding-card, .stat { transition: background-color .24s ease, box-shadow .24s ease, border-color .24s ease; }
:root:not([data-glass="off"]):is([data-material="flat"], [data-material="tactile"]) :is(.card, .headline, .finding-card, .stat) { background: var(--panel-glass); }
:root[data-material="flat"] :is(.card, .headline, .finding-card, .stat) { box-shadow: var(--rim); }
:root[data-material="tactile"] :is(.card, .headline, .finding-card, .stat) { box-shadow: var(--depth); }
/* Tactile's glass face in dark: light falls on the top of the card and fades out by its middle, above where the marks
   are drawn, so the measured surface under a chart is the composited panel, not the lit face. */
:root[data-theme="dark"][data-material="tactile"] :is(.card, .headline, .finding-card, .stat) { background-image: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 50%); }

/* ---- The hero (round 21; Rob: a marketer reads the month's NPS in five seconds): the score inside its gauge, the context
   line under it; on the dashboard the card wears the edge light the help link gave up, and in Tactile a whisper of gold
   at its foot. On a 2560 screen the grid has four columns and the hero spans two, its gauge beside its split. ---- */
.hero { position: relative; max-width: 340px; }
.hero .figure-row { position: absolute; left: 0; right: 0; bottom: 14px; justify-content: center; margin: 0; }
.hero-big .figure { font-size: 60px; letter-spacing: -.03em; line-height: .95; }
.hero-small .figure { font-size: 44px; letter-spacing: -.025em; line-height: .95; }
.hero-context { display: block; max-width: 340px; text-align: center; margin: 0; }
:root[data-material="tactile"] #nps { box-shadow: var(--depth), inset 0 -18px 32px -26px color-mix(in srgb, var(--seam) 60%, transparent); }
@media (min-width: 1900px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #nps { grid-column: span 2; }
  .section-moved #trend { grid-column: 1 / span 2; } .section-moved #brands { grid-column: 3 / span 2; } .section-moved #bands { grid-column: 1 / span 4; }
  .section-cameFrom #source { grid-column: span 2; } .section-cameFrom #sourceNps { grid-column: span 2; }
}
/* The NPS pair, one piece on both pages (round 26; Rob: "put the colored lines beside … on a smaller screen … underneath …
   the same as in the dashboard … then it's more uniform"): the gauge and its context line, and the side with the split.
   The card is the container, so the rule follows the card's own width on either page, the sidebar open or folded: from
   720 px of card the side stands beside the gauge, the context line centred under it; narrower, one under the other.
   (Until round 26 the dashboard did this from a 1900 px screen, and the insights headlines never did.) */
.card-body, .headline { container: card / inline-size; }
.nps-pair { display: flex; flex-direction: column; gap: 12px; }
.nps-pair .side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@container card (min-width: 720px) {
  .nps-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 28px; row-gap: 8px; align-items: center; }
  .nps-pair .hero { grid-column: 1; grid-row: 1; width: 100%; justify-self: center; }
  .nps-pair .hero-context { grid-column: 1; grid-row: 2; justify-self: center; }
  .nps-pair .side { grid-column: 2; grid-row: 1 / span 2; }
}

/* ---- Round 22 (from the inspiration folder's review; Rob: "go for what you think is best") ---- */
/* Figures lit in the words (the sleep app's analysis paragraph): the prose in the secondary ink, the figures in the ink
   and semibold, so the eye reads the numbers first. The month's finding keeps its prose in the ink, its figures bolder. */
.sentence, .hero-context { color: var(--ink-2); }
.sentence b.num, .hero-context b.num { color: var(--ink); font-weight: 600; }
.finding .sentence { color: var(--ink); } .finding .sentence b.num { font-weight: 700; }
/* The month's strip (the habits app's tiles; §6.1's proposal, §11's question seven): four small figures above the glance,
   each an icon tile, a label, the value and one line; two by two on a phone. It takes the card's material. */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
body[data-page="insights"] .main > .strip { grid-column: 1 / -1; }
.stat { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-2); box-shadow: var(--card-shadow); min-width: 0; }
.stat .tile { width: 32px; height: 32px; border-radius: 9px; }
.stat-label { margin: 0; font-size: 12px; color: var(--ink-2); }
.stat-value { margin: 2px 0 0; font: 600 22px/1.1 var(--font); letter-spacing: -.02em; }
.stat-line { margin: 3px 0 0; font-size: 11.5px; color: var(--ink-2); }
@media (max-width: 767px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
