/* =============================================================
   Blocksy Planetario — Dark Astronomy override
   Maps Blocksy's --theme-palette-color-* variables and key
   element styles to the petition's dark astronomy design system.
   Loaded at wp_head priority 20 (after Blocksy's dynamic CSS at 10).
   ============================================================= */

/* ---------- Design tokens (mirror of firma/assets/style.css) ---------- */
:root {
    --pbg-0: #050813;
    --pbg-1: #0a0e1f;
    --pbg-2: #131830;
    --psurface: rgba(20, 26, 50, 0.65);
    --psurface-2: rgba(30, 38, 70, 0.55);
    --pborder: rgba(129, 140, 248, 0.18);
    --pborder-strong: rgba(129, 140, 248, 0.35);

    --ptext: #f1f5f9;
    --ptext-muted: #94a3b8;
    --ptext-dim: #64748b;

    --paccent: #818cf8;
    --paccent-bright: #a5b4fc;
    --paccent-cyan: #22d3ee;
    --paccent-purple: #c084fc;
    --paccent-gold: #fbbf24;

    --pshadow-glow: 0 0 60px rgba(129, 140, 248, 0.18);
    --pshadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);

    --pradius: 14px;
    --pradius-sm: 9px;
    --pradius-lg: 20px;

    --pfont-display: "Iowan Old Style", "Palatino Linotype", Palatino,
                     "Book Antiqua", Georgia, serif;
}

/* ---------- Blocksy palette variable overrides ----------
   Blocksy palette-1 defaults:
     1: #2872fa  → accent indigo
     2: #1559ed  → hover indigo
     3: #3A4F66  → body text (muted for dark bg)
     4: #192a3d  → headings (near-white on dark)
     5: #e1e8ed  → border (subtle indigo)
     6: #f2f5f7  → light surface (dark slate)
     7: #FAFBFC  → page background (deep night)
     8: #ffffff  → inverted text (stays near-white)
*/
:root {
    --theme-palette-color-1: var(--paccent);
    --theme-palette-color-2: var(--paccent-bright);
    --theme-palette-color-3: var(--ptext-muted);
    --theme-palette-color-4: var(--ptext);
    --theme-palette-color-5: var(--pborder);
    --theme-palette-color-6: var(--pbg-2);
    --theme-palette-color-7: var(--pbg-0);
    --theme-palette-color-8: #ffffff;

    --theme-text-color: var(--ptext);
    --theme-headings-color: var(--ptext);
    --theme-link-initial-color: var(--paccent-bright);
    --theme-link-hover-color: var(--paccent-cyan);
    --theme-border-color: var(--pborder);
    --theme-button-background-initial-color: var(--paccent);
    --theme-button-background-hover-color: var(--paccent-bright);
    --theme-button-text-initial-color: #ffffff;
    --theme-button-text-hover-color: #ffffff;
    --theme-selection-text-color: #ffffff;
    --theme-selection-background-color: var(--paccent);
}

/* ---------- Body: layered radial gradients over deep night ---------- */
body {
    color: var(--ptext);
    background:
        radial-gradient(ellipse at 20% 0%, rgba(129, 140, 248, 0.10), transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(192, 132, 252, 0.08), transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(34, 211, 238, 0.06), transparent 50%),
        var(--pbg-0);
    background-attachment: fixed;
}

::selection {
    color: #fff;
    background: var(--paccent);
}

/* ---------- Headings: serif display font ---------- */
h1, h2, h3, h4 {
    font-family: var(--pfont-display);
    color: var(--ptext);
    letter-spacing: -0.01em;
}

/* ---------- Links ---------- */
a {
    color: var(--paccent-bright);
    transition: color 0.15s ease;
}
a:hover {
    color: var(--paccent-cyan);
}

