* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", sans-serif;
    background-color: #fff;
    overflow-x: hidden;
}

/* Preloader styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #e8e4dc;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

#preloader.fade-out {
    opacity: 0;
    pointer-events: none;
}

#main-content {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

#main-content.show {
    opacity: 1;
}

.preloader-body {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    color: #2d2d2d;
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e4dc;
    position: relative;
}

#bayerCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.preloader-container {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 800px;
    height: 500px;
    padding: 60px 40px 40px 40px;
    border: 3px solid #fff;
    background: #f5f3ef;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 4px;
}

.preloader-header-left {
    position: absolute;
    top: 20px;
    left: 40px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 1.5px;
    color: #6b6b6b;
}

.preloader-header-center {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: #6b6b6b;
}

.preloader-header-right {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 12px;
    font-weight: 400;
    color: #2d2d2d;
}

.system-list-container {
    height: 180px;
    overflow: hidden;
    position: absolute;
    opacity: 0;
}

.system-list {
    display: flex;
    flex-direction: column;
}

.system-item {
    padding: 6px 12px;
    font-size: 15px;
    line-height: 1.6;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.2s;
    color: #2d2d2d;
    font-weight: 400;
}

.system-item.highlighted {
    background: #2d2d2d;
    color: #f5f3ef;
    font-weight: 500;
    border-radius: 4px;
}

.percentage-container {
    font-size: 72px;
    text-align: center;
    opacity: 0;
    letter-spacing: 4px;
    position: absolute;
    font-weight: 300;
    color: #2d2d2d;
}

.percentage-wrapper {
    display: inline-block;
    position: relative;
}

.percentage-wrapper::after {
    content: "";
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, #2d2d2d 0%, #2d2d2d 68%, transparent 68%);
    border-radius: 2px;
    animation: progressBar 1.5s ease-in-out;
}

@keyframes progressBar {
    from {
        background: linear-gradient(90deg, #2d2d2d 0%, #2d2d2d 0%, transparent 0%);
    }
    to {
        background: linear-gradient(90deg, #2d2d2d 0%, #2d2d2d 68%, transparent 68%);
    }
}

.boot-message-container {
    font-size: 16px;
    line-height: 1.8;
    text-align: center;
    opacity: 0;
    position: absolute;
    padding: 0 40px;
    max-width: 700px;
    color: #2d2d2d;
    font-weight: 400;
}

.boot-message {
    position: relative;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background: #2d2d2d;
    margin-left: 4px;
    animation: blink 0.8s infinite;
    border-radius: 2px;
}

@keyframes blink {
    0%,
    49% {
        opacity: 1;
    }
    50%,
    100% {
        opacity: 0;
    }
}

code,
pre,
kbd,
samp,
.mono {
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace;
}

.container {
    display: flex;
    min-height: calc(100vh - 48px); /* fallback for older browsers */
    min-height: calc(100dvh - 48px); /* preferred: dynamic viewport height */
    position: relative;
}

/* Left Section */
.left-section {
    flex: 1;
    background-color: #d4c5e8;
    position: relative;
    padding-top: 40px;
    border: 4px solid #000;
    overflow: visible;
}

/* Header */
.header {
    margin-bottom: 60px;
}

.header-content {
    background-color: #4d7bff;
    padding: 20px 0;
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    flex-direction: row;
    gap: 80px;
    align-items: center;
    overflow: visible;
    border-top: 4px solid #000;
    border-bottom: 4px solid #000;
}

.header-content::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 120px;
    height: 100%;
    background-color: #ffff50;
}

/* Decorative after pseudo that extends beyond the right edge and sits over the container border */
.header-content::after {
    content: "";
    position: absolute;
    right: -12px;
    top: 0;
    width: 16px;
    height: 100%;
    background-color: #4d7bff;
    z-index: 10;
}

.main-title {
    font-size: 56px;
    font-weight: 800;
    color: #1a1a1a;
    padding-left: 24px;
    position: relative;
    z-index: 1; /* keep title above decorative pseudos */
    margin-left: 1rem;
}

.main-right-section {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-direction: column;
}

.main-right-section .icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-right-section .icon svg {
    width: 56px;
    height: 56px;
    color: #fff;
    position: relative;
    top: 4px;
    display: block;
}

.main-right-section .text {
    font-size: 16px;
    font-weight: 700;
    font-family: "IBM Plex Mono", monospace;
    color: #000;
    text-align: center;
    line-height: 1.4;
}

.line-shadow-text {
    position: relative;
    z-index: 0;
    display: inline-flex;
}

.line-shadow-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0.04em;
    top: 0.04em;
    z-index: -1;
    background: linear-gradient(45deg, transparent 45%, #000 45%, #000 55%, transparent 0);
    background-size: 0.06em 0.06em;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: line-shadow 15s linear infinite;
}

@keyframes line-shadow {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 100% -100%;
    }
}

/* About Card */
.about-card {
    background-color: #fff;
    border: 8px solid #000;
    box-shadow: 12px 12px 0 rgba(0, 0, 0, 1);
    max-width: 780px;
    width: calc(100% - 80px);
    max-width: 780px;
    margin: 40px auto;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.about-card:hover {
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 1);
    transform: translate(4px, 4px);
}

.card-header {
    background-color: #000;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: transparent;
    border: 2px solid #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
    display: inline-block;
}

.card-title {
    font-family: "IBM Plex Mono", monospace;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 2px;
    flex: 1;
    text-align: center;
}

.user-icon svg {
    color: #fff;
}

.profile-section {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    padding: 40px;
}

