@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Sora:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #060913;
    --bg-surface: rgba(20, 23, 32, 0.6);
    --bg-card: rgba(26, 30, 43, 0.7);
    --border-color: rgba(39, 44, 63, 0.8);
    --border-glow: rgba(79, 195, 247, 0.3);
    --accent-primary: #4fc3f7;
    --accent-secondary: #f5a623;
    --accent-tertiary: #a5d6a7;
    --text-main: #f1f4fa;
    --text-muted: #8a94b5;
    --code-bg: #0a0c10;
    --tag-bg: rgba(30, 37, 53, 0.8);
    --glass-blur: blur(12px);
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(79, 195, 247, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 195, 247, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(245, 166, 35, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(165, 214, 167, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    line-height: 1.8;
    overflow-x: hidden;
}

/* ─── HEADER ─── */
.header {
    position: relative;
    padding: 80px 20px 60px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(13, 15, 20, 0.5);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    overflow: hidden;
    z-index: 10;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(79, 195, 247, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

.header-badge {
    display: inline-block;
    background: var(--tag-bg);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-glow);
    animation: fadeInDown 0.8s ease-out;
}

.header h1 {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 16px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.header h1 span {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.header .sub {
    font-size: clamp(14px, 2vw, 16px);
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.header .sub strong {
    color: var(--accent-secondary);
    font-weight: 600;
}

/* ─── TOC ─── */
.toc {
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 24px;
    animation: fadeIn 1s ease-out 0.6s both;
}

.toc-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.title-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toc-title .title-text {
    white-space: nowrap;
}

.toc-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
    min-width: 30px;
}

.btn-manual {
    background: rgba(79, 195, 247, 0.08);
    color: var(--accent-primary);
    border: 1px solid rgba(79, 195, 247, 0.3);
    padding: 8px 20px;
    border-radius: 50px;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-manual:hover {
    background: var(--accent-primary);
    color: #060913;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 195, 247, 0.3);
}

.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.toc-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: all 0.5s ease;
}

.toc-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    background: var(--bg-card);
}

.toc-item:hover::before {
    left: 100%;
}

.toc-item:hover .toc-num {
    color: var(--accent-primary);
    transform: scale(1.1);
}

.toc-num {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-secondary);
    font-size: 15px;
    font-weight: 700;
    min-width: 32px;
    transition: all 0.3s ease;
}

/* ─── EXPERIMENT CARD ─── */
.experiments {
    display: none;
}

.exp-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 60px;
    overflow: hidden;
    scroll-margin-top: 100px;
    box-shadow: var(--shadow-md);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.exp-card:hover {
    border-color: var(--border-glow);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), var(--shadow-glow);
}

.exp-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 32px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(90deg, rgba(79, 195, 247, 0.05) 0%, transparent 100%);
}

.exp-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 36px;
    font-weight: 800;
    color: transparent;
    -webkit-text-stroke: 1px var(--accent-primary);
    line-height: 1;
    min-width: 56px;
    text-shadow: 0 0 20px rgba(79, 195, 247, 0.3);
}

.exp-meta {
    flex: 1;
}

.exp-title {
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    margin-bottom: 12px;
}

.exp-aim {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-secondary);
}

/* ─── SECTION LABELS ─── */
.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--accent-tertiary);
    padding: 24px 32px 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.section-label::before {
    content: '→';
    margin-right: 8px;
    color: var(--accent-secondary);
    font-weight: bold;
}

.section-label:first-of-type {
    border-top: none;
}

/* ─── THEORY BOX ─── */
.theory-box {
    padding: 12px 32px 24px;
    font-size: 15px;
    color: var(--text-main);
    line-height: 1.8;
}

.theory-box p {
    margin-bottom: 12px;
}

.theory-box strong {
    color: var(--accent-primary);
    font-weight: 600;
}

.theory-box ul {
    padding-left: 24px;
    margin-bottom: 12px;
}

.theory-box li {
    margin-bottom: 6px;
    position: relative;
}

.theory-box li::marker {
    color: var(--accent-secondary);
}

/* ─── SYNTAX BOX ─── */
.syntax-box {
    margin: 0 32px 20px;
    background: rgba(10, 12, 16, 0.6);
    border: 1px solid rgba(42, 48, 80, 0.5);
    border-left: 4px solid var(--accent-secondary);
    border-radius: 8px;
    padding: 16px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--accent-secondary);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* ─── PROGRAM BOX ─── */
.program-container {
    padding: 12px 32px 32px;
}

.prog-sub-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px 24px 24px;
    overflow-x: auto;
    margin-bottom: 24px;
    position: relative;
    box-shadow: inset 0 2px 15px rgba(0, 0, 0, 0.5);
}

pre::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f56;
    box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.7;
    color: #e8ecf4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Syntax highlighting refined */
.kw {
    color: #c678dd;
    font-style: italic;
}

/* keywords */
.fn {
    color: #61afef;
    font-weight: 500;
}

/* functions */
.str {
    color: #98c379;
}

/* strings */
.num {
    color: #d19a66;
}

/* numbers */
.cm {
    color: #5c6370;
    font-style: italic;
}

