/* --- 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;
    -webkit-tap-highlight-color: transparent;
}

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: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    max-width: 1000px;
    margin: 0 auto;
}

.portfolio-card {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #09090b;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    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 35px rgba(0, 0, 0, 0.35);
}

.card-img-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.portfolio-grid > :nth-child(2) .card-img-wrapper img,
.portfolio-grid > :nth-child(3) .card-img-wrapper img,
.portfolio-grid > :nth-child(5) .card-img-wrapper img {
    object-fit: cover;
}

.card-link {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.3rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.portfolio-card:hover .card-link {
    background: #22c55e;
    transform: rotate(-45deg) scale(1.1);
}

/* --- 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;
}

.form-message {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 8px;
    display: none;
}

.form-message.success {
    display: block;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.form-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Social Section --- */
.social-section {
    text-align: center;
    padding: 60px 5%;
}

.social-section h2 {
    font-size: 1.8rem;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.social-section p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 30px;
    opacity: 0.7;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    color: #fff;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.social-btn.instagram {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #f77737);
}

.social-btn:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* --- 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);
}

.instagram-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #f77737);
    color: #fff;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.instagram-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(131, 58, 180, 0.4);
}

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

/* --- Responsive --- */

/* Tablets and small laptops */
@media (max-width: 1024px) {
    .hero {
        padding: 60px 35px;
        min-height: 360px;
    }

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

    .about {
        gap: 40px;
    }

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

/* Landscape phones and small tablets */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 5%;
    }

    .logo-container {
        width: 180px;
        height: 60px;
    }

    .logo-light,
    .logo-dark {
        max-height: 60px;
    }

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

    .nav-links a {
        font-size: 0.85rem;
        padding: 8px 0;
    }

    .switch {
        width: 44px;
        height: 24px;
    }

    .slider::before {
        height: 18px;
        width: 18px;
    }

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

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

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

    .hero p {
        font-size: 1rem;
        max-width: 100%;
    }

    .hero-buttons {
        gap: 12px;
    }

    .about {
        flex-direction: column;
        padding: 50px 5%;
        gap: 35px;
    }

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

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

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .portfolio {
        padding: 50px 5%;
    }

    .portfolio-grid {
        gap: 15px;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .portfolio-card {
        aspect-ratio: 4 / 3;
    }

    .contact {
        padding: 50px 5% 70px;
    }

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

    .footer {
        padding: 30px 5% 20px;
    }
}

/* Portrait phones */
@media (max-width: 480px) {
    .navbar {
        padding: 10px 4%;
        gap: 10px;
    }

    .logo-container {
        width: 150px;
        height: 50px;
    }

    .logo-light,
    .logo-dark {
        max-height: 50px;
    }

    .nav-links {
        gap: 10px;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 6px 0;
    }

    .hero {
        padding: 35px 18px;
        margin: 8px 3%;
        min-height: 260px;
        border-radius: 10px;
    }

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

    .hero p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .hero-buttons .btn {
        text-align: center;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .portfolio {
        padding: 40px 4%;
    }

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

    .portfolio-subtitle {
        font-size: 0.9rem;
        margin-bottom: 30px;
    }

    .about {
        padding: 40px 4%;
        gap: 30px;
    }

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

    .about-text p {
        font-size: 0.9rem;
    }

    .img-small {
        width: 100px;
        bottom: -15px;
        left: 10px;
    }

    .contact {
        padding: 40px 4% 60px;
    }

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

    .contact > p {
        font-size: 0.9rem;
        margin-bottom: 25px;
    }

    .form-group input,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px;
    }

    .btn-submit {
        width: 100%;
        padding: 12px;
        text-align: center;
    }

    .footer {
        padding: 25px 4% 15px;
    }

    .footer-info h3 {
        font-size: 1.1rem;
    }

    .footer-links {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Small phones */
@media (max-width: 360px) {
    .logo-container {
        width: 120px;
        height: 40px;
    }

    .logo-light,
    .logo-dark {
        max-height: 40px;
    }

    .nav-links {
        gap: 8px;
    }

    .nav-links a {
        font-size: 0.75rem;
    }

    .hero {
        padding: 25px 15px;
        min-height: 220px;
    }

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

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

    .portfolio-card {
        height: 160px;
    }

    .img-small {
        width: 80px;
        bottom: -10px;
    }
}

/* Landscape orientation on phones */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 200px;
        padding: 30px 25px;
    }

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

    .hero p {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }

    .navbar {
        padding: 8px 5%;
        gap: 8px;
    }

    .logo-container {
        width: 140px;
        height: 45px;
    }

    .logo-light,
    .logo-dark {
        max-height: 45px;
    }
}

/* Ensure touch targets are adequate on touch devices */
@media (hover: none) and (pointer: coarse) {
    .nav-links a {
        padding: 10px 0;
    }

    .portfolio-card {
        cursor: default;
    }

    .btn,
    .btn-submit {
        padding: 12px 25px;
    }
}

/* --- 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;
}
