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

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

/* Single palette in use: 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;
}

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --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-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 */
header {
    background-color: var(--header-bg);
    color: #fff;
    padding: 16px 40px 20px;
}

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

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    padding-top: 2px;
}

body.toggle-float .header-right {
    position: fixed;
    top: 12px;
    right: max(40px, calc((100vw - 900px) / 2)); /* align with header-content right edge on desktop */
    margin-left: 0;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background-color: var(--bg-card);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 1200;
}

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

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

.brand-line {
    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 h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 1px;
}

.header-text p {
    font-size: 1.1rem;
    color: #8b949e;
    margin: 0;
    line-height: 1.2;
}

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

/* Unified accent link style (header + content + footer) */
.contact-links a,
.section-content a,
footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-speed);
}

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

/* Keep header-specific spacing/size */
.contact-links a {
    margin-right: 20px;
    font-size: 0.95rem;
}

/* 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;
    inset: 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 layout */
main {
    max-width: 900px;
    margin: 16px auto 24px;
    padding: 0 40px;
}

/* Unified card styles */
.section-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.section-card:last-child { margin-bottom: 0; }

.section-title,
.section-card--collapsible > summary {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 10px 20px 8px;
    border-bottom: 2px solid var(--accent);
}

.section-card:first-of-type .section-title {
    font-size: 1.75rem;
}

.section-card--collapsible > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

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

.section-card--collapsible > summary::after {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2.5px solid var(--accent);
    border-bottom: 2.5px solid var(--accent);
    transform: rotate(-45deg);
    margin-left: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.section-card--collapsible[open] > summary::after {
    transform: rotate(45deg);
    border-color: var(--accent);
}

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

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

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

.section-content p:last-child { margin-bottom: 0; }

/* Unified bullet list */
.bullet-list {
    margin-top: 4px;
    padding-left: 20px;
    color: var(--text-secondary);
    list-style: disc;
}

.bullet-list li {
    margin-bottom: 2px;
    padding-left: 2px;
    line-height: 1.35;
}

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

/* Tag/pill list */
.pill-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

/* Reusable entry block */
.entry { margin-bottom: 20px; }
.entry:last-child { margin-bottom: 0; }

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

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

.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;
}

.pdf-download { display: none !important; }

/* Mobile: 768px and below */
@media (max-width: 768px) {
    header {
        padding: 16px 20px 24px;
    }

    .header-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }

    /* Flatten header-text so its children can be ordered directly */
    .header-text {
        display: contents;
    }

    /* Required order:
       1) Brand line
       2) Profile image
       3) Name
       4) Title
       5) Links
       6) Theme toggle
    */
    .brand-line { order: 1; margin-bottom: 2px; }
    .profile-image { order: 2; width: 100px; height: 100px; }
    .header-text h1 { order: 3; font-size: 1.6rem; margin: 0; }
    .header-text p { order: 4; font-size: 0.95rem; margin: 0; }
    .contact-links {
        order: 5;
        margin-top: 6px;
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }
    .contact-links a { margin-right: 0; font-size: 0.9rem; }

    .header-right {
        order: 6;
        margin-left: 0;
        padding-top: 0;
        justify-content: center;
    }

    body.toggle-float .header-right {
        top: 10px;
        right: 10px;
        padding: 5px 7px;
    }


    main {
        margin: 12px auto 20px;
        padding: 0 16px;
    }

    .section-title,
    .section-card--collapsible > summary {
        font-size: 1.2rem;
        padding: 10px 16px 8px;
    }

    .section-card:first-of-type .section-title {
        font-size: 1.45rem;
    }

    .section-content { padding: 12px 16px 16px; }

    .pill-list { gap: 8px; }
    .pill-list li { font-size: 0.75rem; padding: 5px 10px; }

    .bullet-list { padding-left: 16px; font-size: 0.9rem; }
    .entry h3 { font-size: 1rem; }
    .period { font-size: 0.8rem; }

    footer { font-size: 0.75rem; }
}

/* Mobile: 480px and below (small phones) */
@media (max-width: 480px) {
    header {
        padding: 12px 16px 20px;
    }

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

    .header-text h1 {
        font-size: 1.3rem;
        margin-bottom: 0;
    }

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

    .theme-toggle-wrapper {
        gap: 6px;
    }

    .theme-toggle {
        width: 45px;
        height: 27px;
    }

    .toggle-thumb {
        width: 23px;
        height: 23px;
        font-size: 12px;
    }

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

    main {
        padding: 0 12px;
    }

    .section-card {
        margin-bottom: 10px;
        border-radius: 6px;
    }

    .section-title,
    .section-card--collapsible > summary {
        font-size: 1.1rem;
        padding: 8px 12px 6px;
    }

    .section-card:first-of-type .section-title {
        font-size: 1.3rem;
    }

    .section-content {
        padding: 10px 12px 12px;
    }

    .bullet-list {
        padding-left: 14px;
        font-size: 0.85rem;
    }

    .bullet-list li {
        margin-bottom: 2px;
    }

    .pill-list {
        gap: 6px;
    }

    .pill-list li {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    .entry {
        margin-bottom: 16px;
    }

    .entry h3 {
        font-size: 0.95rem;
    }
}