/* ==========================================================
   Project 10 — DSP Engine
   ========================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0d0d0d;
    --surface: #161616;
    --surface-soft: #1e1e1e;
    --text: #f6f6f6;
    --muted: #c9c9c9;
    --primary: #ff4d00;
    --accent: #ff8c00;
    --radius-lg: 0;
    --radius-md: 0;
    --font: 'Inter', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    color: var(--text);
    font-family: var(--font);
    line-height: 1.65;
    overflow-x: hidden;
    cursor: none;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.hero-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.interactive-badge {
    display: inline-block;
    margin-left: 12px;
    padding: 3px 10px;
    background: rgba(255, 77, 0, 0.15);
    border: 1px solid rgba(255, 77, 0, 0.4);
    border-radius: 0;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--primary);
    vertical-align: middle;
    font-family: 'Space Mono', monospace;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.section-intro {
    color: var(--muted);
    font-size: 0.95rem;
    max-width: 700px;
    margin-bottom: 28px;
    line-height: 1.7;
}

/* ==========================================================
   Oscilloscope Hero Background
   ========================================================== */
.scope-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70vh;
    z-index: -1;
    overflow: hidden;
    opacity: 0.25;
}

.scope-bg canvas {
    width: 100%;
    height: 100%;
}

/* ==========================================================
   DFT Interactive Section
   ========================================================== */
.dft-controls {
    margin-bottom: 28px;
}

.signal-builder {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 77, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 24px;
}

.signal-builder h3 {
    color: var(--primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    margin-bottom: 16px;
    letter-spacing: 0.08em;
}

.wave-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wave-entry {
    display: grid;
    grid-template-columns: 120px 1fr 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
}

.wave-entry select {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 77, 0, 0.2);
    border-radius: 0;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}

.wave-entry select option {
    background: #111;
}

.wave-param {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wave-param label {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-width: 40px;
}

.wave-param span {
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    color: var(--text);
    min-width: 30px;
}

.wave-remove {
    padding: 6px 10px;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 4px;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.wave-remove:hover {
    background: rgba(255, 107, 107, 0.3);
}

.builder-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 8px 16px;
    background: rgba(255, 77, 0, 0.1);
    border: 1px solid rgba(255, 77, 0, 0.3);
    color: var(--primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.control-btn:hover {
    background: rgba(255, 77, 0, 0.2);
    border-color: var(--primary);
}

.control-btn i {
    margin-right: 4px;
}

.sample-info {
    display: flex;
    gap: 24px;
    margin-top: 14px;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted);
}

/* Styled slider */
.styled-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0;
    outline: none;
    flex: 1;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 77, 0, 0.4);
}

.styled-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* DFT Display — side by side canvases */
.dft-display {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    align-items: stretch;
    border: 1px solid rgba(255, 77, 0, 0.2);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
}

.dft-canvas-wrap {
    position: relative;
    padding: 16px;
}

.dft-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 200px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
}

.canvas-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.dft-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    border-left: 1px solid rgba(255, 77, 0, 0.15);
    border-right: 1px solid rgba(255, 77, 0, 0.15);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--primary);
    letter-spacing: 0.1em;
}

.dft-arrow i {
    font-size: 1.2rem;
}

/* ==========================================================
   Denoiser — Full-width layout (mirrors DFT section)
   ========================================================== */
.denoise-noise-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.denoise-noise-row .wave-param {
    flex: 1;
}

