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

:root {
    --icon-size: 24px;
}

html {
    font-size: 16px;
}

body {
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    font-family: "Space Mono", "Lucida Console", Monaco, monospace;
    font-weight: 400;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Space Mono", monospace;
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: var(--links-color);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.75;
}

a.site-title {
    font-family: "Space Mono", "Lucida Console", Monaco, monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
}

a.site-title:hover {
    opacity: 0.8;
}

/* Top navigation bar (kept from drishtikon) */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--text-color);
    max-width: 1200px;
    margin: 0 auto 2rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    opacity: 1;
}

.nav-links a:hover {
    text-decoration: underline;
    opacity: 1;
}

.nav-links a.active {
    text-decoration: underline;
}

@media (max-width: 768px) {
    a.site-title {
        font-size: 1.25rem;
    }

    .top-nav {
        padding: 1rem;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }
}

@media (max-width: 400px) {
    .nav-links {
        gap: 0.75rem;
    }
}

/* Main content container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Homepage layout */

/* Top row: photo + about side by side */
.top-block {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 3rem;
}

.top-left {
    flex: 0 0 auto;
}

.hero-image-wrapper {
    width: auto;
}

.hero-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    display: block;
}

.top-right {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 0;
    padding-left: 0;
}

.about-section {
    padding-top: 0;
    padding-left: 0;
}

.about-section .section-title {
    margin-top: 0;
}

.about-description {
    padding-left: 0;
}

/* Bottom row: blog + games side by side */
.bottom-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

/* Section titles */
.section-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* About section */
.about-description p {
    margin-bottom: 1rem;
}

.about-description ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.about-description li {
    margin-bottom: 0.5rem;
}

.contact-link {
    margin-top: 1.5rem;
    font-style: italic;
}

.contact-link a {
    font-weight: 600;
}

.social-links {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid color-mix(in srgb, var(--text-color) 30%, transparent);
}

.social-links a {
    color: var(--links-color);
    text-decoration: none;
}

.social-links a:hover {
    text-decoration: underline;
}

.social-separator {
    margin: 0 0.35rem;
    opacity: 0.7;
}

/* Blog & games sections on homepage */
.post-list-homepage,
.games-list-homepage {
    list-style: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.post-item-homepage,
.game-item-homepage {
    margin-bottom: 0.4rem;
}

.post-date-homepage,
.game-date-homepage {
    color: var(--text-color);
    opacity: 0.85;
}

.post-separator,
.game-separator {
    margin: 0 0.35rem;
    opacity: 0.7;
}

.post-title-homepage-link,
.game-title-homepage-link {
    color: var(--links-color);
}

.more-posts-link,
.more-games-link {
    font-style: italic;
}

.more-posts-link a,
.more-games-link a {
    color: var(--links-color);
}

@media (max-width: 768px) {
    .top-block {
        flex-direction: column;
        gap: 2rem;
    }

    .bottom-block {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Posts list page */
.posts-list-container {
    max-width: 75%;
    margin: 0 auto;
}

.year-group {
    margin: 0 auto 1.5rem;
    color: var(--text-color);
}

.year-group h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.post-list {
    list-style: none;
    margin: auto;
}

.post-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.post-title {
    flex-grow: 1;
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.post-title:hover {
    opacity: 1;
    text-decoration: underline;
}

.post-date {
    color: var(--text-color);
    white-space: nowrap;
    opacity: 0.75;
}

.dot-leader {
    border-bottom: 3px dotted color-mix(in srgb, var(--text-color) 50%, transparent);
    flex-grow: 1;
    height: 1.2rem;
    margin-left: 10px;
    margin-right: 10px;
}

@media (max-width: 768px) {
    .posts-list-container {
        max-width: 95%;
    }

    .post-item {
        display: block;
        margin-bottom: 0.75rem;
    }

    .dot-leader {
        display: none;
    }

    .post-title {
        display: block;
    }

    .post-date {
        display: block;
        font-size: 0.9rem;
        opacity: 0.7;
    }
}

/* Single Post Styling */
.single-post {
    padding: 2rem 0;
    max-width: 75%;
    margin: 0 auto;
}

.post-header {
    margin-bottom: 1.5rem;
}

.post-header h1 {
    margin-bottom: 0.5rem;
    font-size: 2.25rem;
}

.post-meta {
    color: color-mix(in srgb, var(--text-color) 70%, transparent);
    font-size: 0.95rem;
}

.post-content {
    line-height: 1.7;
    max-width: 100%;
    overflow-wrap: break-word;
    hyphens: auto;
}

.post-content p {
    margin-bottom: 1.2rem;
}

.post-content blockquote {
    margin-bottom: 1.2rem;
    border-left: 6px solid var(--table-header-color);
    padding: 1rem 1rem 1rem 1.25rem;
    background: color-mix(in srgb, var(--table-content-color) 40%, var(--background-color));
}

.post-content blockquote p {
    margin-bottom: 0;
}

.post-content ul,
.post-content ol {
    padding-left: 2rem;
    margin-bottom: 1.2rem;
}

.post-content li {
    margin-bottom: 0.4rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

.post-content iframe,
.post-content embed {
    max-width: 100%;
}

.post-content table {
    border-collapse: collapse;
    width: 100%;
    display: table;
    margin: 1rem 0;
    table-layout: auto;
}

.post-content th,
.post-content td {
    padding: 0.5rem;
    text-align: center;
    background-color: var(--table-content-color);
    color: var(--text-color);
    border: 1px solid var(--background-color);
}

.post-content thead th {
    background-color: var(--table-header-color);
    font-weight: 700;
}

.post-content tr:hover td {
    background-color: var(--table-row-hover-color);
}

/* Code blocks */
.post-content pre {
    background: #272822;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-weight: 400;
    font-family: "Space Mono", "Lucida Console", Monaco, monospace;
    margin-bottom: 1.2rem;
}

.post-content code {
    font-family: "Space Mono", "Lucida Console", Monaco, monospace;
}

.inline {
    background-color: #272822;
    color: #f8f8f2;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    font-weight: 400;
    font-family: "Space Mono", "Lucida Console", Monaco, monospace;
}

@media (max-width: 768px) {
    .single-post {
        max-width: 100%;
    }

    .post-header h1 {
        line-height: 1.3;
        font-size: 1.75rem;
    }

    .post-meta {
        margin-bottom: 1rem;
    }
}

/* Writings Page Layout */
.writings-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 1rem;
}

.writings-header {
    text-align: center;
    margin-bottom: 1rem;
}

.writings-header h1 {
    font-size: 2.25rem;
}

.writings-columns {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.writing-column {
    flex: 1;
    background: var(--writing-card-background);
    border-radius: 10px;
    padding: 1.5rem;
    min-width: 0;
}

.column-title {
    margin-bottom: 0.75rem;
    text-align: center;
    font-size: 1.5rem;
}

.writing-item {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--text-color) 15%, transparent);
    margin-bottom: 0.75rem;
}

.writing-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.writing-title {
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: Georgia, "Times New Roman", serif;
}

.writing-title a {
    color: var(--text-color);
    text-decoration: none;
}

.writing-title a:hover {
    text-decoration: underline;
}

.writing-meta {
    color: color-mix(in srgb, var(--text-color) 70%, transparent);
    margin-bottom: 0.25rem;
    display: flex;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.writing-tags {
    color: color-mix(in srgb, var(--text-color) 70%, transparent);
    font-size: 0.9rem;
}

.writing-excerpt {
    line-height: 1.5;
    color: color-mix(in srgb, var(--text-color) 90%, transparent);
}

@media (max-width: 1200px) {
    .writings-columns {
        flex-wrap: wrap;
    }

    .writing-column {
        flex: 1 1 calc(50% - 1rem);
    }
}

@media (max-width: 768px) {
    .writing-column {
        flex: 1 1 100%;
    }
}

/* Photos page */
.photos-container {
    display: flex;
    flex-direction: row;
    box-sizing: border-box;
}

.photo-section {
    flex: 1.5;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: var(--background-color);
    padding: 0 2rem 2rem;
    box-sizing: border-box;
}

.photo-section img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
}

.info-section {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background-color: var(--background-color);
}

.info-content {
    text-align: center;
}

.photo-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
}

.nav-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-button img {
    width: 40px;
    height: auto;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav-button img:hover {
    opacity: 1;
}

#description {
    margin: 1rem 2rem 2rem;
}

#counter {
    height: 50%;
}

#albums {
    list-style: none;
    padding: 0;
    margin: 0;
}

