/* Core CSS - Base styles and layout */

:root {
    --filetype-alt: "File";
    --transition-duration: 0.3s;
    
    /* Background colors */
    --primary-bg: hsl(52, 29%, 5%);
    --secondary-bg: hsl(0, 0%, 100%);
    
    /* Tag background colors */
    --tag-bg: hsla(0, 0%, 0%, 0.05);
    --tag-bg-hover: hsla(0, 0%, 0%, 0.1);
    
    /* Timeline domain colors */
    --timeline-academic: hsl(283, 39%, 53%);
    --timeline-employed: hsl(140, 49%, 54%);
    --timeline-independent: hsl(0, 100%, 71%);
    --timeline-personal: hsl(32, 89%, 51%);
    
    /* Shared background and blur */
    --panel-bg: hsla(0, 0%, 100%, 0.94);
    --panel-blur: blur(10px);
    
    /* Shared list reset */
    --list-reset: list-style: none; padding: 0; margin: 0;
    
    /* Scrollbar styling - DRY definition */
    --scrollbar-width: 4px;
    --scrollbar-track-bg: transparent;
    --scrollbar-thumb-bg: hsla(0, 0%, 0%, 0.15);
    --scrollbar-thumb-hover-bg: hsla(0, 0%, 0%, 0.25);
    
    /* Font sizes */
    --font-size-base: calc(1rem + 1px);
    --font-size-base-small: 0.9rem;
    --font-size-h1: 3rem;
    --font-size-h2: 1.75rem;
    --font-size-h3: 1.5rem;
    --font-size-h4: 1.25rem;
    --font-size-h5: 1.1rem;
    --font-size-h6: 1rem;
    
    /* Font families */
    --font-family-base: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-headings: var(--font-family-base);
    --font-family-h1: var(--font-family-headings);
    
    /* Text colors */
    --text-primary: hsl(0, 0%, 10%);
    --text-h1: var(--text-primary);
    --text-h2: var(--text-primary);
    --text-h3: var(--text-primary);
    --text-h4: var(--text-primary);
    --text-h5: var(--text-primary);
    --text-h6: var(--text-primary);
    
    /* Logo color */
    --logo-color: hsl(0, 0%, 0%);
    
    /* Spacing - based on smallest margin (0.5rem between nav/main/aside and top) */
    --spacing-single: 0.5rem;
    --spacing-double: 1rem;
    --spacing-triple: 1.5rem;
    --spacing-double-triple: 3rem;
}

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

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    position: relative;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--primary-bg);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-headings);
    font-weight: 600;
    line-height: 1.7;
    margin: 0;
    text-wrap: balance;
}

h1 {
    font-family: var(--font-family-h1);
    font-size: var(--font-size-h1);
    color: var(--text-h1);
}
h2 {
    font-size: var(--font-size-h2);
    color: var(--text-h2);
}
h3 {
    font-size: var(--font-size-h3);
    color: var(--text-h3);
}
h4 {
    font-size: var(--font-size-h4);
    color: var(--text-h4);
}
h5 {
    font-size: var(--font-size-h5);
    color: var(--text-h5);
}
h6 {
    font-size: var(--font-size-h6);
    color: var(--text-h6);
}

p {
    margin-bottom: var(--spacing-double);
    padding-left: var(--spacing-double-triple);
    padding-right: var(--spacing-double-triple);
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--text-primary);
}

/* Lists in articles get same margins as p tags */
article ul,
article ol {
    margin-bottom: var(--spacing-double);
    padding-left: var(--spacing-double-triple);
    padding-right: var(--spacing-double-triple);
    list-style-position: inside;
}

blockquote {
    margin-bottom: var(--spacing-double);
    padding: var(--spacing-double);
    border-left: 3px solid var(--accent, hsl(210, 100%, 50%));
    background: var(--panel-bg);
    border-radius: 0;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--text-primary);
    position: relative;
}

