/* Core Stuff */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* --- Cursor Light Effect --- */
.cursor-light {
    position: fixed;
    top: 0;
    left: 0;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
    /* Let clicks pass through */
    z-index: 9999;
    transform: translate(-50%, -50%);
    /* Center on cursor */
    transition: opacity 0.3s ease;
    mix-blend-mode: screen;
    /* clearer glow */
}

body {
    font-family: var(--primary-font);
    font-size: var(--base-font-size);
    line-height: 1.3;
    color: var(--body-text-color);
    cursor: default;
    /* Optional: keep default cursor */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--heading-font);
    color: var(--heading-color);
}

a {
    text-decoration: none;
    color: var(--heading-color);
}

a:hover {
    color: var(--heading-color);
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
}

pre {
    background: #F0F0F0;
    margin: 1rem 0;
    border-radius: 2px;
}

blockquote {
    border-left: 10px solid #eee;
    margin: 0;
    padding: 0 2rem;
}

/*Images*/
img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: auto;
}

/* Utility Classes */
.wrapper {
    margin: 0 3rem;
}

.padding {
    padding: 3rem 1rem;
}

.left {
    float: left;
}

.right {
    float: right
}

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

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

/* Content Styling */

/* --- Card Container for Modules --- */
.card {
    max-width: 1600px;
    margin: 0 auto;
    /* Center the card */
    padding: 20px;
    border-radius: 0;
    background-color: rgba(10, 10, 13, 0.7);
    /* Same as widgets */
    border: 1px solid #00ffff;
    /* Neon border */
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
    /* Stronger neon glow */
}

.card:hover {
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.9);
}

/* --- Module Row Layout --- */
.module-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.module-row .content-block {
    flex: 1 1 calc(50% - 20px);
    /* Flex-grow, flex-shrink, and basis */
}

/* Liquid Cyber Punk Menu Styles */
.header {
    background-color: transparent;
    position: absolute;
    /* Position over hero */
    width: 100%;
    z-index: 100;
    display: flex;
    /* Use flexbox for alignment */
    justify-content: space-between;
    /* Space out logo and nav */
    align-items: center;
    padding: 20px;
    /* Add padding directly to header */
}

.header .logo {
    flex-shrink: 0;
    /* Prevent logo from shrinking */
}

.header .main-nav {
    flex-grow: 1;
    /* Allow nav to take available space */
    text-align: center;
    /* Center the navigation text */
}

.main-nav ul {
    display: inline-block;
    /* Allow ul to be centered by text-align */
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav ul li {
    display: inline-block;
    /* Display menu items inline */
    margin: 0 15px;
    /* Spacing between menu items */
}

.main-nav ul li a {
    font-family: var(--header-font-family);
    font-size: var(--header-font-size);
    color: var(--header-text-color);
    text-transform: var(--header-text-transform);
    text-decoration: none;
    text-shadow: 0 0 3px #00ffff;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.main-nav ul li a:hover {
    color: #00e0e0;
    text-shadow: 0 0 5px #00e0e0, 0 0 10px #00e0e0;
}

.main-nav ul li.selected>a {
    background-color: transparent;
    /* Override white background */
    color: #00e0e0;
    /* Active neon color */
    text-shadow: 0 0 5px #00e0e0, 0 0 10px #00e0e0;
    /* Stronger neon glow for active */
}

.mobile-menu-icon {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1003;
    /* Increased z-index to be above the overlay */
    color: #00ffff;
    font-size: 2em;
    cursor: pointer;
}

body .header.scrolled {
    /* Increased specificity */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* --- Mobile & Scrolled Menu Logic --- */

/* On small screens, ALWAYS hide the nav and show the icon */
@media (max-width: 767px) {
    .header .main-nav {
        display: none;
    }

    .mobile-menu-icon {
        display: block;
    }

    body {
        font-size: 0.9em;
    }

    /* Smaller base font size for mobile */
    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.8em;
    }

    h3 {
        font-size: 1.6em;
    }

    h4 {
        font-size: 1.4em;
    }

    h5 {
        font-size: 1.2em;
    }

    h6 {
        font-size: 1em;
    }

    .section-title {
        font-size: 1.8em;
    }
}

/* On large screens, hide the nav and show the icon ONLY when scrolled */
@media (min-width: 768px) {
    .header.scrolled .main-nav {
        display: none;
    }

    .header.scrolled .mobile-menu-icon {
        display: block;
    }
}

/* Styles for the active (visible) mobile menu */
.header .main-nav.active {
    /* Increased specificity */
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 13, 0.95);
    /* Dark, semi-transparent background */
    z-index: 1002;
    /* Ensure it's above everything else */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.main-nav.active ul {
    text-align: center;
}

.main-nav.active ul li {
    display: block;
    /* Stack menu items vertically */
    margin: 20px 0;
}

.main-nav.active ul li a {
    font-size: 2em;
    /* Larger font size for mobile menu */
}

/* --- Content Block Styles --- */
.content-block {
    padding: 1rem;
    background-color: #0f0f12;
    /* Slightly different dark shade for contrast */
    border-top: 1px solid #222;
}

#about .tile,
#hobby .tile {
    flex-direction: column;
}

