/* ==========================================================================
   Design System & Global Minimalist Styling
   ========================================================================== */

:root {
    --primary-color: #000000;       /* Pure Black */
    --accent-color: #333333;        /* Dark Gray */
    
    /* Light Mode Tokens */
    --bg-main: #fcfcfc;
    --bg-card: #ffffff;
    --text-primary: #000000;
    --text-secondary: #555555;
    --border-color: #dddddd;
    --hover-bg: #f2f2f2;
    --shadow-flat: none;            /* Removed all shadows to guarantee pure flat styling */
    --shadow-hover: none;
}

html.is-dark {
    /* Dark Mode Tokens */
    --primary-color: #ffffff;
    --accent-color: #dddddd;
    --bg-main: #0a0a0a;
    --bg-card: #141414;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #333333;
    --hover-bg: #1f1f1f;
    --shadow-flat: none;            /* Removed all shadows to guarantee pure flat styling */
    --shadow-hover: none;
}

/* Global Font Overrides */
body, html {
    font-family: 'Outfit', "Noto Sans TC", sans-serif !important;
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Disable all browser focus outlines (focus rings) and glowing effects completely */
*:focus, *:active, button:focus, a:focus, input:focus, select:focus, textarea:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Force global monochrome (grayscale) only on specific UI elements like flags to match the colorless aesthetic, keeping brand images and logos in full color */
.ts-flag {
    filter: grayscale(100%) !important;
}

.ts-header, h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', "Noto Sans TC", sans-serif !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

/* Technical & Monospace Data overrides */
code, pre, .ts-table, .timeline-period, .item-date, .stat-value, .ts-timeline .item .content .ts-text.is-description {
    font-family: 'JetBrains Mono', monospace !important;
}

/* ==========================================================================
   Minimalist Utility & Container Classes
   ========================================================================== */

/* Widescreen Hero Banners */
.page-hero-banner {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary-color);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-flat);
    transition: all 0.3s ease;
}

/* Premium Flat Cards */
.premium-flat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.25rem;
    box-shadow: var(--shadow-flat);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
}

.premium-flat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

/* Borderless Modern Tables */
.minimal-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Outfit', "Noto Sans TC", sans-serif !important;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-flat);
}

.minimal-table th {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    font-family: 'Outfit', "Noto Sans TC", sans-serif !important;
    font-weight: 600;
    text-align: left;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.minimal-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: 'Outfit', "Noto Sans TC", sans-serif !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Monospace text utility for numbers and dates */
.text-mono {
    font-family: 'JetBrains Mono', monospace !important;
}

.minimal-table tr:last-child td {
    border-bottom: none;
}

.minimal-table tr:hover td {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.minimal-table tfoot th {
    background-color: var(--hover-bg);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Flat Project Cards Grid */
.repo-flat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.repo-flat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
    box-shadow: var(--shadow-flat);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
}

.repo-flat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-color);
}

.repo-flat-card .repo-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.repo-flat-card .repo-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.repo-flat-card .repo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.repo-flat-card .repo-lang {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.repo-flat-card .lang-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.repo-flat-card .repo-link {
    font-family: 'Outfit', "Noto Sans TC", sans-serif;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
}

.repo-flat-card .repo-link:hover {
    color: var(--accent-color);
}

.ts-tab .item:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}
.border {
    border-style: solid;
    border-color: var(--border-color);
}