.breakout {
    margin-bottom: var(--spacing-double);
    padding: var(--spacing-double);
    background: var(--panel-bg);
    border-radius: 8px;
    border-bottom: 3px solid var(--accent, hsl(210, 100%, 50%));
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: var(--text-primary);
    text-align: center;
    position: relative;
}

.breakout::before,
.breakout::after {
    content: "\f071"; /* fa-triangle-exclamation */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.breakout::before {
    left: var(--spacing-double);
}

.breakout::after {
    right: var(--spacing-double);
}

a {
    color: hsl(210, 100%, 40%);
    text-decoration: underline;
    margin: 0;
    line-height: 1.7;
}

a:hover, a:focus {
    color: hsl(210, 100%, 30%);
    text-decoration: none;
}

a:focus {
    outline: 2px solid hsl(210, 100%, 40%);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Internal links (hashbang routing) */
a[href^="#!"] {
    display: inline-block;
    color: var(--accent, hsl(210, 100%, 50%));
    text-decoration: none;
    cursor: pointer;
}

/* Main navigation icons */
#main-menu a i {
    margin-right: var(--spacing-single);
}

a[href^="#!"]:hover {
    color: var(--accent-hover, hsl(210, 100%, 35%));
    text-decoration: underline;
}

a[href^="#!"]:focus {
    outline: none;
}

a[href^="#!"]:visited {
    color: var(--accent-visited, hsl(271, 68%, 32%));
}

img {
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.skip-link {
    position: absolute;
    top: -9999px;
    left: 0;
    background: hsl(0, 0%, 0%);
    color: hsl(0, 0%, 100%);
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    overflow: hidden;
}

.skip-link:focus {
    top: 0;
    overflow: visible;
}

.skip-link:focus:not(:active) {
    scroll-margin-top: 0;
}

/* Layout */
#layout-wrapper {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 0 var(--spacing-single);
}

@media (max-width: 1049px) {
    #layout-wrapper {
        grid-template-columns: 250px 1fr;
    }
}

@media (max-width: 799px) {
    #layout-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1400px) {
    #layout-wrapper {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Shared panel styles */
#main-menu,
#main-content,
#situational-menu {
    background: var(--panel-bg);
    backdrop-filter: var(--panel-blur);
    border-radius: 8px;
}

/* Navigation */
#main-menu {
    grid-column: 1;
    padding: var(--spacing-double);
    margin: 0 0 var(--spacing-single) var(--spacing-single);
    position: sticky;
    top: var(--spacing-single);
    align-self: start;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    box-sizing: border-box;
}

#main-menu ul,
#situational-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-single);
}

#main-menu li {
    margin: 0;
}

#main-menu a[href^="#!"] {
    display: block;
    padding: var(--spacing-single) var(--spacing-double);
    margin: 0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

/* Reserve space for Font Awesome icons to prevent layout shift */
#main-menu a[href^="#!"] i {
    width: 1em; /* Reserve space for icon */
    display: inline-block;
    text-align: center;
}

/* Active main nav link (current page) - styled like top aside item */
#main-menu a[href^="#!"].active {
    font-weight: 600;
    color: var(--text-primary, hsl(0, 0%, 10%));
    background: hsla(0, 0%, 0%, 0.05);
}

/* Shared link hover/focus styles */
#main-menu a[href^="#!"]:hover,
#main-menu a[href^="#!"]:focus,
#situational-menu a:hover,
#situational-menu a:focus {
    background: hsla(210, 100%, 50%, 0.1);
    color: var(--accent, hsl(210, 100%, 50%));
    outline: none;
}

/* Active link hover/focus - keep active styling */
#main-menu a[href^="#!"].active:hover,
#main-menu a[href^="#!"].active:focus {
    background: hsla(0, 0%, 0%, 0.05);
    color: var(--text-primary, hsl(0, 0%, 10%));
}

