/* ===========================================
   CUSTOM FONTS
   =========================================== */
@font-face {
    font-family: 'LocalFont';
    src: url('/assets/font/light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LocalFont';
    src: url('/assets/font/regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LocalFont';
    src: url('/assets/font/bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ===========================================
   CUSTOMIZE COLORS HERE
   =========================================== */
:root {
    --bg: #0c0c0c;
    --bg-elevated: #141414;
    --bg-hover: #1c1c1c;
    --border: #252525;
    --border-subtle: #1a1a1a;
    --text: #f0f0f0;
    --text-secondary: #888;
    --text-muted: #555;
    --accent: #6ee7b7;
    --accent-dim: rgba(110, 231, 183, 0.15);
    --font-sans: 'LocalFont', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --transition: 0.15s ease;
}

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

::selection {
    background: var(--accent-dim);
    color: var(--accent);
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }

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

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(12px);
    }
}

/* Reverse animations for going back */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(12px);
    }

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

@keyframes fadeOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-12px);
    }
}

.file-row.exiting {
    animation: fadeOutDown 0.2s ease-out forwards;
}

.file-row.exiting-back {
    animation: fadeOutLeft 0.2s ease-out forwards;
}

.file-row.entering-back {
    animation: fadeInRight 0.4s ease-out backwards;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    animation: fadeIn 0.3s ease-out;
}

body.no-animations * {
    animation: none !important;
    transition: none !important;
}

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

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 56px 28px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 24px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.breadcrumb {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: -0.02em;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.crumb {
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 0;
    transition: color var(--transition);
}

.crumb:hover {
    color: var(--text-secondary);
}

.crumb.active {
    color: var(--text);
}

.crumb::after {
    content: '/';
    margin: 0 6px;
    color: var(--border);
}

.crumb:last-child::after,
.crumb.no-separator::after {
    display: none;
}

.stats {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.file-list {
    display: flex;
    flex-direction: column;
}

.loading,
.error,
.empty {
    padding: 64px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.error {
    color: #f87171;
}

.file-row {
    display: grid;
    grid-template-columns: 1fr 72px 88px;
    gap: 24px;
    padding: 12px 16px;
    margin: 0 -16px;
    border-radius: var(--radius);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
    animation: fadeInUp 0.4s ease-out backwards;
}

.file-row:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.file-row:hover .file-icon {
    transform: scale(1.15);
}

.file-name {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.file-indicator {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
    opacity: 0.7;
}

.file-row.folder .file-indicator {
    background: var(--accent);
}

.file-row.image .file-indicator {
    background: #f472b6;
}

.file-row.video .file-indicator {
    background: #a78bfa;
}

.file-row.audio .file-indicator {
    background: #facc15;
}

.file-row.font .file-indicator {
    background: #38bdf8;
}

.file-row.text .file-indicator {
    background: #facc15;
}

.file-row.code .file-indicator {
    background: #34d399;
}

.file-row.archive .file-indicator {
    background: #fb923c;
}

.file-row.document .file-indicator {
    background: #f87171;
}

.file-row.fontFolder .file-indicator {
    background: #38bdf8;
}

.file-row .file-indicator {
    background: var(--text-muted);
}

/* SVG file icons - uses mask to colorize with file type color */
.file-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.8;
    background-color: var(--icon-color, var(--text-muted));
    -webkit-mask-image: var(--icon-src);
    mask-image: var(--icon-src);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    transition: transform 0.2s ease;
}

.file-icon.back {
    filter: brightness(0) invert(1);
    opacity: 0.7;
}

.file-link {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--transition);
}

.file-row:hover .file-link {
    color: var(--text);
}

.file-row.folder .file-link {
    color: var(--accent);
}

.file-row.fontFolder .file-link {
    color: #38bdf8;
}

.file-size,
.file-date {
    font-family: var(--font-mono);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.file-size {
    text-align: right;
    color: var(--text-secondary);
}

.file-date {
    text-align: right;
    color: var(--text-muted);
}

/* Load More button and file count */
.load-more-container {
    padding: 20px 16px;
    margin: 0 -16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.load-more-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all var(--transition);
}

.load-more-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

.file-count-text {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all var(--transition);
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.lightbox-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    pointer-events: auto;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.lightbox-links {
    display: flex;
    gap: 24px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.lightbox-link {
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    text-decoration: none;
}

.lightbox-link:hover {
    color: var(--text);
}

.reader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.reader.active {
    opacity: 1;
    pointer-events: auto;
}

.reader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.reader-window {
    position: relative;
    z-index: 1;
    width: 680px;
    max-width: 92vw;
    max-height: 88vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.reader.active .reader-window {
    transform: translateY(0) scale(1);
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg);
    border-radius: var(--radius) var(--radius) 0 0;
}

.reader-header span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.reader-actions {
    display: flex;
    gap: 4px;
}

.reader-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
}

.reader-content h1,
.reader-content h2,
.reader-content h3 {
    font-family: var(--font-sans);
    color: var(--text);
    line-height: 1.3;
    margin: 32px 0 16px 0;
    letter-spacing: -0.02em;
}

.reader-content h1:first-child,
.reader-content h2:first-child,
.reader-content h3:first-child {
    margin-top: 0;
}

.reader-content h1 {
    font-size: 1.75em;
    font-weight: 600;
}

.reader-content h2 {
    font-size: 1.35em;
    font-weight: 600;
}

.reader-content h3 {
    font-size: 1.1em;
    font-weight: 600;
}

.reader-content p {
    margin: 16px 0;
}

.reader-content code {
    font-family: var(--font-mono);
    background: var(--bg);
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--accent);
}

.reader-content pre {
    background: var(--bg);
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid var(--border-subtle);
}

.reader-content pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
}

.reader-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-dim);
    transition: border-color var(--transition);
}

