/* ========== RESET / GLOBAL ========== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
}

/* THEME VARIABLES */
:root {
    --bg-body: #050816;
    --bg-pane: #020617;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-subtle: #6b7280;
    --accent-gold: #c5a14e;
}

body.theme-light {
    --bg-body: #f9fafb;
    --bg-pane: #e5e7eb;
    --text-main: #020617;
    --text-muted: #4b5563;
    --text-subtle: #6b7280;
}

/* ========== PRELOADER ========== */

.preloader {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, #111827, #020617 60%, #000);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fbbf24;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.preloader-text {
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== MAIN LAYOUT ========== */

.layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Logo pane = 1/3 */
.logo-pane {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-pane);
    padding: 2rem;
    pointer-events: none; /* non blocca lo scroll */
}

#starfish-logo {
    width: 80%;
    max-width: 420px;
    height: auto;
}

/* Rays highlight */
#starfish-logo .ray {
    opacity: 0.45;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
#starfish-logo .ray.active {
    opacity: 0.9;
    transform: scale(1.01);
}

/* Content pane = 2/3 */
.content-pane {
    position: relative;
    background: var(--bg-body);
    overflow: hidden;
}

/* Landscape: logo left, content right */
@media (min-aspect-ratio: 1/1) {
    .layout { flex-direction: row; }
    .logo-pane { flex: 0 0 33.333%; }
    .content-pane { flex: 0 0 66.666%; }
}

/* Portrait: logo top, content bottom */
@media (max-aspect-ratio: 1/1) {
    .layout { flex-direction: column; }
    .logo-pane { flex: 0 0 33.333%; max-height: 35vh; }
    .content-pane { flex: 1; }
}

/* ========== THEME TOGGLE BUTTON (fixed) ========== */

.theme-toggle {
    position: fixed;           /* sempre in alto a dx rispetto alla finestra */
    top: 0.75rem;
    right: 0.75rem;
    z-index: 100;              /* sopra nav fullpage */
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.85);
    color: #f9fafb;
    padding: 0.45rem 0.6rem;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s ease, transform 0.1s ease, border-color 0.2s ease;
}

body.theme-light .theme-toggle {
    background: rgba(249, 250, 251, 0.9);
    color: #111827;
    border-color: rgba(148, 163, 184, 0.8);
}

.theme-toggle:hover {
    transform: translateY(-1px);
}

/* ========== FULLPAGE SECTIONS & STARFIELD ========== */

#fullpage {
    position: relative;
    z-index: 1;
    height: 100%;
}

.section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6vh 8vw;
    text-align: left;
    overflow: hidden; /* per il layer stelle interno */
}

/* STARFIELD PER OGNI SEZIONE */
.section::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(2px 2px at 10% 20%, rgba(255,255,255,0.95), transparent),
        radial-gradient(2px 2px at 30% 80%, rgba(255,255,255,0.85), transparent),
        radial-gradient(2px 2px at 70% 25%, rgba(255,255,255,0.9), transparent),
        radial-gradient(2px 2px at 85% 70%, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 50% 50%, rgba(255,255,255,0.9), transparent);
    opacity: 0.6;
    animation: starfield 30s linear infinite;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: screen;
}

@keyframes starfield {
    0% { transform: translateY(0); }
    100% { transform: translateY(-80px); }
}

/* Contenuto sopra le stelle */
.section-inner {
    position: relative;
    z-index: 1;
    max-width: 900px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.section-inner.visible {
    opacity: 1;
}

/* Typography */
.section-label {
    font-size: 0.8rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin-bottom: 0.75rem;
}

.hero-title {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 540px;
}

.sector-title {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.sector-description {
    font-size: 1rem;
    color: #d1d5db;
    max-width: 540px;
}

body.theme-light .sector-description {
    color: #374151;
}

.footer-note {
    font-size: 0.8rem;
    color: var(--text-subtle);
    margin-top: 1.5rem;
}

/* DARK THEME: sezioni differenziate e semi-trasparenti */
.section-hero {
    background: radial-gradient(circle at top,
        rgba(31, 41, 55, 0.85) 0%,
        rgba(2, 6, 23, 0.85) 60%,
        rgba(0, 0, 0, 0.85) 100%);
}
.section-health {
    background: rgba(15, 23, 42, 0.8);
}
.section-ecology {
    background: rgba(5, 46, 22, 0.8);
}
.section-ai {
    background: rgba(55, 48, 163, 0.8);
}
.section-space {
    background: rgba(15, 23, 42, 0.8);
}
/* Energy: blu “energia”, niente marrone */
.section-energy {
    background: rgba(30, 64, 175, 0.8); /* #1D4ED8 approx */
}
.section-social {
    background: rgba(15, 23, 42, 0.8);
}

/* LIGHT THEME: palette più chiara e distinta */
body.theme-light .section-hero {
    background: radial-gradient(circle at top,
        rgba(229, 231, 235, 0.95) 0%,
        rgba(249, 250, 251, 0.95) 60%,
        rgba(229, 231, 235, 0.95) 100%);
}
body.theme-light .section-health {
    background: rgba(229, 231, 235, 0.95);
}
body.theme-light .section-ecology {
    background: rgba(220, 252, 231, 0.95);
}
body.theme-light .section-ai {
    background: rgba(237, 233, 254, 0.95);
}
body.theme-light .section-space {
    background: rgba(219, 234, 254, 0.95);
}
body.theme-light .section-energy {
    background: rgba(219, 234, 254, 0.95);
}
body.theme-light .section-social {
    background: rgba(224, 231, 255, 0.95);
}

/* ========== FULLPAGE NAV COLORS ========== */

/* Dots di base (dark theme) */
#fp-nav ul li a span,
.fp-slidesNav ul li a span {
    background: rgba(148, 163, 184, 0.7);
}

/* Dot attivo (dark) */
#fp-nav ul li a.active span,
.fp-slidesNav ul li a.active span,
#fp-nav ul li:hover a span,
.fp-slidesNav ul li:hover a span {
    background: var(--accent-gold);
}

/* Tooltips (dark) */
#fp-nav ul li .fp-tooltip {
    font-size: 0.75rem;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #e5e7eb; /* chiaro per tema scuro */
}

/* LIGHT THEME: dots e tooltip più scuri */
body.theme-light #fp-nav ul li a span,
body.theme-light .fp-slidesNav ul li a span {
    background: rgba(31, 41, 55, 0.5);
}

body.theme-light #fp-nav ul li a.active span,
body.theme-light .fp-slidesNav ul li a.active span,
body.theme-light #fp-nav ul li:hover a span,
body.theme-light .fp-slidesNav ul li:hover a span {
    background: #111827;
}

body.theme-light #fp-nav ul li .fp-tooltip {
    color: #111827;
}

/* Mobile / narrow tweaks */
@media (max-width: 768px) {
    .section {
        text-align: center;
        padding: 4vh 6vw;
    }

    .hero-subtitle,
    .sector-description {
        max-width: 100%;
        margin: 0 auto;
    }
}
