/* ==========================================================================
   Heritage Minerals: Expertise and Impact (the craft pages).

   Expertise  Hardness. Depth is what holds under pressure, so the page
              carries a Mohs scale with each mineral at its true hardness,
              and its six-part sections run through the six stones.
              Industries as mineral slabs: Fintech = gold; Healthcare = quartz
              (as GHS everywhere: time, rostering, care); Education and
              Community = emerald; Legal = platinum (permanence);
              Real estate = tantalite; E-commerce = diamond; Media = gold.
              Platforms match the Ventures page: eduSYMS = emerald,
              GHS = quartz, Great Dyke Fintech = platinum (the Great Dyke).
   Impact     The assay. "Proof" is struck in gold under an assay hallmark;
              the dashboard's rings, bars and charts are filled with stones;
              before eduSYMS is dull smoky quartz, after is emerald.

   Layers on pages.css and minerals.css (which holds .mn-s--* tokens, the
   stone chip and the numbers band). Linked on expertise.html and
   impact.html by scripts/update_minerals.py, which also writes the Mohs
   scale and the hallmark.
   ========================================================================== */

.mn-gild--assay { --mn-text-lustre: var(--mn-ink-gold); }
[data-theme="dark"] .mn-gild--assay { --mn-text-lustre: var(--mn-glow-gold); }

/* ==========================================================================
   EXPERTISE
   ========================================================================== */

