@import url('./grounding-tokens.css');
@import url('./grounding-primitives.css');

/* ====================================
   VELORA PAGE PRIMITIVES
   Hero, editorial, and report surfaces grounded in cosmic tokens
   ==================================== */

/* ------------------------------------
   HERO ATMOSPHERE
   ------------------------------------ */
.hero-atmosphere {
    --hero-atmosphere-gradient: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.35), transparent 55%),
        radial-gradient(circle at 80% 0%, rgba(126, 87, 194, 0.6), transparent 65%),
        linear-gradient(135deg, #0f1024 0%, #281942 50%, #40235e 100%);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl, 20px);
    border: 1px solid var(--stroke-base, rgba(0, 0, 0, 0.12));
    padding: clamp(var(--space-12, 3rem), 6vw, var(--space-16, 4rem)) var(--space-6, 1.5rem);
    min-height: clamp(340px, 48vh, 580px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-base, #faf8f5);
    color: var(--text-strong, #151022);
    isolation: isolate;
}

.hero-atmosphere--compact {
    min-height: clamp(260px, 38vh, 420px);
    padding: clamp(var(--space-8, 2rem), 8vw, var(--space-12, 3rem)) var(--space-4, 1rem);
}

.hero-atmosphere-background {
    position: absolute;
    inset: 0;
    background: var(--hero-atmosphere-gradient);
    opacity: 0.85;
    filter: saturate(1.2) blur(0px);
    animation: hero-atmosphere-drift var(--motion-atmosphere, 30s) linear infinite;
    z-index: 0;
}

.hero-atmosphere-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(1px 1px at 10% 20%, rgba(255, 255, 255, 0.45), transparent),
        radial-gradient(1px 1px at 80% 50%, rgba(255, 255, 255, 0.35), transparent),
        radial-gradient(2px 2px at 50% 80%, rgba(255, 255, 255, 0.25), transparent);
    opacity: 0.4;
    animation: hero-atmosphere-twinkle 12s ease-in-out infinite;
}

.hero-atmosphere-content {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-xl, 20px);
    padding: var(--space-8, 2rem);
    box-shadow: var(--shadow-tight, 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1));
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

.hero-atmosphere-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
}

.hero-atmosphere-title {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 600;
    line-height: 1.15;
    color: var(--text-strong, #151022);
    margin: 0;
}

.hero-atmosphere-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.6;
    color: var(--text-muted, rgba(21, 16, 34, 0.78));
    margin: 0;
}

.hero-atmosphere-meta {
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, rgba(21, 16, 34, 0.65));
    margin-bottom: var(--space-2, 0.5rem);
}

.hero-atmosphere-extra {
    margin-top: var(--space-4, 1rem);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2, 0.5rem);
}

.hero-atmosphere--calculator {
    --hero-atmosphere-gradient: radial-gradient(circle at 15% 20%, rgba(255, 216, 236, 0.6), transparent 55%),
        radial-gradient(circle at 70% 0%, rgba(116, 172, 255, 0.9), transparent 60%),
        linear-gradient(135deg, #0d152c 0%, #192e4f 40%, #1e1d3a 100%);
}

.hero-atmosphere--horoscope {
    --hero-atmosphere-gradient: radial-gradient(circle at 10% 30%, rgba(255, 255, 255, 0.4), transparent 55%),
        radial-gradient(circle at 70% 10%, rgba(255, 179, 71, 0.5), transparent 60%),
        linear-gradient(135deg, #1e1242 0%, #2c1d5c 45%, #4a2e7d 100%);
}

.hero-atmosphere--compatibility {
    --hero-atmosphere-gradient: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.4), transparent 60%),
        radial-gradient(circle at 80% 10%, rgba(255, 99, 194, 0.5), transparent 55%),
        linear-gradient(135deg, #1b0f2e 0%, #2c0f3a 40%, #52163f 100%);
}

.hero-atmosphere--knowledge {
    --hero-atmosphere-gradient: radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.35), transparent 50%),
        radial-gradient(circle at 80% 0%, rgba(84, 216, 255, 0.4), transparent 60%),
        linear-gradient(135deg, #091f2c 0%, #0b2c3d 40%, #123d44 100%);
}

.hero-atmosphere--special {
    --hero-atmosphere-gradient: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.45), transparent 65%),
        radial-gradient(circle at 70% 0%, rgba(247, 164, 255, 0.65), transparent 55%),
        linear-gradient(135deg, #120b2b 0%, #24103f 42%, #360f51 100%);
}