@media (max-width: 799px) {
    #main-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        display: none;
        margin: 0;
        padding: var(--spacing-triple) var(--spacing-triple) var(--spacing-triple) 0;
    }
    
    #main-menu.menu-open {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    #main-menu.menu-open ul {
        width: 100%;
        align-items: center;
    }
    
    #main-menu.menu-open a[href^="#!"] {
        font-size: calc(var(--font-size-base) * 2);
    }
}

/* Main content */
#main-content {
    grid-column: 2;
    height: calc(100vh - var(--spacing-single) - 4.7rem - var(--spacing-single));
    margin: var(--spacing-single) 0;
    outline: none;
    align-self: start;
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: var(--spacing-single);
}

#main-content:focus {
    outline: none;
}

@media (max-width: 799px) {
    #main-content {
        grid-column: 1;
        height: calc(100vh - var(--spacing-double) - var(--footer-height, 80px));
    }
}

/* Breadcrumbs navigation */
#situational-menu {
    grid-column: 3;
    padding: var(--spacing-double);
    margin: 0 var(--spacing-double) var(--spacing-single) 0;
    position: sticky;
    top: var(--spacing-single);
    align-self: start;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    box-sizing: border-box;
}

#situational-menu nav {
    margin: 0;
}

#situational-menu h2 {
    font-size: var(--font-size-h6);
    font-weight: 600;
    margin: 0 0 var(--spacing-double) 0;
    color: var(--text-h2);
}

#main-menu li,
#situational-menu li {
    margin: 0;
}

#situational-menu a {
    display: block;
    padding: var(--spacing-single) var(--spacing-double);
    border-radius: 6px;
    font-size: var(--font-size-base-small);
    /* color inherits from a rule (link color) */
    text-decoration: none;
    transition: all 0.2s ease;
}

/* First breadcrumb (current page) - not a link */
#situational-menu li:first-child a {
    font-weight: 600;
    color: var(--text-primary, hsl(0, 0%, 10%));
    background: hsla(0, 0%, 0%, 0.05);
}

@media (max-width: 1049px) {
    #situational-menu {
        display: none;
    }
}

/* Hamburger menu button */
b-hamburger.menu-toggle-label,
.menu-toggle-label {
    display: none;
}

@media (max-width: 799px) {
    b-hamburger.menu-toggle-label,
    .menu-toggle-label {
        display: block;
        position: fixed;
        bottom: var(--spacing-double);
        left: var(--spacing-double);
        z-index: 1001;
        background: var(--accent, hsl(210, 100%, 50%));
        color: var(--secondary-bg, hsl(0, 0%, 100%));
        border: none;
        border-radius: 50%;
        width: 3rem;
        height: 3rem;
        font-size: var(--font-size-h3);
        cursor: pointer;
        box-shadow: 0 2px 8px hsla(0, 0%, 0%, 0.2);
        text-align: center;
        line-height: 3rem;
    }
    
    b-hamburger.menu-toggle-label:hover,
    .menu-toggle-label:hover {
        opacity: 0.9;
    }
    
    b-hamburger.menu-toggle-label:focus,
    .menu-toggle-label:focus {
        outline: 2px solid var(--accent, hsl(210, 100%, 50%));
        outline-offset: 2px;
    }
}

/* Background and foreground containers */
#backgrounds {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
}

#foregrounds {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
}

b-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

b-layer .layer-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


/* Content pane */
#content-pane {
    position: relative;
    z-index: 1;
    padding: var(--spacing-triple) var(--spacing-double-triple);
    container-type: inline-size;
    container-name: content;
    min-height: 300px; /* Reserve minimum space to prevent layout shift during content load */
}

/* Sections */
section {
    margin-bottom: var(--spacing-triple);
}

header {
    margin-bottom: var(--spacing-triple);
}

.tagline {
    font-size: calc(var(--font-size-h4) + 1px);
    letter-spacing: 2px;
    padding-left: 0;
    padding-right: 0;
}

.blockquote-with-logo {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--spacing-single);
    align-items: stretch;
    margin-top: calc(var(--spacing-double) * 2);
    margin-bottom: calc(var(--spacing-double) * 2);
}