/* Mohs scale beside the title */
.page-header:has(.mn-scale) { position: relative; overflow: clip; }
.mn-scale {
    position: absolute; z-index: 1; top: 50%; translate: 0 -44%;
    right: max(2rem, calc((100% - 1280px) / 2 + 2rem));
    height: min(320px, 72%); display: grid; grid-template-columns: 1.6rem 10px auto; grid-template-rows: 1fr auto; column-gap: 0.7rem;
    pointer-events: none;
}
.mn-scale__nums { position: relative; font: 600 0.62rem/1 var(--font-mono, 'JetBrains Mono', monospace); color: var(--color-text-tertiary, #ADB5BD); }
.mn-scale__nums span { position: absolute; right: 0; bottom: calc((var(--n) - 1) / 9 * 100%); translate: 0 50%; }
.mn-scale__rule {
    position: relative; border-radius: 5px;
    background: linear-gradient(0deg, #D6A85A, #C3C8CE 35%, #6E7F96 58%, #B7A9D6 66%, #2FB57F 75%, #CFEFFF);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), 0 12px 24px -14px rgba(0, 0, 0, 0.5);
    animation: mn-scale-grow 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}
.mn-scale__rule::after { /* the ten notches */
    content: ""; position: absolute; inset: 0 -4px;
    background: repeating-linear-gradient(0deg, transparent 0 calc(100% / 9 - 1px), rgba(0, 0, 0, 0.35) calc(100% / 9 - 1px) calc(100% / 9));
    -webkit-mask-image: linear-gradient(90deg, #000 4px, transparent 4px calc(100% - 4px), #000 calc(100% - 4px));
    mask-image: linear-gradient(90deg, #000 4px, transparent 4px calc(100% - 4px), #000 calc(100% - 4px));
}
.mn-scale__marks { position: relative; list-style: none; margin: 0; padding: 0; min-width: 11rem; }
.mn-scale__marks li {
    position: absolute; left: 0; bottom: calc((var(--m) - 1) / 9 * 100%); translate: 0 50%;
    display: flex; align-items: center; gap: 0.45rem; white-space: nowrap;
    font: 500 0.72rem/1 var(--font-mono, 'JetBrains Mono', monospace); color: var(--color-text-secondary);
    opacity: 0; animation: mn-core-label 0.6s ease calc(0.8s + var(--i) * 0.12s) both;
}
.mn-scale__marks li::before { content: ""; width: 10px; height: 1px; margin-left: -0.7rem; background: currentColor; opacity: 0.5; }
.mn-scale__marks i { width: 0.8rem; height: 0.8rem; flex: none; background: var(--s-lustre); }
.mn-scale__marks .mn-s--gold i { border-radius: 46% 54% 42% 58% / 55% 45% 55% 45%; }
.mn-scale__marks .mn-s--platinum i { height: 0.55rem; clip-path: polygon(16% 0, 84% 0, 100% 100%, 0 100%); }
.mn-scale__marks .mn-s--tantalite i { width: 0.5rem; clip-path: polygon(50% 0, 100% 22%, 100% 100%, 0 100%, 0 22%); }
.mn-scale__marks .mn-s--emerald i { clip-path: polygon(28% 0, 72% 0, 100% 28%, 100% 72%, 72% 100%, 28% 100%, 0 72%, 0 28%); }
.mn-scale__marks .mn-s--quartz i { width: 0.5rem; clip-path: polygon(50% 0, 100% 30%, 100% 100%, 0 100%, 0 30%); box-shadow: inset 0 0 0 1px rgba(94, 83, 121, 0.5); }
.mn-scale__marks .mn-s--diamond i { clip-path: polygon(50% 100%, 0 38%, 22% 6%, 78% 6%, 100% 38%); }
.mn-scale__marks b { font-weight: 800; color: var(--s-text); min-width: 2.2em; }
.mn-scale__marks em { font-style: normal; opacity: 0.7; }
.mn-scale__cap { grid-column: 1 / -1; margin: 0.9rem 0 0; font: 600 0.6rem/1.3 var(--font-mono, 'JetBrains Mono', monospace); letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-text-tertiary, #ADB5BD); }
@keyframes mn-scale-grow { from { clip-path: inset(100% 0 0 0 round 5px); } to { clip-path: inset(0 0 0 0 round 5px); } }
@keyframes mn-core-label { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 1099px) { .mn-scale { display: none; } }

/* The Full Stack: six layers, six stones, in seam order */
.stack-layers > :nth-child(6n+1) { --s-c: #B7A9D6; }
.stack-layers > :nth-child(6n+2) { --s-c: var(--mn-gold); }
.stack-layers > :nth-child(6n+3) { --s-c: #A9AFB6; }
.stack-layers > :nth-child(6n+4) { --s-c: var(--mn-tantalite-hi); }
.stack-layers > :nth-child(6n+5) { --s-c: var(--mn-emerald); }
.stack-layers > :nth-child(6n+6) { --s-c: var(--mn-diamond-lo); }
.stack-layers > * { box-shadow: inset 3px 0 0 var(--s-c); }
.stack-layer__title svg { color: var(--s-c); }
.stack-chip--primary {
    color: #F7F4EE; border-color: transparent;
    background: linear-gradient(180deg, #2E2823, #1A1613) padding-box, var(--mn-lustre-gold) border-box;
    border: 1px solid transparent;
}
.stack-chip--primary:hover { box-shadow: 0 6px 16px -8px rgba(214, 168, 90, 0.7); }

/* Industries as mineral slabs */
.industry-card__icon--edu, .industry-card__icon--community { background: linear-gradient(135deg, #064E3B, #1F9D6E); color: #FFFFFF; }
.industry-card__icon--health { background: linear-gradient(135deg, #3B3150, #6D5F8A); color: #FFFFFF; }
.industry-card__icon--fin, .industry-card__icon--media { background: linear-gradient(135deg, #5E4210, #A87A28); color: #FFFFFF; }
.industry-card__icon--legal { background: linear-gradient(135deg, #3F444A, #7A8088); color: #FFFFFF; }
.industry-card__icon--prop { background: linear-gradient(135deg, #1C1815, #3D4A5E); color: #E6ECF4; }
.industry-card__icon--ecom { background: linear-gradient(135deg, #1F4F80, #2D6CA8 60%, #6A4FA0); color: #FFFFFF; }
[class*="industry-card__icon--"] { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 18px -10px rgba(0, 0, 0, 0.55); }
.industry-card__count { color: var(--mn-gold-ink); }
[data-theme="dark"] .industry-card__count { color: var(--mn-gold); }

/* Fixes for long-standing ink problems on this page:
   - "How I Build" is always a dark band, but its ink flipped dark in dark mode;
   - the principle titles were white on white cards (light) / near-black on grey (dark);
   - the Full Stack layer titles were slate on dark in dark mode. */
.approach { color: #FFFFFF; --color-text-inverse: #FFFFFF; }
.approach__principles .principle h3 { color: var(--color-text); }
.approach__principles .principle p { color: var(--color-text-secondary); }
.stack-layer__title { color: var(--color-text-secondary); }

/* How I Build: numerals in the six stones */
.approach__principles .principle:nth-child(6n+1) { --s-ink: var(--mn-ink-quartz); --s-glow: var(--mn-glow-quartz); }
.approach__principles .principle:nth-child(6n+2) { --s-ink: var(--mn-ink-gold); --s-glow: var(--mn-glow-gold); }
.approach__principles .principle:nth-child(6n+3) { --s-ink: var(--mn-ink-platinum); --s-glow: var(--mn-glow-platinum); }
.approach__principles .principle:nth-child(6n+4) { --s-ink: var(--mn-ink-tantalite); --s-glow: var(--mn-glow-tantalite); }
.approach__principles .principle:nth-child(6n+5) { --s-ink: var(--mn-ink-emerald); --s-glow: var(--mn-glow-emerald); }
.approach__principles .principle:nth-child(6n+6) { --s-ink: var(--mn-ink-diamond); --s-glow: var(--mn-glow-diamond); }
.approach__principles .principle__number {
    opacity: 1; background-image: var(--s-ink); background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
[data-theme="dark"] .approach__principles .principle__number { background-image: var(--s-glow); }

/* ==========================================================================
   IMPACT
   ========================================================================== */

/* Assay hallmark beside "Proof of work." */
.page-header:has(.mn-hallmark--proof) { position: relative; overflow: clip; }
.mn-hallmark--proof {
    position: absolute; z-index: 1; top: 50%; translate: 0 -40%; right: max(2rem, calc((100% - 1280px) / 2 + 3rem));
    width: clamp(120px, 11vw, 168px); --hm-rim-stroke: rgba(214, 168, 90, 0.65); --hm-text: #F1D6A0;
    animation: mn-hm-in 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}
@media (max-width: 1099px) { .mn-hallmark--proof { display: none; } }

/* Dashboard rings, one stone each */
.radial-card:nth-child(4n+1) .radial-ring__fill { stroke: var(--mn-gold); }
.radial-card:nth-child(4n+2) .radial-ring__fill { stroke: var(--mn-emerald); }
.radial-card:nth-child(4n+3) .radial-ring__fill { stroke: #8D9298; }
.radial-card:nth-child(4n+4) .radial-ring__fill { stroke: var(--mn-diamond-ink); }
[data-theme="dark"] .radial-card:nth-child(4n+3) .radial-ring__fill { stroke: var(--mn-platinum); }
[data-theme="dark"] .radial-card:nth-child(4n+4) .radial-ring__fill { stroke: var(--mn-diamond-lo); }

/* Growth: figures assayed in gold; the bars are refined, the latest throws fire */
.growth-stat__value {
    background-image: var(--mn-ink-gold); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
[data-theme="dark"] .growth-stat__value { background-image: var(--mn-glow-gold); }
.bar-chart__fill { background: linear-gradient(90deg, #8A6420, #C8963F 60%, #F1D6A0); }
.bar-chart__fill--accent { background: linear-gradient(90deg, #8A6420, #D6A85A 55%, #FFE7A3 76%, #A8E9FF 88%, #C6B8FF); box-shadow: 0 0 12px rgba(214, 168, 90, 0.45); }

/* Where the work lives: each sector in its stone */
.industry-chart__fill[data-color="edu"] { background: var(--mn-lustre-emerald); }
.industry-chart__fill[data-color="fin"] { background: var(--mn-lustre-gold); }
.industry-chart__fill[data-color="health"] { background: linear-gradient(90deg, #5E5379, #CFC6E0); }
.industry-chart__fill[data-color="ecom"] { background: linear-gradient(90deg, #2D6CA8, #A8E9FF 60%, #C6B8FF); }
.industry-chart__fill[data-color="agri"] { background: linear-gradient(90deg, #075E43, #6FE3B0); }
.industry-chart__fill[data-color="prop"] { background: linear-gradient(90deg, #2A2420, #8FA3BE); }
.industry-chart__fill[data-color="legal"] { background: var(--mn-lustre-platinum); }
.industry-chart__fill[data-color="other"] { background: linear-gradient(90deg, #ADB5BD, #DEE2E6); }

/* Before and after eduSYMS: dull smoky quartz becomes emerald */
.comparison-bar__fill--before { background: linear-gradient(90deg, #6F6680, #A79BBF); opacity: 0.8; }
.comparison-bar__fill--after { background: var(--mn-lustre-emerald); box-shadow: 0 0 10px rgba(31, 157, 110, 0.35); }

/* Platform scale: badges as slabs, edged in their stone */
.platform-card--edu .platform-card__badge { background: linear-gradient(135deg, #064E3B, #1F9D6E); color: #FFFFFF; }
.platform-card--health .platform-card__badge { background: linear-gradient(135deg, #3B3150, #6D5F8A); color: #FFFFFF; }
.platform-card--fin .platform-card__badge { background: linear-gradient(135deg, #3F444A, #7A8088); color: #FFFFFF; }
.platform-card--edu { --s-c: var(--mn-emerald); }
.platform-card--health { --s-c: var(--mn-quartz-lo); }
.platform-card--fin { --s-c: #8D9298; }
.platform-cards .platform-card { box-shadow: inset 0 3px 0 var(--s-c); }
.platform-stat__num { color: var(--s-c); }
.platform-card--health .platform-stat__num { color: var(--mn-quartz-ink); }
.platform-card--fin .platform-stat__num { color: var(--mn-platinum-ink); }
[data-theme="dark"] .platform-card--health .platform-stat__num { color: #CFC6E0; }
[data-theme="dark"] .platform-card--fin .platform-stat__num { color: var(--mn-platinum); }

/* Reach: penetration as a gold fill */
.reach-indicator__fill { background: linear-gradient(90deg, #8A6420, #D6A85A 60%, #F7E3B0); }

/* ==========================================================================
   Motion, forced colours, print
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .mn-scale__rule, .mn-scale__marks li, .mn-hallmark--proof { animation: none !important; opacity: 1; }
}
@media (forced-colors: active) {
    .mn-scale, .mn-hallmark--proof { display: none; }
    .growth-stat__value, .approach__principles .principle__number { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; }
}
@media print {
    .mn-scale, .mn-hallmark--proof { display: none !important; }
    .growth-stat__value, .approach__principles .principle__number { background: none; color: #000; -webkit-text-fill-color: #000; }
}
