@font-face {
    font-family: 'Iosevka Slab';
    src: url('../fonts/iosevka-slab-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'Iosevka';
    src: url('../fonts/SGr-Iosevka-Regular.ttc') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-color: #ffffff;
    --text-color: black;
    --accent-bg: black;
    --accent-text: #ffffff;
    --link-color: #4c82ff;
    --selection-fg: #ffffff;
    --selection-bg: black;
}

html[data-theme="dark"] {
    --bg-color: rgb(30, 30, 30);
    --text-color: #ffffff;
    --accent-bg: #ffffff;
    --accent-text: black;
    --link-color: #4cff91;
    --selection-fg: black;
    --selection-bg: #ffffff;
}

#moon {
    position: absolute;
    top: 0px;
    left: 0px;
    padding: 25px;
    font-size: 2rem;
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
}

#tok-counter {
    position: absolute;
    top: 0px;
    right: 0px;
    padding: 25px;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: none;
}

::selection {
    color: var(--selection-fg);
    background-color: var(--selection-bg);
}

p {
    color: var(--text-color);
    line-height: 2rem;
}

li::marker {
    content: "- ";
}

.ascii-art {
    font-family: 'Iosevka Slab', monospace;
    white-space: pre;
    text-align: center;
    font-size: 24px;
    transition: transform 0.08s step-end;
}

.ascii-art .eye {
    display: inline-block;
    animation: spinChar 4s infinite;
    animation-timing-function: steps(12, end);
}


body {
    width: 80%;
    max-width: 1000px;
    margin: 50px auto;
    display: flex;
    flex-direction: column;
    font-family: 'Iosevka Slab', monospace;
    font-weight: 400;
    font-size: 18px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

#main-cont {
    text-align: justify;
    color: var(--text-color);
}


.char-line {
    display: flex;
    justify-content: space-between;
    width: 100%;
    overflow: hidden;
    margin: 2rem 0;
    font-family: 'Iosevka Slab', monospace;
    font-size: 24px;
    cursor: pointer;
    height: auto;
}

/* Individual character container */
.char-line span {
    display: inline-block;
    transform-origin: center center;
    transition: transform 0.3s ease;
    /* Apply continuous rotation animation */
    animation: spinChar 4s linear infinite;
}

.socials {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 16px;
}

.socials fieldset {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap; /* Prevents overflow if you have many social links */
    gap: 15px;       /* Adds equal spacing between each span */
    width: fit-content;
}

.left-align {
    justify-content: center;
}

@media (max-width: 760px) {
    body {
        font-size: 16px;
    }

    #main-cont {
        text-align: left;
    }

    p {
        line-height: 1.6rem;
    }

    .socials {
        flex-direction: column;
    }

    .socials fieldset {
        width: auto;
        justify-content: space-evenly;
    }
}

#projects {
    width: auto;
    height: auto;
    display: flex;
    flex-direction: row;
    gap: 25px;
    justify-content: center;
    margin-top: 25px;
}

#projects fieldset {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 95%;
    padding-top: 25px;
    padding-bottom: 25px;
    border-left: 0;
    border-right: 0;
}

#projects fieldset legend{
    text-align: center;
}

.center-legend {
    text-align: center;
}

.return {
    padding-bottom: 28px;
    text-align: center;
}

.work-content {
    width: 100%;
}

.work-content fieldset {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-top: 25px;
    padding-bottom: 25px;
    padding-left: 50px;
    padding-right: 50px;
    box-sizing: border-box;
    border-left: 0;
    border-right: 0;
}

.work-content iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
}

#cv-list {
    width: 100%;
}

#cv-list fieldset {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
}

#cv-list .cv-entry {
    margin-bottom: 8px;
}

.cv-entry {
    display: grid;
    grid-template-columns: auto 6ch 1fr;
    align-items: baseline;
    column-gap: 10px;
    text-decoration: none;
    width: 100%;
}

.chevron {
    color: white;
}

@media (max-width: 500px) {
    .cv-entry {
        grid-template-columns: 1fr;
        justify-items: center;
        column-gap: 0;
    }
    .cv-entry .chevron {
        display: none;
    }
    .cv-entry .desc {
        text-align: center;
    }
    .cv-entry .year {
        text-align: center;
    }

    #cv-list .cv-entry {
    margin-bottom: 20px;
}
}

#project-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.project {
    display: flex;
    width: 100%;
    height: auto;
}

.project-link {
    display: grid;
    grid-template-columns: auto 6ch 18ch auto 1fr;
    align-items: baseline;
    column-gap: 10px;
    text-decoration: none;
    width: 100%;
}

