* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

:root {
    /* Dark mode (default) */
    --bg-color: #002b5b;
    --text-color: #f5f5dc;
    --border-color: #13013b;
    --code-color: #ad3030;
    --link-color: #7dd3fc;
    --link-hover-color: #bae6fd;
}

[data-theme="light"] {
    /* Light mode */
    --bg-color: #f5f5dc;
    --text-color: #002b5b;
    --border-color: #c4b5fd;
    --code-color: #dc2626;
    --link-color: #0369a1;
    --link-hover-color: #0284c7;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body h1 {
    font-family: 'Archivo Black';
    text-align: center;
    font-size: 60px;
}

li {
    white-space: pre-wrap;
    margin: 0 0 10px 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
    line-height: 1.6;
    display: list-item;
    word-break: break-word;
    hyphens: auto;
}

a.external {
    position: relative;
    color: var(--link-color);
    font-size: 0.8em;
    transition: color 0.3s ease;
    display: inline;
    margin: 0 0.25em;
    white-space: nowrap;
}

a:hover {
    color: var(--link-hover-color);
}

a.external::after {
    content: "↗";
    font-size: 0.7em;
    margin-left: 0.25em;
    text-decoration: none;
    display: inline-block;
    vertical-align: text-top;
}

#section-title {
    font-family: 'Barlow Condensed';
    font-weight: 200;
    font-size: 50px;
    text-align: center;
}

#whoami-section {
    margin-bottom: 200px;
}

#whoami-section img {
    float: left;
    width: 400px;
    max-width: 100%;
    height: 450px;
    border-radius: 25px;
    border: 3px solid;
    border-color: var(--border-color);
    margin-right: 40px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

#whoami-section p {
    margin-left: 0;
    margin-right: 0;
    margin-top: 150px;
    padding: 20px 20px 20px 20px;
    border: 2px solid;
    border-color: var(--border-color);
    text-align: justify;
    overflow: hidden;
    transition: border-color 0.3s ease;
    max-width: 100%;
    word-wrap: break-word;
}

#whoami-section p code {
    color: var(--code-color);
    font-size: 0.83em; /* Relative to paragraph font size (25px / 30px) */
    transition: color 0.3s ease;
}

#containers {
    margin-left: 200px;
    margin-right: 200px;
    font-family: 'Barlow Condensed';
    font-weight: 500;
    font-style: normal;
    font-size: 30px;
    max-width: calc(100vw - 400px);
    box-sizing: border-box;
}

#listed-section {
    margin: 0 0 100px 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

#contactme-section {
    margin: 0 0 100px 0;
    text-align: center;
}

#email-section {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

#email-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    transition: border-color 0.3s ease;
}

#email-address {
    font-family: 'Barlow Condensed';
    font-size: 24px;
    font-weight: 500;
    color: var(--text-color);
    user-select: all;
}

#copy-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--border-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-family: 'Barlow Condensed';
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#copy-button:hover {
    background-color: var(--link-color);
    border-color: var(--link-color);
    transform: translateY(-2px);
}

#copy-button:active {
    transform: translateY(0);
}

#copy-button svg {
    flex-shrink: 0;
}

#copy-button.copied {
    background-color: #10b981;
    border-color: #10b981;
}

#copy-button.copied #copy-text::after {
    content: "ed!";
}

#social-icons {
    display: flex;
    gap: 20px;
    align-items: center;
}

#social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--border-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    text-decoration: none;
}

#social-icons a:hover {
    background-color: var(--link-color);
    transform: translateY(-3px) scale(1.1);
}

#social-icons a svg {
    width: 24px;
    height: 24px;
}

#listed-section ul {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    padding-left: 2em;
    list-style-type: disc !important;
    list-style-position: outside;
    margin-left: 0;
    display: block;
}

#listed-section li {
    padding-right: 0;
    margin-right: 0;
    margin-left: 0;
    padding-left: 0;
    display: list-item !important;
    list-style-type: disc;
}

/* Theme Toggle Button */
#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--border-color);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#theme-toggle:hover {
    transform: scale(1.1);
}

