/**
 * Terminal Component Styles
 * All terminal and navigation card related styles
 */

/* ===== TERMINAL CSS VARIABLES ===== */
/* Terminal-specific borders - darker for better definition */
:root {
    --color-terminal-border: var(--color-gray-800);
    --color-terminal-border-subtle: var(--color-gray-700);
}

/* ===== TERMINAL ANIMATIONS ===== */
/* Terminal command animation */
@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Terminal command cursor animation */
.terminal-content .command-line::after {
    content: '|';
    animation: cursor-blink 1s infinite;
    margin-left: 2px;
}

/* Head shake animation for terminal */
@keyframes headShake {
    0% { transform: translateX(0); }
    6.5% { transform: translateX(-6px) rotateY(-9deg); }
    18.5% { transform: translateX(5px) rotateY(7deg); }
    31.5% { transform: translateX(-3px) rotateY(-5deg); }
    43.5% { transform: translateX(2px) rotateY(3deg); }
    50% { transform: translateX(0); }
}

/* Typewriter animation - reveals characters step by step */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* ===== NAVIGATION CARD STRUCTURE ===== */
/* Navigation Card - Clean Bulma Card Structure */
html body .navigation-card,
.navigation-card.force-flex,
body .navigation-card.styled-nav-card {
    display: flex;
    flex-direction: column;
    background-color: transparent;
    border-radius: 8px;
    border: none; /* No main border - sections handle their own */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    height: fit-content;
    min-height: unset;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
}

/* Card Header - Top section with top border */
html body .navigation-card .card-header,
.navigation-card .styled-card-header,
body .navigation-card .card-header {
    background-color: var(--color-gray-800) !important;
    border: 1px solid var(--color-terminal-border) !important;
    border-bottom: 1px solid var(--color-terminal-border-subtle) !important;
    border-radius: 8px 8px 0 0 !important;
    margin: 0 !important;
    padding: 0.15rem .25rem !important;
}

/* Card Content - Middle section with side borders */
html body .navigation-card .card-content,
.navigation-card .styled-card-content,
body .navigation-card .card-content {
    position: relative !important;
    background-color: var(--color-gray-900) !important;
    color: var(--color-white) !important;
    padding: 20px !important;
    border-left: 1px solid var(--color-terminal-border) !important;
    border-right: 1px solid var(--color-terminal-border) !important;
    border-top: none !important; /* Connects to header */
    border-bottom: none !important; /* Set conditionally below */
    border-radius: 0 !important;
    margin: 0 !important;
    transition: max-height .25s .35s linear,
                max-width .25s linear,
                width .25s .05s linear,
                transform 0.25s ease-in-out,
                height 0.25s ease-in-out,
                min-height .25s linear !important;
    -webkit-backdrop-filter: blur(12px) saturate(200%) !important;
    backdrop-filter: blur(12px) saturate(200%) !important;
    height: fit-content !important;
    min-height: unset !important;
}

/* Card sections with footer - content connects to footer */
.navigation-card:has(.card-footer) .card-content {
    border-bottom: none; /* Footer handles bottom border */
}

/* Card sections without footer - content closes the card */
.navigation-card:not(:has(.card-footer)) .card-content {
    border-bottom: 1px solid var(--color-terminal-border);
    border-radius: 0 0 8px 8px; /* Bottom corners when no footer */
}

/* Card Footer - Bottom section with bottom border */
html body .navigation-card .card-footer,
.navigation-card .styled-card-footer {
    background-color: var(--color-gray-900);
    border-left: 1px solid var(--color-terminal-border);
    border-right: 1px solid var(--color-terminal-border);
    border-bottom: 1px solid var(--color-terminal-border);
    border-top: 1px solid var(--color-terminal-border-subtle);
    border-radius: 0 0 8px 8px;
    margin: 0;
    padding: 0;
}

.navigation-card .card-footer-item {
    background-color: var(--color-gray-900);
    color: var(--color-gray-400);
    border: none;
    transition: all 0.2s ease;
}

