/* ==================================================================
   INNER TOTEM (2.0.0)
   The family card in the totems' own colours: a night sky of deep blue
   and teal, starlight ink and one gold accent, taken from the art.
   Round buttons and tabs, a soft cross-fade between screens, and no
   movement at all when the device asks for reduced motion.
   In the Hermitage the card follows the skin on screen (data-hscheme on
   <html>, protocol 1.2): light or dark, in the skin's own colours.
================================================================== */
.itotem {
    --it-bg-a: #0b1424; --it-bg-b: #12283b; --it-panel: rgba(255, 255, 255, .05);
    --it-ink: #f3ecdc; --it-muted: #b8b1a0; --it-line: rgba(233, 196, 111, .22);
    --it-gold: #e9c46f; --it-btn: #e9c46f; --it-btn-ink: #1a1408; --it-chip: rgba(255, 255, 255, .07);
    --it-star: rgba(255, 255, 255, .55);
    position: relative;
    color: var(--it-ink);
    text-align: center;
    max-width: 460px;
    margin: 1.5rem auto;
    padding: 0 0 1rem;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: linear-gradient(180deg, var(--it-bg-a), var(--it-bg-b) 60%, var(--it-bg-a));
    border: 1px solid var(--it-line);
    border-radius: 16px;
    overflow: hidden;
    box-sizing: border-box;
}
.itotem *, .itotem *::before, .itotem *::after { box-sizing: border-box; }
.itotem a { color: var(--it-gold); }

/* a few fixed stars behind everything */
.it-sky {
    position: absolute; inset: 0; pointer-events: none; opacity: .8;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 18%, var(--it-star), transparent),
        radial-gradient(1px 1px at 78% 12%, var(--it-star), transparent),
        radial-gradient(1.5px 1.5px at 64% 34%, var(--it-star), transparent),
        radial-gradient(1px 1px at 30% 52%, var(--it-star), transparent),
        radial-gradient(1.5px 1.5px at 88% 66%, var(--it-star), transparent),
        radial-gradient(1px 1px at 8% 80%, var(--it-star), transparent),
        radial-gradient(1px 1px at 46% 90%, var(--it-star), transparent);
}
.itotem > *:not(.it-sky) { position: relative; }

.it-head { padding: 1.1rem 1rem .2rem; }
.it-app-name {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    margin: 0; font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: 1.6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--it-gold);
}
.it-rule { flex: 0 1 70px; height: 1px; background: linear-gradient(90deg, transparent, var(--it-gold), transparent); }
.it-label { margin: .3rem 0 0; color: var(--it-muted); font-size: .95rem; }

.it-tabs { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; padding: .6rem .8rem .2rem; }
.it-tab {
    font: inherit; font-size: .92rem; cursor: pointer; color: var(--it-muted);
    background: transparent; border: 1px solid var(--it-line); border-radius: 999px; padding: .32rem .9rem;
}
.it-tab:hover { color: var(--it-ink); }
.it-tab.is-active { color: var(--it-btn-ink); background: var(--it-btn); border-color: var(--it-btn); }

.it-screen { padding: .6rem 1.2rem .4rem; min-height: 320px; transition: opacity .4s ease; }
.it-screen.is-out { opacity: 0; }
.it-loading, .it-lead { color: var(--it-ink); margin: .5rem 0; }
.it-note, .it-sub { color: var(--it-muted); font-size: .9rem; margin: .5rem 0; }
.it-title { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 1.6rem; margin: .4rem 0 .4rem; color: var(--it-ink); }
.itotem h4 { margin: 1.2rem 0 .4rem; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--it-gold); font-weight: 600; }
.itotem h3 { margin: 0 0 .2rem; font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.4rem; }

/* buttons */
.it-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: .8rem 0 .3rem; }
.it-btn {
    font: inherit; font-size: .95rem; cursor: pointer; color: var(--it-ink);
    background: var(--it-chip); border: 1px solid var(--it-line); border-radius: 999px; padding: .5rem 1.1rem;
    transition: transform .15s ease, background .2s ease;
}
.it-btn:hover { transform: translateY(-1px); }
.it-btn.is-main { color: var(--it-btn-ink); background: var(--it-btn); border-color: var(--it-btn); font-weight: 600; }
.it-btn.is-big { font-size: 1.1rem; padding: .7rem 1.6rem; }
.it-btn:disabled { opacity: .6; cursor: default; transform: none; }
.it-link { font: inherit; font-size: .9rem; cursor: pointer; color: var(--it-gold); background: none; border: 0; padding: .2rem .3rem; text-decoration: underline; text-underline-offset: 3px; }
.it-actions { margin: 1rem 0 .2rem; }
.itotem :focus-visible { outline: 2px solid var(--it-gold); outline-offset: 2px; }
.it-msg { min-height: 1.4em; margin: .2rem 0; font-size: .9rem; color: var(--it-gold); }