.blockquote-with-logo blockquote {
    margin-bottom: 0;
}

.blockquote-with-logo .resume-logo {
    width: auto;
    height: 100%;
    min-width: 100px;
    -webkit-mask-image: url('../img/logo.svg');
    mask-image: url('../img/logo.svg');
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    background-color: var(--logo-color);
}

/* Articles - remove border from nested articles */
article article {
    border: none;
    margin-bottom: 0;
    padding-bottom: 0;
    background: transparent;
}

/* Footer */
#main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--spacing-single) var(--spacing-triple);
    background: var(--secondary-bg, hsla(0, 0%, 100%, 0.95));
    border-top: 1px solid hsla(0, 0%, 0%, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    z-index: 100;
    backdrop-filter: blur(10px);
    min-height: 4.7rem;
    box-sizing: border-box;
}

#main-footer .copyright {
    margin: 0;
    font-size: var(--font-size-base-small);
    color: var(--text-primary, hsla(0, 0%, 0%, 0.6));
}

b-flavor-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-single);
}

b-flavor-selector label {
    font-size: var(--font-size-base-small);
    color: var(--text-primary, hsl(0, 0%, 10%));
}

b-flavor-selector select {
    padding: var(--spacing-single);
    border: 1px solid hsla(0, 0%, 0%, 0.2);
    border-radius: 4px;
    background: var(--secondary-bg);
    font-size: var(--font-size-base-small);
    color: var(--text-primary, hsl(0, 0%, 10%));
    cursor: pointer;
}

/* File type indicators using Font Awesome */
a[href$=".pdf"]::after {
    content: "\f1c1"; /* fa-file-pdf */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: var(--spacing-single);
    font-size: var(--font-size-base-small);
}

a[href$=".doc"]::after,
a[href$=".docx"]::after {
    content: "\f1c2"; /* fa-file-word */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: var(--spacing-single);
    font-size: var(--font-size-base-small);
}

/* Tag type icons - Base styles for all tag icons */
.tag.timeline-domain::before,
.timeline-domain::before,
.tags .timeline-domain::before,
a.tag[href^="#!/subdomains/"]::before,
a[href^="#!/subdomains/"].tag::before,
.tags a[href^="#!/subdomains/"]::before,
a.tag[href^="#!/projects/"]::before,
a[href^="#!/projects/"].tag::before,
.tags a[href^="#!/projects/"]::before,
a.tag[href^="#!/skillsets/"]::before,
a[href^="#!/skillsets/"].tag::before,
.tags a[href^="#!/skillsets/"]::before,
a.tag[href^="#!/timeline-events/"]::before,
a[href^="#!/timeline-events/"].tag::before,
.tags a[href^="#!/timeline-events/"]::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: var(--spacing-single);
}

/* Specific icon content for each type */
.tag.timeline-domain::before,
.timeline-domain::before,
.tags .timeline-domain::before {
    content: "\f1c0"; /* fa-folder */
}

a.tag[href^="#!/subdomains/"]::before,
a[href^="#!/subdomains/"].tag::before,
.tags a[href^="#!/subdomains/"]::before {
    content: "\f0e8"; /* fa-sitemap */
}

a.tag[href^="#!/projects/"]::before,
a[href^="#!/projects/"].tag::before,
.tags a[href^="#!/projects/"]::before {
    content: "\f135"; /* fa-rocket */
}

a.tag[href^="#!/skillsets/"]::before,
a[href^="#!/skillsets/"].tag::before,
.tags a[href^="#!/skillsets/"]::before {
    content: "\f5fd"; /* fa-layer-group */
}

a.tag[href^="#!/timeline-events/"]::before,
a[href^="#!/timeline-events/"].tag::before,
.tags a[href^="#!/timeline-events/"]::before {
    content: "\f017"; /* fa-clock */
}

/* ============================================
   STRUCTURAL CLASSES (Layout & Structure)
   ============================================ */

