/*************************************
 * FONT IMPORT & GLOBAL RESET
 *************************************/
 @font-face {
    font-family: 'Share Tech Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/font/ShareTechMono-Regular.woff2') format('woff2');
}

/* CSS Variables for Light/Dark Mode */
:root {
    /* Light Mode (Default) */
    --bg-color: #ffffff;
    --text-color: #333333;
    --secondary-text-color: #555555;
    --tertiary-text-color: #666666;
    --divider-color: rgba(0, 0, 0, 0.125);
    --card-bg-color: #ffffff;
    --hover-bg-color: rgba(0, 0, 0, 0.03);
    --shadow-color: rgba(0, 0, 0, 0.05);
    --transition-duration: 0.3s;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --secondary-text-color: #bbbbbb;
    --tertiary-text-color: #999999;
    --divider-color: rgba(255, 255, 255, 0.1);
    --card-bg-color: #1e1e1e;
    --hover-bg-color: rgba(255, 255, 255, 0.05);
    --shadow-color: rgba(0, 0, 0, 0.2);
}

/* Transition for all color changes */
* {
    transition: background-color var(--transition-duration) ease, 
                color var(--transition-duration) ease, 
                border-color var(--transition-duration) ease,
                box-shadow var(--transition-duration) ease;
}

/* Disable transitions during initial theme paint to avoid flashing */
.no-theme-transition *, .no-theme-transition *::before, .no-theme-transition *::after {
    transition: none !important;
}

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

/*************************************
 * BASE TYPOGRAPHY & BODY
 *************************************/
body {
    background-color: var(--bg-color);
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    line-height: 1.4;
    color: var(--text-color);
}

h1 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-color);
    padding: 0 5px;
}

h2 {
    font-size: 20px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--secondary-text-color);
    padding: 0 5px;
}

/*************************************
 * LAYOUT & CONTAINER
 *************************************/
.container {
    max-width: 970px;
    margin: 0 auto;
    padding: 0 15px;
}

.row {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
}

hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid var(--divider-color);
}

/*************************************
 * HEADER & PROFILE
 *************************************/
#dhead {
    margin-top: 20px;
}

.header-grid {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    max-width: 650px;
    margin: 0 auto;
}

.header-left {
    text-align: center;
    z-index: 2;
}

.header-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    min-width: 0;
    margin: 0 auto;
}

#dpic img {
    width: 110px;
    border-radius: 5px;
    height: auto;
}

#ddesc {
    padding-top: 0;
}

/*************************************
 * SOCIAL ICONS
 *************************************/
#dico {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.iico {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    transition: transform 0.2s ease;
}

/* .iico:hover {
    transform: scale(1.05);
} */

/*************************************
 * THEME TOGGLE
 *************************************/
.theme-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 35px;
    height: 35px;
    border-radius: 6px;
    background: var(--hover-bg-color);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-color);
    transition: fill 0.3s ease;
}

/* Initial icon visibility based on detected theme - prevents flash */
.theme-icon-dark {
    display: block;
}

.theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-light {
    display: block;
}

/*************************************
 * ASCII ART
 *************************************/
.ascii-container,
.ascii-art {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    overflow: visible;
}

.ascii-art pre {
    font-family: 'Courier New', monospace;
    white-space: pre;
    line-height: 1.2;
    font-size: clamp(8px, 2vw, 14px);
    text-align: center;
    margin: 0;
    width: auto;
    min-width: min-content;
    color: var(--text-color);
}

/*************************************
 * MAIN SECTIONS
 *************************************/
#left-section {
    grid-column: 1 / 6;
}

.divider {
    grid-column: 6 / 7;
    position: relative;
}

.divider::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background-color: var(--divider-color);
}

#right-section {
    grid-column: 7 / 12;
}

/*************************************
 * EXPERIENCE
 *************************************/
.experience-entry {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 15px;
    padding: 20px 5px;
    border-bottom: 1px solid var(--divider-color);
}

.experience-entry:last-child {
    border-bottom: none;
}

.experience-logo {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: contain;
}

.experience-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.experience-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.experience-date {
    font-size: 14px;
    color: var(--tertiary-text-color);
    white-space: nowrap;
}

.experience-company {
    font-size: 16px;
    color: var(--secondary-text-color);
    margin: 0;
}

.experience-description {
    font-size: 14px;
    color: var(--tertiary-text-color);
    line-height: 1.4;
    margin: 5px 0 0 0;
}

/*************************************
 * HIGHLIGHT VIDEO
 *************************************/
.highlight-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 5px;
    margin-top: 20px;
    max-width: 100%;
}

.highlight-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.highlight-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.highlight-description {
    font-size: 14px;
    color: var(--tertiary-text-color);
    line-height: 1.4;
    margin: 0;
}

/*************************************
 * VIDEO CONTAINER
 *************************************/
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 6px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/*************************************
 * VIDEO GRID
 *************************************/
.video-grid-section {
    grid-column: 1 / -1;
}

.content-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.header-text {
    flex: 1;
}

.refresh-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--tertiary-text-color);
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    font-family: 'Share Tech Mono', monospace;
}

