/* Ensure all images scale proportionally and never flatten */
img, video, iframe {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}
html {
    /* responsive root font-size: shrinks on small screens with no lower limit */
    font-size: min(1.6vw, 16px);
}

body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 1rem; /* now scales with root */
    line-height: 1.6;
}

    /* make sizing predictable */
    *, *::before, *::after {
        box-sizing: border-box;
    }

.mainInfo p {
    color: #e0e0e0;
}

.top-nav {
    background-color: #1f1f1f;
    border: 1px solid #333;
    padding: 10px;
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap; /* allow nav items to wrap on narrow screens */
}

.top-nav a {
    color: #e0e0e0;
    text-decoration: none;
    margin: 0 0.9375rem; /* 15px */
    font-size: 1.125rem; /* 18px */
}

.top-nav a:hover, .top-nav a.active {
    color: #a600ff;
}

.mainFrame {
    max-width: 50rem; /* 800px */
    margin: 0 auto;
    padding: 1.25rem; /* 20px */
}

.mainFrame {
    overflow-x: hidden;
}

.about {
    background-color: #1f1f1f;
    padding: 20px;
    border: 1px solid #333;
    position: relative;
}

.firstAbout {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.firstAbout.original-state {
    margin-left: 1rem;
}

#pfp {
    width: 6.45rem;
    height: auto;
    border-radius: 0;
    margin-right: 1.75rem;
    cursor: pointer;
}

.mainInfo h1 {
    font-size: 1.75rem; /* 28px */
    margin-bottom: 0.625rem; /*10px*/
    color: #a600ff;
}

.mainInfo a {
    color: #e0e0e0;
    text-decoration: none;
}

.mainInfo a:hover {
    text-decoration: underline;
}

.info, .tech, .socials, .projects, .contact, .blinkies {
    margin-bottom: 30px;
}

h2 {
    font-size: 1.5rem; /*24px*/
    margin-bottom: 0.9375rem; /*15px*/
    color: #a600ff;
    border-bottom: 1px solid #333;
    padding-bottom: 0.3125rem; /*5px*/
}

.languages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9375rem; /*15px*/
}

.languages img {
    width: 3rem; /* 48px */
    height: 3rem; /* 48px */
    object-fit: contain;
}

.blinkies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.blinkies img {
    height: 1.9375rem; /* 31px */
    width: auto;
}

.teams h2 {
    margin-bottom: 1rem;
}

.team-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.teams img {
    height: 3.125rem; /* 50px */
    width: auto;
}

.social-frame {
    list-style: none;
    padding: 0;
    display: grid;
    /* Enforce a 2-column layout that becomes 1 column on small screens */
    grid-template-columns: repeat(2, 1fr);
    justify-content: center; /* center the grid inside the container */
    gap: 0.75rem; /*12px*/
}

.socialLink {
    background-color: #2a2a2a;
    padding: 0.625rem 0.75rem; /*10px 12px*/
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 3.75rem; /*60px*/
    box-sizing: border-box;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.social-info {
    display: flex;
    align-items: center;
    gap: 0.625rem; /* 10px */
}

.socialLink i {
    font-size: 1.25rem; /*20px*/
    width: 1.75rem; /*28px*/
    text-align: center;
}

.socialLink h3 {
    margin: 0;
    font-size: 0.875rem; /*14px*/
    text-transform: capitalize;
}

.socialLink a {
    color: #a600ff;
    text-decoration: none;
    white-space: normal;
    overflow: visible;
}

.socialLink a:hover {
    text-decoration: underline;
}

.socialLink:hover {
    border-color: #a600ff;
    box-shadow: 0 6px 18px rgba(166,0,255,0.08);
    transform: translateY(-2px);
}

/* If the last row has a single item (odd count), make the last item span both columns and center it */
.social-frame > li:nth-last-child(1):nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 20rem; /*320px*/
}

