/* ==========================================================================
   DIRECTORY — style.css

   1.  Settings ........ colors, font and spacing (change the look here)
   2.  Base
   3.  Particle background
   4.  Layout
   5.  Header
   6.  Search
   7.  Folders
   8.  Link cards
   9.  Search results .. highlights and the "no matches" box
   10. Footer
   11. Animations
   12. Small screens
   13. Reduced motion
   ========================================================================== */


/* 1. SETTINGS
   ========================================================================== */

:root {
    /* Colors */
    --primary: #00FAB3;
    --primary-dark: #00C999;
    --background: #000000;
    --panel: rgba(0, 0, 0, 0.85);

    --text: #00FAB3;
    --text-secondary: rgba(0, 250, 179, 0.72);
    --text-faint: rgba(0, 250, 179, 0.45);

    --border: rgba(0, 250, 179, 0.45);
    --border-light: rgba(0, 250, 179, 0.2);

    --fill: rgba(0, 250, 179, 0.1);
    --fill-hover: rgba(0, 250, 179, 0.2);

    --glow: 0 0 20px rgba(0, 250, 179, 0.25);

    /* Font. Put 'Courier New' first instead to get the old look back. */
    --font: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;

    /* Spacing */
    --gap: 1.25rem;            /* space between the big panels */
    --panel-padding: 1.5rem;   /* space inside the big panels  */

    --speed: 0.2s ease;
}


/* 2. BASE
   ========================================================================== */

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

html {
    color-scheme: dark;
    scroll-behavior: smooth;
    scrollbar-color: var(--primary) var(--background);  /* Firefox */
    scrollbar-width: thin;                              /* Firefox */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--background);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: url('../cursor.png'), auto;   /* custom cursor */
}

a {
    color: inherit;
    cursor: url('../cursor.png'), auto;
}

button,
input {
    font: inherit;
    color: inherit;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--primary);
    color: var(--background);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Scrollbar (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 8px;
}

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

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

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


/* 3. PARTICLE BACKGROUND
   ========================================================================== */

#particles-js {
    position: fixed;
    inset: 0;
    z-index: 0;
}


/* 4. LAYOUT
   ========================================================================== */

.cyber-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    width: 100%;
    max-width: 1320px;
    min-height: 100vh;
    margin: 0 auto;
    padding: clamp(0.75rem, 2.5vw, 1.5rem);
}

.directory-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}


/* 5. HEADER
   ========================================================================== */

.system-header {
    padding: var(--panel-padding);
    background: var(--panel);
    border: 1px solid var(--primary);
    box-shadow: var(--glow);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: pulse 2s infinite;
}

.current-time {
    font-weight: 600;
}

.main-title {
    text-align: center;
}

.logo {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
    line-height: 0;
}

.logo-image {
    display: block;
    width: 300px;
    max-width: 100%;
    height: auto;
}

.subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    color: var(--text-secondary);
}

.subtitle-mark {
    color: var(--text-faint);
}

.subtitle + .subtitle {
    margin-top: 0.25rem;
}

/* Optional details row. Empty slots stay hidden until you fill them in. */
.system-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 2.5rem;
    margin-top: 1.25rem;
    font-size: 0.85rem;
}

.system-info:not(:has(.value:not(:empty))) {
    display: none;
}

.info-item {
    display: flex;
    gap: 0.5rem;
}

.info-item:has(> .value:empty) {
    display: none;
}

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

.value {
    font-weight: 600;
}


/* 6. SEARCH
   ========================================================================== */

.search-box {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1.25rem;
    background: var(--panel);
    border: 1px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 250, 179, 0.2);
    transition: box-shadow var(--speed), background var(--speed);
}

.search-box:focus-within {
    background: rgba(0, 14, 10, 0.92);
    box-shadow: 0 0 0 1px var(--primary), 0 0 24px rgba(0, 250, 179, 0.35);
}

.search-box > i {
    font-size: 1.05rem;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 0.2rem 0;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 1rem;
    letter-spacing: 0.05em;
    -webkit-appearance: none;
    appearance: none;
}

.search-box input::placeholder {
    color: var(--text-faint);
}

.search-box input::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}

/* The × button that clears the search */
.search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    transition: background var(--speed), color var(--speed);
}

.search-clear:hover {
    background: var(--primary);
    color: var(--background);
}