#albums li {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#albums li img {
    width: 20px;
    height: 20px;
}

.album-link {
    text-decoration: none;
    color: inherit;
}

.album-link.active {
    color: var(--links-color);
    font-weight: 700;
}

.album-link.active img {
    filter: invert(39%) sepia(11%) saturate(1743%) hue-rotate(243deg) brightness(94%) contrast(88%);
}

@media (max-width: 768px) {
    .photos-container {
        flex-direction: column;
    }

    .photo-section,
    .info-section {
        width: 100%;
        height: auto;
    }

    .photo-section img {
        max-width: 100%;
        max-height: 60vh;
    }
}

/* Footer Structure */
footer {
    margin-top: 3rem;
    border-top: 1px solid color-mix(in srgb, var(--text-color) 30%, transparent);
}

.site-footer {
    text-align: center;
    display: flex;
    background-color: var(--background-color);
    padding: 1.5rem 1rem;
    box-sizing: border-box;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(1rem, 3vw, 2rem);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links a {
    opacity: 0.8;
    transition: opacity 0.2s ease;
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem;
    white-space: nowrap;
}

.footer-links a:hover {
    opacity: 1;
}

@media (max-width: 600px) {
    .site-footer {
        padding: 1rem;
    }

    .footer-links {
        flex-direction: row;
        gap: 0.5rem;
    }

    .footer-links a {
        white-space: normal;
        text-align: center;
        padding: 0.5rem;
    }
}

.email-page {
    width: 100%;
    height: 100%;
}

.email-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Icons */
.icon {
    display: inline-block;
    width: var(--icon-size);
    height: var(--icon-size);
    background-color: var(--text-color);
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

.github-icon {
    mask-image: url('/icons/github.svg');
    -webkit-mask-image: url('/icons/github.svg');
}

.email-icon {
    mask-image: url('/icons/mail.svg');
    -webkit-mask-image: url('/icons/mail.svg');
}

.steam-icon {
    mask-image: url('/icons/steam.svg');
    -webkit-mask-image: url('/icons/steam.svg');
}

.bluesky-icon {
    mask-image: url('/icons/bluesky.svg');
    -webkit-mask-image: url('/icons/bluesky.svg');
}

.telegram-icon {
    mask-image: url('/icons/telegram.svg');
    -webkit-mask-image: url('/icons/telegram.svg');
}

.youtube-icon {
    mask-image: url('/icons/youtube.svg');
    -webkit-mask-image: url('/icons/youtube.svg');
}

.discord-icon {
    mask-image: url('/icons/discord.svg');
    -webkit-mask-image: url('/icons/discord.svg');
}

.cv-icon {
    mask-image: url('/icons/file-text.svg');
    -webkit-mask-image: url('/icons/file-text.svg');
}

/* Email page */
.email-page {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: calc(100vh - 130px);
    margin: 0;
    padding: 0;
}

.email-page img,
.email-page svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}
