/* =========================
   RESET
========================= */

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

/* =========================
   THEME VARIABLES
========================= */

:root {
    --bg: #f4f4f4;
    --surface: #ffffff;

    --text: #222;
    --text-muted: #555;

    --header-bg: #ffffff;
    --header-text: #222;

    --shadow: 0 2px 8px rgba(0, 0, 0, .08);
    --shadow-hover: 0 6px 18px rgba(0, 0, 0, .13);

    --radius-lg: 25px;
    --radius-md: 10px;

    --transition: 0.25s ease;
}

/* =========================
   DARK MODE
========================= */

[data-theme="dark"] {
    --bg: #121212;
    --surface: #1e1e1e;

    --text: #f5f5f5;
    --text-muted: #b5b5b5;

    --header-bg: #1a1a1a;
    --header-text: #f5f5f5;

    --shadow: 0 2px 8px rgba(0,0,0,.35);
    --shadow-hover: 0 6px 18px rgba(0,0,0,.5);
}

/* logo fix */
[data-theme="dark"] .logo {
    filter: invert(1) brightness(1.2);
}

/* =========================
   BASE
========================= */

body {
    font-family: "Space Grotesk", sans-serif;
    background: var(--bg);
    color: var(--text);

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    transition: background-color .3s ease, color .3s ease;
}

/* =========================
   HEADER
========================= */

header {
    background: var(--header-bg);
    color: var(--header-text);

    padding: 2rem 1rem;
    position: relative;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

header h1 {
    font-size: 2rem;
    margin-bottom: .3rem;
}

header p {
    font-size: .95rem;
    line-height: 1.4;
    opacity: .9;
}

.logo {
    width: 90px;
    height: auto;
    border-radius: var(--radius-md);
}

/* =========================
   THEME TOGGLE
========================= */

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;

    width: 30px;
    height: 30px;

    border: none;
    border-radius: 50%;
    cursor: pointer;

    background: rgba(255,255,255,.15);
    color: var(--header-text);

    font-size: 1rem;

    transition: transform .2s ease, background .2s ease;
}

.theme-toggle:hover {
    transform: scale(1.08);
    background: rgba(255,255,255,.25);
}

/* =========================
   LAYOUT
========================= */

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    font-size: .8rem;
    color: #888;
}

/* =========================
   PROJECT
========================= */

.project {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;

    box-shadow: var(--shadow);

    transition:
        background-color .3s ease,
        color .3s ease,
        transform .25s ease,
        box-shadow .25s ease;
}

.project summary {
    list-style: none;
    cursor: pointer;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;

    font-size: 1.4rem;
    font-weight: 500;

    user-select: none;
}

.project summary::-webkit-details-marker,
.project summary::marker {
    display: none;
}

.project summary::after {
    content: "▾";
    font-size: 1rem;
    color: #777;
    transition: transform .3s ease;
}

.project[open] summary::after {
    transform: rotate(180deg);
}

/* =========================
   COLLAPSE ANIMATION
========================= */

.project-content {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;

    transition: grid-template-rows .35s ease, opacity .25s ease;
}

.project-content > * {
    overflow: hidden;
}

.project[open] .project-content {
    grid-template-rows: 1fr;
    opacity: 1;
}

/* =========================
   PROJECT LAYOUT
========================= */

.project-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1rem;
    align-items: center;
    margin-top: 1.5rem;
}

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

.project-image img {
    width: 400px;
    height: 400px;
    object-fit: cover;
    border-radius: 10%;
}

.project-description {
    max-width: 400px;
    margin: 1rem auto 0;

    font-size: 1rem;
    line-height: 1.6;
    text-align: justify;

    color: var(--text-muted);
}

/* =========================
   PRODUCTS
========================= */

.project-products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 120px));
    gap: .5rem;
    justify-content: center;  /* horizontal center */
    align-content: center;    /* vertical center */

    height: 100%;
}

/* =========================
   CARD
========================= */

.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow: var(--shadow);

    transition:
        background-color .3s ease,
        color .3s ease,
        transform .25s ease,
        box-shadow .25s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.card-body {
    flex: 1;
    padding: .9rem;

    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.card-title {
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;

    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;

    overflow: hidden;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 768px) {

    .header-content {
        flex-direction: column;
        text-align: center;
    }
    .logo {
        width: 70px;
    }

    .project-layout {
        grid-template-columns: 1fr;
    }

    .project-products {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .project-image img {
        width: 100%;
        max-width: 100%;
        height: auto;
        object-fit: contain;
        display: block;
    }

    .project-description {
        max-width: 100%;
    }
}