/* ============================================
   plotgrapher.com - Styles
   Frutiger-Aero aesthetic with hexagonal-honeycomb layout
   ============================================ */

/* CSS Custom Properties */
:root {
    --triadic-blue: #2858C0;
    --triadic-red: #C82858;
    --triadic-green: #28C858;
    --chart-dark: #181828;
    --aero-white: #F0F4F8;
    --marble-cream: #E8E0D0;
    --glass-frost: #E0E8F0;

    --font-primary: 'Sora', sans-serif;

    --hex-size: 200px;
    --hex-gap: 4px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: clamp(14px, 0.9vw, 16px);
    line-height: 1.75;
    color: var(--aero-white);
    background: var(--chart-dark);
    overflow-x: hidden;
}

/* ============================================
   Observatory Hero
   ============================================ */
.observatory {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.observatory-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--triadic-blue) 0%, var(--triadic-red) 50%, var(--triadic-green) 100%);
    z-index: 0;
}

/* Marble-classical ornaments */
.ornament {
    position: absolute;
    z-index: 2;
    width: 60px;
    height: 200px;
    opacity: 0;
}

.ornament-left {
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
}

.ornament-right {
    right: 5%;
    top: 50%;
    transform: translateY(-50%) scaleX(-1);
}

.ornament-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.ornament.animated {
    opacity: 1;
}

.ornament.animated .ornament-path {
    animation: drawOrnament 1000ms ease-out forwards;
}

@keyframes drawOrnament {
    to {
        stroke-dashoffset: 0;
    }
}

/* Nature spiral */
.nature-spiral {
    position: absolute;
    z-index: 1;
    width: 400px;
    height: 400px;
    right: 10%;
    top: 15%;
    opacity: 0;
}

.nature-spiral.animated {
    opacity: 1;
}

.spiral-path {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
}

.nature-spiral.animated .spiral-path {
    animation: drawSpiral 2000ms ease-out forwards;
}

@keyframes drawSpiral {
    to {
        stroke-dashoffset: 0;
    }
}

/* Nature branch */
.nature-branch {
    position: absolute;
    z-index: 1;
    width: 200px;
    height: 280px;
    left: 8%;
    bottom: 10%;
    opacity: 0;
}

.nature-branch.animated {
    opacity: 1;
}

.branch-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
}

.nature-branch.animated .branch-path {
    animation: drawBranch 1500ms ease-out forwards;
}

@keyframes drawBranch {
    to {
        stroke-dashoffset: 0;
    }
}