.navigation-card .card-footer-item:hover {
    background-color: var(--color-gray-800);
    color: var(--color-white);
}

/* Footer button separators - clean implementation */
.navigation-card .card-footer-item:not(:last-child) {
    border-right: 1px solid var(--color-terminal-border-subtle);
}

/* ===== TERMINAL STYLES MOVED FROM MAIN CSS ===== */
/* Keep swiper-specific rule as it's layout-related, not content control */
body:has(.featured-notes-swiper) .terminal-static-content {
    display: none;
    margin: 0;
    padding: 0;
    height: 0;
}

/* Welcome message formatting - tighter spacing */
.terminal-static-content {
    display: block;
    margin: 0;
}

/* Add a fix for duplicate terminal content */
.terminal-dynamic-output .terminal-description:nth-child(n+2) {
    display: none;
}

/* ===== TERMINAL CONTENT STYLES ===== */
/* Main Terminal Container */
.terminal-content {
    font-family: var(--font-family-code, monospace);
    background-color: transparent;
    color: var(--color-gray-400);
    line-height: 1.3;
    margin: 0;
    margin-bottom: 0;
    border-radius: 0;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    overflow-wrap: break-word;
    word-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto;
    white-space: normal;
}

/* Terminal Component - Semantic padding control */
.terminal-component .card-content {
    padding: 0 !important; /* Card wrapper has no padding */
}

/* Terminal content controls its own padding */
.terminal-component .terminal-content {
    padding: 1.5rem !important; /* Terminal content provides padding */
}

/* Headless terminals (hero) also get padding since they have no card wrapper */
.terminal-content[data-terminal-type="headless"] {
    padding: 1.5rem;
}

/* Default: all terminal content gets padding */
.terminal-content {
    padding: 1.5rem;
}

/* Ensure typing sequence has no additional padding */
.terminal-typing-sequence {
    padding: 0;
}

/* Keep swiper-specific rule as it's layout-related, not content control */
body:has(.featured-notes-swiper) .terminal-static-content {
    display: none;
    margin: 0;
    padding: 0;
    height: 0;
}

/* Command prompt with timestamp - further reduce margins */
.terminal-command-line,
[data-time] {
    font-family: 'VT323', monospace;
    color: var(--color-gray-400);
    font-size: 1.1rem;
    line-height: 1.2;
    margin: 0.1rem 0 0.3rem 0;
}

/* Terminal content - reduce spacing */
.terminal-static-content,
.terminal-description,
.terminal-response {
    font-family: 'VT323', monospace;
    display: flex;
    flex-direction: column;
    color: var(--color-gray-400);
    font-size: 1.1rem;
    line-height: 1.2;
    white-space: normal;
}

/* Terminal response elements - consistent styling for all HTML elements */
.terminal-response p,
.terminal-response h1, .terminal-response h2, .terminal-response h3, 
.terminal-response h4, .terminal-response h5, .terminal-response h6,
.terminal-response span, .terminal-response div {
    font-family: 'VT323', monospace !important;
    color: var(--color-gray-400) !important;
    font-size: 1.1rem !important;
    line-height: 1.6 !important;
    font-weight: 400 !important;
    margin: 0 0 0.5rem 0 !important;
}

/* Terminal links styling */
.terminal-response a {
    font-family: 'VT323', monospace !important;
    color: var(--color-gray-300) !important;
    font-size: 1.1rem !important;
    text-decoration: none !important;
    border-bottom: 1px solid transparent !important;
    transition: all 0.2s ease !important;
}

.terminal-response a:hover {
    color: var(--color-white) !important;
    border-bottom-color: var(--color-gray-500) !important;
}

.terminal-response h1, .terminal-response h2, .terminal-response h3 {
    font-size: 1.2rem !important;
    margin: 1rem 0 0.5rem 0 !important;
}

/* Remove top margin and padding for first-child headings */
.terminal-response h1:first-child, 
.terminal-response h2:first-child, 
.terminal-response h3:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.terminal-response p:last-child {
    margin-bottom: 0 !important;
}

