/**
 * Empire Mode home dashboard styles.
 * Loaded by spirit-baby.html (EN) and chinese/spirit-baby.html (CN).
 * No inline styles — CSP forbids them. All styling via classes here.
 */

/* Prevent display:flex from overriding the HTML hidden attribute */
.empire-scene-root[hidden] { display: none !important; }

/* r7: today-signals.js inserts a duplicate "what Lumis has learned about you"
   section after #spiritBabyContent. EmpireScene already renders the signals
   strip + identity panel, so hide ONLY those duplicates when Empire is active.
   2026-06-04: keep #ispiritDaily (daily question / narrative / weekly learning)
   visible — EmpireScene does NOT render those, and they're the §4.7 retention
   loop. Hiding the whole #ispiritExtras previously suppressed them entirely. */
body:has(.empire-scene-root) #ispiritExtras > .spirit-portrait,
body:has(.empire-scene-root) #ispiritExtras > .identity-card { display: none !important; }

/* ===== Spirit-baby page header overrides ===== */
/* White Poppins display title for the iSpirit name in the page-head */
.spirit-page-title {
    font-family: var(--font-display, 'Poppins', sans-serif);
    color: var(--fg-strong, #ffffff);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.15;
}

/* Uppercase muted eyebrow */
.spirit-baby-page-head .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.10em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--fg-muted, #94a3b8);
}

