/* ============================================
   pmt.report - Frutiger-Aero Report Dashboard
   ============================================ */

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

:root {
    --sky-ethereal: #D8E8F8;
    --cloud-blue: #A0C0E8;
    --ocean-deep: #1838A0;
    --aero-frost: #E8F0F8;
    --rebel-red: #E04848;
    --ink-charcoal: #202030;
    --wave-teal: #40A0A8;

    --font-handwritten: 'Caveat', cursive;
    --font-body: 'Inter', sans-serif;

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--ink-charcoal);
    background: var(--sky-ethereal);
    overflow-x: hidden;
    line-height: 1.75;
}

/* --- COVER SECTION --- */
#cover {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    background: linear-gradient(160deg, var(--sky-ethereal) 0%, var(--cloud-blue) 50%, var(--sky-ethereal) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#cover-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 40%, rgba(160,192,232,0.4) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 60%, rgba(216,232,248,0.5) 0%, transparent 50%);
    pointer-events: none;
}

/* Wave decorations */
.wave-decoration {
    position: absolute;
    width: 100%;
    pointer-events: none;
}

#wave-top {
    top: 10%;
    left: 0;
    height: 120px;
    opacity: 0.5;
}

#wave-bottom {
    bottom: 0;
    left: 0;
    height: 120px;
}

.wave-path {
    animation: waveFlow 8s linear infinite;
}

.wave-path-1 { animation-duration: 8s; }
.wave-path-2 { animation-duration: 10s; animation-direction: reverse; }
.wave-path-3 { animation-duration: 12s; }
.wave-path-4 { animation-duration: 9s; }
.wave-path-5 { animation-duration: 11s; animation-direction: reverse; }
.wave-path-6 { animation-duration: 7s; }
.wave-path-7 { animation-duration: 10s; }

@keyframes waveFlow {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Cover icons */
#cover-icons {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cover-icon {
    position: absolute;
    opacity: 0;
    animation: iconFadeIn 800ms ease-out forwards;
    filter: drop-shadow(0 2px 4px rgba(24,56,160,0.15));
}

.icon-chart   { top: 18%; left: 12%; animation-delay: 400ms; }
.icon-pie     { top: 22%; right: 15%; animation-delay: 550ms; }
.icon-doc     { bottom: 28%; left: 18%; animation-delay: 700ms; }
.icon-gear    { top: 15%; right: 30%; animation-delay: 300ms; transform: scale(0.8); }
.icon-lightning { bottom: 32%; right: 12%; animation-delay: 600ms; }
.icon-target  { bottom: 22%; left: 35%; animation-delay: 500ms; transform: scale(0.9); }

@keyframes iconFadeIn {
    0% { opacity: 0; transform: scale(0.7) translateY(10px); }
    100% { opacity: 0.7; transform: scale(1) translateY(0); }
}

.icon-gear {
    animation: iconFadeIn 800ms ease-out forwards, gearSpin 20s linear infinite;
    animation-delay: 300ms, 0ms;
}

@keyframes gearSpin {
    0% { transform: scale(0.8) rotate(0deg); }
    100% { transform: scale(0.8) rotate(360deg); }
}

/* Cover content / Title */
#cover-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

#title {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(42px, 6vw, 80px);
    color: var(--ocean-deep);
    letter-spacing: -1px;
    opacity: 0;
    animation: titleReveal 1000ms ease-out 200ms forwards;
    text-shadow: 0 2px 8px rgba(24,56,160,0.15);
}

#title .char {
    display: inline-block;
    opacity: 0;
}

@keyframes titleReveal {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

#subtitle {
    font-family: var(--font-handwritten);
    font-weight: 400;
    font-size: 20px;
    color: var(--rebel-red);
    transform: rotate(-2deg);
    margin-top: 8px;
    opacity: 0;
    animation: subtitleIn 600ms ease-out 1200ms forwards;
}

@keyframes subtitleIn {
    0% { opacity: 0; transform: rotate(-4deg) translateY(10px); }
    100% { opacity: 1; transform: rotate(-2deg) translateY(0); }
}

/* Aero gloss sheen */
#aero-sheen {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.15) 45%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.15) 55%, transparent 60%);
    pointer-events: none;
    z-index: 3;
    animation: sheenSweep 3s ease-in-out 1.5s forwards;
}

@keyframes sheenSweep {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* --- WAVE BANDS --- */
.wave-band {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--sky-ethereal), var(--aero-frost));
}

.wave-band-svg {
    position: absolute;
    width: 200%;
    height: 100%;
    left: 0;
    top: 0;
}

.wave-flow {
    animation: waveBandFlow 12s linear infinite;
}

.wave-flow-1 { animation-duration: 10s; }
.wave-flow-2 { animation-duration: 14s; animation-direction: reverse; }
.wave-flow-3 { animation-duration: 11s; }
.wave-flow-4 { animation-duration: 13s; animation-direction: reverse; }

@keyframes waveBandFlow {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- HEX GRID --- */
#hex-grid {
    background: linear-gradient(180deg, var(--aero-frost) 0%, var(--sky-ethereal) 40%, var(--aero-frost) 100%);
    padding: 80px 20px 100px;
    min-height: 100vh;
}

.hex-grid-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--hex-gap);
    justify-items: center;
    align-items: start;
}

/* Hexagonal cells */
.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: default;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.hex-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

.hex-cell.hex-morph {
    cursor: pointer;
}

/* Offset rows for honeycomb pattern */
.hex-cell:nth-child(n+5):nth-child(-n+7) {
    transform: translateX(calc(var(--hex-size) * 0.5 + var(--hex-gap) * 0.5)) translateY(-30px);
}

