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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1a1610;
    color: #e8dcc0;
    font-family: 'Crimson Pro', Georgia, serif;
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    /* Leather texture via layered radial-gradients at 2-3% opacity */
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(60, 45, 25, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(70, 50, 30, 0.025) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(50, 40, 20, 0.02) 0%, transparent 70%),
        radial-gradient(ellipse at 10% 80%, rgba(65, 48, 28, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 20%, rgba(55, 42, 24, 0.025) 0%, transparent 60%);
}

/* === Hero Section === */
#hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#hero-content {
    text-align: center;
    position: relative;
}

#hero-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(32px, 5vw, 60px);
    letter-spacing: 0.1em;
    color: #c4a050;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease, transform 400ms ease;
}

#hero-title.visible {
    opacity: 1;
    transform: translateY(0);
}

#hero-rule {
    width: 0;
    height: 1px;
    background-color: #c4a050;
    margin: 20px auto;
    transition: width 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#hero-rule.visible {
    width: 100vw;
}

#hero-subtitle {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(18px, 3vw, 32px);
    letter-spacing: 0.1em;
    color: #c4a050;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease, transform 400ms ease;
}

#hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

#scroll-indicator {
    position: absolute;
    bottom: 40px;
    opacity: 0;
    transition: opacity 600ms ease;
    animation: bounce 2s ease-in-out infinite;
}

#scroll-indicator.visible {
    opacity: 1;
}

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

/* === Vulnerabilities Section === */
#vulnerabilities {
    padding: 60px 20px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

#bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 2px;
}

/* Module size variants */
.module-2x1 { grid-column: span 2; }
.module-1x1 { grid-column: span 1; }
.module-1x2 { grid-row: span 2; }
.module-3x1 { grid-column: span 3; }

/* === Bento Module === */
.bento-module {
    background-color: #2a2418;
    border: 1px solid rgba(196, 160, 80, 0.4);
    position: relative;
    cursor: pointer;
    filter: blur(1px);
    opacity: 0;
    transition: filter 400ms ease, border-color 300ms ease, box-shadow 300ms ease, opacity 400ms ease;
}

.bento-module.entered {
    opacity: 1;
    filter: blur(1px);
}

.bento-module:hover {
    filter: blur(0) !important;
    border-color: #c4a050;
    z-index: 2;
}

.bento-module.dimmed {
    filter: blur(2px);
}

.module-inner {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.module-title {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(16px, 2vw, 24px);
    letter-spacing: 0.04em;
    color: #c4a050;
}

/* Severity indicators */
.severity {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.severity-critical { background-color: #c44040; }
.severity-amber { background-color: #c49040; }
.severity-green { background-color: #40a060; }

.module-desc {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.7;
    color: #e8dcc0;
    flex: 1;
}

.module-code {
    background-color: #14120e;
    padding: 12px 14px;
    border-radius: 2px;
    overflow-x: auto;
    position: relative;
}

.module-code code {
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    font-weight: 400;
    color: #c4a050;
    line-height: 1.6;
    font-feature-settings: "liga" 1;
    white-space: pre;
}

/* Code highlight background line */
.module-code::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(196, 160, 80, 0.05);
    pointer-events: none;
}

/* === Detail Panel === */
#detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    height: 100vh;
    background-color: #14120e;
    transform: translateX(100%);
    transition: transform 300ms ease-out;
    z-index: 100;
    overflow-y: auto;
    padding: 40px;
}

#detail-panel.open {
    transform: translateX(0);
}

#panel-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #8a7a60;
    font-size: 28px;
    cursor: pointer;
    font-family: 'Space Mono', monospace;
    transition: color 200ms ease;
    line-height: 1;
}

#panel-close:hover {
    color: #c4a050;
}

#panel-content {
    position: relative;
}

#panel-branch-svg {
    position: absolute;
    top: 0;
    right: -10px;
    width: 200px;
    height: 600px;
    pointer-events: none;
    opacity: 0.6;
}