.reader-content a:hover {
    border-color: var(--accent);
}

.reader-content blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.reader-content ul,
.reader-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.reader-content li {
    margin: 8px 0;
}

.reader-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

.reader-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 16px 0;
}

.reader-content strong {
    color: var(--text);
    font-weight: 600;
}

.preview {
    position: fixed;
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.preview.visible {
    opacity: 1;
}

.preview img {
    display: block;
    max-width: 100%;
    max-height: 280px;
}

.preview-font {
    padding: 24px;
    font-size: 24px;
    line-height: 1.5;
    color: var(--text);
    word-wrap: break-word;
    max-width: 360px;
}

.preview-loading {
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-mono);
}

.font-viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.font-viewer.active {
    opacity: 1;
    pointer-events: auto;
}

.font-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.font-viewer-window {
    position: relative;
    z-index: 1;
    width: 720px;
    max-width: 92vw;
    max-height: 88vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.font-viewer.active .font-viewer-window {
    transform: translateY(0) scale(1);
}

.font-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg);
    border-radius: var(--radius) var(--radius) 0 0;
}

.font-viewer-header span {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

.font-viewer-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.font-preview {
    text-align: center;
    padding: 32px 24px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
}

.font-sample {
    font-size: 48px;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 16px;
}

.font-sample-small {
    font-size: 24px;
    color: var(--text);
    margin-bottom: 20px;
    line-height: 1.4;
}

.font-sample-chars {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.font-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.font-slider-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.font-style-name {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--accent);
    letter-spacing: -0.01em;
    text-align: center;
    font-weight: 500;
}

.font-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    outline: none;
    border: 1px solid var(--border);
}

.font-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition);
}

.font-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

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

.font-viewer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg);
    border-radius: 0 0 var(--radius) var(--radius);
}

.font-viewer-footer span {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

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

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

@media (max-width: 640px) {
    .container {
        padding: 24px 16px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .file-row {
        grid-template-columns: 1fr 60px;
        gap: 16px;
        padding: 10px 12px;
        margin: 0 -12px;
    }

    .file-date {
        display: none;
    }

    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .lightbox-nav.prev {
        left: 12px;
    }

    .lightbox-nav.next {
        right: 12px;
    }

    .reader-content {
        padding: 20px;
    }
}