.profile-image-wrapper {
    flex-shrink: 0;
}

.image-border {
    background-color: #fff;
    border: 12px solid #5173d4;
    outline: 12px solid #f4f061;
}

.profile-image {
    width: 150px;
    height: 150px;
    display: block;
    object-fit: cover;
    filter: grayscale(100%);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 42px;
    font-weight: 800;
    color: #000;
    margin-bottom: 10px;
}

.pronouns {
    font-size: 20px;
    font-weight: 400;
    color: #666;
}

.profile-title {
    font-size: 24px;
    font-weight: 600;
    color: #000;
    margin-bottom: 20px;
}

.profile-description {
    font-size: 18px;
    line-height: 1.6;
    color: #333;
}

.social-links-wrapper {
    background-image: image-set(/* url("../Src/Icon/social_block.avif") type("image/avif") 1x,
        url("../Src/Icon/social_block.webp") type("image/webp") 1x, */ url("../Src/Icon/social_block.png") 1x);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
}

.social-links {
    display: grid;
    grid-template-columns: max-content repeat(4, min-content) 1fr;
    gap: 24px;
    align-items: center;
    padding: 40px 20px;
}

.social-label {
    font-size: 14px;
    font-weight: 500;
    font-family: "IBM Plex Mono", monospace;
    color: #000;
    text-transform: uppercase;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 14px;
    font-weight: 500;
    color: #353537ff;
    text-decoration: none;
    transition: color 0.3s;
}

.social-link:hover {
    color: #5173d4;
}

.country {
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    font-weight: 600;
    color: #000;
    text-align: right;
}

/* Right Section */
.right-section {
    flex: 1;
    background-color: #fff;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* mosaic Image */
.mosaic-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.mosaic-image {
    width: 100%;
    height: 50%;
    object-fit: cover;
    will-change: auto;
    content-visibility: auto;
}

/* Bibliography Card */
.bibliography-card {
    background-color: #1bb9a5;
    border: 8px solid #000;
    box-shadow: 12px 12px 0 rgba(0, 0, 0, 1);
    position: absolute;
    bottom: 60px;
    width: 400px;
    z-index: 10;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.bibliography-card:hover {
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 1);
    transform: translate(4px, 4px);
}

.bibliography-card .card-header {
    background-color: #000;
}

.doc-icon svg {
    color: #fff;
}

.bibliography-content {
    padding: 20px;
}

.bibliography-list {
    list-style-position: outside;
    padding-left: 36px;
}

.bibliography-list li {
    font-family: "IBM Plex Mono", monospace;
    font-size: 20px;
    font-weight: 500;
    color: #000;
    line-height: 1.3;
    padding: 8px 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    min-height: 28px;
}

/* Bottom Bar */
.bottom-bar {
    height: 20px;
    display: flex;
    margin-top: 20px;
    border: 4px solid #000;
}

.bar-segment {
    flex: 1;
    border-right: 2px solid #000;
    border-left: 2px solid #000;
}

.bar-coral {
    background-color: #7fff5b;
}

.bar-pink {
    background-color: #638ff5;
}

.bar-yellow {
    background-color: #ffff50;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }

    .main-title {
        font-size: 48px;
    }

    .profile-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        justify-content: center;
    }

    .social-links {
        grid-template-columns: 1fr;
        font-size: 14px;
    }

    .mosaic-wrapper {
        display: none;
    }

    .bibliography-list {
        padding-left: 24px;
    }

    .bibliography-list li {
        font-size: 16px;
        line-height: 1.4;
        padding: 10px 0;
    }

    .bibliography-card {
        position: relative;
        bottom: auto;
        right: auto;
        margin: 40px;
        width: calc(100% - 80px);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-left: 12px;
        padding-right: 12px;
        align-items: center;
    }

    /* Hide the decorative right-side pseudo on small screens */
    .header-content::after {
        display: none;
    }

    .main-title {
        font-size: 36px;
        margin-left: 0;
        padding-left: 0;
    }

    .main-right-section {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100%;
        justify-content: center;
        align-items: center;
    }

    .main-right-section .icon svg {
        width: 40px;
        height: 40px;
        top: 0;
    }

    .main-right-section .text {
        font-size: 14px;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100% - 56px);
    }

    .percentage-container {
        font-size: 48px;
    }

    .preloader-header-center {
        position: absolute;
        text-align: center;
        top: 60px;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 10px;
        /* width: 100%; */
    }

    .preloader-container {
        padding: 80px 20px 40px 20px;
    }

    .preloader-header-left {
        left: 20px;
    }

    .preloader-header-right {
        right: 20px;
    }

    .social-links-wrapper {
        background-image: url("../Src/Icon/social_block_mobile.png");
        background-repeat: no-repeat;
        background-size: cover;
        background-position: center center;
    }

    .mosaic-wrapper {
        display: none;
    }
}

/* Desktop layout: left main content should take ~75% of horizontal space */
@media (min-width: 1201px) {
    .left-section {
        flex: 0 0 68%;
        max-width: 68%;
        margin: 0 auto;
    }

    .right-section {
        flex: 0 0 32%;
        max-width: 32%;
        min-width: 360px; /* ensure there's room for the bibliography card */
    }
}

/* Give extra space to the right-section for small laptops (eg. 1280px wide) */
@media (min-width: 1201px) and (max-width: 1280px) {
    .left-section {
        flex: 0 0 64%;
        max-width: 64%;
    }

    .right-section {
        flex: 0 0 36%;
        max-width: 36%;
        min-width: 420px; /* accommodate the bibliography card (400px wide plus padding) */
    }
}
