/* CSS for project.html */

.title {
    font-size: 3rem;
    text-align: center;
}

section {
    padding-top: 4vh;
    padding-bottom: 1vh;
    /* Add bottom padding */
    height: auto;
    /* Allow natural height */
    min-height: 96vh;
    /* Minimum viewport height */
    margin: 0 10rem;
    margin-bottom: 1rem;
    /* Add bottom margin */
    box-sizing: border-box;
}

.section_text_p1 {
    text-align: center;
    margin-bottom: 2rem;
    color: rgb(85, 85, 85);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.about-containers {
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    /* Subtle bottom margin */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-auto-rows: minmax(auto, max-content);
    /* Prevent excessive row expansion */
    align-items: center;
    /* Center cards vertically in their grid cells */
    max-width: 1250px;
    margin-left: auto;
    margin-right: auto;
    word-spacing: -0.03em;
    /* fixed missing semicolon */
}

.details-container {
    padding: 1.5rem;
    background: white;
    border-radius: 2rem;
    border: rgb(53, 53, 53) 0.1rem solid;
    border-color: rgb(163, 163, 163);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
    align-items: center;
    /* Center content horizontally */
    transition: all 300ms ease;
}

.details-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: rgb(100, 100, 100);
}

.experience-sub-title {
    color: rgb(85, 85, 85);
    font-weight: 600;
    font-size: 1.15rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    flex-shrink: 0;
    /* Don't allow title to shrink */
}

.btn-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    /* Normal spacing from title */
    flex-shrink: 0;
    /* Don't allow buttons to shrink */
}

.project-btn {
    color: black;
    font-weight: 400;
    padding: 0.5rem 1.25rem;
    border-radius: 1.5rem;
    background: white;
    transition: all 300ms ease;
    border-color: rgb(163, 163, 163);
    border: rgb(53, 53, 53) 0.1rem solid;
}

.project-btn:hover {
    background: black;
    color: white;
    border-color: black;
}

.project-img {
    width: 100%;
    height: 450px;
    /* fixed display height */
    object-fit: contain;
}

/* Flip container */
.flip-card {
    background: transparent;
    width: 100%;
    height: 450px;
    perspective: 1000px;
    /* Needed for 3D effect */
    display: flex;
    justify-content: space-between;
}

/* When flipped to details, allow flexible height */
.flip-card.flipped.showing-details {
    height: auto;
    min-height: 300px;
}

/* Inner wrapper */
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

/* When flipped to details, allow flexible height for inner wrapper */
.flip-card.flipped.showing-details .flip-card-inner {
    height: auto;
    min-height: 300px;
}

/* Front and Back faces */
.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    /* hide back when facing front */
    border-radius: 1rem;
}

/* When showing details, allow flexible height for back face */
.flip-card.flipped.showing-details .flip-card-back {
    position: relative;
    height: auto;
    min-height: 300px;
}

/* Front face */
.flip-card-front {
    z-index: 2;
}

.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    display: none;
    /* hide by default */
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1rem;
    flex-direction: column;
}

.flip-card-back iframe {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0.75rem;
    object-fit: contain;
}

/* Show only the active one */
.flip-card-back.active {
    display: flex;
}

/* Flipped state */
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

/* ====== DETAILS PANEL TYPOGRAPHY BASE ====== */
.details-back {
    flex-direction: column;
    align-items: flex-start;
    /* left align all items */
    justify-content: flex-start;
    text-align: left;
    padding: 1rem;
    gap: 0.75rem;

    /* Set the typographic base for description & chips */
    font-size: 0.8rem;
    /* <— base size, chips will be smaller via em */
}

/* Title */
.details-title {
    font-size: 1.5rem;
    font-weight: 600;
    width: 100%;
    text-align: left;
}

/* Description box — inherits panel font-size */
.details-description {
    border-radius: 0.75rem;
    padding: 1rem;
    width: 100%;
    font-size: 1em;
    /* same as .details-back (the base) */
    text-align: justify;
}

.details-description p {
    margin: 0;
    height: 100%;
}

/* =======================
   Tech chips (clean tags)
   ======================= */

/* Tech stack layout */
.stack-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .6rem;
    width: 100%;
    margin: 0;
}

/* Chip pill — always a bit smaller than description */
.stack-item {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: .48rem .8rem;
    box-sizing: border-box;
    width: 100%;

    white-space: nowrap;
    /* no wrap inside chip */
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;

    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 9999px;
    background: #f3f4f6;
    color: #1f2937;

    line-height: 1.2;
    font-size: .9em;
    /* ~10% smaller than description (inherits from .details-back) */
}

.stack-item:hover {
    background: #edf0f3;
    border-color: rgba(0, 0, 0, .2);
    transform: translateY(-1px);
}

/* Dark mode (optional) */
@media (prefers-color-scheme: dark) {
    .stack-item {
        background: #0f1115;
        color: #c9d1d9;
        border-color: #2a2f36;
    }

    .stack-item:hover {
        background: #171a21;
        border-color: #384152;
    }
}

/* ------------ Layout tweaks ------------ */