.empire-scene-root {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    color: var(--fg, #e6edf3);
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* ===== HERO ===== */

.empire-scene-hero {
    position: relative;
    border-radius: var(--radius-lg, 18px);
    padding: 0;
    min-height: 220px;
    color: #fafafa;
    overflow: hidden;
    box-shadow: var(--shadow-lg, 0 8px 28px rgba(0,0,0,0.35));
    background: linear-gradient(135deg, #10062a 0%, #0a0620 60%, #080418 100%);
    /* r7: photo scene background retired — keep the dark gradient only so the
       creature stays the visual subject. */
    background-image: none !important;
    display: flex;
    align-items: stretch;
}

/* Remove stage-specific photo gradients — creature-centric dark panel only */
.empire-stage-home_office,
.empire-stage-partner_office,
.empire-stage-team_office,
.empire-stage-growth_office,
.empire-stage-empire {
    background: linear-gradient(135deg, #12062e 0%, #0a0620 60%, #080418 100%);
    color: #fff;
}

/* Subtle per-stage accent via a coloured overlay strip */
.empire-stage-home_office::before   { background: rgba(180,140,80,0.08); }
.empire-stage-partner_office::before { background: rgba(148,121,255,0.10); }
.empire-stage-team_office::before   { background: rgba(44,122,91,0.08); }
.empire-stage-growth_office::before  { background: rgba(28,74,130,0.10); }
.empire-stage-empire::before        { background: rgba(232,184,109,0.10); }

.empire-scene-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* Decorative glow behind creature */
.empire-scene-hero::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(148,121,255,0.22) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Creature column */
.empire-hero-creature-col {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px 28px 28px;
}

.empire-hero-creature-img {
    width: 148px;
    height: 148px;
    object-fit: contain;
    filter: drop-shadow(0 4px 28px rgba(148,121,255,0.55));
    animation: empire-creature-float 4s ease-in-out infinite;
}

@keyframes empire-creature-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

/* Text column */
.empire-scene-hero-inner {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    padding: 32px 32px 56px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.empire-scene-stage-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    font-weight: 700;
    color: var(--accent-purple, #9479FF);
    background: rgba(148,121,255,0.14);
    border: 1px solid rgba(148,121,255,0.30);
    padding: 5px 12px;
    border-radius: var(--radius-pill, 999px);
    width: fit-content;
}

/* r7: the iSpirit name moved to the page-head H1, so the hero name slot is
   visually-hidden but kept in the DOM for screen readers + back-compat. */
.empire-scene-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    margin: -1px;
    border: 0;
    padding: 0;
}

/* r7: tagline is the lead voice of the hero — promote to display-size copy
   so it reads as a quiet statement, not a caption. */
.empire-scene-tagline {
    margin: 0;
    font-family: var(--font-serif, 'Fraunces', Georgia, serif);
    font-size: 1.75rem;
    color: rgba(255,255,255,0.92);
    line-height: 1.25;
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.01em;
    max-width: 540px;
    /* Push the tagline up so it doesn't compete with the today-signals
       overlay anchored at the bottom-right of the hero. */
    align-self: flex-start;
}

.empire-scene-creature-note {
    /* r7: retired in JS (now empty string); keep selector for back-compat. */
    display: none;
}

/* When a scene image is ready, overlay it */
.empire-scene-hero[data-scene-ready="true"] {
    background-size: cover;
    background-position: center;
}

/* ===== STATS ROW ===== */

/* r7: stats row is now a clean 4-column numerical strip. The chunky tinted
   icon squares were retired so the row scans as data, not decoration. */
.empire-scene-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.empire-stat {
    background: var(--surface-1, rgba(8, 13, 26, 0.75));
    border: 1px solid var(--border, #1f2937);
    border-radius: var(--radius-md, 14px);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 86px;
}

/* Icon-square retired in r7 (DOM node also removed from renderShell). The
   selector stays so any cached HTML keeps neutral whitespace until refresh. */
.empire-stat-icon-wrap { display: none; }

.empire-stat-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.empire-stat-value {
    font-family: var(--font-display, 'Poppins', sans-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--fg-strong, #ffffff);
    line-height: 1;
    display: block;
    letter-spacing: -0.02em;
}

.empire-stat-label {
    margin: 0;
    font-size: 0.78rem;
    color: var(--fg-muted, #94a3b8);
    letter-spacing: 0.02em;
    line-height: 1.3;
    display: block;
}

/* ===== IDENTITY PANEL ===== */

.empire-identity-panel {
    background: var(--surface-1, rgba(8, 13, 26, 0.75));
    border: 1px solid var(--border, #1f2937);
    border-radius: var(--radius-md, 14px);
    padding: 18px 20px;
}

.empire-identity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}

.empire-identity-title {
    margin: 0;
    font-size: 0.82rem;
    color: var(--fg-muted, #94a3b8);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.empire-identity-pct-label {
    font-size: 0.80rem;
    color: var(--fg-muted, #94a3b8);
    white-space: nowrap;
}

.empire-identity-pct-label strong {
    color: var(--accent-cyan, #4FACFE);
    font-weight: 700;
}

/* Gradient progress bar */
.empire-identity-bar-track {
    height: 6px;
    background: var(--border, #1f2937);
    border-radius: var(--radius-pill, 999px);
    overflow: hidden;
    margin-bottom: 14px;
}

.empire-identity-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan, #4FACFE) 0%, var(--accent-purple, #9479FF) 100%);
    border-radius: var(--radius-pill, 999px);
    transition: width 0.7s ease;
}

.empire-identity-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empire-identity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
}

.empire-identity-label {
    color: var(--fg-muted, #94a3b8);
    min-width: 130px;
    flex-shrink: 0;
}

.empire-identity-value {
    color: var(--fg, #e6edf3);
    font-weight: 500;
}

.empire-identity-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.empire-identity-chip {
    background: rgba(148,121,255,0.14);
    color: var(--fg, #e6edf3);
    border: 1px solid rgba(148,121,255,0.28);
    font-size: 0.80rem;
    padding: 3px 10px;
    border-radius: var(--radius-pill, 999px);
    font-weight: 500;
}

/* ===== STAGE PROGRESS BAR ===== */

.empire-scene-progress {
    background: var(--surface-1, rgba(8, 13, 26, 0.75));
    border: 1px solid var(--border, #1f2937);
    border-radius: var(--radius-md, 14px);
    padding: 14px 18px;
}

.empire-progress-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.empire-progress-label-from,
.empire-progress-label-to {
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--fg-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.empire-progress-label-to {
    text-align: right;
}

.empire-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.empire-progress-stage-from,
.empire-progress-stage-to {
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fg, #e6edf3);
    min-width: 80px;
}

.empire-progress-stage-to {
    text-align: right;
}

.empire-progress-bar {
    flex: 1 1 auto;
    height: 8px;
    background: var(--border, #1f2937);
    border-radius: var(--radius-pill, 999px);
    overflow: hidden;
    cursor: help;
}

.empire-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan, #4FACFE) 0%, var(--accent-purple, #9479FF) 100%);
    transition: width 0.6s ease;
    border-radius: var(--radius-pill, 999px);
}

.empire-progress-hint {
    margin: 10px 0 0;
    font-size: 0.84rem;
    color: var(--fg-muted, #94a3b8);
}

/* ===== CONTENT PANELS ROW ===== */

.empire-content-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.empire-panel {
    background: var(--surface-1, rgba(8, 13, 26, 0.75));
    border: 1px solid var(--border, #1f2937);
    border-radius: var(--radius-md, 14px);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empire-panel-full {
    grid-column: 1 / -1;
}

.empire-panel-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--fg-muted, #94a3b8);
    margin: 0;
}

.empire-panel-quote {
    font-family: var(--font-serif, 'Fraunces', Georgia, serif);
    font-size: 1.05rem;
    color: var(--fg, #e6edf3);
    line-height: 1.6;
    margin: 0;
    font-style: italic;
}

.empire-panel-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* r7: when the learned-about-you panel is full-width, render its items in
   a two-column flow so the panel reads densely instead of stretched. */
.empire-panel-list--two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    row-gap: 8px;
}
@media (max-width: 720px) {
    .empire-panel-list--two-col { grid-template-columns: 1fr; }
}

.empire-panel-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--fg, #e6edf3);
    line-height: 1.45;
}

.empire-panel-list-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-cyan, #4FACFE);
    margin-top: 6px;
}

.empire-panel-list-item.empire-panel-list-item--notice .empire-panel-list-dot {
    background: var(--accent-purple, #9479FF);
}

.empire-panel-voice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.empire-panel-voice-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.empire-panel-voice-cell-label {
    font-size: 0.72rem;
    color: var(--fg-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.empire-panel-voice-cell-value {
    font-size: 0.88rem;
    color: var(--fg, #e6edf3);
    font-weight: 500;
}

/* ===== ACTIONS ===== */

.empire-scene-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.empire-link-secondary {
    display: inline-block;
    padding: 10px 18px;
    background: var(--surface-1, rgba(8, 13, 26, 0.75));
    border: 1px solid var(--border, #1f2937);
    border-radius: var(--radius-pill, 999px);
    color: var(--fg, #e6edf3);
    text-decoration: none;
    font-size: 0.88rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.empire-link-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(148,121,255,0.4);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 860px) {
    .empire-scene-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .empire-content-panels {
        grid-template-columns: 1fr;
    }
    .empire-panel-full {
        grid-column: 1;
    }
}

@media (max-width: 600px) {
    .empire-scene-name { font-size: 1.6rem; }
    .empire-scene-hero { min-height: auto; }
    .empire-hero-creature-img { width: 88px; height: 88px; }
    .empire-hero-creature-col { padding: 20px 10px 20px 16px; }
    .empire-scene-hero-inner { padding: 20px 16px; }
    .empire-stat { padding: 12px; }
    .empire-stat-value { font-size: 1.35rem; }
    .empire-progress-stage-from,
    .empire-progress-stage-to { min-width: 60px; font-size: 0.75rem; }
    .empire-scene-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .empire-panel-voice-grid {
        grid-template-columns: 1fr;
    }
}

/* Reduced-motion respect (Dev Rule #33) */
@media (prefers-reduced-motion: reduce) {
    .empire-progress-fill,
    .empire-identity-bar-fill,
    .empire-hero-creature-img,
    .empire-scene-hero {
        transition: none;
        animation: none;
    }
}

/* ===== Companion theme toggle (user_profile.html section) ===== */

.companion-theme-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border, #1f2937);
}

.section-subtitle {
    font-size: 1.15rem;
    margin: 0 0 6px;
    font-weight: 600;
}

.companion-theme-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
}

@media (min-width: 640px) {
    .companion-theme-options { grid-template-columns: 1fr 1fr; }
}

.companion-theme-option {
    display: block;
    cursor: pointer;
}

.companion-theme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.companion-theme-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    background: var(--surface-1, rgba(8, 13, 26, 0.75));
    border: 1px solid var(--border, #1f2937);
    border-radius: 10px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.companion-theme-option input[type="radio"]:checked + .companion-theme-card {
    border-color: #9479ff;
    background: rgba(148, 121, 255, 0.12);
}

.companion-theme-option input[type="radio"]:focus-visible + .companion-theme-card {
    outline: 2px solid #6b4f9c;
    outline-offset: 2px;
}

.companion-theme-card strong {
    font-size: 1rem;
}

.companion-theme-card span {
    font-size: 0.88rem;
    color: var(--fg-muted, #94a3b8);
}

.companion-theme-status {
    margin: 12px 0 0;
    font-size: 0.88rem;
    color: var(--fg-muted, #94a3b8);
    min-height: 1.2em;
}

.companion-theme-status[data-kind="warn"]    { color: #b86b1e; }
.companion-theme-status[data-kind="error"]   { color: #b8221e; }
.companion-theme-status[data-kind="success"] { color: #2c7a5b; }

/* ===== Empire Mode in-app invite card (Phase 4) ===== */

.empire-invite-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 360px;
    background: linear-gradient(135deg, #f5d690 0%, #b87b1e 100%);
    color: #2a1f10;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    padding: 18px 20px;
    z-index: 9000;
    transform: translateY(0);
    transition: transform 0.25s ease, opacity 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.empire-invite-card.empire-invite-leaving {
    transform: translateY(20px);
    opacity: 0;
}

.empire-invite-card.empire-invite-pending {
    opacity: 0.7;
    pointer-events: none;
}

.empire-invite-title {
    font-size: 1.08rem;
    margin: 0 0 6px;
    font-weight: 700;
}

.empire-invite-text {
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0;
    color: #2a1f10;
}

.empire-invite-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.empire-invite-primary,
.empire-invite-dismiss {
    border: none;
    cursor: pointer;
    font: inherit;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: transform 0.1s ease, background 0.15s ease;
}

.empire-invite-primary {
    background: #2a1f10;
    color: #fff;
}

.empire-invite-primary:hover {
    background: #1a1208;
    transform: translateY(-1px);
}

.empire-invite-dismiss {
    background: rgba(255, 255, 255, 0.5);
    color: #2a1f10;
}

.empire-invite-dismiss:hover {
    background: rgba(255, 255, 255, 0.75);
}

@media (max-width: 600px) {
    .empire-invite-card {
        right: 12px;
        left: 12px;
        bottom: 12px;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .empire-invite-card { transition: none; }
}

/* ===== Today signals overlay (v1.2 — reward layer for accepted notices) =====
   r7: moved from bottom-left of the hero (where it collided with the
   tagline at narrower viewports) to a row anchored at the bottom-right
   of the hero, so the tagline reads cleanly while the curated notes stay
   in the same visual unit. */
.today-signals-overlay {
    position: absolute;
    bottom: 16px;
    right: 20px;
    left: auto;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    max-width: 46%;
    pointer-events: none;
}

.today-signal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.42);
    border-radius: 999px;
    color: #fafafa;
    font-size: 0.85rem;
    backdrop-filter: blur(6px);
    animation: today-signal-fade-in 0.45s ease;
}

@keyframes today-signal-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.today-signal-icon {
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}
/* Lucide glyph (icons.js inflates [data-icon] → svg). Size explicitly so it
   never flex-shrinks inside the inline-flex pill. */
.today-signal-icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.today-signal-caption {
    line-height: 1.3;
}

@media (max-width: 600px) {
    .today-signals-overlay {
        bottom: 12px;
        right: 12px;
        left: auto;
        max-width: 80%;
    }
    .today-signal { font-size: 0.78rem; padding: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .today-signal { animation: none; }
}

/* Shared Goals rail — Empire dashboard only. */
.empire-shared-goals {
    margin: 0;
    padding: 16px 18px 18px;
    background: var(--surface-1, rgba(8, 13, 26, 0.75));
    border: 1px solid var(--border, #1f2937);
    border-radius: 14px;
}
.empire-rail-title {
    font-size: 13px;
    letter-spacing: 0.06em;
    color: var(--fg-muted, #94a3b8);
    text-transform: uppercase;
    margin: 0 0 12px;
    font-weight: 600;
}
.empire-shared-goals__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.empire-shared-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border, #1f2937);
    border-radius: 12px;
    padding: 14px 16px;
    display: block;
    text-decoration: none;
    color: var(--fg, #e6edf3);
    transition: transform 120ms ease, border-color 120ms ease;
}
.empire-shared-card:hover {
    transform: translateY(-2px);
    border-color: rgba(148, 121, 255, 0.45);
}
.empire-shared-card__title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    line-height: 1.3;
}
.empire-shared-card__role {
    font-size: 12px;
    color: var(--fg-muted, #94a3b8);
    text-transform: capitalize;
}
.empire-cta {
    background: rgba(148, 121, 255, 0.16);
    color: var(--fg, #e6edf3);
    border: 1px solid rgba(148, 121, 255, 0.42);
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.empire-cta:hover {
    background: rgba(148, 121, 255, 0.28);
    border-color: rgba(148, 121, 255, 0.7);
}
.empire-cta:focus-visible {
    outline: 2px solid rgba(148, 121, 255, 0.85);
    outline-offset: 2px;
}

/* ── iSpirit page reorg (2026-06-28) ───────────────────────────────────────
   Align the daily-engagement zone to the empire width and lay its cards in a
   2-column grid so they pack tightly instead of stacking full-width. */
.ispirit-extras {
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.ispirit-daily {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.ispirit-daily > * { min-width: 0; }
@media (max-width: 900px) {
  .ispirit-daily { grid-template-columns: 1fr; }
}