/* Card - Base structural container */
.card {
    background: var(--panel-bg);
    padding: var(--spacing-triple);
    border-radius: 8px;
    margin: var(--spacing-triple) auto;
    max-width: 800px;
}

/* Card list - Container for multiple cards */
.card-list {
    display: grid;
    gap: var(--spacing-triple);
    margin-top: var(--spacing-double);
    max-height: max(50vh, 500px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Tag list - Container for tags/badges - merged into .tags */


/* ============================================
   STYLISTIC CLASSES (Appearance & Theme)
   ============================================ */

/* Tag/Badge - Small labeled element - Unified tag structure */
.tag {
    padding: var(--spacing-single) var(--spacing-triple);
    font-size: 0.9rem;
    display: inline-block;
    background: var(--tag-bg);
    border-radius: 3px;
    text-decoration: none;
    color: inherit;
}

code {
    padding: var(--spacing-single) var(--spacing-triple);
    font-size: 0.9rem;
    display: inline-block;
    background: var(--tag-bg);
    border-radius: 3px;
    text-decoration: none;
    color: inherit;
}

/* Screen-reader-only text helper */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* XP indicator visuals */
b-xp {
    display: inline-flex;
    align-items: center;
    margin-right: var(--spacing-single);
}

.xp-char {
    display: inline-block;
    line-height: 1;
}

a.tag:hover {
    background: var(--tag-bg-hover);
    text-decoration: underline;
}

/* Tags - Container for tags */
.tags {
    display: flex;
    gap: var(--spacing-single);
    flex-wrap: wrap;
    font-size: var(--font-size-base);
    margin-top: var(--spacing-single);
    margin-bottom: var(--spacing-triple);
    justify-content: flex-start;
    align-items: flex-start;
}

/* Add extra margin when tags follows a description */
p + .tags {
    margin-top: var(--spacing-triple);
}

/* All tags children should use .tag class */
.tags > span,
.tags > a {
    /* Tags should use .tag class - these styles are fallback for legacy */
    padding: var(--spacing-single) var(--spacing-triple);
    font-size: 0.9rem;
    display: inline-block;
    background: var(--tag-bg);
    border-radius: 3px;
    text-decoration: none;
}

.tags > a:hover {
    background: var(--tag-bg-hover);
    text-decoration: underline;
}

/* Related content section */
.related {
    margin-top: var(--spacing-triple);
}

.related h2 {
    font-size: var(--font-size-h3);
    margin-bottom: var(--spacing-double);
}

/* ============================================
   TIMELINE SPECIFIC STYLES
   ============================================ */

.timeline-container {
    position: relative;
    padding: 0 calc(var(--spacing-double) + 2px) 0 0;
    min-height: 300px; /* Increased to better match loaded content height */
    max-height: max(50vh, 500px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Full height mode - no scrolling, expands to fit content */
b-timeline.timeline-full-height .timeline-container {
    max-height: none;
    overflow-y: visible;
}

/* Reserve space for timeline component to prevent layout shift */
b-timeline {
    display: block;
    min-height: 400px; /* Reserve space to prevent layout shift during load */
}

/* ============================================
   UNIFIED MINIMAL SCROLLBAR STYLING (DRY)
   ============================================ */

/* Scrollbar padding moved to inline CSS in index.html */

/* Universal scrollbar styling for all elements */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb-bg) var(--scrollbar-track-bg);
}

/* WebKit scrollbar styling */
*::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
}

/* Hide scrollbar buttons/arrows */
*::-webkit-scrollbar-button {
    width: 0;
    height: 0;
    display: none;
}

*::-webkit-scrollbar-button:single-button,
*::-webkit-scrollbar-button:double-button,
*::-webkit-scrollbar-button:start:decrement,
*::-webkit-scrollbar-button:end:increment {
    width: 0;
    height: 0;
    display: none;
}

/* Scrollbar track */
*::-webkit-scrollbar-track {
    background: var(--scrollbar-track-bg);
}

/* Scrollbar thumb */
*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb-bg);
    border-radius: 0;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover-bg);
}