/* Apply hover effects only on devices that support hover */
@media (hover: hover) {
    .refresh-button:hover {
        color: var(--text-color);
        background-color: var(--hover-bg-color);
        transform: scale(1.02);
        box-shadow: 0 2px 8px var(--shadow-color);
    }
}

/* Add a separate active state for touch devices */
.refresh-button:active {
    color: var(--text-color);
    background-color: var(--hover-bg-color);
    transform: scale(1.02);
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.1s ease;
}

.refresh-button svg {
    width: 24px;
    height: 24px;
}

.refresh-button span {
    font-size: 12px;
    font-weight: 500;
}

.refresh-button.spinning svg {
    animation: spin 0.2s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
    padding: 5px;
}

.video-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: transparent;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: none;
}

.card-content {
    padding: 10px 0;
}

.video-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 10px 0;
}

.video-description {
    font-size: 14px;
    color: var(--tertiary-text-color);
    line-height: 1.4;
    margin: 0;
}

/*************************************
 * PROJECTS
 *************************************/
.project-header-intro {
    grid-column: 1 / -1;
    text-align: left;
    margin-bottom: 20px;
}

.project-list {
    grid-column: 1 / -1;
}

.project-entry {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--divider-color);
}

.project-entry:first-child {
    padding-top: 0;
}

.project-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.project-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.project-icon img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: contain;
}

.project-title {
    margin: 0;
}

.project-title a {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.project-description {
    font-size: 14px;
    color: var(--tertiary-text-color);
    line-height: 1.4;
    margin: 0;
}

/*************************************
 * BLOG
 *************************************/
.blog-header-intro {
    grid-column: 1 / -1;
    text-align: left;
    margin-bottom: 20px;
}

.blog-list {
    grid-column: 1 / -1;
    padding: 0 15px;
}

.blog-entry {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 0;
    border-bottom: 1px solid var(--divider-color);
}

.blog-entry:first-child {
    padding-top: 0;
}

.blog-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.blog-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.blog-title {
    margin: 0;
    flex: 1;
}

.blog-title a {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.blog-date {
    font-size: 14px;
    color: var(--tertiary-text-color);
    white-space: nowrap;
    font-weight: 500;
}

.blog-description {
    font-size: 14px;
    color: var(--tertiary-text-color);
    line-height: 1.4;
    margin: 0;
}

/*************************************
 * CONTACT
 *************************************/
.contact-row {
    grid-column: 1 / -1;
    text-align: center;
    margin: 20px 0;
}

.contact-col {
    grid-column: 1 / -1;
}

.contact-link {
    color: var(--text-color);
    text-decoration: underline;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.contact-email {
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    margin-top: 10px;
    font-size: 16px;
    color: var(--secondary-text-color);
}

/*************************************
 * BOTTOM CTA
 *************************************/
.channel-cta {
    padding: 5px;
    text-align: center;
}

.channel-cta p {
    margin: 0;
    font-size: 16px;
}

.channel-cta a {
    color: var(--text-color);
    text-decoration: underline;
    font-weight: bold;
    transition: color 0.2s ease;
}

/*************************************
 * Special container for theme-transitioning images
 *************************************/
 .theme-image-container {
    position: relative;
    display: inline-block;
  }
  
  /* Base styles for both light and dark theme images */
  .theme-image-light,
  .theme-image-dark {
    transition: opacity var(--transition-duration) ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  
  /* Light theme settings */
  :root:not([data-theme="dark"]) .theme-image-light {
    opacity: 1;
  }
  
  :root:not([data-theme="dark"]) .theme-image-dark {
    opacity: 0;
  }
  
  /* Dark theme settings */
  [data-theme="dark"] .theme-image-light {
    opacity: 0;
  }
  
  [data-theme="dark"] .theme-image-dark {
    opacity: 1;
  }
  
/*************************************
 * RESPONSIVE MEDIA QUERIES
 *************************************/
@media (max-width: 768px) {
    .header-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;
        text-align: center;
    }
    
    .header-left, 
    .header-right {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #dpic {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    #dpic img {
        width: 110px;
    }
    
    .ascii-container {
        width: 100%;
        padding: 0 10px;
    }
    
    .ascii-art {
        width: auto;
        min-width: min-content;
    }
    
    .ascii-art pre {
        font-size: clamp(7px, 2.5vw, 12px);
        width: auto;
    }
    
    #dico {
        width: 100%;
        margin-top: 10px;
        justify-content: center;
    }
    
    #left-section,
    #right-section {
        grid-column: 1 / -1;
    }
    
    .divider {
        grid-column: 1 / -1;
        height: 1px;
        margin: 20px 0;
        background-color: var(--divider-color);
    }
    
    .divider::after {
        display: none;
    }
    
    .experience-header {
        flex-direction: column;
        gap: 5px;
    }
    
    .experience-date {
        white-space: normal;
    }
    
    .project-entry {
        grid-template-columns: 1fr;
    }
    
    .blog-header {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .blog-date {
        white-space: normal;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .ascii-art pre {
        font-size: clamp(5px, 2vw, 8px);
    }
    
    #dpic img {
        width: 100px;
    }
}

@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991px) {
    .container {
        padding: 0 50px;
    }
}