@keyframes hero-atmosphere-drift {
    0% {
        transform: scale(1) translate3d(0, 0, 0);
    }
    50% {
        transform: scale(1.1) translate3d(-3%, -2%, 0);
    }
    100% {
        transform: scale(1) translate3d(0, 0, 0);
    }
}

@keyframes hero-atmosphere-twinkle {
    0% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 0.2;
    }
}

/* ------------------------------------
   EDITORIAL SECTION
   ------------------------------------ */
.editorial-section {
    --text-column-width: 65ch;
    padding: var(--space-12, 3rem) var(--space-4, 1rem);
    background: transparent;
    color: var(--text-strong, #151022);
}

.editorial-section--medium {
    --text-column-width: 75ch;
}

.editorial-section--wide {
    --text-column-width: 85ch;
}

.editorial-section--centered .editorial-content-shell {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.editorial-content-shell {
    max-width: var(--text-column-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 1rem);
}

.editorial-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    color: var(--text-muted, rgba(21, 16, 34, 0.65));
}

.editorial-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 600;
    margin: 0;
    color: var(--text-strong, #151022);
}

.editorial-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-default, rgba(21, 16, 34, 0.88));
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
    max-width: var(--text-column-width, 65ch);  /* Atmospheric System: enforce max-width */
}

/* Max-width discipline: Long explanations use narrow column, interactive UI can be wider */
.editorial-content p,
.editorial-content ul,
.editorial-content ol {
    max-width: 65ch;  /* Long explanations: narrow column */
}

.editorial-content .interactive-ui {
    max-width: 100%;  /* Interactive UI: wider */
}

.editorial-content > :last-child {
    margin-bottom: 0;
}

.editorial-cta {
    margin-top: var(--space-4, 1rem);
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--space-3, 0.75rem);
    justify-content: flex-start;
}

.editorial-section--centered .editorial-cta {
    justify-content: center;
}

/* ------------------------------------
   PAPER CARD
   ------------------------------------ */
.paper-card {
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-6, 1.5rem);
    box-shadow: var(--shadow-tight, 0 1px 2px rgba(0, 0, 0, 0.05));
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 1rem);
    transition: border-color var(--motion-ui-base, 180ms) var(--ease-ui, ease),
        box-shadow var(--motion-ui-base, 180ms) var(--ease-ui, ease),
        transform var(--motion-ui-fast, 120ms) var(--ease-ui, ease);
}

.paper-card--soft {
    background: var(--surface-soft, #f5f3ff);
}

.paper-card--elevated {
    box-shadow: var(--shadow-subtle, 0 2px 4px rgba(0, 0, 0, 0.06));
}

.paper-card--compact {
    padding: var(--space-4, 1rem);
}

.paper-card--spacious {
    padding: var(--space-8, 2rem);
}

.paper-card--interactive {
    cursor: pointer;
}

@media (hover: hover) {
    .paper-card--interactive:hover {
        border-color: var(--stroke-base, rgba(0, 0, 0, 0.12));
        box-shadow: var(--shadow-subtle, 0 2px 4px rgba(0, 0, 0, 0.06));
    }
}

.paper-card--interactive:active {
    transform: var(--press-down, translateY(1px));
}

.paper-card--reserved {
    min-height: 240px;
}

.paper-card-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
}

.paper-card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

.paper-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3, 0.75rem);
    justify-content: flex-start;
}

/* ------------------------------------
   REPORT HEADER
   ------------------------------------ */
.report-header {
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-xl, 20px);
    padding: var(--space-8, 2rem);
    box-shadow: var(--shadow-tight, 0 1px 2px rgba(0, 0, 0, 0.05));
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 1rem);
}

.report-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: var(--text-muted, rgba(21, 16, 34, 0.6));
}

.report-header-main {
    display: flex;
    gap: var(--space-4, 1rem);
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
}

.report-header-text {
    flex: 1 1 60%;
    min-width: 240px;
}

.report-title {
    margin: 0;
    font-size: clamp(2rem, 3.8vw, 2.75rem);
    line-height: 1.2;
    font-weight: 600;
    color: var(--text-strong, #151022);
}

.report-subtitle {
    margin: 0.4rem 0 0;
    font-size: 1.1rem;
    color: var(--text-muted, rgba(21, 16, 34, 0.7));
}

.report-score {
    min-width: 160px;
    padding: var(--space-4, 1rem);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-lg, 16px);
    background: var(--surface-soft, #f5f3ff);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 0.5rem);
}

.report-score-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-strong, #151022);
    line-height: 1.1;
}

