/* Basic resets and base font */
body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    background-color: var(--background);
    color: var(--foreground);
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* --- Global Link Styles --- */
a:link,
a:visited {
    color: var(--link-color);
    background-color: transparent;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

a:active {
    text-decoration: underline;
}

/* Navbar styles */
#navbar {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-links li a {
    color: var(--foreground);
    text-decoration: none;
    font-weight: 600;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav-links li a:hover {
    opacity: 1;
    color: var(--link-color);
}

/* Theme Switcher in Nav */
#theme-switcher {
    position: relative;
}

#theme-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--foreground);
    font-family: 'Inter', sans-serif;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    background-color: var(--highlight-bg);
    font-weight: 600;
}

#theme-btn:hover {
    background-color: var(--header-bg);
    border-color: var(--link-color);
}

#theme-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 100;
    min-width: 150px;
}

/* Main Content Area */
#main-content {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px 100px 20px; /* bottom padding for terminal drawer */
    box-sizing: border-box;
}

#content-area {
    /* Uses markdown output styling */
    line-height: 1.6;
    font-size: 1.1rem;
}

#content-area h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5em;
    padding-bottom: 10px;
}

#content-area h2 {
    font-size: 1.8rem;
    margin-top: 1.5em;
}

#content-area h3 {
    font-size: 1.4rem;
    margin-top: 1.2em;
}

/* Directory listing styles for Main Content */
.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    background: var(--header-bg);
}

.back-link:hover {
    background: var(--highlight-bg);
    border-color: var(--link-color);
    transform: translateX(-2px);
}

.directory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.directory-header h1 {
    font-size: 2.2rem;
    margin: 0;
    padding: 0;
    border-bottom: none;
}

.view-toggle-btn {
    background: var(--highlight-bg);
    border: 1px solid var(--border-color);
    color: var(--foreground);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

.view-toggle-btn:hover {
    border-color: var(--link-color);
}

.directory-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.directory-list.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.directory-list-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.directory-list.tiles .directory-list-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--header-bg);
}

.directory-list.tiles .directory-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: var(--link-color);
    background: var(--highlight-bg);
}

.directory-list-item:hover {
    background-color: var(--highlight-bg);
    border-radius: 4px;
}

.directory-list-item a {
    text-decoration: none;
    color: var(--link-color);
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.directory-list.tiles .directory-list-item a {
    flex-direction: column;
    gap: 15px;
    width: 100%;
    overflow: hidden;
}

.directory-list-item a .icon {
    font-size: 1.2rem;
}

.directory-list.tiles .directory-list-item a .icon {
    font-size: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.directory-list.tiles .directory-list-item .thumbnail {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.directory-list.tiles .directory-list-item .name {
    white-space: nowrap;
    width: 100%;
}

.directory-list-item span.date {
    font-size: 0.9rem;
    color: var(--prompt-color);
    margin-left: auto;
}

.directory-list.tiles .directory-list-item span.date {
    margin-left: 0;
    margin-top: 10px;
}

/* Terminal Drawer */
#terminal-drawer {
    position: fixed;
    bottom: -400px; /* Hidden by default, height is 400 */
    left: 10%;
    width: 80%;
    height: 400px;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.5);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    flex-direction: column;
}

#terminal-drawer.open {
    bottom: 0;
}

.terminal-handle {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 5px 20px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    color: var(--foreground);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

#terminal-window {
    width: 100%;
    height: 100%;
    max-width: none;
    box-shadow: none;
    border-radius: 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* --- Classified Redaction Effect --- */
.classified {
    position: relative;
    display: inline-block;
    color: inherit;
}

.classified::after {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background-color: var(--foreground); /* Redaction marker matching theme text color */
    transform-origin: right; /* Shrinks towards the right (wipes left to right) */
    /* Uses inline variables for varied timings, with fallbacks */
    animation: unredact var(--duration, 2s) cubic-bezier(0.77, 0, 0.175, 1) var(--delay, 1s) forwards;
}

@keyframes unredact {
    0% {
        transform: scaleX(1);
    }
    100% {
        transform: scaleX(0);
    }
}