.timeline-event {
    position: relative;
    padding-left: calc(var(--spacing-single) * 8);
    margin-bottom: var(--spacing-triple);
    transition: height 0.3s ease, margin 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    transition-behavior: allow-discrete;
    opacity: 1;
    overflow: visible;
}

.timeline-event-hidden {
    margin-bottom: 0;
    opacity: 0;
    pointer-events: none;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

/* Marker with colored circle, white ring, and grey ring */
.timeline-marker {
    position: absolute;
    left: 12px;
    top: 17px;
    width: 20px;
    height: 20px;
    z-index: 3;
    transform: translateY(-50%);
    margin-top: var(--spacing-single);
}

.timeline-marker-outer {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: hsl(0, 0%, 50%);
    z-index: 1;
}

.timeline-marker-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--secondary-bg);
    transform: translate(-50%, -50%);
    z-index: 2;
}

.timeline-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent, hsl(210, 100%, 50%));
    transform: translate(-50%, -50%);
    z-index: 3;
}

/* Domain-specific marker colors */
.timeline-event[data-domain="academic"] .timeline-marker::after {
    background: var(--timeline-academic);
}

.timeline-event[data-domain="employed"] .timeline-marker::after {
    background: var(--timeline-employed);
}

.timeline-event[data-domain="independent"] .timeline-marker::after {
    background: var(--timeline-independent);
}

.timeline-event[data-domain="personal"] .timeline-marker::after {
    background: var(--timeline-personal);
}

/* Star before title for major events */
.timeline-title-star {
    color: var(--domain-color, var(--accent, hsl(210, 100%, 50%)));
    margin-right: var(--spacing-single);
}

/* Domain-specific star colors */
.timeline-event[data-domain="academic"] .timeline-title-star {
    color: var(--timeline-academic);
}

.timeline-event[data-domain="employed"] .timeline-title-star {
    color: var(--timeline-employed);
}

.timeline-event[data-domain="independent"] .timeline-title-star {
    color: var(--timeline-independent);
}

.timeline-event[data-domain="personal"] .timeline-title-star {
    color: var(--timeline-personal);
}

/* Domain-specific color utility */
[data-domain="academic"] { --domain-color: var(--timeline-academic); }
[data-domain="employed"] { --domain-color: var(--timeline-employed); }
[data-domain="independent"] { --domain-color: var(--timeline-independent); }
[data-domain="personal"] { --domain-color: var(--timeline-personal); }

/* Line segment extending from marker to next marker using ::before */
.timeline-event::before {
    content: '';
    position: absolute;
    left: 21px;
    top: 16px;
    width: 2px;
    background: hsl(0, 0%, 50%);
    pointer-events: none;
    z-index: 0;
    height: calc(100% + 1.5rem - 0px);
    display: block;
    transition: height 0.5s ease, margin 0.5s ease, padding 0.5s ease, opacity 0.5s ease;
    transition-behavior: allow-discrete;
}

/* Hide line on last child or last visible event */
.timeline-event:last-child::before,
.timeline-event.timeline-last-visible::before {
    display: none;
}

/* Hide line when this event is hidden */
.timeline-event-hidden::before {
    opacity: 0;
}


.timeline-content {
    background: var(--panel-bg);
    padding: 0 var(--spacing-double) var(--spacing-single);
    border-radius: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-left: 3px solid var(--accent, hsl(210, 100%, 50%));
}

.timeline-event[data-domain] .timeline-content {
    border-left-color: var(--domain-color);
}

/* Timeline typography */
.timeline-content time,
.card time {
    font-weight: 600;
    color: var(--accent, hsl(210, 100%, 50%));
    margin: 0;
    line-height: 1.7;
    font-size: var(--font-size-base-small);
    display: block;
}

/* Domain-specific colors for time elements */
[data-domain] time,
[data-domain] .timeline-content time {
    color: var(--domain-color);
}