#theme-toggle:active {
    transform: scale(0.95);
}

#theme-icon {
    transition: transform 0.3s ease;
}

/* Responsive Design for Medium Screens */
@media screen and (max-width: 1200px) {
    #containers {
        margin-left: 100px;
        margin-right: 100px;
        max-width: calc(100vw - 200px);
    }

    #whoami-section img {
        width: 300px;
        height: auto;
        max-height: 400px;
    }

    #whoami-section p {
        margin-top: 50px;
    }

    #whoami-section p code {
        font-size: 0.83em; /* Maintains relative size */
    }

    li {
        white-space: pre-wrap;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    a.external {
        white-space: normal;
    }
}

@media screen and (max-width: 1024px) {
    #containers {
        margin-left: 50px;
        margin-right: 50px;
        max-width: calc(100vw - 100px);
    }

    #whoami-section img {
        width: 250px;
        max-height: 350px;
    }

    body h1 {
        font-size: 48px;
    }

    #section-title {
        font-size: 40px;
    }

    #containers {
        font-size: 24px;
    }

    #whoami-section p code {
        font-size: 0.83em; /* Maintains relative size */
    }

    li {
        white-space: pre-wrap;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    a.external {
        white-space: normal;
    }

    #email-address {
        font-size: 22px;
    }
}

/* Responsive Design for Mobile */
@media screen and (max-width: 768px) {
    body h1 {
        font-size: 36px;
        padding: 0 20px;
    }

    #containers {
        margin-left: 20px;
        margin-right: 20px;
        font-size: 18px;
        max-width: calc(100vw - 40px);
    }

    #section-title {
        font-size: 32px;
    }

    #whoami-section {
        margin-bottom: 100px;
    }

    #whoami-section img {
        float: none;
        width: 100%;
        max-width: 300px;
        height: auto;
        display: block;
        margin: 0 auto 30px auto;
    }

    #whoami-section p {
        margin-left: 0;
        margin-right: 0;
        margin-top: 0;
        padding: 15px;
        overflow: visible;
    }

    #whoami-section p code {
        font-size: 1em; /* Same size as paragraph text on mobile for better readability */
    }

    li {
        white-space: pre-wrap;
        margin: 0 0 15px 0;
        line-height: 1.6;
        overflow-wrap: break-word;
        word-wrap: break-word;
        max-width: 100%;
    }

    #listed-section {
        margin: 0 0 60px 0;
    }

    a.external {
        display: inline-block;
        margin-top: 5px;
        white-space: normal;
        word-break: break-all;
    }
    
    #listed-section li {
        white-space: pre-wrap;
    }
    
    #listed-section ul {
        padding-left: 2em;
        list-style-type: disc;
        list-style-position: outside;
        margin-left: 0;
    }
    
    #listed-section li {
        padding-left: 0;
        margin-left: 0;
        display: list-item;
    }

    #theme-toggle {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    #email-container {
        flex-direction: column;
        padding: 12px 20px;
    }

    #email-address {
        font-size: 20px;
        text-align: center;
    }

    #copy-button {
        width: 100%;
        justify-content: center;
    }

    #social-icons {
        gap: 15px;
    }

    #social-icons a {
        width: 44px;
        height: 44px;
    }
}

@media screen and (max-width: 480px) {
    #email-address {
        font-size: 18px;
    }

    #copy-button {
        font-size: 14px;
        padding: 6px 12px;
    }

    #social-icons a {
        width: 40px;
        height: 40px;
    }

    #social-icons a svg {
        width: 20px;
        height: 20px;
    }
}

@media screen and (max-width: 480px) {
    body h1 {
        font-size: 28px;
    }

    #containers {
        margin-left: 15px;
        margin-right: 15px;
        font-size: 16px;
        max-width: calc(100vw - 30px);
    }

    #section-title {
        font-size: 26px;
    }

    #whoami-section img {
        max-width: 250px;
    }

    #whoami-section p code {
        font-size: 1em; /* Same size as paragraph text on small mobile */
    }
}
