/* ==========================================================================
   Heritage Minerals: Journal and Watch.

     Journal   Quartz     clarity and precision; quartz keeps time, and
                          essays are measured in it (dates, minutes to read).
                          The reading surfaces are quartz glass.
     Watch     Platinum   the record that goes platinum: discs, grooves and
                          a brushed-platinum bezel round the player.
                          (A material, not a claim of any certification.)

   Layers on pages.css and minerals.css. Linked on /journal/*, /youtube
   and /watch/* by scripts/update_minerals.py, which also lays the hero
   phrases in their stone (.mn-gild--quartz, .mn-gild--platinum).
   ========================================================================== */

/* Fixed-stone gilding for these page families */
.mn-gild--quartz { --mn-text-lustre: var(--mn-ink-quartz); }
[data-theme="dark"] .mn-gild--quartz { --mn-text-lustre: var(--mn-glow-quartz); }
.mn-gild--platinum { --mn-text-lustre: var(--mn-glow-platinum); filter: drop-shadow(0 0 18px rgba(229, 228, 226, 0.18)); }

/* ==========================================================================
   JOURNAL (quartz)
   ========================================================================== */

/* Header: a quartz cluster grows behind the title */
.page-header--journal::before {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='100 120 400 340' fill='none' stroke='rgb(167,155,191)' stroke-width='1.1' stroke-linejoin='round'%3E%3Cg transform='translate(300 420) rotate(-4)'%3E%3Cpolygon points='-23.0,0.0 -23.0,-230.0 23.0,-230.0 23.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-8.3,0.0 -8.3,-230.0 8.3,-230.0 8.3,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-23.0,-230.0 0.0,-294.4 23.0,-230.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-8.3,-230.0 0.0,-294.4 8.3,-230.0' fill='none'/%3E%3Cpath d='M-8.3 0V-230M8.3 0V-230' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(352 425) rotate(18)'%3E%3Cpolygon points='-18.0,0.0 -18.0,-180.0 18.0,-180.0 18.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-6.5,0.0 -6.5,-180.0 6.5,-180.0 6.5,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-18.0,-180.0 0.0,-230.4 18.0,-180.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-6.5,-180.0 0.0,-230.4 6.5,-180.0' fill='none'/%3E%3Cpath d='M-6.5 0V-180M6.5 0V-180' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(250 425) rotate(-22)'%3E%3Cpolygon points='-17.0,0.0 -17.0,-170.0 17.0,-170.0 17.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-6.1,0.0 -6.1,-170.0 6.1,-170.0 6.1,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-17.0,-170.0 0.0,-217.6 17.0,-170.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-6.1,-170.0 0.0,-217.6 6.1,-170.0' fill='none'/%3E%3Cpath d='M-6.1 0V-170M6.1 0V-170' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(395 430) rotate(34)'%3E%3Cpolygon points='-13.0,0.0 -13.0,-120.0 13.0,-120.0 13.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-4.7,0.0 -4.7,-120.0 4.7,-120.0 4.7,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-13.0,-120.0 0.0,-153.6 13.0,-120.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-4.7,-120.0 0.0,-153.6 4.7,-120.0' fill='none'/%3E%3Cpath d='M-4.7 0V-120M4.7 0V-120' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(205 430) rotate(-38)'%3E%3Cpolygon points='-12.0,0.0 -12.0,-110.0 12.0,-110.0 12.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-4.3,0.0 -4.3,-110.0 4.3,-110.0 4.3,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-12.0,-110.0 0.0,-140.8 12.0,-110.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-4.3,-110.0 0.0,-140.8 4.3,-110.0' fill='none'/%3E%3Cpath d='M-4.3 0V-110M4.3 0V-110' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(278 430) rotate(-10)'%3E%3Cpolygon points='-11.0,0.0 -11.0,-95.0 11.0,-95.0 11.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-4.0,0.0 -4.0,-95.0 4.0,-95.0 4.0,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-11.0,-95.0 0.0,-121.6 11.0,-95.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-4.0,-95.0 0.0,-121.6 4.0,-95.0' fill='none'/%3E%3Cpath d='M-4.0 0V-95M4.0 0V-95' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(330 432) rotate(8)'%3E%3Cpolygon points='-10.0,0.0 -10.0,-85.0 10.0,-85.0 10.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-3.6,0.0 -3.6,-85.0 3.6,-85.0 3.6,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-10.0,-85.0 0.0,-108.8 10.0,-85.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-3.6,-85.0 0.0,-108.8 3.6,-85.0' fill='none'/%3E%3Cpath d='M-3.6 0V-85M3.6 0V-85' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(440 438) rotate(50)'%3E%3Cpolygon points='-8.0,0.0 -8.0,-64.0 8.0,-64.0 8.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-2.9,0.0 -2.9,-64.0 2.9,-64.0 2.9,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-8.0,-64.0 0.0,-81.9 8.0,-64.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-2.9,-64.0 0.0,-81.9 2.9,-64.0' fill='none'/%3E%3Cpath d='M-2.9 0V-64M2.9 0V-64' stroke-opacity='.5'/%3E%3C/g%3E%3Cg transform='translate(160 438) rotate(-52)'%3E%3Cpolygon points='-8.0,0.0 -8.0,-60.0 8.0,-60.0 8.0,0.0' fill='rgb(255,255,255)' fill-opacity='.18'/%3E%3Cpolygon points='-2.9,0.0 -2.9,-60.0 2.9,-60.0 2.9,0.0' fill='rgb(237,232,245)' fill-opacity='.22'/%3E%3Cpolygon points='-8.0,-60.0 0.0,-76.8 8.0,-60.0' fill='rgb(255,255,255)' fill-opacity='.3'/%3E%3Cpolyline points='-2.9,-60.0 0.0,-76.8 2.9,-60.0' fill='none'/%3E%3Cpath d='M-2.9 0V-60M2.9 0V-60' stroke-opacity='.5'/%3E%3C/g%3E%3Cpath d='M120 440Q300 410 480 440' stroke-opacity='.5'/%3E%3C/svg%3E") no-repeat right max(2%, calc((100% - 1280px) / 2)) bottom -6% / min(440px, 46vw),
        radial-gradient(ellipse at 50% 0%, rgba(167, 155, 191, 0.14) 0%, transparent 60%);
    width: 100%; left: 0; transform: none; opacity: 0.85;
}
[data-theme="dark"] .page-header--journal::before { opacity: 0.55; }
.page-header--journal::after { background: linear-gradient(90deg, transparent, var(--mn-quartz-lo) 30%, var(--mn-gold) 50%, var(--mn-quartz-lo) 70%, transparent); }
.page-header--journal .page-header__label::before {
    content: ""; display: inline-block; width: 0.55em; height: 0.85em; margin-right: 0.5em; vertical-align: -0.1em;
    background: var(--mn-lustre-quartz); clip-path: polygon(50% 0, 100% 30%, 100% 100%, 0 100%, 0 30%);
}