/* ---------- Starfield (injected via wp_body_open) ---------- */
.planetario-starfield {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.planetario-starfield::before,
.planetario-starfield::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 25% 15%, #fff, transparent),
        radial-gradient(1px 1px at 50% 80%, #cbd5e1, transparent),
        radial-gradient(1px 1px at 75% 35%, #fff, transparent),
        radial-gradient(2px 2px at 15% 60%, #a5b4fc, transparent),
        radial-gradient(1px 1px at 85% 65%, #c4b5fd, transparent),
        radial-gradient(1px 1px at 40% 25%, #e0e7ff, transparent),
        radial-gradient(1px 1px at 65% 90%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 10% 40%, #a5f3fc, transparent),
        radial-gradient(1px 1px at 90% 10%, #fff, transparent),
        radial-gradient(1px 1px at 30% 70%, #c084fc, transparent);
    background-size: 600px 600px;
    background-repeat: repeat;
    opacity: 0.5;
    animation: planetario-twinkle 6s ease-in-out infinite alternate;
}
.planetario-starfield::after {
    background-size: 350px 350px;
    background-position: 80px 120px;
    opacity: 0.3;
    animation-duration: 9s;
    animation-delay: -2s;
}
@keyframes planetario-twinkle {
    0% { opacity: 0.2; }
    100% { opacity: 0.65; }
}

/* Keep content above the starfield */
#main-container,
#header,
.ct-footer {
    position: relative;
    z-index: 1;
}

/* ---------- Header: glassmorphism ---------- */
#header {
    background: rgba(5, 8, 19, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--pborder);
}
#header [data-row] {
    background: rgba(5, 8, 19, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--pborder);
}
#header [data-row*='top'] {
    border-bottom: 1px solid var(--pborder);
}
#header [data-row*='bottom'] {
    border-top: 1px solid var(--pborder);
    border-bottom: none;
}
#header [data-row*='boxed'] > div {
    background: rgba(10, 14, 31, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}
/* Sub-menu dropdowns: dark glass */
#header .sub-menu,
#header [data-id='menu'] .sub-menu {
    background: rgba(10, 14, 31, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--pborder);
    border-radius: var(--pradius-sm);
}
.site-title, .site-title a, .site-description {
    color: var(--ptext) !important;
}
.site-title a:hover {
    color: var(--paccent-bright) !important;
}

/* Header menu items */
#header [data-device='desktop'] .ct-menu-link,
#header .ct-header-text {
    color: var(--ptext);
}
#header .ct-menu-link:hover,
#header [data-id='menu'] .ct-menu-link:hover,
#header [data-id='menu'] .current-menu-item > .ct-menu-link {
    color: var(--paccent-bright);
}
#header .ct-menu-link::after {
    background-color: var(--paccent);
}

/* ---------- Buttons: accent gradient + glow ---------- */
.ct-button,
button[class*="ajax"],
.ct-button-ghost {
    background: linear-gradient(135deg, var(--paccent), var(--paccent-bright));
    color: #ffffff !important;
    border: 1px solid transparent;
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.25);
    transition: all 0.2s ease;
    border-radius: var(--pradius-sm);
}
.ct-button:hover,
button[class*="ajax"]:hover,
.ct-button-ghost:hover {
    background: linear-gradient(135deg, var(--paccent-bright), var(--paccent-cyan));
    color: #ffffff !important;
    box-shadow: 0 6px 28px rgba(129, 140, 248, 0.4);
    transform: translateY(-1px);
}
.ct-button-ghost {
    background: transparent;
    border: 1px solid var(--pborder-strong);
    color: var(--paccent-bright) !important;
    box-shadow: none;
}
.ct-button-ghost:hover {
    background: var(--psurface);
    border-color: var(--paccent);
    color: #ffffff !important;
}

/* ---------- Content area + entry cards: glassmorphism ---------- */
.site-main {
    color: var(--ptext);
}
.entries > * > article,
.ct-posts .entry-card,
.archive .entry-card,
.search-results .entry-card {
    background: var(--psurface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--pborder);
    border-radius: var(--pradius);
    box-shadow: var(--pshadow-card);
    overflow: hidden;
}
.entries > * > article .entry-card-content,
.entry-card .entry-card-content {
    padding: 1.75rem;
}
.entry-title, .entry-title a {
    color: var(--ptext) !important;
    font-family: var(--pfont-display);
}
.entry-title a:hover {
    color: var(--paccent-bright) !important;
}
.entry-meta {
    color: var(--ptext-muted);
}
.entry-meta a {
    color: var(--paccent-bright);
}
.entry-meta a:hover {
    color: var(--paccent-cyan);
}
.entry-button .ct-button,
.entry-read-more {
    color: var(--paccent-bright) !important;
}

/* ---------- Page title / hero ---------- */
.ct-page-title {
    color: var(--ptext);
}
.ct-page-title .entry-meta {
    color: var(--ptext-muted);
}
.hero-section,
[data-prefix="single_blog_post"] .ct-container,
[data-prefix="blog"] .ct-container {
    color: var(--ptext);
}

/* ---------- Single post content ---------- */
.entry-content,
.entry-content p,
.comment-content p {
    color: var(--ptext);
    line-height: 1.7;
}
.entry-content h2,
.entry-content h3,
.entry-content h4 {
    color: var(--ptext);
}
.entry-content a {
    color: var(--paccent-bright);
    text-decoration: underline;
    text-decoration-color: var(--pborder-strong);
    text-underline-offset: 3px;
}
.entry-content a:hover {
    color: var(--paccent-cyan);
}
.entry-content blockquote {
    border-left: 3px solid var(--paccent);
    background: var(--psurface);
    padding: 1rem 1.5rem;
    border-radius: 0 var(--pradius-sm) var(--pradius-sm) 0;
    color: var(--ptext-muted);
}
.entry-content code,
.entry-content pre {
    background: var(--pbg-2);
    color: var(--paccent-cyan);
    border-radius: var(--pradius-sm);
}

