:root {
    /* Transitions */
    --transition-speed: 0.4s;
    --transition-ease: ease-in-out;
}

/* Theme 1: Elegant Light (Default) */
.theme-elegant-light {
    --bg-color: #f7f9fc;
    --text-main: #2c3e50;
    --text-muted: #596a7a;
    --accent: #3498db;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: #e1e8ed;
    --canvas-opacity: 0.15;
    --particle-color: "52, 152, 219";
    /* RGB format for canvas */
}

/* Theme 2: Warm Beige */
.theme-elegant-warm {
    --bg-color: #fcf8f2;
    --text-main: #4a3f35;
    --text-muted: #7d6b5d;
    --accent: #d35400;
    --card-bg: rgba(255, 252, 247, 0.85);
    --border-color: #e8dcd0;
    --canvas-opacity: 0.2;
    --particle-color: "211, 84, 0";
}

/* Theme 3: Mint Green */
.theme-elegant-green {
    --bg-color: #f0fafa;
    --text-main: #1d3e35;
    --text-muted: #4e7a6c;
    --accent: #16a085;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: #cce8e0;
    --canvas-opacity: 0.15;
    --particle-color: "22, 160, 133";
}

/* Theme 4: Ice Blue */
.theme-elegant-blue {
    --bg-color: #eef5fa;
    --text-main: #1e375a;
    --text-muted: #567296;
    --accent: #2980b9;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: #c8dfef;
    --canvas-opacity: 0.15;
    --particle-color: "41, 128, 185";
}

/* Theme 5: Dark Starry */
.theme-dark-starry {
    --bg-color: #0b0f19;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #93c5fd;
    --card-bg: rgba(17, 24, 39, 0.75);
    --border-color: #334155;
    --canvas-opacity: 0.8;
    --particle-color: "255, 255, 255";
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color var(--transition-speed) var(--transition-ease), color var(--transition-speed);
    overflow-x: hidden;
}

/* Canvas Background */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: var(--canvas-opacity);
    transition: opacity var(--transition-speed) var(--transition-ease);
}

/* Floating Toggle Button */
.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 101;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s;
}

.floating-btn:hover {
    transform: scale(1.1) rotate(45deg);
}

.theme-dark-starry .floating-btn {
    color: #0b0f19;
}

/* Controls Panel */
.controls-panel {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%) translateX(calc(100% + 50px));
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.4s;
    opacity: 0;
    pointer-events: none;
    width: 280px;
}

.controls-panel.show {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.panel-header h3 {
    font-size: 1.1rem;
    color: var(--text-main);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--accent);
}


.control-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.toggle-btn,
select {
    padding: 6px 12px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

select {
    color: var(--text-main);
    border-color: var(--border-color);
}

.toggle-btn:hover,
select:hover {
    background: var(--accent);
    color: white;
}

.theme-dark-starry .toggle-btn:hover {
    color: #0b0f19;
}

/* Resume Container Layout */
.resume-container {
    max-width: 900px;
    margin: 40px auto 80px;
    padding: 40px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed);
}

.theme-dark-starry .resume-container {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Header */
.resume-header {
    display: flex;
    align-items: center;
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.profile-pic-container {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    border: 3px solid var(--accent);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.profile-pic-container:hover {
    transform: scale(1.05);
}

#profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.pic-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.7rem;
    text-align: center;
    padding: 4px 0;
    opacity: 0;
    transition: opacity 0.3s;
}

.profile-pic-container:hover .pic-hint {
    opacity: 1;
}

.header-info h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--accent);
}

.header-info .subtitle {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 12px;
}

.contact-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.contact-info span {
    display: flex;
    align-items: center;
}

.contact-info span::before {
    content: "•";
    color: var(--accent);
    margin-right: 6px;
    font-weight: bold;
}

/* Sections */
.resume-section {
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resume-section h3 {
    font-size: 1.4rem;
    color: var(--accent);
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
    display: inline-block;
}

/* Bullet list */
.bullet-list {
    list-style: none;
    margin-left: 5px;
}

.bullet-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    color: var(--text-main);
}

.bullet-list li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

/* Timeline */
.timeline-item {
    display: flex;
    margin-bottom: 15px;
    gap: 20px;
}

.timeline-item .time {
    width: 140px;
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: right;
    padding-top: 3px;
}

.timeline-item .content {
    flex-grow: 1;
    border-left: 2px solid var(--border-color);
    padding-left: 20px;
    position: relative;
}

.timeline-item .content::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--card-bg);
}

/* Skills grid */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.skill-card {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
}

.theme-dark-starry .skill-card {
    background: rgba(255, 255, 255, 0.02);
}

.skill-card h4 {
    color: var(--text-main);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.skill-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.mt-4 {
    margin-top: 20px;
}

/* View Switching Logic */
.detailed-only {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.simplified-only {
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease;
}

body[data-view="detailed"] .detailed-only {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

body[data-view="detailed"] .timeline-item.detailed-only {
    display: flex;
    /* timeline items must be flex */
}

body[data-view="detailed"] .simplified-only {
    display: none;
}

/* Device Mode Styles - Controlled by body class */
body.mode-mobile .resume-header {
    flex-direction: column;
    text-align: center;
}

body.mode-mobile .contact-info {
    justify-content: center;
}

body.mode-mobile .timeline-item {
    flex-direction: column;
    gap: 5px;
}

body.mode-mobile .timeline-item .time {
    width: auto;
    text-align: left;
}

body.mode-mobile .timeline-item .content {
    border-left: none;
    padding-left: 0;
}

body.mode-mobile .timeline-item .content::before {
    display: none;
}

body.mode-mobile .skills-grid {
    grid-template-columns: 1fr;
}

body.mode-mobile .controls-panel {
    top: 50%;
    bottom: auto;
    right: 50%;
    transform: translate(50%, -50%) scale(0.9);
    width: 90%;
    max-width: 320px;
    padding: 20px;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
}

body.mode-mobile .controls-panel.show {
    transform: translate(50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

body.mode-mobile .control-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

body.mode-mobile .toggle-btn,
body.mode-mobile select {
    width: 100%;
}

/* PC Mode Specific Tweaks (Optional overrides from base) */
body.mode-pc .resume-container {
    padding: 60px;
}