.report-score-label {
    font-size: 0.95rem;
    color: var(--text-muted, rgba(21, 16, 34, 0.7));
}

.report-summary {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-default, rgba(21, 16, 34, 0.88));
    margin: 0;
}

.report-header-extra {
    border-top: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    padding-top: var(--space-4, 1rem);
}

/* ------------------------------------
   REPORT CHAPTER
   ------------------------------------ */
.report-chapter {
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-6, 1.5rem);
    box-shadow: var(--shadow-tight, 0 1px 2px rgba(0, 0, 0, 0.05));
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

.report-chapter--highlight {
    background: var(--surface-soft, #f5f3ff);
}

.report-chapter--reserved {
    min-height: 220px;
}

.report-chapter-header {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
}

.report-chapter-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full, 999px);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-size: 0.95rem;
}

.report-chapter-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.report-chapter-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-default, rgba(21, 16, 34, 0.88));
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

/* ------------------------------------
   FACTS PANEL
   ------------------------------------ */
.facts-panel {
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-6, 1.5rem);
    box-shadow: var(--shadow-tight, 0 1px 2px rgba(0, 0, 0, 0.05));
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 1rem);
}

.facts-panel--sticky {
    position: sticky;
    top: var(--space-12, 3rem);
}

.facts-panel-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.facts-panel-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

.facts-panel-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: var(--space-2, 0.5rem);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.facts-panel-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.facts-panel-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, rgba(21, 16, 34, 0.6));
}

.facts-panel-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-strong, #151022);
}

/* ------------------------------------
   EXPLAINER BLOCKS
   ------------------------------------ */
.explainer-blocks {
    padding: var(--space-8, 2rem) var(--space-4, 1rem);
}

.explainer-blocks--compact {
    padding: var(--space-6, 1.5rem) var(--space-3, 0.75rem);
}

.explainer-blocks-grid {
    display: grid;
    gap: var(--space-6, 1.5rem);
}

.explainer-blocks--1col .explainer-blocks-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.explainer-blocks--2col .explainer-blocks-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.explainer-blocks--3col .explainer-blocks-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.explainer-block {
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--stroke-subtle, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-6, 1.5rem);
    box-shadow: var(--shadow-tight, 0 1px 2px rgba(0, 0, 0, 0.05));
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 0.75rem);
}

.explainer-block-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.explainer-block-content {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-default, rgba(21, 16, 34, 0.88));
}

/* ------------------------------------
   RESPONSIVE ADJUSTMENTS
   ------------------------------------ */
@media (max-width: 1024px) {
    .hero-atmosphere-content {
        padding: var(--space-6, 1.5rem);
    }

    .report-header-main {
        flex-direction: column;
    }

    .report-score {
        width: 100%;
    }

    .explainer-blocks--3col .explainer-blocks-grid,
    .explainer-blocks--2col .explainer-blocks-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .hero-atmosphere {
        padding: var(--space-8, 2rem) var(--space-3, 0.75rem);
    }

    .hero-atmosphere-content {
        padding: var(--space-4, 1rem);
    }

    .hero-atmosphere-extra {
        flex-direction: column;
        align-items: stretch;
    }

    .facts-panel--sticky {
        position: static;
    }

    .explainer-blocks-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ------------------------------------
   DARK MODE SUPPORT
   ------------------------------------ */
[data-theme="dark"] .hero-atmosphere {
    color: var(--text-strong, #f9f6ff);
    background: #070712;
}

[data-theme="dark"] .hero-atmosphere-content,
[data-theme="dark"] .report-header,
[data-theme="dark"] .report-chapter,
[data-theme="dark"] .paper-card,
[data-theme="dark"] .facts-panel,
[data-theme="dark"] .explainer-block {
    background: var(--surface-card, #151829);
    color: var(--text-strong, #f9f6ff);
}

[data-theme="dark"] .editorial-section,
[data-theme="dark"] .editorial-content,
[data-theme="dark"] .report-summary,
[data-theme="dark"] .explainer-block-content,
[data-theme="dark"] .paper-card-body {
    color: var(--text-default, rgba(249, 246, 255, 0.82));
}

[data-theme="dark"] .report-score {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .report-chapter-icon {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .facts-panel-item {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* ------------------------------------
   REDUCED MOTION
   ------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .hero-atmosphere-background,
    .hero-atmosphere-background::after {
        animation: none;
    }

    .paper-card--interactive,
    .hero-atmosphere,
    .report-header,
    .report-chapter {
        transition-duration: 0.01ms !important;
    }
}