/* Terminal input field */
.terminal-prompt {
    font-family: 'VT323', monospace;
    color: var(--color-gray-400);
    margin: 0 !important; /* Force no vertical margin */
    font-size: 1.1rem;
    line-height: 1.5;
    display: block !important; /* Changed from flex to block */
    width: 100% !important; /* Take full width */
}

/* Terminal response styling - uses flex from above rule */
.terminal-response {
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    border: 0px;
    border-radius: 8px;
    padding: 24px 24px;
    background-color: var(--color-gray-800);
}

/* ===== TERMINAL CURSOR AND ANIMATIONS ===== */
/* Blinking cursor style - fix spacing */
.terminal-content .cursor {
    display: inline-block;
    width: 0.6em;
    height: 1em;
    background-color: var(--color-gray-400);
    animation: blink 1s step-end infinite;
    vertical-align: middle;
}

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

/* Terminal Cursor Animation */
.command-cursor {
    animation: cursor-blink 1s infinite;
    color: var(--color-gray-400);
    margin: 0;
}

/* ===== TERMINAL CONTENT MANAGEMENT ===== */
/* Ensure there's no duplication of content */
.terminal-seo-content {
    display: none;
    visibility: hidden;
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Welcome message formatting - tighter spacing */
.terminal-static-content {
    display: block;
    margin: 0;
}

/* Terminal text styling for hero sections */
body:has(.hero) .terminal-static-content,
.hero .terminal-static-content {
    color: var(--color-gray-400);
}

/* Add a fix for duplicate terminal content */
.terminal-dynamic-output .terminal-description:nth-child(n+2) {
    display: none;
}

/* Terminal Content Styling (previously static content) */
.terminal-output-area {
    display: block;
    flex: 1;
    min-height: 80px;
}

/* ===== TERMINAL TYPOGRAPHY ===== */
/* Terminal title and metadata */
.terminal-title {
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
    padding: 0;
    color: var(--color-white);
    line-height: 1.2;
    letter-spacing: 0.5px;
}

.terminal-meta {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: var(--color-gray-600);
    margin: 0.1rem 0 0.3rem 0;
    display: block;
}

.terminal-description {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    color: var(--color-gray-400);
    line-height: 1.4;
    margin: 0.5rem 0;
    white-space: normal;
    display: block;
}

/* Ensure terminal card headers aren't bold */
.navigation-card h4,
.navigation-card h1,
.navigation-card .title,
.navigation-card .card-header-title h1,
#terminal h4,
.card-header-title h1,
.title.is-1.is-family-mono,
.title.is-2.is-family-mono,
.title.is-3.is-family-mono,
.title.is-4.is-family-mono,
.title.is-5.is-family-mono,
.title.is-6.is-family-mono,
.title.is-7.is-family-mono {
    font-weight: var(--weight-normal);
}

/* High-specificity override to ensure no bold text in terminal navigation */
body .navigation-card .card-header-title h1,
body .navigation-card .card-header-title h4,
body .navigation-card .card-header .title,
body #terminal h4,
body #terminal h1 {
    font-weight: 400;
    font-variation-settings: "wght" 400;
}

/* ===== TERMINAL CATEGORIES ===== */
/* Categories display */
.terminal-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.terminal-category {
    background-color: var(--color-gray-900);
    color: var(--color-gray-400);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    transition: all 0.2s ease;
    font-family: 'VT323', monospace;
}

.terminal-category:hover {
    background-color: var(--color-gray-800);
    color: var(--color-gray-400);
}

