/* ============================================
   Captain Crimson — Personal Website
   VS Code-inspired layout
   Palette: Plastic Code Wrap + custom VS Code UI
   Font: Roboto Mono (self-hosted, variable)
   ============================================ */

/* --- Fonts --- */

@font-face {
    font-family: 'Roboto Mono';
    src: url('fonts/RobotoMono-Regular.woff2') format('woff2'),
         url('fonts/RobotoMono-Regular.ttf') format('truetype');
    font-weight: 100 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto Mono';
    src: url('fonts/RobotoMono-Italic.woff2') format('woff2'),
         url('fonts/RobotoMono-Italic.ttf') format('truetype');
    font-weight: 100 700;
    font-style: italic;
    font-display: swap;
}

/* --- Plastic Code Wrap Palette --- */

:root {
    /* from theme file */
    --bg:          #0B161D; /* editor background */
    --text:        #F8F8F8; /* foreground */
    --comment:     #1E9AE0; /* comment — blue italic */
    --constant:    #FF3A83; /* constant — hot pink */
    --entity:      #EFE900; /* entity — bright yellow */
    --keyword:     #FFAA00; /* keyword — amber bold */
    --storage:     #F6F080; /* storage — pale yellow */
    --string:      #55E439; /* string — bright green */
    --support:     #9DF39F; /* support — light green */
    --variable:    #FB9A4B; /* variable — orange */
    --tag:         #9EFFFF; /* meta.tag — cyan */
    --function:    #FFB454; /* support.function — golden orange */
    --caret:       #8BA7A7; /* caret — muted teal */
    --support-const: #EB939A; /* support.constant — salmon pink */

    /* from Daniel's VS Code user settings */
    --bg-lighter:  #121f28; /* sideBar.background */
    --bg-panel:    #0e1a22; /* activityBar.background */
    --border:      #1e3a4a; /* sideBar.border — dark teal */
    --bg-inactive: #0d2b35; /* tab.inactiveBackground */
}

/* --- Reset & Base --- */

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Roboto Mono';
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- App Layout (CSS Grid) --- */

.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 1fr 28px;
    grid-template-areas:
        "sidebar editor"
        "statusbar statusbar";
    height: 100vh;
    width: 100%;
}

/* --- Sidebar --- */

.sidebar {
    grid-area: sidebar;
    background-color: var(--bg-lighter);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--comment); /* blue */
    padding: 12px 16px 8px;
    user-select: none;
}

/* --- File Tree --- */

.file-tree {
    flex: 1;
    padding: 0;
    margin: 0;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.6;
    user-select: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

/* sidebar highlight sweep on hover */
.tree-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transform: translateX(-100%);
    transition: none;
    pointer-events: none;
}

