/* 
   ========================================
   1. CSS VARIABLES (CUSTOM PROPERTIES)
   ========================================
   By defining common values here, we reduce repetition and make it easy
   to change the site's theme later. This is the biggest simplification.
*/
:root {
    --color-text-main: #111;
    --color-text-secondary: #777;
    --color-background: #f6f6f6;
    --color-highlight: #FFFB05;
    --color-white: #fff;
    --font-main: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
    --font-mono: 'Courier New', monospace;
    --border-main: 2px solid var(--color-text-main);
    --shadow-main: 0.3ex 0.3ex var(--color-text-main);
}


/* 
   ========================================
   2. BASE & TYPOGRAPHY STYLES
   ========================================
   Replaced hardcoded values with our new variables.
*/
html { 
    background: var(--color-background); 
    overflow-y: scroll; 
}

body { 
    color: var(--color-text-main); 
    font-family: var(--font-main); 
    font-size: 100%; 
    padding: 0 1em 2em 1em; 
    line-height: 1.35; 
    margin: 1em auto; 
    max-width: 60em; 
}

a { 
    text-decoration: none; 
    color: var(--color-text-secondary); 
    border-bottom: 1px solid var(--color-text-secondary); 
}

a:hover { 
    color: var(--color-text-main); 
    background: var(--color-highlight); 
    border-bottom-color: var(--color-text-main); 
}

a.button, a.button:hover {
    border-bottom: none;
}

/* 
   ========================================
   3. HERO SECTION & LOGO
   ========================================
*/
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 30vh;
    margin: 3em 0 0 0;
    text-align: center;
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 2em;
    margin-bottom: 1.5em;
}

.logo-container {
    position: relative;
    width: 150px;
    height: 150px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

.face-logo {
    width: 100%;
    height: 100%;
    fill: var(--color-text-main);
    transition: fill 0.2s ease;
}

.logo-container:hover .face-logo {
    fill: #333; /* Kept specific for a slightly different shade on hover */
}

/* --- Keyframe Consolidation --- */
/* The 'artistBounce' keyframe was identical to 'hatBounce', so it was removed. */
.logo-container:hover .hat.active,
.logo-container:hover .hat-3.active {
    animation: hatBounce 0.5s ease;
}

@keyframes hatBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

.hat {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: all 0.5s ease;
    pointer-events: none;
}

.hat img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hat.active {
    opacity: 1;
    animation: hatDrop 0.5s ease;
}

@keyframes hatDrop {
    from { transform: translateX(-50%) translateY(-20px) rotate(-10deg); }
    to { transform: translateX(-50%) translateY(0) rotate(0deg); }
}

/* Individual hat customizations (no changes needed) */
.hat-1 { top: -30px; width: 80px; height: 80px; margin-left: 5px; }
.hat-1 img { transform: rotate(-5deg); }
.hat-2 { top: -40px; width: 75px; height: 75px; margin-left: -5px; }
.hat-2 img { transform: rotate(-7deg) scale(1.15); }
.hat-3 { top: -45px; left: 44%; width: 105px; height: 105px; }
.hat-3 img { transform: rotate(-12deg); }
.hat-3.active { animation: hatDrop 0.5s ease; transform: translateX(-50%) rotate(0deg); }
.hat-4 { top: -55px; width: 85px; height: 85px; }
.hat-4 img { transform: rotate(4deg); }
.hat-5 { top: -40px; width: 78px; height: 78px; }
.hat-5 img { transform: rotate(-3deg); }


/* --- Selector Grouping --- */
/* Grouped hover and active states for hat selector to reduce repetition. */
.hat-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 0.5em;
    z-index: 100;
}

.hat-selector-item {
    width: 40px;
    height: 40px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    padding: 4px;
    border-radius: 4px;
}

.hat-selector-item:hover,
.hat-selector-item.active {
    opacity: 1;
    background: var(--color-highlight);
}

.hat-selector-item:hover {
    transform: scale(1.1);
}

.hat-selector-item.active {
    border-color: var(--color-text-main);
}