/* Tweak anchor font size to fit better */
.socialLink a {
    font-size: 0.8125rem; /* 13px at 16px root, now scales */
}

@media (min-width: 68.75rem) { /*1100px*/
    /* on large screens, allow a tighter layout if space permits */
    .social-frame {
        grid-template-columns: repeat(2, 22.5rem); /*360px*/
    }
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); /*200px*/
    gap: 1rem; /*16px*/
}

.project-card {
    background-color: #2a2a2a;
    border: 1px solid #333;
    border-radius: 6px;
    text-decoration: none;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.project-card:hover {
    border-color: #a600ff;
    box-shadow: 0 6px 18px rgba(166,0,255,0.08);
    transform: translateY(-2px);
}

.project-card-image img {
    border-bottom: 1px solid #333;
    border-radius: 6px 6px 0 0;
    width: 100%;
}

.project-card-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-card-info h3 {
    font-size: 1.1rem;
    color: #a600ff;
    margin: 0 0 0.5rem 0;
}

.project-card-info p {
    font-size: 0.9rem;
    margin: 0 0 1rem 0;
    flex-grow: 1;
}

.project-card-tags {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.project-card-tags span {
    background-color: #1f1f1f;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stats-container img {
    width: 100%;
    justify-self: center;
}

.projects-grid a {
    display: block;
    width: 100%;
}

.projects-grid img {
    width: 100%;
    height: auto; /* allow image to determine card height */
    object-fit: unset; /* don't crop */
    background-color: transparent;
    padding: 0;
    border: 1px solid #333;
    border-radius: 6px;
    display: block;
    max-width: 100%;
}

@media (max-width: 420px) {
    .projects-grid {
        grid-template-columns: 1fr; /* force single column on very narrow phones */
    }
}

/* Reduce text size and enable wrapping in the projects area on very narrow screens */
@media (max-width: 420px) {
    .projects {
        font-size: 13px; /* base text slightly smaller */
        line-height: 1.3;
    }
    .projects h2 {
        font-size: 1.125rem; /* 18px */
    }
    .projects * {
        word-break: break-word;
    }
}

.skills {
    margin-bottom: 2rem;
}

.skill-category {
    margin-bottom: 1.5rem;
}

.skill-category h3 {
    font-size: 1.2rem;
    color: #a600ff;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.25rem;
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-list span {
    background-color: #2a2a2a;
    padding: 0.5rem 1rem;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 0.9rem;
}

.contact-list {
    list-style: none;
    padding: 0;
}

.contact-list li {
    margin-bottom: 10px;
}

.contact-list a {
    color: #a600ff;
}

.web-badges {
    margin-bottom: 30px;
}

.friends {
    display: flex;
    gap: 20px;
    align-items: center;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: #999;
}

/* Ensure any embedded media scales down to fit the layout */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

.blog {
    background-color: #1f1f1f;
    padding: 20px;
    border: 1px solid #333;
}

.post {
    margin-bottom: 2rem;
    border-bottom: 1px solid #333;
    padding-bottom: 1.5rem;
}

.post:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.post h3 {
    font-size: 1.3rem;
    color: #a600ff;
    margin-bottom: 0.25rem;
}

.post .date {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 1rem;
}

.secret-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 5px 10px;
    background-color: #3a3a3a;
    border: 1px solid #000;
    border-radius: 3px;
    box-shadow: inset -1px -1px #fff, inset 1px 1px #848273, 2px 2px #000;
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
    text-decoration: none;
    color: #a0a0a0;
    cursor: pointer;
}

.secret-button:active {
    box-shadow: inset 1px 1px #fff, inset -1px -1px #848273;
    padding: 6px 9px 4px 11px;
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0) rotate(-1deg);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0) rotate(1deg);
    }
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0) rotate(-1deg);
    }
    40%, 60% {
        transform: translate3d(4px, 0, 0) rotate(1deg);
    }
}

.shake {
  animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}