/* comments */
.tag {
    color: #e06c75;
}

/* html tags */
.atr {
    color: #d19a66;
    font-style: italic;
}

/* attributes */
.val {
    color: #98c379;
}

/* attribute values */

/* ─── OUTPUT BOX ─── */
.output-box {
    margin: 0 32px 24px;
    background: rgba(8, 13, 8, 0.6);
    border: 1px solid rgba(26, 46, 26, 0.5);
    border-left: 4px solid var(--accent-tertiary);
    border-radius: 8px;
    padding: 16px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--accent-tertiary);
    white-space: pre-wrap;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
}

.output-box::after {
    content: '❯_';
    position: absolute;
    bottom: 16px;
    right: 20px;
    opacity: 0.5;
    animation: blink 1s step-end infinite;
}

.output-label {
    font-size: 11px;
    letter-spacing: 2.5px;
    color: var(--accent-tertiary);
    text-transform: uppercase;
    margin-bottom: 10px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── KEY METHODS TABLE ─── */
.methods-table {
    margin: 0 32px 24px;
    width: calc(100% - 64px);
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.methods-table th {
    background: rgba(26, 31, 46, 0.8);
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.methods-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: top;
    background: rgba(20, 23, 32, 0.4);
    transition: background 0.3s;
}

.methods-table tr:hover td {
    background: rgba(30, 37, 53, 0.5);
}

.methods-table tr:last-child td {
    border-bottom: none;
}

.methods-table code {
    color: var(--accent-secondary);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ─── DIVIDER ─── */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 0 32px 24px;
}

/* ─── CONCLUSION ─── */
.conclusion-box {
    margin: 16px 32px 32px;
    background: rgba(18, 22, 32, 0.6);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 18px 24px;
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    position: relative;
    padding-left: 48px;
}

.conclusion-box::before {
    content: '💡';
    position: absolute;
    left: 20px;
    top: 18px;
    font-style: normal;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--bg-main);
}

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

/* ─── ANIMATIONS ─── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ─── RESPONSIVENESS ─── */
@media (max-width: 768px) {
    .header {
        padding: 60px 20px 40px;
    }

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

    .exp-header {
        flex-direction: column;
        gap: 16px;
        padding: 24px;
    }

    .exp-num {
        font-size: 28px;
    }

    .section-label,
    .theory-box,
    .syntax-box,
    .program-container,
    .output-box,
    .methods-table,
    .conclusion-box {
        margin-left: 16px;
        margin-right: 16px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .methods-table {
        width: calc(100% - 32px);
        display: block;
        overflow-x: auto;
    }

    .conclusion-box {
        padding-left: 40px;
    }

    .conclusion-box::before {
        left: 14px;
    }
}

/* ─── BACK TO TOP ─── */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(30, 37, 53, 0.8);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    background: var(--bg-card);
    border-color: var(--accent-primary);
    color: var(--text-main);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* ─── MODAL ─── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

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

.modal-box {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow-y: auto;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal.open .modal-box {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: sticky;
    top: 20px;
    left: calc(100% - 60px);
    background: var(--tag-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    float: right;
    margin-top: 20px;
    margin-right: 20px;
}

.modal-close:hover {
    background: rgba(240, 113, 120, 0.2);
    color: #f07178;
    border-color: #f07178;
    transform: rotate(90deg);
}

.modal-body {
    padding: 0 0 20px 0;
    clear: both;
}

.modal-body .exp-card {
    margin-bottom: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}

.modal-body .exp-card:hover {
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

/* ─── COPY BUTTON ─── */
.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-family: 'Sora', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.copy-btn:hover {
    background: rgba(79, 195, 247, 0.1);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.copy-btn.copied {
    background: rgba(165, 214, 167, 0.15);
    color: var(--accent-tertiary);
    border-color: var(--accent-tertiary);
}

/* ─── FOOTER ─── */
footer {
    display: block !important;
    margin-top: 80px;
    padding: 60px 24px 30px;
    background: rgba(13, 15, 20, 0.8);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--accent-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.footer-section p {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 400px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-secondary);
}

.footer-bottom {
    max-width: 1100px;
    margin: 0 auto;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.copyright {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #3a4060;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }

    .footer-section p {
        margin: 0 auto;
    }
}

/* ─── RESOURCE CENTER ─── */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.resource-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.resource-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--accent-primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.resource-icon {
    font-size: 32px;
    width: 54px;
    height: 54px;
    background: rgba(79, 195, 247, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.resource-info {
    flex-grow: 1;
}

.resource-info h5 {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
}

.resource-info p {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.resource-action {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
    font-size: 16px;
    transition: all 0.3s;
    text-decoration: none;
}

.resource-card:hover .resource-action {
    background: var(--accent-primary);
    color: #060913;
}

.resource-actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.view-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid rgba(79, 195, 247, 0.2);
    border-radius: 8px;
    transition: all 0.3s;
    background: rgba(79, 195, 247, 0.05);
}

.view-link:hover {
    background: var(--accent-primary);
    color: #060913;
    border-color: var(--accent-primary);
}