/* the ritual: a slow orb */
.it-ritual { padding: .4rem 0 .2rem; }
.it-orb { width: 120px; height: 120px; margin: .6rem auto 1rem; border-radius: 50%; display: grid; place-items: center;
    background: radial-gradient(circle, rgba(233, 196, 111, .35), rgba(233, 196, 111, 0) 70%); animation: it-breathe 6s ease-in-out infinite; }
.it-orb span { width: 36px; height: 36px; border-radius: 50%; background: radial-gradient(circle, #fff6dc, var(--it-gold) 60%, transparent 72%); }
@keyframes it-breathe { 0%, 100% { transform: scale(.85); opacity: .75; } 50% { transform: scale(1.08); opacity: 1; } }

/* the turn: a ring of light while the totem comes forward */
.it-turn { display: grid; place-items: center; min-height: 320px; }
.it-ring { position: relative; width: 170px; height: 170px; }
.it-ring i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--it-gold); animation: it-spin 2.3s cubic-bezier(.5, .1, .4, .9) forwards; }
.it-ring i:nth-child(2) { inset: 18px; border-top-color: transparent; border-right-color: rgba(233, 196, 111, .7); animation-duration: 2s; }
.it-ring i:nth-child(3) { inset: 40px; border: 0; background: radial-gradient(circle, rgba(255, 246, 220, .9), rgba(233, 196, 111, 0) 70%); animation: it-bloom 2.3s ease forwards; }
@keyframes it-spin { from { transform: rotate(0); opacity: 0; } 20% { opacity: 1; } to { transform: rotate(540deg); opacity: .2; } }
@keyframes it-bloom { 0% { transform: scale(.2); opacity: 0; } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }

/* the reading */
.it-reading { padding: .2rem 0 .4rem; }
.it-reading.is-fresh > * { opacity: 0; transform: translateY(10px); animation: it-rise 1.1s ease forwards; animation-delay: var(--d, 0s); }
@keyframes it-rise { to { opacity: 1; transform: none; } }
.it-art { width: 200px; height: 200px; margin: .4rem auto .8rem; border-radius: 50%; overflow: hidden;
    box-shadow: 0 0 0 2px rgba(233, 196, 111, .6), 0 0 40px rgba(233, 196, 111, .35); }
