/* ============================================
   monopole.wiki — Scandinavian Observatory
   Chrome-Metallic / Star-Celestial / Masonry
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-midnight: #1a1a2e;
    --frost-white: #f7f7f9;
    --platinum-text: #e8e8ec;
    --brushed-chrome: #b8b8c0;
    --titanium-gray: #4a4a58;
    --magnetic-blue: #5b7dba;
    --aurora-silver: #c8d0e4;
    --carbon-black: #0e0e18;
    --signal-violet: #7b68ae;

    --font-display: 'Nunito', sans-serif;
    --font-body: 'Quicksand', sans-serif;
    --font-accent: 'Comfortaa', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--frost-white);
    color: var(--titanium-gray);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* --- Magnetic Field Lines Background --- */
.field-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0.12;
}

.field-lines path {
    fill: none;
    stroke: var(--brushed-chrome);
    stroke-width: 1px;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--deep-midnight);
    z-index: 1;
}

.hero-starfield {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.hero-duotone {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--deep-midnight), var(--aurora-silver));
    mix-blend-mode: color;
    opacity: 0.4;
    z-index: 2;
}

.hero-title {
    position: relative;
    z-index: 3;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: -0.02em;
    color: var(--platinum-text);
    text-align: center;
    background: linear-gradient(180deg, #e8e8ec 0%, #b8b8c0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: refined-glitch 600ms ease-out 1;
}

.hero-subtitle {
    position: relative;
    z-index: 3;
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--aurora-silver);
    margin-top: 1.5rem;
    text-align: center;
}

/* --- Glitch Animation --- */
@keyframes refined-glitch {
    0% { text-shadow: 2px 0 #7b68ae, -2px 0 #5b7dba; }
    15% { text-shadow: -1px 0 #7b68ae, 1px 0 #5b7dba; }
    30% { text-shadow: 1px 0 #7b68ae, -1px 0 #5b7dba; }
    50% { text-shadow: 0 0 transparent, 0 0 transparent; }
    100% { text-shadow: 0 0 transparent, 0 0 transparent; }
}

.glitch-animate {
    animation: refined-glitch 600ms ease-out 1;
}

/* --- Card Entrance Animation --- */
@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    opacity: 0;
    transform: translateY(8px);
}

.card.visible {
    animation: card-enter 400ms ease-out forwards;
}

/* --- Masonry Layout --- */
.masonry-container {
    position: relative;
    z-index: 1;
    column-count: 3;
    column-gap: 2.4rem;
    padding: 4rem 4rem 6rem;
    max-width: 1440px;
    margin: 0 auto;
}

/* --- Card Base Styles --- */
.card {
    break-inside: avoid;
    margin-bottom: 2rem;
    border: 1px solid var(--brushed-chrome);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    transition: border-color 300ms ease;
}

.card:hover {
    border-color: var(--aurora-silver);
}

/* Hover star points at corners */
.card::before,
.card::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--aurora-silver);
    box-shadow: 0 0 8px var(--aurora-silver);
    opacity: 0;
    transition: opacity 400ms ease;
    pointer-events: none;
}

.card::before {
    top: 8px;
    right: 8px;
}

.card::after {
    bottom: 8px;
    left: 8px;
}

.card:hover::before,
.card:hover::after {
    opacity: 1;
}

/* --- Card Label --- */
.card-label {
    display: inline-block;
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--magnetic-blue);
    margin-bottom: 0.75rem;
}

/* --- Card Typography --- */
.card h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
    color: var(--deep-midnight);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.card p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--titanium-gray);
    line-height: 1.72;
}

.card p + p {
    margin-top: 1rem;
}

.card p em {
    font-weight: 500;
    font-style: italic;
    color: var(--magnetic-blue);
}

/* --- Definition Cards --- */
.card-definition {
    background: var(--frost-white);
    min-height: 180px;
}