.hex-cell:nth-child(n+5):nth-child(-n+7).visible {
    transform: translateX(calc(var(--hex-size) * 0.5 + var(--hex-gap) * 0.5)) translateY(-30px);
}

.hex-cell:nth-child(n+8) {
    transform: translateY(-60px);
}

.hex-cell:nth-child(n+8).visible {
    transform: translateY(-60px);
}

.hex-inner {
    position: absolute;
    inset: 3px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(180deg, var(--aero-frost) 0%, rgba(216,232,248,0.7) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: box-shadow 300ms ease, background 300ms ease;
    overflow: hidden;
}

/* Aero gloss on hex cells */
.hex-gloss {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Hex content */
.hex-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    width: 100%;
}

.hex-content-chart {
    width: 100%;
}

.hex-icon {
    margin-bottom: 4px;
}

.hex-label {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(11px, 0.8vw, 13px);
    color: var(--ink-charcoal);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hex-value {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: clamp(24px, 2.5vw, 40px);
    color: var(--ocean-deep);
    line-height: 1.1;
}

.hex-change {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 10px;
}

.hex-change.positive {
    color: #0a7a3e;
    background: rgba(10,180,80,0.1);
}

.hex-change.negative {
    color: var(--rebel-red);
    background: rgba(224,72,72,0.1);
}

/* Handwritten annotations */
.hex-annotation {
    font-family: var(--font-handwritten);
    font-weight: 400;
    font-size: 16px;
    color: var(--rebel-red);
    position: absolute;
    bottom: 20%;
    right: 8%;
    transform: rotate(-2deg);
    z-index: 3;
    opacity: 0;
    transition: opacity 400ms ease, transform 400ms ease;
    white-space: nowrap;
    pointer-events: none;
}

.hex-cell.visible .hex-annotation {
    opacity: 0.85;
}

/* Hex chart content */
.hex-chart {
    width: 100%;
    max-width: 140px;
    height: auto;
}

/* Hover effects */
.hex-cell:hover .hex-inner {
    background: linear-gradient(180deg, rgba(232,240,248,1) 0%, rgba(200,220,240,0.9) 100%);
}

.hex-cell:hover::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: transparent;
    border: 2px solid var(--ocean-deep);
    pointer-events: none;
    z-index: 4;
    box-shadow: 0 0 20px rgba(24,56,160,0.3);
}

.hex-cell.hex-morph:hover .hex-annotation {
    transform: rotate(0deg);
}

/* Morph pulse for interactive cells */
.hex-cell.hex-morph .hex-inner {
    animation: morphPulse 2s ease-in-out infinite;
}

@keyframes morphPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.01); }
}

/* Morph active state */
.hex-cell.morphed .hex-content-metric {
    display: none !important;
}

.hex-cell.morphed .hex-content-chart {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: morphIn 400ms ease-out;
}

.hex-cell.morphed .hex-annotation {
    opacity: 0 !important;
}

@keyframes morphIn {
    0% {
        opacity: 0;
        clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%);
    }
    100% {
        opacity: 1;
        clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    }
}

/* Cover icon hover: Rebel red shift */
.cover-icon:hover {
    filter: drop-shadow(0 2px 8px rgba(224,72,72,0.4));
}

/* Gloss shine on entry */
.hex-cell.visible .hex-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.2) 45%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.2) 55%, transparent 70%);
    pointer-events: none;
    z-index: 5;
    animation: hexShine 1.5s ease-in-out 0.5s forwards;
}

@keyframes hexShine {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* --- SIGNATURE BLOCK (Footer) --- */
#signature {
    position: relative;
    background: linear-gradient(180deg, var(--aero-frost), var(--sky-ethereal));
    padding: 60px 20px 80px;
    overflow: hidden;
}

#signature-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
}

#signature-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.signature-label {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(12px, 0.8vw, 14px);
    color: var(--ink-charcoal);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.signature-name {
    font-family: var(--font-handwritten);
    font-weight: 700;
    font-size: clamp(32px, 4vw, 52px);
    color: var(--ocean-deep);
    margin-bottom: 4px;
}

.signature-date {
    font-family: var(--font-handwritten);
    font-weight: 400;
    font-size: 18px;
    color: var(--wave-teal);
    transform: rotate(-1deg);
}

#signature-decorations {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 24px;
}

.sig-icon {
    opacity: 0.6;
    transition: opacity 300ms ease;
}

.sig-icon:hover {
    opacity: 1;
}

#signature-text {
    position: relative;
    z-index: 2;
}

/* --- RESPONSIVE --- */
@media (max-width: 1000px) {
    .hex-grid-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
    }

    .hex-cell {
        --hex-size: 180px;
    }

    .hex-cell:nth-child(n+5):nth-child(-n+7) {
        transform: translateX(0) translateY(0);
    }
    .hex-cell:nth-child(n+5):nth-child(-n+7).visible {
        transform: translateX(0) translateY(0);
    }
    .hex-cell:nth-child(n+8) {
        transform: translateY(0);
    }
    .hex-cell:nth-child(n+8).visible {
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .hex-grid-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .hex-cell {
        --hex-size: 160px;
    }

    .cover-icon {
        display: none;
    }

    #hex-grid {
        padding: 40px 10px 60px;
    }
}

@media (max-width: 480px) {
    .hex-grid-container {
        grid-template-columns: 1fr;
    }

    .hex-cell {
        --hex-size: 200px;
    }
}

/* --- Annotation write-in animation --- */
.hex-annotation {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 600ms ease-out 200ms, opacity 400ms ease, transform 400ms ease;
}

.hex-cell.visible .hex-annotation {
    clip-path: inset(0 0% 0 0);
}

/* --- Selection prevention on hex cells --- */
.hex-cell {
    user-select: none;
    -webkit-user-select: none;
}