.denoise-run-btn {
    padding: 10px 24px;
    background: rgba(255, 77, 0, 0.15);
    border: 1px solid rgba(255, 77, 0, 0.4);
    color: var(--primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.denoise-run-btn:hover {
    background: rgba(255, 77, 0, 0.25);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(255, 77, 0, 0.15);
}

.denoise-display {
    margin-bottom: 16px;
}

/* ==========================================================
   Algorithm Comparison Grid
   ========================================================== */
.compare-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.compare-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px;
    transition: all 0.25s ease;
}

.compare-card:hover {
    border-color: rgba(255, 140, 0, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.compare-title {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.compare-r2 {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    color: var(--accent);
    letter-spacing: 0.04em;
}

.compare-card canvas {
    display: block;
    width: 100%;
    height: 140px;
    background: rgba(0, 0, 0, 0.3);
}

.compare-desc {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.5;
    opacity: 0.7;
}

/* ==========================================================
   Function Card Grid (Source Code)
   ========================================================== */
.fn-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.fn-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.fn-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.fn-card[data-fn^="signals"]::before {
    background: var(--accent);
}

.fn-card::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 20px;
    right: 16px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.15);
    transition: all 0.25s ease;
}

.fn-card:hover::before {
    opacity: 1;
}

.fn-card:hover::after {
    color: var(--primary);
    transform: translateX(3px);
}

.fn-card[data-fn^="signals"]:hover::after {
    color: var(--accent);
}

.fn-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.fn-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.fn-file {
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 7px;
    border: 1px solid rgba(255, 77, 0, 0.25);
    color: var(--primary);
    background: rgba(255, 77, 0, 0.06);
}

.fn-card[data-fn^="signals"] .fn-file {
    border-color: rgba(255, 140, 0, 0.3);
    color: var(--accent);
    background: rgba(255, 140, 0, 0.08);
}

.fn-name {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 700;
}

.fn-card-desc {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 14px;
}

.fn-card-preview {
    background: rgba(0, 0, 0, 0.5);
    border-left: 2px solid rgba(255, 255, 255, 0.06);
    padding: 10px 14px;
    border-radius: 0;
    overflow: hidden;
}

.fn-card-preview code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.7rem;
    line-height: 1.6;
    color: rgba(246, 246, 246, 0.45);
    display: block;
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* denoising.py source card accent */
.fn-card[data-fn^="denoise"]::before {
    background: var(--accent);
}

.fn-card[data-fn^="denoise"] .fn-file {
    border-color: rgba(255, 140, 0, 0.3);
    color: var(--accent);
    background: rgba(255, 140, 0, 0.08);
}

.fn-card[data-fn^="denoise"]:hover::after {
    color: var(--accent);
}

/* ==========================================================
   Code Modal Overlay
   ========================================================== */
.code-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.code-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.code-modal {
    width: min(900px, 92vw);
    max-height: 85vh;
    background: var(--bg);
    border: 1px solid rgba(255, 77, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.code-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 77, 0, 0.2);
    background: rgba(13, 13, 13, 0.95);
    flex-shrink: 0;
}

.code-modal-title {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: var(--primary);
    letter-spacing: 0.05em;
}

.code-modal-actions {
    display: flex;
    gap: 8px;
}

.code-modal-body {
    padding: 24px;
    margin: 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text);
    overflow: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 77, 0, 0.2) transparent;
}

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

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

.code-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 77, 0, 0.2);
}

.code-modal-body .keyword {
    color: #ff79c6;
}

.code-modal-body .function {
    color: #50fa7b;
}

.code-modal-body .comment {
    color: #6272a4;
    font-style: italic;
}

.code-modal-body .number {
    color: #bd93f9;
}

.code-modal-body .string {
    color: #f1fa8c;
}



/* ==========================================================
   Module Grid & Planned Tags
   ========================================================== */
.module-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.module-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s ease;
}

.module-item:hover {
    border-color: rgba(255, 77, 0, 0.15);
}

.module-item span {
    font-size: 0.82rem;
    color: var(--muted);
}

.module-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.58rem !important;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border: 1px solid rgba(255, 77, 0, 0.2);
    color: var(--primary) !important;
    background: rgba(255, 77, 0, 0.06);
    white-space: nowrap;
    flex-shrink: 0;
}

.planned-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.planned-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    padding: 6px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    color: var(--muted);
    transition: all 0.2s ease;
}

.planned-tag:hover {
    border-color: rgba(255, 77, 0, 0.3);
    color: var(--primary);
}

/* ==========================================================
   Status Badge
   ========================================================== */
.status-badge-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 10px 20px;
    background: rgba(255, 77, 0, 0.08);
    border: 1px solid rgba(255, 77, 0, 0.25);
    border-radius: 0;
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    color: var(--primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ==========================================================
   Two-col, equations, key features
   ========================================================== */
.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg, 40px);
}


.narrative-section p,
.project-writeup p,
.technical-specs p {
    color: var(--text);
    line-height: 1.7;
}

.narrative-section h3,
.project-writeup h3,
.technical-specs h3,
.key-features h3 {
    color: var(--accent-color, var(--primary));
    margin-top: var(--spacing-lg, 32px);
    margin-bottom: var(--spacing-md, 16px);
}

.narrative-section ul,
.technical-specs ul,
.key-features ul {
    list-style: none;
    padding: 0;
}

.narrative-section li,
.technical-specs li,
.key-features li {
    color: var(--text);
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.narrative-section li::before,
.technical-specs li::before,
.key-features li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-color, var(--primary));
}

.project-writeup code,
.technical-specs code {
    background: rgba(255, 77, 0, 0.1);
    border: 1px solid rgba(255, 77, 0, 0.2);
    border-radius: 0;
    padding: 2px 6px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.88em;
    color: var(--primary);
}

/* ==========================================================
   Footer polish
   ========================================================== */
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-meta {
    text-align: right;
}

.footer-meta p {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.footer-sub {
    margin-top: 4px;
    font-size: 0.68rem !important;
    opacity: 0.5;
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1080px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    .dft-display {
        grid-template-columns: 1fr;
    }

    .dft-arrow {
        flex-direction: row;
        padding: 12px 0;
        border-left: none;
        border-right: none;
        border-top: 1px solid rgba(255, 77, 0, 0.15);
        border-bottom: 1px solid rgba(255, 77, 0, 0.15);
    }

    .dft-arrow i {
        transform: rotate(90deg);
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }

    .denoise-noise-row {
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .project-hero {
        padding-top: 96px;
        padding-bottom: 72px;
    }

    .wave-entry {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .fn-card-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-meta {
        text-align: left;
    }

    .code-modal {
        width: 100vw;
        max-height: 100vh;
        border: none;
    }

}
