/* ============================================ */
/* Destiny Vector - Custom Styles               */
/* Neo-Oriental Cyber Design System             */
/* ============================================ */

/* CSS Variables */
:root {
    --bg-deep: #0F172A;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-solid: #1E293B;
    --accent-gold: #F59E0B;
    --accent-purple: #8B5CF6;
    --vector-lu: #10B981;
    --vector-quan: #EF4444;
    --vector-ke: #3B82F6;
    --text-main: #E2E8F0;
    --text-dim: #94A3B8;
    --black-deep: #0B0F19;
}

/* ============================================ */
/* Base Styles                                  */
/* ============================================ */

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--text-main);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* Hide scrollbar for horizontal scroll */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ============================================ */
/* Glass Morphism Card                          */
/* ============================================ */

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -2px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

/* ============================================ */
/* Language Switcher                            */
/* ============================================ */

.lang-btn {
    color: var(--text-dim);
    background: transparent;
}

.lang-btn:hover {
    color: var(--text-main);
}

.lang-btn.active {
    background: var(--accent-purple);
    color: white;
    font-weight: 500;
}

/* ============================================ */
/* Hero Section Styles                          */
/* ============================================ */

#hero {
    background: linear-gradient(180deg, var(--bg-deep) 0%, var(--black-deep) 100%);
}

#hero-canvas {
    z-index: 1;
}

/* Typewriter Cursor */
.typewriter-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--accent-purple);
    margin-left: 4px;
    animation: blink 0.8s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* ============================================ */
/* Gender Toggle Styles                         */
/* ============================================ */

.gender-option input:checked+.gender-label {
    background: var(--accent-purple);
    color: white;
    font-weight: 500;
}

.gender-label {
    color: var(--text-dim);
}

.gender-label:hover {
    color: var(--text-main);
}

/* ============================================ */
/* Form Input Styles                            */
/* ============================================ */

.form-input::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

/* Custom Select Arrow */
select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Date Input Styles */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

/* ============================================ */
/* CTA Button Styles                            */
/* ============================================ */

.cta-button {
    background: linear-gradient(135deg, var(--accent-purple) 0%, #7C3AED 100%);
    position: relative;
    overflow: hidden;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 20px rgba(139, 92, 246, 0.4),
        0 0 40px rgba(139, 92, 246, 0.2),
        0 10px 40px -10px rgba(139, 92, 246, 0.5);
}

.cta-button:active {
    transform: translateY(0);
}

.cta-glow {
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
}

/* Loading State */
.cta-button.loading .cta-text,
.cta-button.loading>span:nth-child(2) {
    opacity: 0;
}

.cta-button.loading .cta-spinner {
    display: flex !important;
}

/* ============================================ */
/* Arrow Animation                              */
/* ============================================ */

@keyframes arrow-pulse {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

.animate-arrow-pulse {
    animation: arrow-pulse 2s infinite;
}

/* ============================================ */
/* Vector Lines Animation                       */
/* ============================================ */

.vector-line {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: dash 3s linear infinite;
}

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

/* ============================================ */
/* Reverse Trace Demo Styles                    */
/* ============================================ */

#trace-demo {
    perspective: 1000px;
}

.trace-line {
    transition: opacity 0.5s ease-out, stroke-dashoffset 1s ease-out;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.trace-line.active {
    opacity: 1;
    stroke-dashoffset: 0;
}

.trace-label {
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    transform: scale(0.9);
}

.trace-label.active {
    opacity: 1;
    transform: scale(1);
}

/* Palace Icon Hover Effects */
.palace-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#palace-icon:hover .palace-container {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.4);
}

.palace-pulse {
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* ============================================ */
/* Report Cards Styles                          */
/* ============================================ */

.report-card {
    transition: all 0.3s ease;
}

.report-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

.report-card:hover .card-accent {
    height: 3px;
}

/* ============================================ */
/* Parallax Background Effect                   */
/* ============================================ */

.parallax-layer {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* ============================================ */
/* Responsive Adjustments                       */
/* ============================================ */

@media (max-width: 768px) {
    .glass-card {
        padding: 1.5rem;
    }

    .comparison-visual {
        flex-direction: column;
    }

    .comparison-visual .arrow-container {
        transform: rotate(90deg);
        margin: 1rem 0;
    }

    #trace-demo {
        min-height: 400px;
    }

    .trace-label {
        font-size: 0.7rem;
        padding: 0.375rem 0.5rem;
    }

    #label-a {
        top: 5%;
        left: 2%;
    }

    #label-b {
        top: 5%;
        right: 2%;
    }

    #label-c {
        bottom: 5%;
        left: 2%;
    }
}

/* ============================================ */
/* Loading Animation for Page                   */
/* ============================================ */

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Staggered animation delays */
.fade-in-delay-1 {
    animation-delay: 0.1s;
    opacity: 0;
}