/* CTRL K hint (hidden on touch screens and while a search is typed in) */
.shortcut {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.shortcut kbd {
    padding: 0.1rem 0.4rem;
    font: inherit;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background: rgba(0, 250, 179, 0.06);
    border: 1px solid var(--border-light);
}

.search-box:has(.search-clear:not([hidden])) .shortcut {
    display: none;
}

@media (hover: none) {
    .shortcut {
        display: none;
    }
}

.search-stats {
    flex-shrink: 0;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    white-space: nowrap;
    color: var(--text-secondary);
}

.search-stats span {
    font-weight: 600;
    color: var(--primary);
}


/* 7. FOLDERS
   ========================================================================== */

.folder {
    background: var(--panel);
    border: 1px solid var(--primary);
    box-shadow: 0 0 20px rgba(0, 250, 179, 0.15);
}

.folder-heading {
    font-size: inherit;
    font-weight: inherit;
}

/* The clickable bar at the top of each folder */
.folder-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1.1rem 1.5rem;
    text-align: left;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(0, 30, 20, 0.8));
    border: 0;
    border-bottom: 1px solid var(--primary);
    cursor: pointer;
    transition: background var(--speed), box-shadow var(--speed), border-color var(--speed);
}

.folder-header:hover {
    background: linear-gradient(135deg, rgba(0, 20, 15, 0.95), rgba(0, 40, 30, 0.85));
    box-shadow: inset 0 0 10px rgba(0, 250, 179, 0.2);
}

.folder-header:focus-visible {
    outline-offset: -4px;
}

.folder-icon {
    flex-shrink: 0;
    width: 1.6rem;
    text-align: center;
    font-size: 1.3rem;
    text-shadow: 0 0 6px rgba(0, 250, 179, 0.7);
}

.folder-name {
    flex: 1;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.file-count {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--text-secondary);
}

.folder-chevron {
    display: none;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

/* Opening and closing. Only happens when JavaScript is on;
   without it every folder simply stays open. */
.js .folder-chevron {
    display: inline-block;
}

.js .folder.active .folder-chevron {
    transform: rotate(180deg);
}

.js .folder:not(.active) .folder-header {
    border-bottom-color: transparent;
}

.folder-content {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.4s ease;
}

.js .folder:not(.active) .folder-content {
    grid-template-rows: 0fr;
    visibility: hidden;   /* links in closed folders can't be tabbed into */
    transition: grid-template-rows 0.4s ease, visibility 0s linear 0.4s;
}

.file-section {
    min-height: 0;
    overflow: hidden;
}

/* The icon line at the top of an open folder */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

.section-header i {
    font-size: 1rem;
    color: var(--primary);
    text-shadow: 0 0 8px rgba(0, 250, 179, 0.6);
}

.section-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 0.9rem;
    padding: 0 1.5rem 1.5rem;
}


/* 8. LINK CARDS
   ========================================================================== */

.file-item {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 4.6rem;
    padding: 0.85rem 1rem;
    color: var(--text);
    text-decoration: none;
    background: linear-gradient(135deg, rgba(0, 10, 8, 0.95), rgba(0, 30, 22, 0.85));
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed);
}

.file-item:hover,
.file-item:focus-visible {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(0, 250, 179, 0.3), inset 0 0 15px rgba(0, 250, 179, 0.15);
}

/* Light that sweeps across a card on hover */
.file-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0, 250, 179, 0.15), transparent);
    transform: translateX(-100%);
    pointer-events: none;
}

.file-item:hover::before {
    transform: translateX(100%);
    transition: transform 0.6s ease;
}

/* The glowing icon box. Works on any icon in a card, with or without the
   "file-icon" class, so icons pasted straight from fontawesome.com get it too. */
.file-item > i,
.file-item .file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.2rem;
    color: var(--primary);
    background: var(--fill);
    border: 1px solid var(--primary);
    box-shadow: 0 0 8px rgba(0, 250, 179, 0.3);
    transition: background var(--speed), box-shadow var(--speed), transform var(--speed);
}

.file-item:hover > i,
.file-item:focus-visible > i,
.file-item:hover .file-icon,
.file-item:focus-visible .file-icon {
    background: var(--fill-hover);
    box-shadow: 0 0 12px var(--primary);
    transform: scale(1.05);
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.file-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.05em;
    overflow-wrap: anywhere;
}