@media (max-width: 760px) {
    #about {
        padding-top: 10rem;
    }

    .content-block {
        padding: 1rem;
    }

    .module-row .content-block {
        flex: 1 1 100%;
        margin-left: 0;
        margin-right: 0;
    }

    /* Мобильные стили для изображений в плитках */
    .tile img {
        height: 200px;
        /* Меньшая высота для мобильных */
    }
}

.content-column {
    margin: 0 auto;
    /* Center the column */
}

.l-box {
    padding: 1em;
}

.section-title {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 1.5rem;
    color: var(--heading-color);
    text-shadow: 0 0 5px var(--heading-color);
}

/*footer*/
.footer {
    background-color: #0f0f12;
    border-top: 1px solid #222;
}

/*Blog page styles*/
.e-content {
    padding: 4rem;
    max-width: 1200px;
    margin: auto;
    margin-top: 2rem;
}

.blog-listing {
    padding-top: 8rem;
}

/*Виджет blog posts*/
/* Контейнер для сетки плиток */
.blog-grid-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 posts per row */
    gap: 20px;
}

@media (max-width: 767px) {
    .blog-grid-tiles {
        grid-template-columns: 1fr; /* 1 column on mobile */
    }
}

/* Стили самой плитки */
.tile {
    border: 1px solid #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    transition: transform 0.1s ease-out;
    /* Smooth return, fast movement */
    transform-style: preserve-3d;
    will-change: transform;
}

.tile-image-link {
    display: block;
    width: 100%;
    overflow: hidden;
}

.tile img {
    display: block;
    width: 100%;
    height: 250px;
    /* Фиксированная высота для единообразия */
    object-fit: cover;
    /* Покрывает всю область, обрезая лишнее */
    /* transition removed here to avoid conflict with JS tilt movement */
}

.tile:hover {
    z-index: 10;
    /* Bring to front on hover */
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.9);
}

.tile:hover img {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.9);
}

.tile-content {
    padding: 20px;
}

.tile-content h3 {
    margin-top: 0;
    color: var(--heading-color);
}

/* --- Glitch Effect for Titles --- */
@keyframes glitch-skew {
    0% {
        transform: skew(0deg);
    }

    20% {
        transform: skew(-2deg);
    }

    40% {
        transform: skew(2deg);
    }

    60% {
        transform: skew(-1deg);
    }

    80% {
        transform: skew(1deg);
    }

    100% {
        transform: skew(0deg);
    }
}

@keyframes glitch-anim {
    0% {
        text-shadow: 2px 0 #00ffff, -2px 0 #ff00ff;
        clip-path: inset(0 0 0 0);
    }

    25% {
        text-shadow: -2px 0 #00ffff, 2px 0 #ff00ff;
        clip-path: inset(20% 0 0 0);
    }

    50% {
        text-shadow: 2px 0 #00ffff, -2px 0 #ff00ff;
        clip-path: inset(40% 0 60% 0);
    }

    75% {
        text-shadow: -2px 0 #00ffff, 2px 0 #ff00ff;
        clip-path: inset(0 0 40% 0);
    }

    100% {
        text-shadow: 2px 0 #00ffff, -2px 0 #ff00ff;
        clip-path: inset(0 0 0 0);
    }
}

.section-title:hover {
    animation: glitch-anim 0.3s infinite linear alternate-reverse, glitch-skew 0.3s infinite;
    position: relative;
}

/* Optional: Add a subtle text-shadow for non-hover state to match theme */
.section-title {
    text-shadow: 0 0 5px var(--heading-color);
    /* Existing shadow */
    transition: text-shadow 0.2s;
}