#branch-illustration {
    width: 100%;
    height: 100%;
}

.branch-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

#detail-panel.open .branch-path {
    stroke-dashoffset: 0;
}

#panel-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 36px);
    color: #c4a050;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 300ms ease, transform 300ms ease;
}

#detail-panel.open #panel-title {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 200ms;
}

#panel-severity-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    opacity: 0;
    transition: opacity 300ms ease;
}

#detail-panel.open #panel-severity-wrap {
    opacity: 1;
    transition-delay: 250ms;
}

#panel-severity-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

#panel-severity-label {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a7a60;
}

#panel-description {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.7;
    color: #e8dcc0;
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 300ms ease, transform 300ms ease;
}

#detail-panel.open #panel-description {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 400ms;
}

#panel-section-code,
#panel-section-fix,
#panel-section-related {
    margin-bottom: 28px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 300ms ease, transform 300ms ease;
}

#detail-panel.open #panel-section-code {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 600ms;
}

#detail-panel.open #panel-section-fix {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 800ms;
}

#detail-panel.open #panel-section-related {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 1000ms;
}

#panel-content h3 {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a7a60;
    margin-bottom: 12px;
}

#panel-code {
    background-color: #1a1610;
    padding: 16px 18px;
    border-radius: 2px;
    overflow-x: auto;
}

#panel-code code {
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: #c4a050;
    line-height: 1.7;
    font-feature-settings: "liga" 1;
    white-space: pre;
}

#panel-fix {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.7;
    color: #e8dcc0;
}

#panel-fix code {
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: #c4a050;
    background-color: rgba(196, 160, 80, 0.1);
    padding: 2px 6px;
    border-radius: 2px;
}

#panel-related {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-item {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: #8a7a60;
    padding: 8px 12px;
    border: 1px solid rgba(196, 160, 80, 0.2);
    cursor: pointer;
    transition: border-color 200ms ease, color 200ms ease;
}

.related-item:hover {
    border-color: #c4a050;
    color: #c4a050;
}

/* Panel overlay */
#panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(20, 18, 14, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    z-index: 99;
}

#panel-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* === Secured Footer === */
#secured-footer {
    padding: 60px 20px 80px;
    text-align: center;
}

#footer-rule {
    width: 120px;
    height: 1px;
    background-color: #c4a050;
    margin: 0 auto 40px;
}

#footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

#footer-text {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.06em;
    color: #8a7a60;
}

/* Lock Icon (CSS geometric) */
#lock-icon {
    position: relative;
    width: 24px;
    height: 34px;
}

#lock-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 18px;
    border: 1.5px solid #c4a050;
    border-radius: 2px;
}

#lock-shackle {
    position: absolute;
    top: 0;
    left: 4px;
    width: 16px;
    height: 18px;
    border: 1.5px solid #c4a050;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

#lock-latch {
    position: absolute;
    top: 14px;
    right: -1px;
    width: 4px;
    height: 6px;
    background-color: #c4a050;
    transform-origin: bottom right;
    transform: rotate(30deg);
    transition: transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#lock-latch.locked {
    transform: rotate(0deg);
}

/* === Responsive === */
@media (max-width: 900px) {
    #bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .module-3x1 {
        grid-column: span 2;
    }

    #detail-panel {
        width: 80vw;
    }
}

@media (max-width: 600px) {
    #bento-grid {
        grid-template-columns: 1fr;
    }

    .module-2x1,
    .module-1x1,
    .module-1x2,
    .module-3x1 {
        grid-column: span 1;
        grid-row: span 1;
    }

    #detail-panel {
        width: 100vw;
        padding: 24px;
    }

    #vulnerabilities {
        padding: 40px 12px 60px;
    }
}

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

::-webkit-scrollbar-track {
    background: #1a1610;
}

::-webkit-scrollbar-thumb {
    background: rgba(196, 160, 80, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 160, 80, 0.5);
}