.timeline-content h3 {
    margin: 0;
    font-size: var(--font-size-h4);
    font-weight: 600;
    line-height: 1.7;
}

.timeline-content p {
    font-size: var(--font-size-base);
    color: var(--text-primary, hsla(0, 0%, 0%, 0.7));
    line-height: 1.7;
}

.timeline-content .tags {
    display: flex;
    gap: var(--spacing-single);
    flex-wrap: wrap;
    font-size: var(--font-size-base-small);
    color: var(--text-primary, hsla(0, 0%, 0%, 0.6));
    margin-top: var(--spacing-single);
    margin-bottom: 0;
}

/* Timeline tags - all should use .tag class */
.timeline-content .tags > span,
.timeline-content .tags > a {
    /* Tags should use .tag class - these styles are fallback for legacy */
    padding: var(--spacing-single) var(--spacing-single);
    background: var(--tag-bg);
    border-radius: 3px;
    text-decoration: none;
    display: inline-block;
}

.timeline-content .tags > a:hover {
    background: var(--tag-bg-hover);
    text-decoration: underline;
}

/* Legacy classes - should be replaced with .tag */
.timeline-domain {
    font-weight: 600;
}

.timeline-event[data-domain] .timeline-domain,
.card[data-domain] .timeline-domain,
article[data-domain] .timeline-domain,
[data-domain] .tags .timeline-domain {
    color: var(--domain-color);
}

.timeline-skillset,
.timeline-skill {
    font-weight: 500;
}

/* Timeline Event Detail Page */
.timeline-event-detail {
    position: relative;
    margin: var(--spacing-triple) auto;
}

.timeline-event-detail::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--panel-bg);
    z-index: 1;
}

.timeline-event-detail .card {
    background: var(--panel-bg);
    padding: var(--spacing-triple);
    border-radius: 8px;
}



.timeline-event-detail h1 {
    font-size: var(--font-size-h1);
    margin: 0;
    line-height: 1.7;
}

.timeline-event-detail p {
    font-size: var(--font-size-h4);
    line-height: 1.7;
    color: var(--text-primary, hsla(0, 0%, 0%, 0.8));
}

.timeline-event-detail .tags {
    font-size: var(--font-size-base);
    gap: var(--spacing-triple);
    margin-top: var(--spacing-single);
}

/* Prevent nested tags from getting double styling */
.timeline-event-detail .tags > a > span,
.timeline-event-detail .tags > span > a {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.timeline-event-detail .timeline-domain {
    font-weight: 600;
}

.timeline-event-detail[data-domain] .timeline-domain {
    color: var(--domain-color);
}

.timeline-wrapper {
    position: relative;
    container-type: inline-size;
    container-name: timeline;
    width: 100%;
    margin-top: var(--spacing-double);
    min-height: 400px; /* Reserve space to prevent layout shift */
}

.timeline-content-area {
    position: relative;
}

.timeline-filters {
    float: right;
    width: 200px;
    padding: var(--spacing-double);
    margin: 0 0 var(--spacing-single) var(--spacing-double);
    background: var(--secondary-bg, hsl(0, 0%, 100%));
    border-radius: 4px;
    clear: right;
    position: sticky;
    top: var(--spacing-double);
    z-index: 10;
    box-shadow: 0 2px 8px hsla(0, 0%, 0%, 0.1);
}

.timeline-filters h2 {
    font-size: var(--font-size-h5);
    margin-bottom: var(--spacing-single);
    margin-top: 0;
}


.filter-controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-single);
    margin-top: var(--spacing-single);
}

/* In wide/stacked mode (not floating on side), make controls horizontal with vertical separator */

.filter-controls label {
    display: flex;
    align-items: center;
    gap: var(--spacing-single);
    cursor: pointer;
    font-size: var(--font-size-base);
}

.filter-controls input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.filter-controls input[type="checkbox"]:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.filter-controls label:focus {
    outline: none !important;
}

.filter-controls label:focus-within {
    outline: none !important;
}

