/* Life: the content comes alive, the chrome stays quiet.
 *
 * Contract and usage: docs/design/LIFE_2026-11.md. Loaded after chrome.css
 * (base.html, journey/tools shells) and after marketing.css (marketing_base).
 * Every colour is an `R G B` triplet used as rgb(var(--token)), so both themes
 * follow automatically. Pages read --area / --area-soft / --area-ink; identity
 * surfaces read --id / --id-soft / --id-ink.
 */

/* ---------- area hues (the flower's petals) ---------- */
:root {
    --area-learn: 59 110 165;
    --area-learn-soft: 235 240 246;
    --area-learn-ink: 51 91 138;
    --area-apply: 106 84 196;
    --area-apply-soft: 240 238 249;
    --area-apply-ink: 92 73 169;
    --area-money: 52 128 96;
    --area-money-soft: 235 242 239;
    --area-money-ink: 44 99 79;
    --area-week: 196 132 26;
    --area-week-soft: 249 243 232;
    --area-week-ink: 122 83 28;
    --area-family: 176 86 122;
    --area-family-soft: 247 238 242;
    --area-family-ink: 135 68 98;
    /* The sixth identity hue: never an area, only a child or course colour. */
    --life-teal: 38 128 140;
    --life-teal-soft: 233 242 244;
    --life-teal-ink: 33 97 109;

    /* Category tokens: the petals again, restored from the grey that
       tailwind-input.css flattened them to. */
    --cat-college-soft: var(--area-apply-soft);
    --cat-college-ink: var(--area-apply-ink);
    --cat-college-on: 72 57 133;
    --cat-school-soft: var(--area-learn-soft);
    --cat-school-ink: var(--area-learn-ink);
    --cat-school-on: 40 71 108;
    --cat-testing-soft: var(--area-week-soft);
    --cat-testing-ink: var(--area-week-ink);
    --cat-testing-on: 96 65 22;
    --cat-scholarship-soft: var(--area-money-soft);
    --cat-scholarship-ink: var(--area-money-ink);
    --cat-scholarship-on: 34 77 61;
    --cat-aid-soft: var(--area-family-soft);
    --cat-aid-ink: var(--area-family-ink);
    --cat-aid-on: 106 53 77;
}
html.dark {
    --area-learn: 130 175 225;
    --area-learn-soft: 49 54 72;
    --area-learn-ink: 150 188 230;
    --area-apply: 176 160 245;
    --area-apply-soft: 57 51 76;
    --area-apply-ink: 189 175 247;
    --area-money: 130 200 160;
    --area-money-soft: 49 58 61;
    --area-money-ink: 132 201 162;
    --area-week: 232 182 92;
    --area-week-soft: 67 55 49;
    --area-week-ink: 232 182 92;
    --area-family: 225 150 180;
    --area-family-soft: 66 49 64;
    --area-family-ink: 230 167 192;
    --life-teal: 110 196 204;
    --life-teal-soft: 45 57 69;
    --life-teal-ink: 116 198 206;

    --cat-college-on: 214 206 250;
    --cat-school-on: 196 218 242;
    --cat-testing-on: 243 214 160;
    --cat-scholarship-on: 190 228 205;
    --cat-aid-on: 240 204 218;
}

/* A page declares its area once (base.html stamps it on #page-content). The
   default is the violet accent family, so an unmapped page reads as before. */
:root, [data-area=""] { --area: var(--accent); --area-soft: var(--accent-subtle); --area-ink: var(--accent); }
[data-area="learn"] { --area: var(--area-learn); --area-soft: var(--area-learn-soft); --area-ink: var(--area-learn-ink); }
[data-area="apply"] { --area: var(--area-apply); --area-soft: var(--area-apply-soft); --area-ink: var(--area-apply-ink); }
[data-area="money"] { --area: var(--area-money); --area-soft: var(--area-money-soft); --area-ink: var(--area-money-ink); }
[data-area="week"] { --area: var(--area-week); --area-soft: var(--area-week-soft); --area-ink: var(--area-week-ink); }
[data-area="family"] { --area: var(--area-family); --area-soft: var(--area-family-soft); --area-ink: var(--area-family-ink); }

/* ---------- identity: a stable hue per child and course (identity_hue) ---------- */
.life-id-1 { --id: var(--area-learn); --id-soft: var(--area-learn-soft); --id-ink: var(--area-learn-ink); }
.life-id-2 { --id: var(--area-apply); --id-soft: var(--area-apply-soft); --id-ink: var(--area-apply-ink); }
.life-id-3 { --id: var(--area-money); --id-soft: var(--area-money-soft); --id-ink: var(--area-money-ink); }
.life-id-4 { --id: var(--area-week); --id-soft: var(--area-week-soft); --id-ink: var(--area-week-ink); }
.life-id-5 { --id: var(--area-family); --id-soft: var(--area-family-soft); --id-ink: var(--area-family-ink); }
.life-id-6 { --id: var(--life-teal); --id-soft: var(--life-teal-soft); --id-ink: var(--life-teal-ink); }

/* ---------- the automatic header wash ---------- */
/* Every app page's .calm-header is a lifted band; on a page with an area its
   accent wash becomes one soft wash of the area hue, fading to the surface. */
