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

:root {
    --transition-speed: 0.3s;
}

/* ============================================
   PALETTE DEFINITIONS - START
   ============================================ */

/* Burnt Orange */
[data-palette="burnt-orange"] {
    --palette-accent: #ff6b00;
    --palette-accent-hover: #ff8c33;
    --palette-tag-bg-dark: #ff6b0022;
    --palette-tag-border: #e05500;
    --palette-tag-text-dark: #ff8c33;
    --palette-accent-light: #e05500;
    --palette-accent-hover-light: #c24e03;
    --palette-tag-bg-light: #fff7ed;
    --palette-tag-text-light: #c24e03;
}

/* Amber Gold */
[data-palette="amber-gold"] {
    --palette-accent: #fbbf24;
    --palette-accent-hover: #fcd34d;
    --palette-tag-bg-dark: #fbbf2422;
    --palette-tag-border: #d97706;
    --palette-tag-text-dark: #fbbf24;
    --palette-accent-light: #d97706;
    --palette-accent-hover-light: #b45309;
    --palette-tag-bg-light: #fffbeb;
    --palette-tag-text-light: #b45309;
}

/* Copper */
[data-palette="copper"] {
    --palette-accent: #e8956a;
    --palette-accent-hover: #f0ad8d;
    --palette-tag-bg-dark: #e8956a22;
    --palette-tag-border: #c2703e;
    --palette-tag-text-dark: #e8956a;
    --palette-accent-light: #c2703e;
    --palette-accent-hover-light: #a35a2e;
    --palette-tag-bg-light: #fdf2ec;
    --palette-tag-text-light: #a35a2e;
}

/* Tangerine */
[data-palette="tangerine"] {
    --palette-accent: #fb923c;
    --palette-accent-hover: #fdba74;
    --palette-tag-bg-dark: #fb923c22;
    --palette-tag-border: #e85d04;
    --palette-tag-text-dark: #fb923c;
    --palette-accent-light: #e85d04;
    --palette-accent-hover-light: #c24e03;
    --palette-tag-bg-light: #fff4ed;
    --palette-tag-text-light: #c24e03;
}

/* Rust */
[data-palette="rust"] {
    --palette-accent: #d97249;
    --palette-accent-hover: #e8956a;
    --palette-tag-bg-dark: #d9724922;
    --palette-tag-border: #b85c38;
    --palette-tag-text-dark: #d97249;
    --palette-accent-light: #b85c38;
    --palette-accent-hover-light: #9a4a2c;
    --palette-tag-bg-light: #fdf0ea;
    --palette-tag-text-light: #9a4a2c;
}

/* Electric Violet */
[data-palette="violet"] {
    --palette-accent: #a78bfa;
    --palette-accent-hover: #c4b5fd;
    --palette-tag-bg-dark: #7c3aed22;
    --palette-tag-border: #7c3aed;
    --palette-tag-text-dark: #a78bfa;
    --palette-accent-light: #7c3aed;
    --palette-accent-hover-light: #6d28d9;
    --palette-tag-bg-light: #ede9fe;
    --palette-tag-text-light: #6d28d9;
}

/* Teal */
[data-palette="teal"] {
    --palette-accent: #2dd4bf;
    --palette-accent-hover: #5eead4;
    --palette-tag-bg-dark: #0d948822;
    --palette-tag-border: #0d9488;
    --palette-tag-text-dark: #2dd4bf;
    --palette-accent-light: #0d9488;
    --palette-accent-hover-light: #0f766e;
    --palette-tag-bg-light: #f0fdfa;
    --palette-tag-text-light: #0f766e;
}

/* Original Blue */
[data-palette="blue"] {
    --palette-accent: #58a6ff;
    --palette-accent-hover: #79b8ff;
    --palette-tag-bg-dark: #1f6feb22;
    --palette-tag-border: #1f6feb;
    --palette-tag-text-dark: #58a6ff;
    --palette-accent-light: #0969da;
    --palette-accent-hover-light: #0550ae;
    --palette-tag-bg-light: #ddf4ff;
    --palette-tag-text-light: #0550ae;
}

/* Terminal Green */
[data-palette="terminal"] {
    --palette-accent: #33ff00;
    --palette-accent-hover: #66ff44;
    --palette-tag-bg-dark: #33ff0022;
    --palette-tag-border: #20cc00;
    --palette-tag-text-dark: #33ff00;
    --palette-accent-light: #1a9e00;
    --palette-accent-hover-light: #147a00;
    --palette-tag-bg-light: #ecfde5;
    --palette-tag-text-light: #147a00;
}

/* ============================================
   PALETTE DEFINITIONS - END
   ============================================ */

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: var(--palette-accent);
    --accent-hover: var(--palette-accent-hover);
    --border: #30363d;
    --header-bg: #010409;
    --tag-bg: var(--palette-tag-bg-dark);
    --tag-border: var(--palette-tag-border);
    --tag-text: var(--palette-tag-text-dark);
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1c1e21;
    --text-secondary: #656d76;
    --accent: var(--palette-accent-light);
    --accent-hover: var(--palette-accent-hover-light);
    --border: #d0d7de;
    --header-bg: #1c2128;
    --tag-bg: var(--palette-tag-bg-light);
    --tag-border: var(--palette-tag-border);
    --tag-text: var(--palette-tag-text-light);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "SF Mono", Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