/* Geometric frame */
.geometric-frame {
    position: absolute;
    z-index: 2;
    width: min(80%, 600px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.geometric-frame.animated {
    opacity: 1;
}

.frame-rect,
.frame-rect-inner,
.greek-key {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.geometric-frame.animated .frame-rect,
.geometric-frame.animated .frame-rect-inner,
.geometric-frame.animated .greek-key {
    animation: drawFrame 1200ms ease-out forwards;
}

@keyframes drawFrame {
    to {
        stroke-dashoffset: 0;
    }
}

/* Observatory content */
.observatory-content {
    position: relative;
    z-index: 3;
    text-align: center;
}

.domain-title {
    font-family: var(--font-primary);
    font-weight: 800;
    font-size: clamp(28px, 3.5vw, 56px);
    letter-spacing: -0.01em;
    color: var(--aero-white);
    opacity: 0;
    transform: translateY(20px);
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.domain-title.animated {
    animation: fadeInUp 600ms ease-out forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.observatory-tagline {
    font-weight: 400;
    font-size: clamp(14px, 1.2vw, 18px);
    color: var(--marble-cream);
    margin-top: 12px;
    opacity: 0;
}

.observatory-tagline.animated {
    animation: fadeIn 600ms 300ms ease-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 0.8;
    }
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 32px;
    z-index: 3;
    animation: bobDown 2s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ============================================
   Hex Grid Section
   ============================================ */
.hex-grid-section {
    position: relative;
    padding: 80px 24px;
    background: var(--chart-dark);
}

.section-heading {
    font-family: var(--font-primary);
    font-weight: 800;
    font-size: clamp(24px, 3vw, 44px);
    letter-spacing: -0.01em;
    text-align: center;
    color: var(--aero-white);
    margin-bottom: 48px;
}

.hex-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--hex-gap);
}

.hex-row {
    display: flex;
    gap: var(--hex-gap);
    justify-content: center;
}

.hex-row-odd {
    margin-top: calc(-1 * var(--hex-size) * 0.13);
}

/* Hexagonal cell */
.hex-cell {
    width: var(--hex-size);
    height: calc(var(--hex-size) * 1.1547);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;

    /* Frutiger-aero glass */
    background: linear-gradient(
        180deg,
        rgba(224, 232, 240, 0.85) 0%,
        rgba(224, 232, 240, 0.7) 100%
    );
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    /* Bounce-enter initial state */
    opacity: 0;
    transform: scale(0.8);
}

.hex-cell.visible {
    animation: bounceIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounceIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hex color variants - aero glossy gradients */
.hex-cell.hex-blue {
    background: linear-gradient(
        180deg,
        rgba(224, 232, 240, 0.85) 0%,
        rgba(200, 216, 240, 0.72) 100%
    );
}

.hex-cell.hex-red {
    background: linear-gradient(
        180deg,
        rgba(240, 224, 232, 0.85) 0%,
        rgba(240, 208, 220, 0.72) 100%
    );
}

.hex-cell.hex-green {
    background: linear-gradient(
        180deg,
        rgba(224, 240, 232, 0.85) 0%,
        rgba(208, 240, 220, 0.72) 100%
    );
}

/* Hex hover - triadic glow */
.hex-cell:hover {
    transform: scale(1.05);
}

.hex-cell.hex-blue:hover {
    filter: drop-shadow(0 0 16px rgba(40, 88, 192, 0.6));
}

.hex-cell.hex-red:hover {
    filter: drop-shadow(0 0 16px rgba(200, 40, 88, 0.6));
}

.hex-cell.hex-green:hover {
    filter: drop-shadow(0 0 16px rgba(40, 200, 88, 0.6));
}

/* Hex inner content */
.hex-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.hex-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
}

.hex-label {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--chart-dark);
    margin-bottom: 2px;
}

.hex-value {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: clamp(20px, 2vw, 32px);
    color: var(--chart-dark);
}

/* ============================================
   Nature-Data Interstitial
   ============================================ */
.nature-interstitial {
    position: relative;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    overflow: hidden;
}

.nature-interstitial-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, var(--chart-dark) 0%, #1a2040 50%, var(--chart-dark) 100%);
    z-index: 0;
}

.nature-interstitial-alt .nature-interstitial-bg {
    background: linear-gradient(200deg, var(--chart-dark) 0%, #20182a 50%, var(--chart-dark) 100%);
}

.nature-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 640px;
}

.nature-heading {
    font-family: var(--font-primary);
    font-weight: 800;
    font-size: clamp(24px, 3vw, 44px);
    letter-spacing: -0.01em;
    color: var(--aero-white);
    margin-bottom: 16px;
}

.nature-text {
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    color: var(--marble-cream);
    opacity: 0.85;
}

.fibonacci-spiral {
    position: absolute;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    height: auto;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fibonacci-spiral.animated {
    opacity: 1;
}

.fib-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.fibonacci-spiral.animated .fib-path {
    animation: drawSpiral 2500ms ease-out forwards;
}

.branching-tree {
    position: absolute;
    z-index: 1;
    width: 100%;
    max-width: 600px;
    height: auto;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.branching-tree.animated {
    opacity: 1;
}

.tree-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.branching-tree.animated .tree-path {
    animation: drawBranch 1800ms ease-out forwards;
}

/* ============================================
   Cartographer's Footer
   ============================================ */
.cartographer-footer {
    position: relative;
    padding: 60px 24px 48px;
    background: var(--chart-dark);
    overflow: hidden;
}

.footer-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
}

.footer-nature-border {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    height: 30px;
}

.footer-nature-border svg {
    width: 100%;
    height: 100%;
}

.footer-hex-grid {
    display: flex;
    justify-content: center;
    gap: var(--hex-gap);
    margin-top: 40px;
    margin-bottom: 40px;
}

.footer-hex {
    width: 100px;
    height: 115px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;

    /* Aero glass */
    background: linear-gradient(
        180deg,
        rgba(224, 232, 240, 0.15) 0%,
        rgba(224, 232, 240, 0.08) 100%
    );
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    /* Bounce entry state */
    opacity: 0;
    transform: scale(0.8);
}

.footer-hex.visible {
    animation: bounceIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.footer-hex:hover {
    transform: scale(1.1);
}

.footer-hex.hex-blue:hover {
    filter: drop-shadow(0 0 12px rgba(40, 88, 192, 0.5));
}

.footer-hex.hex-red:hover {
    filter: drop-shadow(0 0 12px rgba(200, 40, 88, 0.5));
}

.footer-hex.hex-green:hover {
    filter: drop-shadow(0 0 12px rgba(40, 200, 88, 0.5));
}

.footer-hex-inner {
    text-align: center;
}

.footer-hex .hex-label {
    color: var(--aero-white);
    font-size: 11px;
}

.footer-info {
    text-align: center;
    margin-top: 24px;
}

.footer-domain {
    font-family: var(--font-primary);
    font-weight: 800;
    font-size: clamp(20px, 2vw, 28px);
    letter-spacing: -0.01em;
    color: var(--aero-white);
    margin-bottom: 4px;
}

.footer-tagline {
    font-weight: 400;
    font-size: clamp(12px, 0.8vw, 14px);
    color: var(--marble-cream);
    opacity: 0.7;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    :root {
        --hex-size: 150px;
    }

    .ornament {
        width: 40px;
        height: 140px;
    }

    .nature-spiral {
        width: 250px;
        height: 250px;
    }

    .nature-branch {
        width: 140px;
        height: 200px;
    }
}

@media (max-width: 640px) {
    :root {
        --hex-size: 110px;
    }

    .hex-row {
        flex-wrap: wrap;
    }

    .hex-icon {
        width: 36px;
        height: 36px;
    }

    .hex-value {
        font-size: 14px;
    }

    .hex-label {
        font-size: 9px;
    }

    .ornament-left,
    .ornament-right {
        display: none;
    }

    .nature-spiral {
        width: 180px;
        height: 180px;
        right: -20px;
    }

    .nature-branch {
        display: none;
    }

    .geometric-frame {
        width: 90%;
    }

    .footer-hex {
        width: 70px;
        height: 81px;
    }

    .footer-hex .hex-label {
        font-size: 9px;
    }
}