.tree-item:hover::after {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.tree-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.tree-item.active {
    background-color: var(--bg);
    border-left: 2px solid var(--constant);
    padding-left: 6px;
}

/* folder items */
.tree-folder > .tree-item {
    color: var(--keyword); /* amber orange */
    font-weight: 700;
}

/* chevron for folders */
.tree-folder > .tree-item::before {
    content: '\25B8'; /* right-pointing triangle */
    display: inline-block;
    width: 16px;
    font-size: 10px;
    color: var(--caret);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.tree-folder.expanded > .tree-item::before {
    transform: rotate(90deg);
}

/* file items */
.tree-file .tree-item {
    color: var(--entity); /* bright yellow — pairs with amber folders */
}

.tree-file .tree-item::before {
    content: '';
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
}

/* folder children container */
.tree-children {
    display: none;
}

.tree-folder.expanded > .tree-children {
    display: block;
}

/* depth indentation */
.tree-item[data-depth="0"] { padding-left: 12px; }
.tree-item[data-depth="1"] { padding-left: 28px; }
.tree-item[data-depth="2"] { padding-left: 44px; }
.tree-item.active[data-depth="0"] { padding-left: 10px; }
.tree-item.active[data-depth="1"] { padding-left: 26px; }
.tree-item.active[data-depth="2"] { padding-left: 42px; }

/* --- Editor Area --- */

.editor-area {
    grid-area: editor;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Tab Bar --- */

.tab-bar {
    display: flex;
    background-color: var(--bg-inactive);
    border-bottom: 1px solid var(--border);
    min-height: 36px;
    align-items: stretch;
}

.tab {
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 13px;
    color: var(--caret);
    background-color: var(--bg-inactive);
    border-right: 1px solid var(--border);
    cursor: default;
    user-select: none;
    white-space: nowrap;
}

.tab.active {
    color: var(--text);
    background-color: var(--bg);
    border-top: 2px solid var(--keyword);
    border-bottom: 1px solid var(--bg); /* blends into editor */
    margin-bottom: -1px;
}

/* --- Now Playing Ticker --- */

.now-playing {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding: 0 12px;
    gap: 8px;
    font-size: 12px;
    color: var(--caret);
    white-space: nowrap;
}

.now-playing-icon {
    color: var(--string);
    font-size: 14px;
    flex-shrink: 0;
}

.now-playing-text {
    overflow: hidden;
    max-width: 220px;
    position: relative;
}

.now-playing-scroll {
    display: inline-block;
    white-space: nowrap;
    color: var(--constant); /* hot pink — currently playing text */
}

.now-playing-scroll.scrolling {
    animation: tickerScroll 12s linear infinite;
}

@keyframes tickerScroll {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.now-playing-btn {
    background: none;
    border: none;
    color: var(--caret);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 3px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}

.now-playing-btn:hover {
    color: var(--text);
}

.now-playing-btn.active {
    color: var(--string); /* green when loop is on */
}

/* --- Music Page --- */

.music-track {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.music-track:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.music-track.playing {
    background-color: rgba(255, 58, 131, 0.06);
    border-left: 3px solid var(--constant); /* hot pink for active track */
    padding-left: 9px;
}

.music-track-icon {
    color: var(--caret);
    font-size: 14px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.music-track.playing .music-track-icon {
    color: var(--constant); /* hot pink */
}

.music-track-info {
    flex: 1;
    min-width: 0;
}

.music-track-title {
    color: var(--text);
    font-size: 14px;
}

.music-track.playing .music-track-title {
    color: var(--constant); /* hot pink */
}

.music-track-artist {
    color: var(--support-const); /* salmon pink */
    font-size: 12px;
    font-style: italic;
}

/* sidebar highlight sweep reuse for music tracks */
.music-track::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transform: translateX(-100%);
    transition: none;
    pointer-events: none;
}

.music-track:hover::after {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

/* --- Photo Gallery --- */

.gallery-item {
    margin-bottom: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--border);
}

.gallery-item:last-child {
    border-bottom: none;
}

.gallery-img {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    display: block;
    max-width: 500px;
}

.gallery-subtitle {
    color: var(--comment);
    font-style: italic;
    font-size: 15px;
    margin: 0 0 8px;
}

.gallery-story {
    color: var(--text);
    font-size: 15px;
    margin: 0;
    line-height: 1.6;
}

/* --- Editor Pane --- */

.editor-pane {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--bg);
    padding: 40px 20px 60px;
}

.editor-content {
    max-width: 680px;
    margin: 0 auto;
}

/* custom scrollbar */
.editor-pane::-webkit-scrollbar {
    width: 8px;
}

.editor-pane::-webkit-scrollbar-track {
    background: var(--bg);
}

.editor-pane::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.editor-pane::-webkit-scrollbar-thumb:hover {
    background: var(--caret);
}

/* firefox scrollbar */
.editor-pane {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
}

/* --- Status Bar --- */

.status-bar {
    grid-area: statusbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--comment);
    user-select: none;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-comment {
    font-style: italic;
    opacity: 0.7;
}

.sound-toggle {
    background: none;
    border: none;
    color: var(--caret);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.2s;
}

.sound-toggle:hover {
    color: var(--text);
}

.sound-toggle.muted {
    opacity: 0.4;
}

/* --- Mobile Sidebar Toggle --- */

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 18px;
    padding: 4px 8px;
    cursor: pointer;
    line-height: 1;
}

/* --- Typography (editor pane content) --- */

.editor-content h1,
.editor-content h2,
.editor-content h3 {
    color: var(--text);
    font-weight: 700;
    line-height: 1.4;
    margin-top: 0;
}

.editor-content h1 {
    font-size: 1.5em;
    margin-bottom: 8px;
    color: var(--string); /* bright green — ties to tagline, content zone color */
}

.editor-content h2 {
    font-size: 1.2em;
    margin-bottom: 6px;
    color: var(--keyword);
}

.editor-content h3 {
    font-size: 1em;
    margin-bottom: 4px;
    color: var(--entity); /* bright yellow */
}

.editor-content p {
    margin: 0 0 1.2em;
}

.editor-content a {
    color: var(--tag);
    text-decoration: none;
}

.editor-content a:hover {
    text-decoration: underline;
    color: var(--function); /* golden orange on hover */
}

.editor-content strong {
    color: var(--constant); /* hot pink for bold/strong */
    font-weight: 700;
}

.editor-content em {
    color: var(--comment);
    font-style: italic;
}

.editor-content code {
    background-color: var(--bg-lighter);
    color: var(--support); /* light green for inline code */
    padding: 2px 6px;
    font-size: 0.9em;
}

.editor-content pre {
    background-color: var(--bg-lighter);
    border: 1px solid var(--border);
    padding: 16px;
    overflow-x: auto;
    line-height: 1.5;
}

.editor-content pre code {
    background: none;
    padding: 0;
}

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

.editor-content ul,
.editor-content ol {
    padding-left: 24px;
    margin: 0 0 1.2em;
}

.editor-content li {
    margin-bottom: 0.4em;
}

.editor-content li::marker {
    color: var(--variable); /* orange list markers */
}

.editor-content blockquote {
    border-left: 3px solid var(--string); /* green border for blockquotes */
    margin: 0 0 1.2em;
    padding: 4px 16px;
    color: var(--string);
}

/* --- Tagline (welcome page) --- */

.tagline {
    font-style: italic;
    color: var(--string);
    margin-bottom: 32px;
    font-size: 16px;
}

/* --- Blinking Cursor --- */

.cursor {
    display: inline-block;
    color: var(--caret);
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* --- Content Fade-In --- */

.fade-in {
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Comment Style Text --- */

.comment {
    color: var(--comment);
    font-style: italic;
}

/* --- Project Blocks --- */

.editor-content .project {
    background-color: var(--bg-lighter);
    border-left: 3px solid var(--variable);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.editor-content .project h2 {
    margin-bottom: 4px;
}

.editor-content .project .tech {
    color: var(--tag);
    font-size: 13px;
    margin-bottom: 10px;
}

.editor-content .project p:last-child {
    margin-bottom: 0;
}

/* --- Link Entries --- */

.editor-content .link-entry {
    margin-bottom: 20px;
}

.editor-content .link-entry .label {
    color: var(--function); /* golden orange for link labels */
}

.editor-content .link-entry .dots {
    color: var(--support-const); /* salmon pink */
}

.editor-content .link-entry .description {
    color: var(--support-const); /* salmon pink */
    font-style: italic;
    font-size: 14px;
    margin-left: 20px;
}

/* --- Developer Console --- */

.console {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-height: 40vh;
    background-color: var(--bg-panel);
    border-bottom: 2px solid var(--keyword);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    font-size: 13px;
}

.console.open {
    transform: translateY(0);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    color: var(--text);
    line-height: 1.6;
    min-height: 100px;
    max-height: calc(40vh - 36px);
}

.console-output .con-line {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.console-output .con-cmd {
    color: var(--keyword);
}

.console-output .con-response {
    color: var(--support); /* light green for console responses */
}

.console-output .con-error {
    color: var(--constant);
}

.console-input-line {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    border-top: 1px solid var(--border);
    background-color: var(--bg);
}

.console-prompt {
    color: var(--keyword);
    margin-right: 8px;
    font-weight: 700;
}

.console-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'Roboto Mono';
    font-size: 13px;
    caret-color: var(--caret);
}

/* --- Loading Bar --- */

.loading-bar {
    height: 2px;
    width: 0;
    background-color: var(--keyword);
    transition: none;
}

.loading-bar.loading {
    animation: loadProgress 1s ease-out forwards;
}

.loading-bar.done {
    width: 100%;
    animation: none;
    transition: width 0.15s ease-out, opacity 0.3s 0.15s;
    opacity: 0;
}

@keyframes loadProgress {
    0% { width: 0; }
    100% { width: 70%; }
}

/* --- HEV Status Bar Prefix --- */

.status-filepath {
    font-style: normal;
}

.status-filepath::before {
    content: '] exec ';
    color: var(--keyword);
}

/* --- HEV Startup Sequence --- */

.startup-line {
    margin: 0 0 4px;
    opacity: 0;
    animation: startupFade 0.3s ease forwards;
}

.startup-line.system {
    color: var(--keyword);
    font-weight: 700;
}

.startup-line.activated {
    color: var(--string);
    font-weight: 700;
}

.startup-line.loading-text {
    color: var(--comment);
    font-style: italic;
}

.startup-line.welcome {
    color: var(--text);
}

@keyframes startupFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- HEV Error States --- */

.hev-warning {
    color: var(--constant); /* hot pink for warnings */
    font-weight: 700;
    font-size: 1.3em;
    margin: 0 0 8px;
}

.hev-text {
    color: var(--variable);
    margin: 0 0 6px;
}

/* --- Mobile Responsive --- */

@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-areas:
            "editor"
            "statusbar";
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 28px;
        width: 260px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    /* overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
    }

    .sidebar-overlay.visible {
        display: block;
    }
}