header {
    background-color: var(--header-bg);
    color: #fff;
    padding: 40px;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 30px;
}

.header-right {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.profile-image {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    object-fit: cover;
    flex-shrink: 0;
    background-color: #333;
}

.header-text h1 {
    font-size: 2rem;
    margin-bottom: 0px;
    font-weight: 600;
}

.brand-name {
    /* font-family: "IBM Plex Mono", monospace; */
    font-family: "JetBrains Mono", monospace;
    color: var(--accent);
}

.brand-line {
    /* font-family: "IBM Plex Mono", monospace; */
    font-family: "JetBrains Mono", monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.brand-separator {
    color: #8b949e;
    margin: 0 4px;
    font-weight: 400;
}

.header-text p {
    font-size: 1.1rem;
    color: #8b949e;
}

.contact-links {
    margin-top: 10px;
}

.contact-links a {
    color: var(--accent);
    text-decoration: none;
    margin-right: 20px;
    font-size: 0.95rem;
    transition: color var(--transition-speed);
}

.contact-links a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* PDF download button */
.pdf-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.pdf-download:hover {
    background-color: var(--accent-hover);
    text-decoration: none;
    color: #fff;
}

.pdf-download svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* iOS-style theme toggle */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle-label {
    font-size: 0.8rem;
    color: #8b949e;
    user-select: none;
}

.theme-toggle {
    position: relative;
    width: 51px;
    height: 31px;
    cursor: pointer;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4cd964;
    border-radius: 31px;
    transition: background-color 0.3s;
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.theme-toggle input:checked + .toggle-track {
    background-color: #30363d;
}

.theme-toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
}

main {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 40px;
}

/* Collapsible sections using <details> */
details.collapsible {
    background-color: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

details.collapsible summary {
    font-size: 1.4rem;
    color: var(--text-primary);
    padding: 10px 20px 8px 20px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    border-bottom: 2px solid var(--accent);
}

details.collapsible summary::-webkit-details-marker {
    display: none;
}

details.collapsible summary::after {
    content: '▸';
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 10px;
}

details.collapsible[open] summary::after {
    transform: rotate(90deg);
}

details.collapsible:not([open]) summary {
    padding-bottom: 10px;
    border-bottom: none;
}

details.collapsible .section-content {
    padding: 15px 30px 20px 30px;
}

details.collapsible .section-content p {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

/* details.collapsible:first-of-type .section-content p {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
} */

details.collapsible .section-content p strong {
    color: var(--text-primary);
}

details.collapsible .section-content a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-speed);
}

details.collapsible .section-content a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.skills-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skills-list li {
    background-color: var(--tag-bg);
    color: var(--tag-text);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid var(--tag-border);
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    transition: background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
}

.skills-group {
    margin-bottom: 18px;
}

.skills-group:last-child {
    margin-bottom: 0;
}

.skills-group h3 {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.experience-item {
    margin-bottom: 20px;
}

.experience-item:last-child {
    margin-bottom: 0;
}

.experience-item h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.experience-item .period {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-family: "SF Mono", "Fira Code", monospace;
}

.experience-list {
    margin-top: 8px;
    padding-left: 25px;
    color: var(--text-secondary);
    list-style: disc;
}

.experience-list li {
    margin-bottom: 0px;
    font-size: 0.95rem;
    padding-left: 4px;
}

.experience-list li::marker {
    color: var(--accent);
}

.text-justify {
    text-align: justify;
    word-break: keep-all;
    overflow-wrap: normal;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Print styles for PDF generation */
@media print {
    .header-right,
    .pdf-download {
        display: none !important;
    }

    details.collapsible summary::after {
        display: none;
    }

    body {
        background-color: #fff;
        color: #1c1e21;
    }

    header {
        background-color: #1c2128;
        padding: 30px;
    }

    details.collapsible {
        background-color: #fff;
        border: 1px solid #d0d7de;
        break-inside: avoid;
    }

    details.collapsible summary {
        color: #1c1e21;
        border-bottom-color: var(--palette-tag-border);
    }

    details.collapsible .section-content p,
    .experience-item .period {
        color: #656d76;
    }

    details.collapsible .section-content p strong,
    .experience-item h3 {
        color: #1c1e21;
    }

    .skills-list li {
        background-color: var(--palette-tag-bg-light);
        color: var(--palette-tag-text-light);
        border-color: var(--palette-tag-border);
    }

    footer {
        color: #656d76;
    }
}

@media (max-width: 600px) {
    header {
        padding: 25px 20px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .brand-line {
        font-size: 0.9rem;
    }

    .header-text h1 {
        font-size: 1.4rem;
    }

    .header-right {
        margin-left: 0;
        order: -1;
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    .profile-image {
        width: 100px;
        height: 100px;
    }

    .header-text h1 {
        font-size: 1.4rem;
    }

    .header-text p {
        font-size: 0.95rem;
    }

    .contact-links {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .contact-links a {
        margin-right: 0;
    }

    main {
        padding: 0 15px;
    }

    details.collapsible summary {
        font-size: 1.2rem;
        padding: 10px 15px 8px 15px;
    }

    details.collapsible:not([open]) summary {
        padding-bottom: 10px;
    }

    details.collapsible .section-content {
        padding: 12px 15px 15px 15px;
    }

    .skills-list {
        gap: 8px;
    }

    .skills-list li {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    footer {
        font-size: 0.8rem;
        padding: 15px;
    }
}