.it-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.it-kicker { margin: 0; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--it-muted); }
.it-name { margin: .1rem 0 .3rem; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 2.4rem; line-height: 1.1; color: var(--it-ink); outline: none; }
.it-trait { margin: 0 0 .25rem; color: var(--it-gold); font-size: .95rem; letter-spacing: .12em; text-transform: uppercase; }
.it-meta { margin: 0 0 .9rem; font-style: italic; color: var(--it-muted); font-size: .95rem; }
.it-meta em { font-style: normal; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .8; margin-right: .2em; }
.it-meta b { margin: 0 .5em; color: var(--it-gold); font-weight: 400; }
.it-message { font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.3rem; line-height: 1.45; margin: .6rem 0 .9rem; }
.it-time { display: inline-flex; align-items: center; gap: .5em; margin: 0 0 .9rem; color: var(--it-gold); font-weight: 600; }
.it-sun { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.it-sun.is-day { background: radial-gradient(circle, #fff3c4, var(--it-gold) 65%); box-shadow: 0 0 10px var(--it-gold); }
.it-sun.is-night { background: transparent; box-shadow: inset -5px -2px 0 0 var(--it-gold); }
.it-ask { margin: .2rem auto .4rem; max-width: 34ch; padding: .7rem 1rem; border-left: 2px solid var(--it-gold); background: var(--it-panel); border-radius: 0 10px 10px 0; text-align: left; font-size: .98rem; }

/* share and calendar */
.it-share, .it-sched { margin: 1.2rem 0 0; padding: .9rem 1rem 1rem; border-top: 1px solid var(--it-line); }
.it-sharetext { margin: .3rem 0; font-size: .95rem; color: var(--it-ink); transition: opacity .25s ease; }
.it-sharetext.is-out { opacity: 0; }
.it-socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: .5rem 0 .3rem; }
.it-social { font-size: .82rem; text-decoration: none; color: var(--it-muted) !important; border: 1px solid var(--it-line); border-radius: 999px; padding: .22rem .7rem; }
.it-social:hover { color: var(--it-ink) !important; border-color: var(--it-gold); }
.it-field { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: .8rem; color: var(--it-muted); }
.it-field select, .it-field input { font: inherit; font-size: .95rem; color: var(--it-ink); background: var(--it-chip); border: 1px solid var(--it-line); border-radius: 10px; padding: .35rem .6rem; color-scheme: dark; }
.it-field option { color: #111; }

/* the collection */
.it-progress { height: 6px; border-radius: 999px; background: var(--it-chip); overflow: hidden; margin: .6rem auto 1rem; max-width: 280px; }
.it-progress i { display: block; height: 100%; background: var(--it-gold); }
.it-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.it-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 8px; border-radius: 14px; border: 1px solid var(--it-line); background: var(--it-chip); color: var(--it-ink); font: inherit; font-size: .82rem; }
.it-tile img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.it-tile.is-met { cursor: pointer; }
.it-tile.is-met:hover { border-color: var(--it-gold); }
.it-tile small { position: absolute; top: 4px; right: 8px; color: var(--it-gold); font-size: .72rem; }
.it-tile.is-veiled { color: var(--it-muted); opacity: .6; }
.it-tile.is-veiled i { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 1.4rem; color: var(--it-gold); border: 1px dashed var(--it-line); }
.it-detail:empty { display: none; }
.it-card-mini { display: flex; gap: 14px; align-items: flex-start; text-align: left; margin: 1rem 0 .4rem; padding: .9rem; border: 1px solid var(--it-line); border-radius: 14px; background: var(--it-panel); }
.it-card-mini img { width: 84px; height: 84px; border-radius: 50%; flex: none; }
.it-card-mini p { margin: .3rem 0; }
.it-card-mini .it-meta { margin: 0; }
.it-card-mini .it-trait { margin: .3rem 0 0; font-size: .8rem; }

/* the pattern */
.it-pattern { text-align: left; margin: 1rem 0 .4rem; padding: .9rem 1rem 1rem; border: 1px solid var(--it-line); border-radius: 14px; background: var(--it-panel); }
.it-pattern h4 { text-align: center; margin-top: 0; }
.it-oracle { margin: .2rem 0 .6rem; font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.12rem; line-height: 1.4; }
.it-oracle p { margin: .35rem 0; }
.it-oracle b { color: var(--it-gold); font-weight: 600; }
.it-bars-title { margin: 1rem 0 .35rem; font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--it-muted); font-weight: 600; }
.it-bars { list-style: none; margin: 0; padding: 0; }
.it-bars li { margin: .3rem 0; }
.it-barrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .9rem; }
.it-barrow b { font-weight: 600; white-space: nowrap; }
.it-barrow em { font-style: normal; font-size: .72rem; color: var(--it-gold); border: 1px solid var(--it-line); border-radius: 999px; padding: 0 .45em; margin-left: .3em; }
.it-bar { height: 8px; border-radius: 999px; background: var(--it-chip); overflow: hidden; margin-top: 3px; }
.it-bar i { display: block; height: 100%; border-radius: 999px; background: color-mix(in srgb, var(--it-gold) 55%, transparent); transition: width .8s ease; }
.it-bars li.is-top .it-bar i { background: var(--it-gold); box-shadow: 0 0 10px var(--it-gold); }
.it-bar-totem { display: inline-flex; align-items: center; gap: 6px; font: inherit; color: var(--it-ink); background: none; border: 0; padding: 0; cursor: pointer; }
.it-bar-totem img { width: 24px; height: 24px; border-radius: 50%; }
.it-bar-totem:hover { color: var(--it-gold); }
.it-daynight { display: flex; height: 26px; border-radius: 999px; overflow: hidden; border: 1px solid var(--it-line); font-size: .78rem; }
.it-daynight i { font-style: normal; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; }
.it-daynight .is-day { background: var(--it-gold); color: var(--it-btn-ink); }
.it-daynight .is-night { background: #24365a; color: #e8e4f4; }
.it-pattern .it-row { margin-top: 1rem; }

/* Me */
.it-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: .8rem 0; }
.it-stat { padding: .7rem .4rem; border: 1px solid var(--it-line); border-radius: 14px; background: var(--it-chip); }
.it-stat b { display: block; font-family: "Cormorant Garamond", Georgia, serif; font-size: 2rem; line-height: 1; color: var(--it-gold); }
.it-stat b small { font-size: 1rem; color: var(--it-muted); }
.it-stat span { font-size: .82rem; color: var(--it-muted); }
.it-days { list-style: none; padding: 0; margin: 0 auto; max-width: 300px; text-align: left; }
.it-days li { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--it-line); padding: .15rem 0; font-size: .92rem; color: var(--it-muted); }

