/* ================================================
 * Archive Page - Custom Styles
 * Path: assets/css/archive/styles.css
 * ================================================ */

body {
    background-color: #0a0e17;
    color: #e2e8f0;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #0a0e17;
}
::-webkit-scrollbar-thumb {
    background: #1a2236;
}
::-webkit-scrollbar-thumb:hover {
    background: #f0a500;
}

/* Scanline Overlay */
.scanlines::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 50;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

/* Grid Background */
.bg-grid-pattern {
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Archive Modal */
#drawer {
    --archive-accent: #e63946;
    --archive-accent-soft: rgba(230, 57, 70, 0.14);
    --archive-accent-muted: rgba(230, 57, 70, 0.08);
    --archive-accent-strong: #ff6b75;
    --archive-accent-glow: rgba(230, 57, 70, 0.14);
    --archive-accent-line: rgba(230, 57, 70, 0.4);
    --archive-panel-bg: #0d0d0d;
    --archive-panel-bg-soft: #111111;
    --archive-panel-border: #1a1a1a;
    --archive-text-dim: rgba(255, 255, 255, 0.48);
    top: 50%;
    left: 50%;
    right: auto;
    width: min(92vw, 980px);
    height: auto;
    max-height: 88vh;
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    background:
        radial-gradient(circle at top left, var(--archive-accent-glow), transparent 34%),
        linear-gradient(180deg, rgba(13, 13, 13, 0.985), rgba(10, 10, 10, 0.995));
    box-shadow:
        0 32px 120px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    overflow: hidden;
}

#drawer[data-module='core'] {
    --archive-accent: #e63946;
    --archive-accent-soft: rgba(230, 57, 70, 0.14);
    --archive-accent-muted: rgba(230, 57, 70, 0.08);
    --archive-accent-strong: #ff6b75;
    --archive-accent-glow: rgba(230, 57, 70, 0.15);
    --archive-accent-line: rgba(230, 57, 70, 0.4);
}

#drawer[data-module='ext'] {
    --archive-accent: #f4a261;
    --archive-accent-soft: rgba(244, 162, 97, 0.14);
    --archive-accent-muted: rgba(244, 162, 97, 0.08);
    --archive-accent-strong: #ffd3a8;
    --archive-accent-glow: rgba(244, 162, 97, 0.16);
    --archive-accent-line: rgba(244, 162, 97, 0.4);
}

#drawer[data-module='ref'] {
    --archive-accent: #60a5fa;
    --archive-accent-soft: rgba(96, 165, 250, 0.14);
    --archive-accent-muted: rgba(96, 165, 250, 0.08);
    --archive-accent-strong: #93c5fd;
    --archive-accent-glow: rgba(96, 165, 250, 0.16);
    --archive-accent-line: rgba(96, 165, 250, 0.38);
}

#drawer.archive-modal-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

#drawer-backdrop {
    background:
        radial-gradient(circle at center, rgba(10, 14, 23, 0.52), rgba(5, 8, 15, 0.9));
}

.archive-modal-header {
    background:
        linear-gradient(180deg, rgba(13, 13, 13, 0.98), rgba(13, 13, 13, 0.92));
}

.archive-modal-body {
    background:
        linear-gradient(180deg, rgba(13, 13, 13, 0.98), rgba(11, 11, 11, 0.98));
}

.archive-modal-footer {
    background: linear-gradient(180deg, rgba(13, 13, 13, 0.96), rgba(11, 11, 11, 0.99));
}

.archive-modal-footer a {
    background: #0f0f0f;
    border-color: #1e1e1e;
    border-radius: 0;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.16em;
}

.archive-modal-footer a:hover {
    background: var(--archive-accent-muted);
    border-color: var(--archive-accent-line);
    color: var(--archive-accent-strong);
}

.archive-modal-footer p {
    color: rgba(255, 255, 255, 0.18);
    letter-spacing: 0.12em;
}

.archive-modal-noise {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.26), transparent 60%);
}

#drawer-header-meta h2 {
    font-size: clamp(1.85rem, 3vw, 2.8rem);
    line-height: 1.04;
    letter-spacing: -0.03em;
    max-width: 14ch;
}

#drawer-content > .font-mono.text-\[10px\] {
    color: rgba(148, 163, 184, 0.52);
    letter-spacing: 0.22em;
}

#drawer-content .grid.grid-cols-2.gap-x-6.gap-y-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    background: rgba(10, 14, 23, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 1.1rem;
}

#drawer-content .space-y-1\.5,
#drawer-content .space-y-3,
#drawer-content .text-sm.text-gray-300.leading-relaxed {
    animation: archiveModalSectionIn 240ms ease-out both;
}

#drawer-header-meta {
    position: relative;
    z-index: 1;
}

.archive-entry-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.archive-entry-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--archive-accent-line);
    color: var(--archive-accent-strong);
    background: var(--archive-accent-muted);
    padding: 4px 10px;
    font-family: "Courier New", monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.archive-entry-badge-core,
.archive-entry-badge-ext,
.archive-entry-badge-ref {}

.archive-entry-badge-timeline {
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.03);
}

.archive-entry-title {
    font-size: clamp(2.5rem, 5vw, 3.6rem);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.04em;
    color: #f2f2f2;
    margin-bottom: 10px;
    word-break: break-word;
}

.archive-entry-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.48);
    flex-wrap: wrap;
}

.archive-entry-dot {
    color: var(--archive-accent);
    font-size: 11px;
    line-height: 1;
}

.archive-section-wrap {
    margin-bottom: 28px;
    animation: archiveModalSectionIn 240ms ease-out both;
}

.archive-section-label {
    margin-bottom: 14px;
    font-family: "Courier New", monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
}