/* ==========================================================================
   Desktop Left Sidebar Layout Styles
   ========================================================================== */

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .app-layout {
        display: grid;
        grid-template-columns: minmax(260px, 18%) 1fr;
        min-height: 100vh;
        transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .app-layout.is-sidebar-collapsed {
        grid-template-columns: 80px 1fr;
    }

    .desktop-sidebar {
        height: 100vh;
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        background-color: var(--bg-main);
        color: var(--text-primary);
        padding: 2.5rem 1.5rem;
        border-right: 1px solid var(--border-color);
        z-index: 1000;
        box-shadow: none !important;
        transition: background-color 0.3s ease, border-color 0.3s ease, width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .main-container {
        flex: 1;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
}

@media (max-width: 767px) {
    .main-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: 100vh;
    }
}

/* Sidebar components design */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.sidebar-brand {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    width: 28px;
    height: 28px;
    margin-right: 0.75rem;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapse-toggle {
    color: var(--ts-gray-400);
    font-size: 1rem;
    transition: all 0.25s ease;
}

.collapse-toggle:hover {
    color: white;
}

html.is-light .collapse-toggle:hover {
    color: var(--ts-gray-900);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-grow: 1;
    margin-top: 1.5rem;
}

.sidebar-item {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.25s ease;
}

.sidebar-item .ts-icon {
    font-size: 1.2rem;
    transition: all 0.25s ease;
}

.sidebar-item:hover,
.sidebar-item.is-active {
    color: var(--text-primary);
    background-color: var(--hover-bg);
}

.sidebar-item.is-active {
    font-weight: 700;
    box-shadow: none !important;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    transition: all 0.3s ease;
}

.sidebar-footer .copyright {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: opacity 0.25s ease;
}

.sidebar-footer .theme-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Collapsible Sidebar State Modifications
   ========================================================================== */

.desktop-sidebar.is-collapsed {
    padding: 2.5rem 0.75rem;
    width: 80px;
}

.desktop-sidebar.is-collapsed .sidebar-header {
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
}

.desktop-sidebar.is-collapsed .sidebar-brand .full-text {
    display: none;
}

.desktop-sidebar.is-collapsed .sidebar-logo {
    margin-right: 0;
    width: 36px;
    height: 36px;
}

.desktop-sidebar.is-collapsed .sidebar-item {
    justify-content: center;
    padding: 0.85rem 0;
    gap: 0;
}

.desktop-sidebar.is-collapsed .sidebar-item .item-text {
    display: none;
}

.desktop-sidebar.is-collapsed .sidebar-item .ts-icon {
    font-size: 1.4rem;
}

.desktop-sidebar.is-collapsed .sidebar-footer .copyright {
    display: none;
}

.desktop-sidebar.is-collapsed .sidebar-footer .theme-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    min-width: 0;
    border-radius: 50%;
    gap: 0;
}

/* Fluid container scaling for main content */
.main-container .ts-container {
    max-width: 1440px !important;
    width: 100%;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Centralized Alternating Timeline Redesign
   ========================================================================== */

.premium-timeline {
    position: relative;
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem 0;
}

.premium-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background-color: var(--border-color);
    transform: translateX(-50%);
}

.timeline-row {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.timeline-row:last-child {
    margin-bottom: 0;
}

.timeline-indicator {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    z-index: 2;
    transition: all 0.3s ease;
}

.timeline-row:hover .timeline-indicator {
    border-color: var(--text-primary);
    transform: translateX(-50%) scale(1.05);
}

.timeline-content-wrapper {
    width: 50%;
    position: relative;
}

.timeline-row.is-left .timeline-content-wrapper {
    padding-right: 3rem;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.timeline-row.is-right {
    justify-content: flex-end;
}

.timeline-row.is-right .timeline-content-wrapper {
    padding-left: 3rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.timeline-spacer {
    width: 50%;
}

.timeline-date {
    display: inline-block;
    padding: 0.35rem 1rem;
    background-color: var(--hover-bg);
    color: var(--text-primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    font-family: 'JetBrains Mono', 'Outfit', "Noto Sans TC", sans-serif !important;
}

.timeline-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-role {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

@media (max-width: 767px) {
    .premium-timeline::before {
        left: 22px;
    }

    .timeline-row {
        justify-content: flex-start;
    }

    .timeline-indicator {
        left: 22px;
    }

    .timeline-spacer {
        display: none;
    }

    .timeline-content-wrapper {
        width: 100%;
    }

    .timeline-row.is-left .timeline-content-wrapper,
    .timeline-row.is-right .timeline-content-wrapper {
        padding-left: 60px;
        padding-right: 0;
        text-align: left;
        align-items: flex-start;
    }
}

/* ==========================================================================
   Mobile Responsive Navigation Theme Overrides
   ========================================================================== */

@media (max-width: 767px) {
    /* Mobile Topbar & Footer Theme Styling */
    .ts-app-topbar {
        background-color: var(--bg-main) !important;
        color: var(--text-primary) !important;
        border-bottom: 1px solid var(--border-color) !important;
        z-index: 9999 !important;
        transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    }

    /* Mobile Side Drawer Theme Styling */
    .ts-app-drawer {
        background-color: var(--bg-main) !important;
        color: var(--text-primary) !important;
        transition: background-color 0.3s ease, color 0.3s ease;
    }

    /* Drawer menu items */
    .ts-app-drawer .ts-menu .item {
        color: var(--text-secondary) !important;
        transition: all 0.25s ease;
    }

    .ts-app-drawer .ts-menu .item:hover,
    .ts-app-drawer .ts-menu .item.is-active {
        color: var(--text-primary) !important;
        background-color: var(--hover-bg) !important;
    }
}

.desktop-sidebar.is-collapsed .sidebar-footer .theme-btn .btn-text {
    display: none;
}