@media (max-width: 500px) {
    .cursor-image {
        display: none !important;
    }

    #projects fieldset {
        gap: 40px;
    }

    .project-link {
        grid-template-columns: 1fr;
        justify-items: center;
        column-gap: 0;
        row-gap: 10px;
    }
    .chevron,
    .project-sep {
        display: none;
    }
    .year {
        order: 1;
    }
    .project-name {
        order: 2;
        width: auto;
        text-align: center;
    }
    .desc {
        display: none;
    }
    .project-thumb {
        order: 3;
        margin-top: 8px;
    }
}

.year {
    background-color: var(--accent-bg);
    color: var(--accent-text);
    height: fit-content;
    white-space: nowrap;
}

.project-name {
    width: 18ch;
    text-align: center;
    overflow-wrap: break-word;
    word-break: break-word;
}

.project-sep {
    color: white;
}

.project-thumb {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: 500px;
}

@media (min-width: 501px) {
    .project-thumb {
        display: none;
    }
}

.desc-link {
    white-space: normal;
    overflow-wrap: anywhere;
}

.desc {
    overflow-wrap: anywhere;
}

/* Markdown content image defaults */
.bio img,
.work-content img {
    width: auto;
    display: block;
    max-height: 700px;
    max-width: 90%;
    height: auto;
    margin: 1.25rem auto;
}

.bio figure,
.work-content figure {
    margin: 1.5rem 0;
}

.bio figcaption,
.work-content figcaption {
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Side-by-side image rows for markdown HTML blocks */
.bio .image-row,
.work-content .image-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: 90%;
    margin: 1.25rem auto;
    justify-items: center;
    align-items: center;
}

.bio .image-row figure,
.work-content .image-row figure {
    margin: 0;
}

.bio .image-row img,
.work-content .image-row img {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

@media (max-width: 760px) {
    .work-content fieldset {
        padding-left: 10px;
        padding-right: 10px;
    }

    .bio .image-row,
    .work-content .image-row {
        grid-template-columns: 1fr;
    }

    .work-content .image-row,
    .work-content img {
        max-width: 100%;
    }

    .work-content img {
        width: 100%;
    }
}

/* Optional helper classes for HTML img tags inside markdown */
.bio img.img-small,
.work-content img.img-small {
    max-width: 420px;
}

.bio img.img-medium,
.work-content img.img-medium {
    max-width: 680px;
}

.bio img.img-framed,
.work-content img.img-framed {
    padding: 6px;
    box-sizing: border-box;
}

.cursor-image {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none; /* Prevents image from blocking mouse hover events */
  
  /* Initial hidden state */
  opacity: 0;
  visibility: hidden;
  /* transition: opacity 0.15s ease-in-out; */
  
  /* Sizing and visual tweaks */
  max-width: 600px;
  height: auto;
  max-height: 600px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999; /* Ensure it stays above everything else */
}

/* Shown state */
.cursor-image.active {
  opacity: 1;
  visibility: visible;
}

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

#datetime {
    text-align: center;
}

/* Rotate Keyframes */
@keyframes spinChar {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Monster */
.monster {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    top: 0;
    left: 0;
    color: rgb(245, 102, 102);
    font-size: 24px;
    animation: flip 1s steps(1, end) infinite;
    z-index: 500;
    font-family: system-ui, -apple-system, sans-serif;
    cursor: pointer;
    user-select: none;
}

@keyframes flip {
    0%, 100% { transform: scaleX(1); }
    50% { transform: scaleX(-1); }
}

.monster-poof {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 1;
    font-size: 24px;
    color: var(--link-color);
    opacity: 0.8;
    font-family: "Iosevka Slab", monospace;
    transition: opacity 2s ease-out, transform 2s ease-out;
}

.monster-poof.fade {
    opacity: 0;
    transform: translateY(-60px);
}

@media (max-width: 500px) {
    .monster {
        font-size: 16px;
        gap: 5px;
    }
}

/* Leaderboard */
.lb-self {
    margin-bottom: 12px;
    display: flex;
    gap: 20px;
}

.lb-self span {
    white-space: nowrap;
}

.lb-row {
    display: block;
    white-space: pre;
    font-family: "Iosevka Slab", monospace;
    line-height: 1.6;
}

.lb-loading,
.lb-empty,
.lb-error {
    opacity: 0.6;
    font-style: italic;
}

#leaderboard legend {
    text-align: center;
}

@media (max-width: 500px) {
    .lb-self {
        flex-direction: column;
        gap: 4px;
    }
}