.hat-selector-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hero-title h1 {
    margin: 0;
    font-size: 3em;
    line-height: 1.2;
    font-weight: 300;
    text-align: left;
}

.hero-subtitle {
    color: var(--color-text-secondary);
    font-size: 1.3em;
    margin-top: .5em;
    min-height: 1.8em;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    text-align: center;
    width: 100%;
}

.shuffle-text .letter {
    display: inline-block;
    position: relative;
    transition: all 0.3s ease;
    min-width: 0.3em;
}

.shuffle-text .letter.shuffling {
    animation: letterShuffle 0.3s ease;
    color: var(--color-text-main);
}

@keyframes letterShuffle {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-5px); opacity: 0.3; }
    50% { transform: translateY(5px); opacity: 0.5; }
    75% { transform: translateY(-3px); opacity: 0.7; }
}

/* 
   ========================================
   4. ENGAGEMENTS SECTION
   ========================================
*/
.engagements-section {
    margin: 4em 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3em;
}

.engagement-column h3 {
    font-size: 1.2em;
    margin-bottom: 1em;
    color: var(--color-text-main);
    font-weight: 600;
}

.engagement-item { margin-bottom: 0.8em; line-height: 1.5; color: #555; }
.engagement-item strong, .engagement-item .company { color: var(--color-text-main); font-weight: 500; }
.engagement-item .company { font-weight: 600; }
.engagement-item .year { color: #999; font-size: 0.9em; }


/* 
   ========================================
   5. PORTFOLIO & UI COMPONENTS
   ========================================
*/
.portfolio-section { margin-top: 2em; }
.portfolio-header { margin-bottom: 2em; }
.portfolio-header h2 { font-size: 1.8em; font-weight: 300; margin-bottom: 1em; text-align: center}

.portfolio-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2em;
    margin-bottom: 2em;
    padding: 1em 0;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.view-selector { display: flex; gap: 1em; }

.view-selector a {
    padding: 0.5em 1em;
    border: 1px solid var(--color-text-main);
    transition: all 0.2s ease;
}

.view-selector a.active {
    background: var(--color-text-main);
    color: var(--color-white);
    border-color: var(--color-text-main);
}

.view-selector a:hover {
    background: var(--color-highlight);
    color: var(--color-text-main);
    border-color: var(--color-text-main);
}

.filter-controls { display: flex; gap: 0.5em; flex-wrap: wrap; }
.filter-btn { padding: 0.5em 1em; font-size: 0.9em; position: relative; }
.filter-btn.active { background-color: var(--color-highlight); }
.filter-btn .icon { margin-right: 0.3em; }

/* --- General Button Style --- */
.button { 
    cursor: pointer; 
    color: var(--color-text-main); 
    background-color: var(--color-white); 
    border: var(--border-main); 
    padding: .5ex 1ex; 
    box-shadow: var(--shadow-main); 
    margin: 0 .3ex .3ex 0; 
    font-weight: 700; 
    transition: all 0.1s ease;
    text-decoration: none;
    display: inline-block;
    -webkit-appearance: none; 
    -webkit-border-radius: 0; 
}

.button:active { 
    box-shadow: none; 
    margin: .3ex 0 0 .3ex; 
}

.button:hover, .button:focus { 
    color: var(--color-text-main); 
    background-color: var(--color-highlight); 
    border-color: var(--color-text-main); 
}

.button.primary {
    background-color: var(--color-text-main);
    color: var(--color-white);
}

.button.primary:hover {
    background-color: var(--color-highlight);
    color: var(--color-text-main);
}

/* 
   ========================================
   6. PORTFOLIO VIEWS (DICE, TIMELINE, IMPACT)
   ========================================
*/

/* --- Dice View --- */
.dice-container { display: none; text-align: center; }
.dice-container.active { display: block; }

.dice-button {
    font-size: 1.75em;
    padding: 0.3em 0.5em;
    margin: 0 auto 1em;
    display: inline-block;
    background: var(--color-white);
}

.dice-button:hover { animation: wobble 0.5s ease; }
.dice-button.rolling { animation: roll 0.5s ease; }

@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

@keyframes roll {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1em;
}

.dice-grid .cta-button{
    display: none;
}

.portfolio-card {
    background: var(--color-white);
    border: var(--border-main);
    padding: 1em;
    box-shadow: var(--shadow-main);
    transition: all 0.2s ease;
    cursor: pointer;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    display: flex;
    flex-direction: column;
}

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

.portfolio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0.5ex 0.5ex var(--color-text-main);
    background-color: var(--color-highlight);
}

.portfolio-card h3 { margin: 0.5em 0; font-size: 1.1em; }
.portfolio-card .category-icon { font-size: 2em; margin-bottom: 0.3em; }
.portfolio-card .date { color: var(--color-text-secondary); font-size: 0.8em; }
.portfolio-card .description { margin: 0.5em 0; font-size: 0.9em; flex-grow: 1; }
.portfolio-card .media-preview { width: 100%; height: 120px; object-fit: cover; margin: 0.5em 0; border: 1px solid var(--color-text-main); }
.portfolio-card .cta-button { margin-top: auto; padding: 0.5em; background: var(--color-text-main); color: var(--color-white); text-align: center; transition: all 0.2s ease; }
.portfolio-card:hover .cta-button { background: black; transform: translateX(5px); }
.portfolio-card .cta-button::after { content: ' →'; }

/* --- Timeline View --- */
.timeline-container { display: none; position: relative; }
.timeline-container.active { display: block; }

.timeline-line {
    position: absolute;
    left: 1em; top: 0; bottom: 0;
    width: 2px;
    background: var(--color-text-main);
}

.timeline-item {
    position: relative;
    margin-bottom: 2em;
    padding-left: 2em;
    opacity: 0;
    animation: slideIn 0.5s forwards;
    cursor: pointer;
    transition: all 0.2s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -0.5em; top: 0.5em;
    width: 1em; height: 1em;
    background: var(--color-white);
    border: var(--border-main);
    border-radius: 50%;
}

.timeline-item:hover::before { background: var(--color-highlight); }
.timeline-item:hover { padding-left: 2.3em; }
.timeline-item h3 { margin: 0 0 0.3em; }
.timeline-item .meta { color: var(--color-text-secondary); font-size: 0.9em; margin-bottom: 0.5em; }
.timeline-item .cta-inline { display: inline-block; margin-top: 0.5em; padding: 0.3em 0.8em; background: var(--color-text-main); color: var(--color-white); font-size: 0.85em; font-weight: bold; transition: all 0.2s ease; }
.timeline-item:hover .cta-inline { background: var(--color-highlight); color: var(--color-text-main); transform: translateX(5px); }
.timeline-item .cta-inline::after { content: ' →'; }

/* --- Impact View --- */
.impact-container { display: none; padding: 2em 0; }
.impact-container.active { display: block; }
.pyramid { display: flex; flex-direction: column; align-items: center; gap: 0.5em; }
.pyramid-level { display: flex; justify-content: center; gap: 0.5em; width: 100%; }

.pyramid-item {
    background: var(--color-white);
    border: var(--border-main);
    padding: 0.8em;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 300px;
    opacity: 0;
    animation: pyramidFadeIn 0.5s forwards;
    display: flex;
    flex-direction: column;
}

@keyframes pyramidFadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.pyramid-item:hover { background: var(--color-highlight); transform: scale(1.05); z-index: 10; }
.pyramid-item h4 { margin: 0.3em 0; font-size: 0.9em; }
.pyramid-item .impact-number { font-weight: bold; color: var(--color-text-secondary); font-size: 0.8em; margin-bottom: 0.5em; }
.pyramid-item .category-badge { position: absolute; top: 0.3em; right: 0.3em; font-size: 1.2em; }
.pyramid-item .cta-text { margin-top: auto; font-size: 0.75em; font-weight: bold; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; transition: all 0.2s ease; }
.pyramid-item:hover .cta-text { opacity: 1; transform: translateY(-2px); }

/* Impact levels styling */
.level-0 .pyramid-item { background: linear-gradient(135deg, #FFE4B5 0%, #FFD700 100%); box-shadow: 0.4ex 0.4ex var(--color-text-main); }
.level-1 .pyramid-item { background: linear-gradient(135deg, #E6E6FA 0%, #DDA0DD 100%); }
.level-2 .pyramid-item { background: linear-gradient(135deg, #B0E0E6 0%, #87CEEB 100%); }

/* 
   ========================================
   7. MODAL
   ========================================
*/
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.1);
    background: var(--color-white);
    border: 3px solid var(--color-text-main);
    box-shadow: var(--shadow-main);
    width: 800px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal-header { padding: 1.5em; border-bottom: var(--border-main); display: flex; justify-content: space-between; align-items: center; background: var(--color-highlight); }
.modal-close { font-size: 1.5em; cursor: pointer; padding: 0 0.3em; transition: transform 0.2s ease; }
.modal-close:hover { transform: rotate(90deg); }
.modal-body { padding: 1.5em; }
.modal-media { margin-bottom: 1em; border: var(--border-main); }
#modal-media img { max-height: 300px; height: auto; display: block; margin: 0 auto; max-width: 100%}
.modal-media video, .modal-media iframe { width: 100%; height: auto; }
.modal-meta { display: flex; gap: 1em; margin: 1em 0; flex-wrap: wrap; color: var(--color-text-secondary); font-size: 0.9em; }
.modal-description { line-height: 1.6; margin: 1em 0; }
.modal-cta { margin-top: 1.5em; text-align: center; }
.modal-cta .button { padding: 0.8em 2em; font-size: 1em; }
.modal-cta .button.primary::after { content: ' →'; }

/* 
   ========================================
   8. UTILITIES & RESPONSIVE
   ========================================
*/
.loading { text-align: center; padding: 2em; color: var(--color-text-secondary); }
.hidden { display: none; }

/* Category Icons */
.engineering-icon::before { content: "⚙️"; }
.science-icon::before { content: "🔬"; }
.art-icon::before { content: "🎨"; }
.education-icon::before { content: "📚"; }

@media (max-width: 768px) {
    .hero-section { min-height: 30vh; margin: 6em 0 3em 0; }
    .hero-content { flex-direction: column; gap: 1em; }
    .logo-container { width: 100px; height: 100px; }
    .hat { font-size: 2.5em; width: 50px !important; height: 50px !important}
    .hat-selector { position: fixed; top: 10px; right: 10px; }
    .hat-selector-item { width: 30px; height: 30px; }
    .hero-title h1 { font-size: 2em; text-align: center; }
    .hero-subtitle { font-size: 1em; }
    .engagements-section { grid-template-columns: 1fr; gap: 2em; }
    .portfolio-controls { flex-direction: column; align-items: flex-start; gap: 1em; }
    .view-selector, .filter-controls { width: 100%; }
    .dice-grid { grid-template-columns: repeat(2, 1fr); }
    .hat-1 { margin-top: 10px }
    .hat-2 { margin-top: 15px }
    .hat-3 { margin-top: 22px }
    .hat-4 { margin-top: 20px }
    .hat-5 { margin-top: 15px }
}

/* 
   ========================================
   9. SOCIAL LINKS (in Hero Section)
   ========================================
*/
.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5em; /* Space between icons */
    margin: 1.5em 0; /* Space above and below the link bar */
}

.social-links a {
    /* Override the default link styles */
    border-bottom: none;
    background: none;
    display: inline-block;
}

.social-links .hf_logo{
    width: 35px;
    height: 35px;
    transform: scale(1.25);
    margin-top: .15em;
}

.social-links .twitter{
    transform: scale(1.05);
    margin-top: .3em;
}

.social-links a:hover {
    background: none; /* Ensure no yellow background on hover */
}

.social-links svg {
    width: 26px;
    height: 26px;
    fill: var(--color-text-secondary); /* Start with the secondary text color */
    transition: all 0.2s ease-in-out;
}

.social-links a:hover svg {
    fill: var(--color-text-main); /* Darken to main text color on hover */
    transform: scale(1.15) translateY(-2px); /* Add a subtle lift effect */
}