/* --- Variables --- */
:root {
    --primary-red: #d63d46;
    --primary-red-hover: #b8333b;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Roboto', sans-serif;
    --bg-body: #ffffff;
    --color-body: #333333;
    --text-gray: #666666;
    --input-bg: #ffffff;
    --input-border: #ddd;
    --input-color: #333333;
    --footer-text: #666666;
    --footer-heading: #333333;
    --footer-border: rgba(0,0,0,0.1);
    --primary-white: #ffffff;
}

[data-theme="dark"] {
    --bg-body: #000000;
    --color-body: #e0e0e0;
    --text-gray: #999999;
    --input-bg: #111111;
    --input-border: #333333;
    --input-color: #e0e0e0;
    --footer-text: #888888;
    --footer-heading: #ffffff;
    --footer-border: rgba(255,255,255,0.1);
    --primary-white: #ffffff;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--color-body);
    background-color: var(--bg-body);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Header / Navbar --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: var(--bg-body);
    transition: background-color 0.3s;
}

.logo-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 260px;
    height: 80px;
}

.logo-light,
.logo-dark {
    position: absolute;
    top: 0;
    left: 0;
    max-height: 80px;
    width: auto;
    transition: opacity 0.35s ease;
}

.logo-light {
    opacity: 1;
}

.logo-dark {
    opacity: 0;
}

[data-theme="dark"] .logo-light {
    opacity: 0;
}

[data-theme="dark"] .logo-dark {
    opacity: 1;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-gray);
    font-size: 0.9rem;
    border-bottom: 1px solid transparent;
    transition: all 0.3s;
    padding: 4px 0;
}

.nav-links a:hover {
    color: var(--color-body);
    border-bottom-color: var(--text-gray);
}

/* --- Theme Toggle Switch --- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    border-radius: 34px;
    transition: 0.3s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #122b24;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: #444;
}

input:checked + .slider::before {
    transform: translateX(24px);
    background-color: #fff;
}

.switch input:active + .slider::before {
    width: 24px;
}

.switch input:checked:active + .slider::before {
    transform: translateX(20px);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-red);
    color: var(--primary-white);
}

.btn-primary:hover {
    background-color: var(--primary-red-hover);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    color: var(--primary-white);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* --- Hero Section --- */
.hero {
    position: relative;
    background-image: url('../images/hero.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 15px;
    margin: 20px 5%;
    padding: 80px 50px;
    color: var(--white);
    display: flex;
    align-items: center;
    min-height: 420px;
    isolation: isolate;
    overflow: hidden;
    image-rendering: auto;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 20, 50, 0.75) 0%,
        rgba(0, 40, 70, 0.5) 40%,
        rgba(0, 20, 50, 0.7) 100%
    );
    z-index: 1;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(214, 61, 70, 0.15) 0%, transparent 60%);
    z-index: 2;
    animation: heroGlow 6s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.hero-content {
    position: relative;
    z-index: 3;
    width: 100%;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 15px;
    color: #ffffff;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    max-width: 500px;
    color: #ffffff;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* --- Portfolio Section --- */
.portfolio {
    padding: 80px 5%;
    text-align: center;
    content-visibility: auto;
    contain-intrinsic-size: 700px;
}

.portfolio h2 {
    font-size: 2rem;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.portfolio-subtitle {
    color: var(--text-gray);
    margin-bottom: 50px;
    font-size: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.portfolio-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.portfolio-card {
    width: 288px;
    height: 224px;
    background-color: var(--bg-body);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

.card-img-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-link {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 1.2rem;
    color: var(--text-gray);
    transition: transform 0.3s;
}

.portfolio-card:hover .card-link {
    transform: translateX(4px);
}

/* --- Theme transition overlay --- */
.theme-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    background: rgba(0, 0, 0, 0.03);
    transition: opacity 0.25s ease, backdrop-filter 0.25s ease;
}

.theme-overlay.active {
    opacity: 1;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(0, 0, 0, 0.06);
}



/* --- About Section --- */
.about {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 5%;
    gap: 60px;
    max-width: 1100px;
    margin: 0 auto;
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

.about-images {
    position: relative;
    flex: 1;
}

.img-main {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.img-small {
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 200px;
    border-radius: 10px;
    border: 5px solid var(--bg-body);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.about-text {
    flex: 1;
}

.about-text .label {
    color: var(--primary-red);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.about-text h2 {
    font-size: 2.2rem;
    margin: 10px 0 20px;
    color: var(--color-body);
}

.about-text p {
    color: var(--text-gray);
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* --- Contact Section --- */
.contact {
    text-align: center;
    padding: 80px 5% 100px;
    max-width: 700px;
    margin: 0 auto;
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

.contact h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--color-body);
}

.contact > p {
    color: var(--text-gray);
    margin-bottom: 40px;
}

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

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    padding: 12px 15px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    color: var(--input-color);
    outline: none;
    transition: border 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-red);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.btn-submit {
    margin-top: 25px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    padding: 12px 40px;
}

/* --- Footer --- */
.footer {
    background-color: var(--bg-body);
    color: var(--footer-text);
    padding: 40px 5% 30px;
    margin-top: 60px;
    border-top: 1px solid rgba(128, 128, 128, 0.15);
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}

.footer-info h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--footer-heading);
    margin-bottom: 5px;
}

.footer-links {
    display: flex;
    gap: 25px;
}

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--footer-heading);
}

.footer-copy {
    font-size: 0.8rem;
    padding-top: 20px;
    border-top: 1px solid var(--footer-border);
    width: 100%;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px 5%;
    }

    .hero {
        padding: 50px 25px;
        margin: 15px 4%;
        min-height: 300px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .about {
        flex-direction: column;
        padding: 60px 5%;
        gap: 40px;
    }

    .img-small {
        left: 10px;
        bottom: -20px;
        width: 130px;
    }

    .form-row {
        flex-direction: column;
    }

    .portfolio-grid {
        gap: 20px;
    }

    .portfolio-card {
        width: 100%;
        max-width: 350px;
        height: 200px;
    }

    .contact {
        padding: 60px 5% 80px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 40px 20px;
        margin: 10px 3%;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .portfolio h2 {
        font-size: 1.6rem;
    }

    .about-text h2 {
        font-size: 1.6rem;
    }

    .contact h2 {
        font-size: 1.6rem;
    }
}

/* --- Animations --- */

/* Navbar slide in */
@keyframes navSlideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.anim-nav-in {
    animation: navSlideIn 0.6s ease forwards;
}

/* Hero title */
@keyframes heroTitleUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.anim-hero-title {
    animation: heroTitleUp 0.7s ease 0.2s both;
}

.anim-hero-p {
    animation: heroTitleUp 0.7s ease 0.4s both;
}

.anim-hero-btns {
    animation: heroTitleUp 0.7s ease 0.6s both;
}

/* Generic fade + slide up for scroll */
@keyframes fadeSlideUp {
    from {
        transform: translateY(35px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.anim-in {
    animation: fadeSlideUp 0.6s ease both;
}

/* Portfolio cards stagger on scroll */
@keyframes cardIn {
    from {
        transform: translateY(40px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.anim-card-in {
    animation: cardIn 0.5s ease both;
}

/* Initial hidden states for scroll elements */
.about .label,
.about h2,
.about p,
.about .btn,
.about-images,
.about-text,
.contact h2,
.contact > p,
.contact-form,
.contact-form .form-group,
.btn-submit,
.portfolio h2,
.portfolio-subtitle,
.portfolio-card {
    opacity: 0;
}