/* The list: each essay cut from a different stone (its hover rim) */
.journal-list-item { --mn-c: var(--mn-lustre-quartz); }
.journal-list-item:nth-child(6n+2) { --mn-c: var(--mn-lustre-gold); }
.journal-list-item:nth-child(6n+3) { --mn-c: var(--mn-lustre-platinum); }
.journal-list-item:nth-child(6n+4) { --mn-c: var(--mn-glow-tantalite); }
.journal-list-item:nth-child(6n+5) { --mn-c: var(--mn-glow-emerald); }
.journal-list-item:nth-child(6n+6) { --mn-c: conic-gradient(from 30deg, var(--mn-fire-stops)); }
.journal-list-item::before { background: var(--mn-c); }
.journal-list-item__date { display: inline-flex; align-items: center; gap: 0.45em; }
.journal-list-item__date::before {
    content: ""; width: 0.5em; height: 0.8em; background: var(--mn-lustre-quartz);
    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.45);
}
.journal-card:hover { box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--mn-quartz-lo) 55%, transparent); }

/* Article header: category in quartz glass; the reading time ticks */
.article__category {
    display: inline-flex; align-items: center; gap: 0.5em; padding: 0.3em 0.75em; border-radius: 999px;
    color: var(--mn-quartz-ink);
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.7), rgba(237, 232, 245, 0.55));
    box-shadow: inset 0 0 0 1px rgba(167, 155, 191, 0.45), 0 4px 14px -8px rgba(94, 83, 121, 0.4);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.article__category::before {
    content: ""; width: 0.55em; height: 0.85em; background: var(--mn-lustre-quartz);
    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);
}
[data-theme="dark"] .article__category { color: #CFC6E0; background: rgba(167, 155, 191, 0.12); box-shadow: inset 0 0 0 1px rgba(167, 155, 191, 0.3); }
/* Quartz keeps time: a crystal beside the date beats once a second */
.article__meta time { display: inline-flex; align-items: center; gap: 0.45em; }
.article__meta time::before {
    content: ""; width: 0.5em; height: 0.8em; background: var(--mn-lustre-quartz);
    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);
    animation: mn-qz-tick 1s steps(1, end) infinite;
}
@keyframes mn-qz-tick { 0% { filter: brightness(1.25) drop-shadow(0 0 3px rgba(167, 155, 191, 0.9)); } 12% { filter: none; } }