/* ---------- Forms ---------- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
    background: var(--psurface-2);
    border: 1px solid var(--pborder);
    color: var(--ptext);
    border-radius: var(--pradius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    border-color: var(--paccent);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
    outline: none;
}
input::placeholder,
textarea::placeholder {
    color: var(--ptext-dim);
}

/* ---------- Sidebar widgets ---------- */
.ct-sidebar .ct-widget,
.widget {
    background: var(--psurface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--pborder);
    border-radius: var(--pradius);
    padding: 1.5rem;
    color: var(--ptext);
}
.widget-title,
.ct-widget .widget-title {
    color: var(--ptext);
    font-family: var(--pfont-display);
}
.widget a {
    color: var(--paccent-bright);
}
.widget a:hover {
    color: var(--paccent-cyan);
}

/* ---------- Footer ---------- */
.ct-footer {
    background: var(--pbg-1);
    border-top: 1px solid var(--pborder);
    color: var(--ptext-muted);
}
.ct-footer .site-title,
.ct-footer a {
    color: var(--ptext-muted);
}
.ct-footer a:hover {
    color: var(--paccent-bright);
}
.ct-footer .ct-widget {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}
.ct-footer-copyright {
    color: var(--ptext-dim);
}

/* ---------- Pagination ---------- */
.ct-pagination,
.pagination,
.wp-block-query-pagination {
    color: var(--ptext-muted);
}
.ct-pagination a,
.pagination a,
.wp-block-query-pagination a {
    color: var(--paccent-bright);
    background: var(--psurface);
    border: 1px solid var(--pborder);
    border-radius: var(--pradius-sm);
}
.ct-pagination a:hover,
.pagination a:hover,
.wp-block-query-pagination a:hover {
    color: #fff;
    background: var(--psurface-2);
    border-color: var(--paccent);
}
.ct-pagination .current,
.pagination .current,
.wp-block-query-pagination .current {
    background: var(--paccent);
    color: #fff;
    border-color: var(--paccent);
    border-radius: var(--pradius-sm);
}

/* ---------- Back to top button ---------- */
.ct-back-to-top {
    background: var(--psurface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--pborder);
    color: var(--paccent-bright);
    box-shadow: var(--pshadow-card);
}
.ct-back-to-top:hover {
    background: var(--psurface-2);
    color: var(--paccent-cyan);
    border-color: var(--paccent);
}

/* ---------- Breadcrumbs ---------- */
.ct-breadcrumbs,
.rank-math-breadcrumb {
    color: var(--ptext-muted);
}
.ct-breadcrumbs a,
.rank-math-breadcrumb a {
    color: var(--paccent-bright);
}
.ct-breadcrumbs a:hover,
.rank-math-breadcrumb a:hover {
    color: var(--paccent-cyan);
}

/* ---------- Search modal ---------- */
#search-modal,
.ct-header-search .modal {
    background: rgba(5, 8, 19, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
#search-modal input,
.ct-header-search input {
    color: var(--ptext);
    border-color: var(--pborder);
}

/* ---------- Tables ---------- */
table,
th,
td {
    border-color: var(--pborder);
}
th {
    background: var(--psurface-2);
    color: var(--ptext);
}
td {
    color: var(--ptext-muted);
}

/* ---------- HR / separator ---------- */
hr {
    background-color: var(--pborder);
    border: none;
    height: 1px;
}

/* ---------- Comments ---------- */
.comments-area,
.ct-comments {
    color: var(--ptext);
}
.ct-comments .comment-body {
    background: var(--psurface);
    border: 1px solid var(--pborder);
    border-radius: var(--pradius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.ct-comments .comment-meta a,
.ct-comments .comment-author {
    color: var(--ptext);
}
.ct-comments .reply a {
    color: var(--paccent-bright);
}
.ct-comments .reply a:hover {
    color: var(--paccent-cyan);
}

/* ---------- WordPress block editor blocks ---------- */
.wp-block-quote,
.wp-block-pullquote {
    border-color: var(--paccent);
    background: var(--psurface);
    color: var(--ptext);
    border-radius: var(--pradius);
}
.wp-block-quote cite,
.wp-block-pullquote cite {
    color: var(--ptext-muted);
}
.wp-block-separator {
    border-color: var(--pborder);
}
.wp-block-button .wp-block-button__link {
    background: linear-gradient(135deg, var(--paccent), var(--paccent-bright));
    color: #fff;
    border-radius: var(--pradius-sm);
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.25);
    border: none;
}
.wp-block-button .wp-block-button__link:hover {
    background: linear-gradient(135deg, var(--paccent-bright), var(--paccent-cyan));
    color: #fff;
}
.wp-block-button.is-style-outline .wp-block-button__link {
    background: transparent;
    border: 1px solid var(--pborder-strong);
    color: var(--paccent-bright);
    box-shadow: none;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
    background: var(--psurface);
    color: #fff;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 768px) {
    .entries > * > article,
    .archive .entry-card {
        padding: 0;
    }
    .ct-sidebar .ct-widget,
    .widget {
        padding: 1.25rem;
    }
}