.archive-section-label::before {
    content: "// ";
}

.archive-section-label-warn {
    color: rgba(244, 162, 97, 0.75);
}

.archive-section-count {
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.24);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: none;
}

.archive-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--archive-panel-bg-soft);
    border: 1px solid var(--archive-panel-border);
    padding: 22px 0;
}

.archive-info-cell {
    padding: 0 22px;
    border-right: 1px solid #1e1e1e;
}

.archive-info-cell:last-child {
    border-right: 0;
}

.archive-info-cell-label {
    display: block;
    margin-bottom: 10px;
    font-family: "Courier New", monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
}

.archive-info-cell-value {
    font-size: 14px;
    font-weight: 500;
    color: #f0f0f0;
}

.archive-info-cell-accent {
    color: var(--archive-accent);
    letter-spacing: 0.06em;
}

.archive-info-cell-muted {
    color: rgba(255, 255, 255, 0.32);
}

.archive-info-divider {
    color: rgba(255, 255, 255, 0.3);
    margin: 0 4px;
}

.archive-desc-block,
.archive-note-block {
    background: var(--archive-panel-bg-soft);
    border: 1px solid var(--archive-panel-border);
    border-left: 2px solid var(--archive-accent);
    padding: 18px 22px;
    font-size: 14px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.7);
    white-space: pre-line;
}

.archive-note-block {
    border-left-color: #f4a261;
    color: rgba(255, 234, 214, 0.82);
    background: rgba(244, 162, 97, 0.05);
}

.archive-ref-stack,
.archive-supplement-stack,
.archive-video-stack {
    display: grid;
    gap: 12px;
}

.archive-ref-item {
    display: flex;
    align-items: baseline;
    gap: 14px;
    background: var(--archive-panel-bg-soft);
    border: 1px solid var(--archive-panel-border);
    padding: 13px 18px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.archive-ref-item:hover {
    border-color: var(--archive-accent-line);
    background: #151515;
    transform: translateY(-1px);
}

.archive-ref-index {
    flex: none;
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: var(--archive-accent);
}

.archive-ref-text {
    min-width: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    overflow-wrap: anywhere;
}

.archive-media-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.archive-media-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--archive-panel-border);
    overflow: hidden;
    background: var(--archive-panel-bg);
}

.archive-media-link {
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.archive-media-link:hover {
    border-color: var(--archive-accent-line);
    transform: translateY(-2px);
}

.archive-media-img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, #1a2e20, #0d1710);
}

.archive-media-caption {
    border-top: 1px solid var(--archive-panel-border);
    padding: 8px 12px;
    font-family: "Courier New", monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.38);
}

.archive-video-card {
    background: var(--archive-panel-bg-soft);
    border: 1px solid var(--archive-panel-border);
    padding: 14px;
}

.archive-video-frame {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--archive-panel-border);
    background: #000;
}

.archive-video-iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.archive-video-meta {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: "Courier New", monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

.archive-video-link,
.archive-supplement-link {
    color: var(--archive-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.archive-video-link:hover,
.archive-supplement-link:hover {
    color: var(--archive-accent-strong);
}

.archive-supplement-card {
    background: rgba(17, 17, 17, 0.96);
    border: 1px solid var(--archive-panel-border);
    border-left: 2px solid var(--archive-accent-line);
    padding: 16px 18px;
}

.archive-supplement-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.archive-supplement-type {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--archive-accent-line);
    background: var(--archive-accent-muted);
    color: var(--archive-accent-strong);
    font-family: "Courier New", monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.archive-supplement-date,
.archive-supplement-author,
.archive-footer-label,
.archive-footer-value {
    font-family: "Courier New", monospace;
}

.archive-supplement-date {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.34);
}

.archive-supplement-content {
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.68);
    white-space: pre-line;
}

.archive-supplement-links {
    display: grid;
    gap: 6px;
}

.archive-supplement-link {
    font-size: 11px;
    overflow-wrap: anywhere;
}

.archive-supplement-author {
    margin-top: 10px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
}

.archive-footer-meta {
    margin-top: 6px;
    padding-top: 18px;
    border-top: 1px solid var(--archive-panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.archive-footer-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.28);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.archive-footer-value {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.56);
}

.archive-empty-state,
.archive-empty-inline {
    color: rgba(255, 255, 255, 0.3);
}

.archive-empty-state {
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.01);
    padding: 18px;
    text-align: center;
    font-family: "Courier New", monospace;
    font-size: 12px;
}

.archive-page-btn {
    min-width: 38px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.62);
    font-family: "Courier New", monospace;
    font-size: 11px;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.archive-page-btn:hover:not(:disabled) {
    border-color: rgba(244, 162, 97, 0.35);
    color: #f4a261;
    background: rgba(244, 162, 97, 0.06);
}

.archive-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.archive-page-btn-active {
    border-color: rgba(244, 162, 97, 0.4);
    background: rgba(244, 162, 97, 0.12);
    color: #f4a261;
}

@keyframes archiveModalSectionIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    #drawer {
        width: min(96vw, 980px);
        max-height: 92vh;
        border-radius: 22px;
    }

    .archive-info-grid,
    .archive-media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    #drawer {
        width: min(96vw, 980px);
        max-height: 94vh;
        border-radius: 18px;
    }

    .archive-entry-title {
        font-size: clamp(2rem, 10vw, 2.8rem);
    }

    .archive-info-grid,
    .archive-media-grid {
        grid-template-columns: 1fr;
    }

    .archive-info-cell {
        padding: 0 18px 18px;
        border-right: 0;
        border-bottom: 1px solid #1e1e1e;
    }

    .archive-info-cell:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .archive-video-meta,
    .archive-footer-meta,
    .archive-supplement-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