/* Body: a quartz drop cap, the seam under each section, quartz-glass quotes */
.article__body .container > p:first-child::first-letter {
    float: left; font-size: 3.7em; line-height: 0.82; font-weight: 800; margin: 0.06em 0.12em 0 0;
    background-image: var(--mn-ink-quartz); -webkit-background-clip: text; background-clip: text;
    color: transparent; -webkit-text-fill-color: transparent;
}
[data-theme="dark"] .article__body .container > p:first-child::first-letter { background-image: var(--mn-glow-quartz); }
.article__body h2::after {
    content: ""; display: block; width: 64px; height: 3px; margin-top: 0.55rem; border-radius: 2px;
    background: var(--mn-strata);
}
.article__body a { text-decoration-color: color-mix(in srgb, var(--mn-quartz-lo) 80%, transparent); text-decoration-thickness: 2px; transition: color 0.2s, text-decoration-color 0.2s; }
.article__body a:hover { color: var(--mn-quartz-ink); text-decoration-color: var(--mn-gold); }
[data-theme="dark"] .article__body a:hover { color: #CFC6E0; }
.article__body blockquote {
    position: relative; padding: 1.1rem 1.4rem 1.1rem 1.5rem; border-left: 3px solid transparent;
    border-image: linear-gradient(180deg, #CFC6E0, #7E6FA0 50%, #D6A85A) 1;
    background: linear-gradient(115deg, rgba(237, 232, 245, 0.65), rgba(255, 255, 255, 0.35) 45%, rgba(237, 232, 245, 0.45));
}
[data-theme="dark"] .article__body blockquote { background: linear-gradient(115deg, rgba(167, 155, 191, 0.12), rgba(255, 255, 255, 0.03) 45%, rgba(167, 155, 191, 0.08)); }
.article__body code { color: var(--mn-tantalite-ink); background: rgba(61, 74, 94, 0.09); box-shadow: inset 0 0 0 1px rgba(61, 74, 94, 0.14); }
[data-theme="dark"] .article__body code { color: #C8D3E2; background: rgba(143, 163, 190, 0.12); }
.article__body hr { border: 0; height: 2px; margin: 2.5rem auto; width: min(240px, 60%); background: var(--mn-strata); border-radius: 2px; opacity: 0.85; }
.article__body li::marker { color: var(--mn-quartz-lo); }
/* End mark: the essay closes on a quartz point */
.article__body .container > p:last-of-type::after {
    content: ""; display: inline-block; width: 0.5em; height: 0.75em; margin-left: 0.45em; vertical-align: -0.05em;
    background: var(--mn-lustre-quartz); 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);
}
.article__featured-image img { transition: filter 0.6s; }

/* ==========================================================================
   WATCH (platinum)
   ========================================================================== */

/* The hero is always dark: keep its "inverse" ink white in dark mode too
   (it flipped to near-black and hid the title and the outline button) */
.yt-hero { --color-text-inverse: #FFFFFF; color: #FFFFFF; }

/* Hero: a platinum record turns behind the copy */
.yt-hero > .container { position: relative; z-index: 1; }
.yt-hero::after {
    content: ""; position: absolute; z-index: 0; pointer-events: none;
    top: 50%; right: max(-12%, calc((100% - 1280px) / 2 - 160px)); width: min(620px, 62vw); aspect-ratio: 1; translate: 0 -50%;
    border-radius: 50%;
    background:
        radial-gradient(circle, #0E0E10 0 3%, transparent 3.2%),
        radial-gradient(circle, transparent 0 14%, rgba(0, 0, 0, 0.35) 14.4% 15%, transparent 15.4%),
        conic-gradient(from var(--mn-fire), rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0.16) 30deg, rgba(255, 255, 255, 0) 70deg, rgba(255, 255, 255, 0) 180deg, rgba(255, 255, 255, 0.12) 215deg, rgba(255, 255, 255, 0) 250deg),
        repeating-radial-gradient(circle, rgba(229, 228, 226, 0.12) 0 1px, rgba(0, 0, 0, 0) 1px 3.5px),
        radial-gradient(circle, var(--mn-platinum) 0 14%, #1A1A1D 14.5% 98%, rgba(229, 228, 226, 0.5) 98.5% 100%);
    opacity: 0.38;
    animation: mn-fire 14s linear infinite;
    -webkit-mask-image: radial-gradient(circle, #000 60%, transparent 72%);
    mask-image: radial-gradient(circle, #000 60%, transparent 72%);
}
@media (max-width: 900px) { .yt-hero::after { opacity: 0.18; right: -40%; } }
.yt-hero__badge { box-shadow: inset 0 0 0 1px rgba(229, 228, 226, 0.35); }

/* Play buttons become platinum discs */
.yt-video-card__play {
    width: 52px; height: 52px; color: #141416;
    background:
        radial-gradient(circle, var(--mn-platinum) 0 34%, #2A2A2E 35% 38%, transparent 39%),
        conic-gradient(from var(--mn-fire), rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0.28) 35deg, rgba(255, 255, 255, 0) 80deg, rgba(255, 255, 255, 0) 180deg, rgba(255, 255, 255, 0.22) 215deg, rgba(255, 255, 255, 0) 260deg),
        repeating-radial-gradient(circle, #1B1B1E 0 1.4px, #2B2B30 1.4px 2.8px);
    box-shadow: 0 0 0 1.5px rgba(229, 228, 226, 0.55), 0 10px 24px -8px rgba(0, 0, 0, 0.7);
}
.yt-video-card__play svg { width: 14px; height: 14px; margin-left: 2px; }
.yt-video-card:hover .yt-video-card__play { animation: mn-fire 2.2s linear infinite; }
.yt-video-card:hover { box-shadow: var(--shadow-lg), 0 0 0 1px rgba(141, 146, 152, 0.55); }

/* Watch page: the player sits in a brushed-platinum bezel */
.watch-page__player {
    padding: 3px; border-radius: calc(var(--radius-lg) + 3px);
    background: var(--mn-lustre-platinum); background-size: 220% 100%;
    animation: mn-bezel 12s ease-in-out infinite alternate;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.55);
}
@keyframes mn-bezel { to { background-position: 100% 0; } }
.watch-page__player .yt-embed { box-shadow: none; }
.watch-page__category {
    display: inline-flex; align-items: center; gap: 0.45em; color: var(--mn-platinum-ink);
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.9), rgba(185, 190, 196, 0.45)); box-shadow: inset 0 0 0 1px rgba(141, 146, 152, 0.45);
}
.watch-page__category::before { /* a small record */
    content: ""; width: 0.85em; height: 0.85em; border-radius: 50%;
    background: radial-gradient(circle, var(--mn-platinum) 0 28%, #222 30% 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
[data-theme="dark"] .watch-page__category { color: #E5E4E2; background: rgba(229, 228, 226, 0.1); }

/* ==========================================================================
   Motion, forced colours, print
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .article__meta time::before, .yt-hero::after, .yt-video-card:hover .yt-video-card__play, .watch-page__player { animation: none !important; }
}
@media (forced-colors: active) {
    .page-header--journal::before, .yt-hero::after { display: none; }
    .article__body .container > p:first-child::first-letter { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; }
    .article__body blockquote { border-image: none; border-left-color: CanvasText; }
}
@media print {
    .yt-hero::after, .page-header--journal::before { display: none !important; }
    .article__body .container > p:first-child::first-letter { background: none; color: #000; -webkit-text-fill-color: #000; }
}