.file-desc {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.file-meta {
    font-size: 0.7rem;
    line-height: 1.4;
    letter-spacing: 0.04em;
    color: rgba(0, 250, 179, 0.6);
}

/* The arrow that shows on hover. It's added here so the cards don't each need it. */
.file-item::after {
    content: '\f35d';
    content: '\f35d' / '';   /* same, but screen readers skip it */
    flex-shrink: 0;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.85rem;
    text-shadow: 0 0 5px var(--primary);
    opacity: 0;
    transform: translateX(8px);
    transition: opacity var(--speed), transform var(--speed);
}

.file-item:hover::after,
.file-item:focus-visible::after {
    opacity: 1;
    transform: none;
}

/* Click effect */
.ripple {
    position: absolute;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: rgba(0, 250, 179, 0.35);
    pointer-events: none;
    animation: ripple 0.6s ease-out forwards;
}

.file-item.is-opening {
    animation: file-pulse 0.3s ease-in-out;
}


/* 9. SEARCH RESULTS
   ========================================================================== */

mark {
    padding: 0 2px;
    color: var(--primary);
    background: rgba(0, 250, 179, 0.25);
    box-shadow: 0 0 6px rgba(0, 250, 179, 0.25);
}

.no-results {
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--panel);
    border: 1px solid var(--border);
    animation: rise 0.4s ease-out;
}

.no-results i {
    display: block;
    margin-bottom: 1rem;
    font-size: 2.5rem;
    opacity: 0.5;
}

.no-results-title {
    margin-bottom: 0.4rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.no-results p:last-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
}


/* 10. FOOTER
   ========================================================================== */

.system-footer {
    padding: 1.25rem var(--panel-padding);
    background: var(--panel);
    border: 1px solid var(--primary);
    box-shadow: var(--glow);
}

.footer-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

.stat {
    display: flex;
    gap: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
}

.system-health {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.health-bar {
    flex: 1;
    height: 6px;
    overflow: hidden;
    background: rgba(0, 250, 179, 0.15);
}

.health-fill {
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    transition: width 0.5s ease;
}


/* 11. ANIMATIONS
   ========================================================================== */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

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

@keyframes ripple {
    to {
        transform: scale(40);
        opacity: 0;
    }
}

@keyframes file-pulse {
    50% { scale: 0.98; }
}

/* Panels slide in one after another when the page loads */
@media (prefers-reduced-motion: no-preference) {
    .system-header,
    .search-container,
    .folder,
    .system-footer {
        animation: rise 0.5s cubic-bezier(0.2, 0.9, 0.4, 1.1) both;
    }

    .search-container {
        animation-delay: 0.1s;
    }

    .folder {
        animation-delay: calc(0.2s + var(--i, 0) * 0.04s);
    }

    .system-footer {
        animation-delay: 0.3s;
    }
}


/* 12. SMALL SCREENS
   ========================================================================== */

@media (max-width: 700px) {
    :root {
        --gap: 1rem;
        --panel-padding: 1.1rem;
    }

    .header-top {
        font-size: 0.72rem;
    }

    .subtitle {
        font-size: 0.75rem;
        letter-spacing: 0.18em;
    }

    .search-box {
        flex-wrap: wrap;
        gap: 0.6rem 0.8rem;
        padding: 0.8rem 1rem;
    }

    .search-stats {
        flex-basis: 100%;
        font-size: 0.72rem;
    }

    .folder-header {
        gap: 0.8rem;
        padding: 0.95rem 1.1rem;
    }

    .folder-icon {
        font-size: 1.1rem;
    }

    .folder-name {
        font-size: 1rem;
        letter-spacing: 0.08em;
    }

    .section-header {
        padding: 1rem 1.1rem 0.8rem;
    }

    .file-grid {
        gap: 0.7rem;
        padding: 0 1.1rem 1.1rem;
    }

    .file-item {
        min-height: 4rem;
        padding: 0.75rem 0.85rem;
    }

    .file-item > i,
    .file-item .file-icon {
        width: 2.4rem;
        height: 2.4rem;
        font-size: 1.05rem;
    }

    .footer-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}


/* 13. REDUCED MOTION
   For people who turn off animations in their device settings.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
}