/* --- Equation Plates --- */
.card-equation {
    background: linear-gradient(170deg, var(--deep-midnight) 0%, #14142a 100%);
    min-height: 280px;
    box-shadow: 0 0 40px rgba(184, 184, 192, 0.15);
}

.card-equation .card-label {
    color: var(--aurora-silver);
}

.card-equation h2 {
    color: var(--platinum-text);
}

.card-equation p {
    color: var(--aurora-silver);
}

.card-equation p em {
    color: var(--magnetic-blue);
}

.equation-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
    margin: 0.5rem 0;
    border-top: 1px solid rgba(184, 184, 192, 0.2);
    border-bottom: 1px solid rgba(184, 184, 192, 0.2);
}

.equation-svg {
    width: 100%;
    max-width: 380px;
    height: auto;
}

/* --- Narrative Panels --- */
.card-narrative {
    background: #ffffff;
    min-height: 400px;
    padding-left: 2.5rem;
    border-left: 4px solid #c0c0cc;
}

/* --- Star Field Windows --- */
.card-starfield {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    min-height: 320px;
    padding: 0;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.starfield-bg {
    position: absolute;
    inset: 0;
    background-color: var(--deep-midnight);
    z-index: 0;
}

.starfield-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--deep-midnight), var(--aurora-silver));
    mix-blend-mode: color;
    opacity: 0.6;
    z-index: 1;
}

.starfield-annotations {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.annotation-svg {
    width: 100%;
    height: 100%;
}

.annotation-svg line {
    stroke: #8888aa;
    stroke-width: 0.5;
    opacity: 0.6;
}

.annotation-svg circle {
    fill: var(--aurora-silver);
    opacity: 0.7;
}

.starfield-caption {
    position: relative;
    z-index: 3;
    padding: 1.5rem 2rem;
    background: linear-gradient(to top, rgba(14, 14, 24, 0.9), transparent);
}

.starfield-caption .card-label {
    color: var(--aurora-silver);
}

.starfield-caption p {
    color: var(--aurora-silver);
    font-size: 0.85rem;
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
}

.card-starfield:hover {
    border-color: transparent;
}

/* --- Star Divider --- */
.star-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 0;
}

.star-point {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--aurora-silver);
    box-shadow: 0 0 8px var(--aurora-silver);
}

/* --- Further Reading Section --- */
.further-reading {
    position: relative;
    z-index: 1;
    background-color: var(--carbon-black);
    padding: 6rem 4rem;
    overflow: hidden;
}

.further-starfield {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.further-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.further-reading h2 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: -0.01em;
    color: var(--platinum-text);
    text-align: center;
    margin-bottom: 2.5rem;
}

.reading-list {
    list-style: none;
    padding: 0;
}

.reading-list li {
    position: relative;
    padding-left: 1.5rem;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--aurora-silver);
    line-height: 1.72;
    margin-bottom: 1.25rem;
}

.reading-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--magnetic-blue);
    box-shadow: 0 0 8px var(--aurora-silver);
}

.reading-list li em {
    font-style: italic;
    color: var(--platinum-text);
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .masonry-container {
        column-count: 2;
        padding: 3rem 2.5rem 5rem;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 640px) {
    .masonry-container {
        column-count: 1;
        padding: 2rem 1.5rem 4rem;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .further-reading {
        padding: 4rem 1.5rem;
    }

    .card-narrative {
        min-height: auto;
    }

    .card-equation {
        min-height: auto;
    }
}

/* --- Star point bullet replacement for further reading --- */
.further-reading .star-divider .star-point {
    background: var(--aurora-silver);
}

/* --- Custom list stars for body --- */
.card ul {
    list-style: none;
    padding: 0;
}

.card ul li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.card ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--magnetic-blue);
    box-shadow: 0 0 8px var(--aurora-silver);
}

/* --- Selection color --- */
::selection {
    background: var(--magnetic-blue);
    color: var(--frost-white);
}