#page-content:not([data-area=""]) .calm-header,
.life-band {
    background:
        radial-gradient(140% 180% at 100% 0%, rgb(var(--area-soft)) 0%, rgb(var(--area-soft) / .7) 42%, rgb(var(--area-soft) / 0) 82%),
        rgb(var(--surface));
}
.life-band { padding: 32px 32px 30px; border: 1px solid rgb(var(--hairline)); border-radius: 20px; box-shadow: var(--shadow-card); }
@media (max-width: 767px) { .life-band { padding: 22px 20px 24px; border-radius: 16px; } }

/* ---------- primitives ---------- */
/* Avatar: tinted initial circle. Sizes 28 / 40 (default) / 56. */
.life-avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 40px; height: 40px; border-radius: 50%;
    font: 600 16px/1 var(--font-sans);
    color: rgb(var(--id-ink, var(--area-ink)));
    background: rgb(var(--id-soft, var(--area-soft)));
    /* The soft fills sit within a few dE of each other; the ring carries the hue. */
    box-shadow: inset 0 0 0 1.5px rgb(var(--id, var(--area)) / .6);
}
.life-avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.life-avatar--lg { width: 56px; height: 56px; font-size: 22px; }

/* Icon tile: 44px (40 / 48 variants), 12px radius, hue glyph. */
.life-tile {
    display: inline-grid; place-items: center; flex: none;
    width: 44px; height: 44px; border-radius: 12px;
    color: rgb(var(--id-ink, var(--area-ink)));
    background: rgb(var(--id-soft, var(--area-soft)));
}
.life-tile svg { width: 22px; height: 22px; }
.life-tile--sm { width: 40px; height: 40px; }
.life-tile--lg { width: 48px; height: 48px; }

/* Ring: style="--value: 45" (0-100); the figure sits in the middle. */
@property --value { syntax: "<number>"; inherits: true; initial-value: 0; }
.life-ring {
    --ring-size: 56px; --ring-width: 6px;
    position: relative; display: inline-grid; place-items: center; flex: none;
    width: var(--ring-size); height: var(--ring-size);
    font: 600 calc(var(--ring-size) * .27)/1 var(--font-sans);
    font-variant-numeric: tabular-nums;
    color: rgb(var(--ink));
}
.life-ring::before {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(rgb(var(--ring-color, var(--id, var(--area)))) calc(var(--value) * 1%), rgb(var(--surface-sunken)) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring-width)), #000 calc(100% - var(--ring-width) + .5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring-width)), #000 calc(100% - var(--ring-width) + .5px));
}
.life-ring > * { position: relative; }
.life-ring small { font-size: .6em; font-weight: 600; color: rgb(var(--ink-3)); }
.life-ring--sm { --ring-size: 40px; --ring-width: 4px; }
.life-ring--lg { --ring-size: 88px; --ring-width: 8px; }

/* Meter: linear (style="--value: 40") or segmented (child spans, .is-on filled). */
.life-meter {
    display: flex; gap: 3px; height: 8px; overflow: hidden;
    border-radius: 999px; background: rgb(var(--surface-sunken));
}
.life-meter-fill {
    width: calc(var(--value) * 1%); border-radius: inherit;
    background: rgb(var(--meter-color, var(--id, var(--area))));
}
.life-meter--segments { background: none; border-radius: 0; }
.life-meter--segments > span { flex: 1; border-radius: 3px; background: rgb(var(--surface-sunken)); }
.life-meter--segments > .is-on { background: rgb(var(--meter-color, var(--id, var(--area)))); }

/* Figure: a large tabular number over a small label. */
.life-figure { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.life-figure-value { font: 600 36px/1.05 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: rgb(var(--ink)); }
.life-figure-value small { font-size: .5em; font-weight: 600; letter-spacing: 0; color: rgb(var(--ink-3)); }
.life-figure-label { font-size: 13px; line-height: 18px; color: rgb(var(--ink-3)); }

/* Small markers: an 8px dot, a 3px item bar, a small chip. */
.life-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--id, var(--area))); }
.life-bar { display: block; flex: none; align-self: stretch; width: 3px; min-height: 16px; border-radius: 3px; background: rgb(var(--id, var(--area))); }
.life-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px;
    border-radius: 6px; font-size: 12.5px; line-height: 18px; font-weight: 600;
    color: rgb(var(--id-ink, var(--area-ink))); background: rgb(var(--id-soft, var(--area-soft)));
}

/* The one featured card per page. */
.life-feature { background: rgb(var(--area-soft)); border-color: rgb(var(--area) / .22); }

/* ---------- moments: once, 200ms or less, off for reduced motion ---------- */
@media (prefers-reduced-motion: no-preference) {
    .life-enter { animation: life-enter 180ms ease-out both; }
    .life-ring::before { animation: life-fill 200ms ease-out both; }
    .life-meter-fill { animation: life-grow 200ms ease-out both; }
    .life-lift { transition: transform 160ms ease-out, box-shadow 160ms ease-out; }
    .life-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
}
@keyframes life-enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes life-fill { from { --value: 0; } }
@keyframes life-grow { from { width: 0; } }
