/* ===================================
   parallengine.com - Styles
   Aurora-gradient engine with grainy texture
   Font: Inter (Google Fonts)
   =================================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1vw, 17px);
    line-height: 1.75;
    color: #E8E8F0;
    background-color: #0A0820;
    overflow-x: hidden;
}

/* --- Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.05;
    transition: opacity 0.3s ease;
}

#grain-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    animation: grainShift 0.5s steps(4) infinite;
}

@keyframes grainShift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5%, -5%); }
    50% { transform: translate(5%, -10%); }
    75% { transform: translate(-10%, 5%); }
    100% { transform: translate(0, 0); }
}

/* --- Typography --- */
h1, h2 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(28px, 3.5vw, 56px);
}

h2 {
    font-size: clamp(22px, 2.5vw, 40px);
    margin-bottom: 24px;
}

.tech-label {
    display: inline-block;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #28C860;
    margin-bottom: 16px;
}

.playful-aside {
    font-weight: 400;
    font-style: italic;
    font-size: 14px;
    color: #E8E8F0;
    opacity: 0.65;
    transition: transform 0.2s ease;
}

.playful-aside:hover {
    transform: rotate(0.5deg);
}

/* --- Shake-Error Effect --- */
@keyframes shake {
    0% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-3px, 0) rotate(-0.5deg); }
    20% { transform: translate(3px, 0) rotate(0.5deg); }
    30% { transform: translate(-3px, 0) rotate(-0.5deg); }
    40% { transform: translate(3px, 0) rotate(0.5deg); }
    50% { transform: translate(-2px, 0) rotate(-0.3deg); }
    60% { transform: translate(2px, 0) rotate(0.3deg); }
    70% { transform: translate(-1px, 0) rotate(-0.2deg); }
    80% { transform: translate(1px, 0) rotate(0.2deg); }
    90% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.shake-active {
    animation: shake 0.2s ease-in-out;
}

/* --- Aurora Background --- */
.aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 50%, #28C860 0%, transparent 50%),
                radial-gradient(ellipse at 70% 30%, #6840B0 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, #D8A030 0%, transparent 40%),
                #0A0820;
    background-size: 200% 200%;
    animation: auroraShift 25s ease-in-out infinite;
    opacity: 0.35;
    z-index: 0;
}

@keyframes auroraShift {
    0% { background-position: 0% 0%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 50% 100%; }
    75% { background-position: 0% 50%; }
    100% { background-position: 0% 0%; }
}

/* --- Engine Ignition (Hero) --- */
#engine-ignition {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #0A0820;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 24px;
}

#domain-title {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    margin-bottom: 16px;
}

#domain-title.visible {
    opacity: 1;
    transform: translateX(0);
}

.hero-tagline {
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
}

.hero-tagline.visible {
    opacity: 0.65;
}

/* --- City Silhouettes --- */
.city-silhouette {
    width: 100%;
    height: auto;
}

#city-silhouette-hero {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px;
    z-index: 1;
}

#city-silhouette-hero .city-buildings rect {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1s ease;
}

#city-silhouette-hero.drawn .city-buildings rect {
    stroke-dashoffset: 0;
}

.city-windows circle {
    fill: none;
    transition: fill 0.3s ease;
}

.city-silhouette:hover .city-windows circle {
    fill: #28C860;
}

.city-divider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #0A0820;
}

.city-divider .city-silhouette {
    display: block;
    width: 100%;
    height: 120px;
    opacity: 0.6;
}

/* --- Architecture Layers --- */
.arch-layer {
    position: relative;
    width: 100%;
    padding: 100px 24px;
    background-color: #0A0820;
    border-left: 3px solid transparent;
    transition: border-color 0.3s ease;
}

.arch-layer:hover {
    border-left-color: #E04850;
}

/* Reduce grain on hovered layers */
.arch-layer:hover ~ #grain-overlay,
.arch-layer.hovered ~ #grain-overlay {
    opacity: 0.03;
}

.layer-content {
    max-width: 760px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.layer-content p {
    margin-bottom: 16px;
}

.layer-content .playful-aside {
    margin-top: 8px;
    margin-bottom: 32px;
}

/* --- Architecture Diagrams --- */
.arch-diagram {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 32px auto 0;
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.arch-diagram.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Diagram draw-in animation for strokes */
.arch-diagram rect,
.arch-diagram line,
.arch-diagram path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.2s ease;
}

.arch-diagram.visible rect,
.arch-diagram.visible line,
.arch-diagram.visible path {
    stroke-dashoffset: 0;
}

.arch-diagram text,
.arch-diagram polygon,
.arch-diagram circle {
    opacity: 0;
    transition: opacity 0.6s ease 0.6s;
}

.arch-diagram.visible text,
.arch-diagram.visible polygon,
.arch-diagram.visible circle {
    opacity: 1;
}

/* --- Core Layer (deepest) --- */
.arch-layer-core {
    position: relative;
    padding-bottom: 140px;
}

.core-glow {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: radial-gradient(ellipse at center bottom, #D8A030 0%, #6840B0 30%, transparent 70%);
    opacity: 0.2;
    animation: coreGlowPulse 4s ease-in-out infinite;
    z-index: 0;
}

@keyframes coreGlowPulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.3; }
}

/* --- Footer --- */
#engine-footer {
    position: relative;
    width: 100%;
    padding: 60px 24px 40px;
    background-color: #0A0820;
    text-align: center;
    z-index: 2;
}

.footer-content {
    max-width: 760px;
    margin: 0 auto;
}

.footer-content .tech-label {
    color: #D8A030;
    font-size: 14px;
    margin-bottom: 8px;
}

.footer-content .playful-aside {
    opacity: 0.4;
}

/* --- Scroll-based aurora intensification --- */
.aurora-intensify {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(ellipse at center bottom, #6840B0 0%, #28C860 20%, transparent 60%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* --- Parallax for city silhouettes --- */
.city-divider {
    will-change: transform;
}

/* --- Section fade-in on scroll --- */
.arch-layer .layer-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.arch-layer.in-view .layer-content {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .arch-layer {
        padding: 60px 16px;
    }

    #city-silhouette-hero {
        height: 100px;
    }

    .city-divider .city-silhouette {
        height: 80px;
    }

    .arch-diagram {
        max-width: 100%;
    }

    h1 {
        font-size: clamp(24px, 6vw, 40px);
    }

    h2 {
        font-size: clamp(20px, 4vw, 32px);
    }
}

/* --- Selection style --- */
::selection {
    background-color: #6840B0;
    color: #E8E8F0;
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0A0820;
}

::-webkit-scrollbar-thumb {
    background: #384058;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6840B0;
}