/* About */
.itotem ol { text-align: left; padding-left: 1.3rem; margin: .3rem 0; }
.itotem ol li { margin: .35rem 0; }
.it-box { text-align: left; padding: .2rem .9rem; border: 1px solid var(--it-line); border-radius: 12px; background: var(--it-panel); font-size: .94rem; }
.it-version { color: var(--it-muted); font-size: .8rem; margin-top: 1.2rem; }

.it-privacy { margin: .6rem 1.2rem 0; font-size: .78rem; color: var(--it-muted); }
.it-home { margin: .3rem 0 0; font-size: .85rem; }

/* ---- the Hermitage: the house colours, light and dark by the skin ---- */
.itotem.is-hermitage {
    --it-bg-a: #fbfaf6; --it-bg-b: #f4f0e7; --it-panel: rgba(0, 0, 0, .03);
    --it-ink: #2c2a26; --it-muted: #6f6a60; --it-line: #d4ccbd; --it-chip: #f1ede4;
    --it-gold: #8a6a24; --it-btn: #6d7f6a; --it-btn-ink: #fbfaf6; --it-star: rgba(0, 0, 0, 0);
}
.itotem.is-hermitage .it-field select, .itotem.is-hermitage .it-field input { color-scheme: light; }
html[data-hscheme="dark"] .itotem.is-hermitage {
    --it-bg-a: #1e1d19; --it-bg-b: #1a1916; --it-panel: rgba(255, 255, 255, .04);
    --it-ink: #ece7dd; --it-muted: #aaa293; --it-line: #403c33; --it-chip: #26241f;
    --it-gold: #d9b665; --it-btn: #a3b69f; --it-btn-ink: #1b1a17; --it-star: rgba(255, 255, 255, .4);
}
@media (prefers-color-scheme: dark) {
    html:not([data-hscheme]) .itotem.is-hermitage {
        --it-bg-a: #1e1d19; --it-bg-b: #1a1916; --it-panel: rgba(255, 255, 255, .04);
        --it-ink: #ece7dd; --it-muted: #aaa293; --it-line: #403c33; --it-chip: #26241f;
        --it-gold: #d9b665; --it-btn: #a3b69f; --it-btn-ink: #1b1a17; --it-star: rgba(255, 255, 255, .4);
    }
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
    html[data-hscheme][data-hskin] .itotem.is-hermitage {
        --it-bg-a: var(--h-bg); --it-bg-b: var(--h-bg);
        --it-ink: var(--h-ink); --it-btn: var(--h-accent); --it-gold: var(--h-accent);
        --it-muted: color-mix(in srgb, var(--h-ink) 68%, var(--h-bg));
        --it-line: color-mix(in srgb, var(--h-ink) 20%, var(--h-bg));
        --it-chip: color-mix(in srgb, var(--h-ink) 7%, var(--h-bg));
    }
}

@media (max-width: 420px) {
    .it-screen { padding: .5rem .8rem .3rem; }
    .it-name { font-size: 2rem; }
    .it-app-name { font-size: 1.25rem; letter-spacing: .1em; gap: 8px; }
    .it-rule { flex-basis: 34px; }
    .it-art { width: 170px; height: 170px; }
}
@media (prefers-reduced-motion: reduce) {
    .itotem *, .itotem *::before, .itotem *::after { animation: none !important; transition: none !important; }
}