.filter-color {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: box-shadow 0.2s ease;
    /* White ring created with border */
    border: 2px solid hsl(0, 0%, 100%);
    /* Black outline created with box-shadow, only when checked */
    box-shadow: 0 0 0 0 transparent;
}

.filter-color.academic {
    background: var(--timeline-academic);
}

.filter-color.employed {
    background: var(--timeline-employed);
}

.filter-color.independent {
    background: var(--timeline-independent);
}

.filter-color.personal {
    background: var(--timeline-personal);
}

/* Filter separator - horizontal by default (when floating on side) */
.filter-separator {
    height: 1px;
    background: hsla(0, 0%, 0%, 0.2);
    margin: var(--spacing-double) 0 var(--spacing-single) 0;
}

/* Major filter styling */
.filter-major {
    display: inline-block;
    font-size: var(--font-size-h4);
    line-height: 1;
    color: hsl(45, 100%, 50%);
}

/* Underline star when checkbox is checked */
.filter-controls input[type="checkbox"]:checked + .filter-major {
    text-decoration: underline;
    text-decoration-color: hsl(0, 0%, 0%);
    text-decoration-thickness: 4px;
}

/* Show black outline when checked */
.filter-controls input[type="checkbox"]:checked + .filter-color {
    box-shadow: 0 0 0 3px hsl(0, 0%, 0%);
}

/* Turn outline grey on hover (both checked and unchecked) */
.filter-controls label:hover .filter-color {
    box-shadow: 0 0 0 3px hsl(0, 0%, 50%);
}

.filter-controls label:hover {
    font-weight: bold;
}

@container timeline (max-width: 600px) {
    .timeline-filters {
        float: none;
        width: 100%;
        position: static;
        margin: 0 0 var(--spacing-triple) 0;
    }
    
    /* In narrow/stacked mode, make filter controls horizontal */
    .filter-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    /* In narrow/stacked mode, major filter stays on its own line below separator */
    .timeline-filters > .filter-controls:last-of-type {
        margin-top: 0;
    }
    
    /* Keep separator as full-width horizontal line separating domain filters from major */
    .timeline-filters > .filter-separator {
        display: block;
        height: 1px;
        width: 100%;
        background: hsla(0, 0%, 0%, 0.2);
        margin: var(--spacing-triple) 0;
    }
    
    /* Prevent jiggle when hovering (text bolds) by setting min-width */
    .filter-controls label {
        min-width: 125px;
    }
}

/* ============================================
   PROJECTS, SKILLS, SKILLSETS
   ============================================ */

/* Project/Skillset items in lists */
b-projects,
b-skillsets {
    display: grid;
    gap: var(--spacing-triple);
    margin-top: var(--spacing-double);
    max-height: max(50vh, 500px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Full height mode - no scrolling, expands to fit content */
b-projects.projects-full-height,
b-skillsets.skillsets-full-height {
    max-height: none;
    overflow-y: visible;
}

/* Article cards (projects, skillsets, spotlight items) */
article {
    border-radius: 4px;
    margin-bottom: var(--spacing-triple);
}

article h3 {
    margin: 0;
}

article p {
    line-height: 1.7;
    font-size: var(--font-size-base);
}

/* Skillset groups */
.skillset-group {
    margin-bottom: var(--spacing-double);
}

.skillset-group h3 {
    margin: 0;
    font-size: var(--font-size-h3);
}

/* Spotlight projects grid */
.spotlight-projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-triple);
    margin-top: var(--spacing-double);
}

/* Mobile adjustments */
@media (max-width: 799px) {
    #content-pane {
        padding-bottom: var(--spacing-triple);
    }
    
    .spotlight-projects {
        grid-template-columns: 1fr;
    }
    
    #main-footer {
        position: fixed;
        bottom: 0;
        flex-direction: column;
        align-items: flex-end;
        text-align: right;
        padding-right: var(--spacing-double);
    }
    
    #main-content {
        height: calc(100vh - 1rem - var(--footer-height, 80px) - 1rem);
    }
}