/* ===== TERMINAL NAVIGATION ===== */
/* Terminal Navigation */
.terminal-navigation {
    background-color: var(--color-gray-900);
    color: var(--color-gray-100);
    border: 1px solid var(--color-terminal-border);
    border-top: 1px solid var(--color-terminal-border-subtle);
    border-radius: 0px 0px 8px 8px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.terminal-navigation .card-footer-item {
    color: var(--color-gray-300);
    font-family: "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    border: none;
    transition: all 0.2s ease;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminal-navigation .card-footer-item.disabled {
    color: var(--color-gray-800);
    cursor: not-allowed;
    pointer-events: none;
}

.terminal-navigation .card-footer-item:not(.disabled):hover {
    background-color: var(--color-gray-700);
    color: var(--color-gray-100);
}

/* Return button styling - ensure it looks like other footer items */
.terminal-navigation .return-category {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    outline: inherit;
    width: 100%;
    text-align: center;
    font-size: 12px; /* Match other footer items */
    font-family: "JetBrains Mono", Menlo, Monaco, Consolas, monospace; /* Match other footer items */
}

.terminal-navigation .card-footer-item i {
    font-size: 14px;
}

.terminal-navigation .return-category {
    border-left: 1px solid var(--color-gray-800);
    border-right: 1px solid var(--color-gray-800);
}

/* ===== LEGACY TERMINAL CORE STYLES ===== */
/* Terminal Core Styles */
#terminal {
    position: relative;
    font-family: var(--font-family-code) !important;
    text-align: left;
    border-radius: 5px;
    min-height: 1px;
    width: 100%;
    margin: 0 auto;
    transition: max-height .25s .35s linear,
                max-width .25s linear,
                width .25s .05s linear,
                transform 0.25s ease-in-out,
                height 0.25s ease-in-out,
                min-height .25s linear;
    overflow: hidden;
    z-index: 9999999;
}

.terminal-wrapper {
    position: relative;
    width: 100%;
}

.terminal-wrapper.headShake {
    animation-timing-function: ease-in-out;
    animation-name: headShake;
    animation-duration: 0.5s;
}

#terminal p, #terminal h4 {
    font-family: var(--font-family-code) !important;
}

#terminal.big {
    height: 100vh;
    width: 100vw;
    max-height: 100vh;
    max-width: 100vw;
}

#terminal.minimized {
    transition: height .25s .35s linear,
                max-width .25s linear,
                width .25s .05s linear,
                min-height .25s linear;
}

#terminal.minimized .terminal-body {
    max-height: 0px;
    min-height: 0px;
    height: auto;
    padding: 0px;
    transition: max-height .25s .35s ease-in-out,
                padding .25s .45s ease-in-out,
                opacity .25s ease-in-out,
                max-width .25s linear,
                width .25s .05s linear,
                transform 0.25s ease-in-out,
                height 0.25s ease-in-out;
}

#terminal .terminal__header, 
.card-header {
    background-color: var(--color-gray-800);   
    color: var(--color-white);
    border: 1px solid var(--color-terminal-border);
    border-bottom: 1px solid var(--color-terminal-border-subtle);
    border-radius: 5px 5px 0px 0px;
    -webkit-backdrop-filter: blur(12px) saturate(200%);
    backdrop-filter: blur(12px) saturate(200%);
}

#terminal .terminal-body, 
#terminal .card-content {
    position: relative;
    background-color: var(--color-gray-900);   
    color: var(--color-white);
    padding: 20px;
    transition: max-height .25s .35s linear,
                max-width .25s linear,
                width .25s .05s linear,
                transform 0.25s ease-in-out,
                height 0.25s ease-in-out,
                min-height .25s linear;
    border-radius: 0px 0px 5px 5px;
    -webkit-backdrop-filter: blur(12px) saturate(200%);
    backdrop-filter: blur(12px) saturate(200%);
    border: 1px solid var(--color-terminal-border);
    border-top: none;
}

/* ===== TERMINAL INTERACTIVITY ===== */
/* Terminal interactivity */
.navigation-card:focus {
    outline: none;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
}

.terminal-input-line .terminal-prompt {
    margin: 0;
}

/* ===== TERMINAL LAYOUT CONTROL ===== */
/* Force line breaks between any inline terminal elements */
.terminal-content > * {
    display: block;
}

/* Ensure command prompt and response are on separate lines */
.terminal-command-line + .terminal-response,
.terminal-prompt + .terminal-response {
    margin-top: 0.5rem;
}