.fade-in-delay-2 {
    animation-delay: 0.2s;
    opacity: 0;
}

.fade-in-delay-3 {
    animation-delay: 0.3s;
    opacity: 0;
}

.fade-in-delay-4 {
    animation-delay: 0.4s;
    opacity: 0;
}

.fade-in-delay-5 {
    animation-delay: 0.5s;
    opacity: 0;
}

/* ============================================ */
/* Noise Texture Overlay (Optional)             */
/* ============================================ */

.noise-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 10;
}

/* ============================================ */
/* Glow Effects                                 */
/* ============================================ */

.glow-gold {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.glow-purple {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.glow-green {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.glow-red {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Text Glow */
.text-glow-gold {
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.text-glow-purple {
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

/* ============================================ */
/* Modal Overlay & Container                    */
/* ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-container {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

.modal-content {
    position: relative;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow:
        0 25px 60px -12px rgba(0, 0, 0, 0.6),
        0 0 1px 0 rgba(139, 92, 246, 0.3),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.25s ease;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2.5rem;
    overflow-y: auto;
    max-height: 85vh;
    scrollbar-width: thin;
    scrollbar-color: var(--text-dim) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 5px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

/* ============================================ */
/* About Us Modal Typography                    */
/* ============================================ */

.about-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.about-header .about-logo {
    font-family: 'Playfair Display', 'Noto Serif SC', serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
}

.about-header .about-tagline {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: var(--accent-gold);
    font-weight: 400;
    letter-spacing: 0.05em;
}

.about-section {
    margin-bottom: 2rem;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section-title {
    font-family: 'Playfair Display', 'Noto Serif SC', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--accent-purple);
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.about-section-title .section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.15);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.about-section p {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 0.9rem;
    line-height: 1.8;
    color: rgba(226, 232, 240, 0.85);
    margin-bottom: 0.75rem;
}

.about-section p:last-child {
    margin-bottom: 0;
}

/* Feature list inside About modal */
.about-features {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.5rem;
    margin-bottom: 0.85rem;
}

.about-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(139, 92, 246, 0.06);
    border-left: 3px solid var(--accent-purple);
    border-radius: 0 0.5rem 0.5rem 0;
    transition: background 0.25s ease;
}

.about-feature-item:hover {
    background: rgba(139, 92, 246, 0.1);
}

.about-feature-item .feature-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    margin-top: 2px;
}

.about-feature-item .feature-text strong {
    display: block;
    font-size: 0.88rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.about-feature-item .feature-text span {
    font-size: 0.82rem;
    color: rgba(226, 232, 240, 0.7);
    line-height: 1.6;
}

/* Footer quote */
.about-footer-quote {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.about-footer-quote p {
    font-family: 'Noto Serif SC', serif;
    font-size: 0.95rem;
    color: var(--accent-gold) !important;
    font-style: italic;
    line-height: 1.7;
    letter-spacing: 0.03em;
}

.about-footer-quote .quote-en {
    font-family: 'Playfair Display', serif;
    font-size: 0.85rem;
    color: rgba(245, 158, 11, 0.7) !important;
    margin-top: 0.25rem;
}

/* ============================================ */
/* Modal Responsive                             */
/* ============================================ */

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 1.5rem;
        max-height: 90vh;
    }

    .about-header .about-logo {
        font-size: 1.4rem;
    }

    .about-header .about-tagline {
        font-size: 0.88rem;
    }

    .about-section-title {
        font-size: 1.05rem;
    }

    .about-section p {
        font-size: 0.85rem;
    }
}

/* ============================================ */
/* Methodology Modal Specific                   */
/* ============================================ */

/* Numbered step badge */
.method-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), #7C3AED);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

/* Formula / code block */
.method-formula {
    display: block;
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent-gold);
    letter-spacing: 0.03em;
    text-align: center;
    line-height: 1.6;
}

/* Key-value highlight items */
.method-kv {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.method-kv-label {
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.method-kv-value {
    font-size: 0.85rem;
    color: rgba(226, 232, 240, 0.8);
    line-height: 1.6;
}

/* Summary highlight box */
.method-summary-box {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 0.75rem;
}

.method-summary-box .about-feature-item {
    background: transparent;
    border-left-color: var(--accent-gold);
    padding: 0.5rem 0.75rem;
}

/* CTA link in modal */
.method-cta {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-purple), #7C3AED);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
    border: none;
}

.method-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -6px rgba(139, 92, 246, 0.5);
}

/* ============================================ */
/* Global Input Styling                         */
/* ============================================ */

input,
select,
textarea,
.form-input {
    outline: none !important;
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus {
    outline: none !important;
    box-shadow: none !important;
}