:root {
    --bg-color: #ffffff;
    /* Clean white background */
    --surface-color: #f8fafc;
    /* Very light slate */
    --text-primary: #0f172a;
    /* Deep slate text */
    --text-secondary: #475569;
    /* Slate 600 for secondary text */
    --accent-color: #9358eb;
    /* Purple accent */
    --accent-hover: #7b45c9;
    /* Darker purple for hover */
    --border-color: #e2e8f0;
    --transition: 0.3s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;

    /* Gridded A5 Binder Page Background */
    background-image:
        linear-gradient(90deg, transparent 58px, rgba(239, 68, 68, 0.25) 58px, rgba(239, 68, 68, 0.25) 60px, transparent 60px),
        linear-gradient(rgba(226, 232, 240, 0.7) 1px, transparent 1px),
        linear-gradient(90deg, rgba(226, 232, 240, 0.7) 1px, transparent 1px);
    background-size: 100% 100%, 24px 24px, 24px 24px;
    background-position: 0 0, 0 calc(var(--scroll-offset, 0px) * -0.45), 0 0;
    background-attachment: fixed;
}

/* Binder Holes Simulation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 58px;
    height: 100vh;
    background-image: radial-gradient(circle 8px at 29px 24px, #cbd5e1 90%, rgba(0, 0, 0, 0.05) 100%, transparent);
    background-size: 58px 48px;
    background-position: 0 calc(var(--scroll-offset, 0px) * -0.45);
    background-repeat: repeat-y;
    pointer-events: none;
    z-index: 100;
}

.container {
    max-width: 1050px;
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
}

/* 1 & 2. Header and Subheading */
.hero {
    text-align: center;
    padding: 6rem 1rem 4rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(147, 88, 235, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
}

.hero h1 {
    font-family: 'Caveat', cursive;
    font-size: clamp(3.5rem, 8vw, 5.5rem);
    font-weight: 700;
    letter-spacing: 0;
    background: linear-gradient(to right, #0f172a, #475569);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.2rem;
    transform: rotate(-2deg);
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    font-weight: 400;
}

.social-links {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.social-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding-bottom: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.social-links a:hover {
    color: var(--text-primary);
}

.social-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: center;
}

.social-links a:hover::after {
    transform: scaleX(1);
}

/* 3. About Me Section */
.about-section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 20px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 2px;
}

.about-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-height: 120px;
    /* Leave empty but define boundaries for visuals */
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Custom Sections Shared */
.content-section {
    margin-bottom: 5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.section-header .section-title {
    margin-bottom: 0;
}

.section-header .section-title::after {
    bottom: -13px;
    /* Align to bottom border */
}

.view-all {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.view-all:hover {
    color: var(--accent-hover);
}

/* Common Card Styles */
.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    border-color: #4b5563;
    /* Tailwind gray-600 */
    transform: translateY(-2px);
}

.card h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
}

/* Portfolio Marquee Carousel */
.carousel-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    gap: 1rem;
}

.marquee-wrapper {
    overflow: hidden;
    flex-grow: 1;
    border-radius: 12px;
    /* Soft fade edges so items don't just abruptly vanish */
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.marquee-track {
    display: flex;
    width: max-content;
}

.marquee-group {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    padding-right: 1rem;
    /* Seamless gap spacer */
    animation: scrollMarquee linear infinite;
}

.marquee-group.reverse {
    animation-direction: reverse;
}

@keyframes scrollMarquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

.carousel-item {
    width: 233px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .carousel-item {
        width: 187px;
    }
}

.carousel-img {
    width: 100%;
    height: 107px;
    object-fit: cover;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: block;
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.blog-date {
    font-size: 0.8rem;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.read-more {
    display: inline-block;
    margin-top: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.read-more:hover {
    color: var(--accent-hover);
}

/* CV Card Specifics */
.cv-card {
    cursor: pointer;
    padding: 1rem;
}

.cv-card h3 {
    font-size: 0.95rem;
    margin: 0.75rem 0 0.35rem !important;
}

.cv-card .blog-date {
    font-size: 0.75rem;
}

.cv-card p {
    font-size: 0.8rem;
}

.cv-card:hover .carousel-img {
    filter: brightness(0.9);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    /* Dark slate semi-transparent */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Content */
.modal-content {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Modal Gallery */
.modal-gallery {
    position: relative;
    width: 100%;
    background-color: #e2e8f0;
    /* Soft gray for image background */
    display: flex;
    align-items: center;
    justify-content: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    overflow: hidden;
}

.modal-img {
    width: 100%;
    max-height: 400px;
    height: auto;
    object-fit: contain;
    display: block;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(2px);
    transition: background 0.2s, color 0.2s;
}

.gallery-nav:hover {
    background: var(--surface-color);
}

.gallery-prev {
    left: 1rem;
}

.gallery-next {
    right: 1rem;
}

.gallery-indicators {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.2s;
}

.indicator-dot.active {
    background-color: var(--accent-color);
}

/* Modal Info */
.modal-info {
    padding: 2rem;
}

.modal-info h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--text-primary);
    padding-right: 2rem;
    /* prevent overlap with close button if very long, though close btn is usually on the image */
}

.modal-info h3 a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-info h3 a::after {
    content: "↗";
    font-size: 1rem;
    color: var(--accent-color);
}

.modal-info h3 a:hover {
    color: var(--accent-hover);
}

.modal-info p {
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .modal-info {
        padding: 1.5rem;
    }

    .modal-img {
        max-height: 300px;
    }
}