/* Fix typing terminal alignment - prevent flex justification */
.terminal-component .terminal-typing-sequence .terminal-command-line {
    display: flex !important;
    align-items: baseline !important;
    justify-content: flex-start !important; /* Align to start, not space-between */
    gap: 0 !important; /* No gap between prompt and command text */
    flex-wrap: nowrap !important;
}

.terminal-component .terminal-typing-sequence .terminal-prompt {
    display: flex !important;
    align-items: baseline !important;
    gap: 0 !important;
}

.terminal-component .terminal-typing-sequence .typing-text {
    display: inline !important;
    white-space: nowrap !important;
}

/* Force all terminal command lines to not justify content */
.terminal-component .terminal-command-line {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: baseline !important;
    gap: 0 !important;
}

/* ===== TERMINAL DISPLAY CONTROL ===== */
/* Terminal Display Control - increase specificity for attribute selectors */
body .terminal-content[data-terminal-display]:not([data-terminal-display*="title"]) .terminal-response .terminal-title {
    display: none;
}

body .terminal-content[data-terminal-display]:not([data-terminal-display*="date"]) .terminal-response .terminal-meta {
    display: none;
}

body .terminal-content[data-terminal-display]:not([data-terminal-display*="categories"]) .terminal-response .terminal-categories {
    display: none;
}

body .terminal-content[data-terminal-display]:not([data-terminal-display*="description"]) .terminal-response .terminal-description {
    display: none;
}

/* Homepage-specific display settings */
body:has(.featured-notes-swiper) .terminal-response .terminal-title,
body:has(.featured-notes-swiper) .terminal-response .terminal-meta,
body:has(.featured-notes-swiper) .terminal-response .terminal-categories {
    display: none;
}

/* ===== TERMINAL ANIMATION STATES ===== */
/* Animation states for terminal responses (controlled by JS) */
.terminal-response.js-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
}

.terminal-response.js-visible {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* SIMPLE TERMINAL CONTENT VISIBILITY - NO MORE OVERENGINEERING */
.terminal-content .terminal-command-line,
.terminal-content .terminal-response,
.card-content .terminal-command-line, 
.card-content .terminal-response {
    /* Hidden by default - will be shown by JavaScript animation */
    opacity: 0;
    visibility: hidden;
    display: block;
}

/* Show real content when no JavaScript available (progressive enhancement) */
.no-js .terminal-content .terminal-command-line,
.no-js .terminal-content .terminal-response,
.no-js .card-content .terminal-command-line, 
.no-js .card-content .terminal-response {
    opacity: 1;
    visibility: visible;
}

/* Hide skeleton when no JavaScript available */
.no-js .terminal-skeleton {
    display: none;
}

/* Clean terminal state management - let JavaScript handle everything */

/* ===== TERMINAL SKELETON LOADING STATE ===== */

/* ===== SIMPLE LOADING FLASH ===== */

/* Header loads first (for terminals that have headers) */
.card-header.loading {
    animation: loading-flash 0.6s ease-out forwards;
}

/* Content loads after header is done */
.terminal-content.loading,
.card-content.loading {
    animation: loading-flash 0.8s ease-out forwards;
    animation-delay: 0.5s;
}

/* For headless terminals (no header), start immediately */
.terminal-content.terminal-component.loading {
    animation: loading-flash 0.8s ease-out forwards;
    animation-delay: 0s;
}

/* Prevent re-animation */
.card-header.loaded,
.terminal-content.loaded,
.card-content.loaded {
    animation: none !important;
}

@keyframes loading-flash {
    0% { background-color: rgba(255, 255, 255, 0.03); }
    50% { background-color: rgba(255, 255, 255, 0.05); }
    100% { background-color: rgba(255, 255, 255, 0.02); }
}

/* Light mode override */
@media (prefers-color-scheme: light) {
    @keyframes loading-flash {
        0% { background-color: rgba(0, 0, 0, 0.03); }
        50% { background-color: rgba(0, 0, 0, 0.05); }
        100% { background-color: rgba(0, 0, 0, 0.02); }
    }
} 