/* Desktop and large screens */
@media (min-width: 1200px) {
    .stack-container {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

/* Large tablets and small desktops */
@media (max-width: 1199px) and (min-width: 992px) {
    .stack-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Tablets */
@media (max-width: 991px) and (min-width: 769px) {
    .stack-container {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    }

    /* scale both by changing the base only */
    .details-back {
        font-size: 0.75rem;
    }
}

/* Small tablets and large phones */
@media (max-width: 768px) and (min-width: 481px) {
    .stack-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .details-back {
        font-size: 0.72rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .stack-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: .5rem;
    }

    .details-back {
        font-size: 0.70rem;
        gap: 0.6rem;
        padding: 0.8rem;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .stack-container {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: .4rem;
    }

    .details-back {
        font-size: 0.65rem;
    }
}

/* Bottom link buttons */
.details-links {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
}

.details-btn {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid #333;
    border-radius: 0.75rem;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    color: black;
    background: #f2f2f2;
    transition: all 300ms ease;
}

.details-btn:hover {
    background: black;
    color: white;
}

/* Icon button specific styles */
.details-btn.icon-btn {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.details-btn.icon-btn i {
    line-height: 1;
}

.article-container {
    display: flex;
    flex-direction: column;
    /* Stack flip card and title vertically */
    align-items: center;
    width: 100%;
}

/* Badges */
.achievement-badge {
    display: inline-block;
    padding: 0.4rem 0.6rem;
    border-radius: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: left;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    text-transform: none;
    letter-spacing: normal;
    align-self: center;
    width: fit-content;
}

.achievement-badge.participant {
    background: #e8f4ff;
    color: #2563eb;
    border: 1px solid #93c5fd;
}

.achievement-badge.finalist {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fbbf24;
}

/* =======================
   Responsive
   ======================= */

/* Large tablets and small desktops */
@media screen and (max-width: 1200px) {
    section {
        margin: 0 5rem;
    }

    .about-containers {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
        max-width: 1000px;
    }

    .flip-card {
        height: 400px;
    }

    .project-img {
        height: 400px;
    }
}

/* Tablets */
@media screen and (max-width: 768px) {
    section {
        margin: 0 2rem;
        padding-top: 3vh;
    }

    .title {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .section_text_p1 {
        font-size: 1rem;
        padding: 0 0.5rem;
    }

    .about-containers {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 1.5rem;
    }

    .details-container {
        padding: 1.2rem;
    }

    .flip-card {
        height: 350px;
    }

    .project-img {
        height: 350px;
    }

    .experience-sub-title {
        font-size: 1rem;
        margin-top: 1rem;
    }

    .btn-container {
        gap: 0.8rem;
        margin-top: 0.8rem;
    }

    .project-btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }

    .flip-card-back {
        padding: 0.8rem;
    }

    .details-title {
        font-size: 1.3rem;
    }

    /* description & chips scale from .details-back font-size */
    .details-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .details-btn.icon-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.1rem;
    }
}

/* Mobile phones */
@media screen and (max-width: 480px) {
    section {
        margin: 0 1rem;
        padding-top: 2vh;
    }

    .title {
        font-size: 2rem;
    }

    .section_text_p1 {
        font-size: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .about-containers {
        gap: 1.2rem;
        margin-top: 1.2rem;
    }

    .details-container {
        padding: 1rem;
    }

    .flip-card {
        height: 300px;
    }

    .project-img {
        height: 300px;
    }

    .experience-sub-title {
        font-size: 0.95rem;
        margin-top: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .btn-container {
        gap: 0.6rem;
        margin-top: 0.6rem;
    }

    .project-btn {
        padding: 0.35rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 1rem;
    }

    .flip-card-back {
        padding: 0.6rem;
    }

    .details-title {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }

    .details-links {
        gap: 0.8rem;
        margin-top: 0.8rem;
    }

    .details-btn {
        padding: 0.4rem;
        font-size: 0.75rem;
    }

    .details-btn.icon-btn {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 1rem;
    }

    .achievement-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }
}

/* Extra small devices */
@media screen and (max-width: 320px) {
    section {
        margin: 0 0.5rem;
    }

    .title {
        font-size: 1.8rem;
    }

    .details-container {
        padding: 0.8rem;
    }

    .flip-card {
        height: 250px;
    }

    .project-img {
        height: 250px;
    }

    .experience-sub-title {
        font-size: 0.9rem;
    }

    .project-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .details-title {
        font-size: 1rem;
    }
}

/* Disable hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .details-container:hover {
        transform: none;
        box-shadow: none;
        border-color: rgb(163, 163, 163);
    }

    .project-btn:hover {
        background: white;
        color: black;
        border-color: rgb(163, 163, 163);
    }

    .details-btn:hover {
        background: #f2f2f2;
        color: black;
    }
}

/* Shrink the flipped details card to its content on small screens */
@media (max-width: 768px) {
    .flip-card.flipped.showing-details {
        height: auto;
        min-height: 0;
    }

    .flip-card.flipped.showing-details .flip-card-inner {
        height: auto;
        min-height: 0;
    }

    .flip-card.flipped .details-back.active {
        height: auto;
        min-height: 0;
    }

    .flip-card-back.active {
        /* height: auto; */
        min-height: 0;
    }
}