/*
Theme Name: Possible Joan Casado
Theme URI: https://possiblestudi.com
Author: Joan Casado
Description: Possible Studio Portfolio
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: portfolio-designer
*/

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

::selection { background: rgb(255, 0, 255); color: #000000; }

/* ── Loading screen ── */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 15px;
    transform: translateY(-100%);
    transition: transform 0.7s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.6s ease;
}

#loading-screen.visible { transform: translateY(0); }

#loading-screen.exit {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.loading-image { width: 100%; height: auto; display: block; }

.loading-text {
    text-align: center;
    font-size: 22px;
    margin-top: 15px;
    padding-bottom: 15px;
}

/* ── Base ── */
html, body {
    background: #ffffff;
    color: #000000;
    font-family: Times, serif;
    font-size: 18px;
    line-height: 19px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* ── Layout ── */
.site-wrapper {
    margin: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header labels (fixed) ── */
.header-labels {
    position: fixed;
    top: 15px;
    left: 15px;
    width: calc(80vw - 30px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    z-index: 10;
}

.header-phonetic { font-style: italic; }

/* ── Header text (scrolls) ── */
.header-right,
.project-info-right { font-style: italic; }

.site-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: calc(80vw - 30px);
    padding-top: 25px;
    margin-bottom: 15px;
}

.site-header p + p,
.project-info p + p { margin-top: 4px; }

/* ── Main content ── */
.site-content { flex: 1; }

/* ── Projects grid ── */
.projects-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    gap: 30px;
    width: 100%;
}

.projects-grid::-webkit-scrollbar { display: none; }

.project-item {
    flex: 0 0 calc((80vw - 45px) / 2);
    display: flex;
    flex-direction: column;
}

.project-item a { display: block; }
.project-item > a:first-child { flex: 1; min-height: 0; }

.project-item img,
.project-item .project-placeholder {
    width: 100%;
    aspect-ratio: 4 / 5;
    height: auto;
    object-fit: cover;
    display: block;
}

.project-placeholder { background: #f0f0f0; }

/* ── Home: tot a la pantalla ── */
body.page-home { overflow: hidden; }

body.page-home .site-wrapper {
    min-height: unset;
    height: calc(100vh - 30px);
    overflow: hidden;
}
body.page-home .site-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
body.page-home .projects-grid {
    flex: 1;
    min-height: 0;
}
body.page-home .project-item {
    flex: 0 0 calc((100vh - 200px) * 4 / 5);
    height: 100%;
}
body.page-home .project-item img,
body.page-home .project-item .project-placeholder {
    aspect-ratio: unset;
    height: 100%;
    width: 100%;
}

.project-title {
    margin-top: 4px;
    font-size: 16px;
    line-height: 17px;
}

.title-phonetic { display: none; font-style: italic; }
.project-item.has-phonetic:hover .title-main,
.project-item.has-phonetic.scroll-active .title-main { display: none; }
.project-item.has-phonetic:hover .title-phonetic,
.project-item.has-phonetic.scroll-active .title-phonetic { display: inline; }

.project-type {
    font-size: 16px;
    line-height: 17px;
    min-height: 17px;
}

/* ── Single project ── */
.project-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: calc(80vw - 30px);
    padding-top: 25px;
}

.project-content {
    width: 80%;
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.project-content img { width: 100%; height: auto; display: block; }

.project-content figure,
.project-content [class*="wp-block-"] { margin: 0; }

.project-content .wp-block-columns { gap: 15px; }

.project-back {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: calc(80vw - 30px);
    font-size: 16px;
    line-height: 17px;
}

.phonetic-inline { display: none; }

/* ── Footer ── */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 15px;
    font-size: 16px;
    line-height: 17px;
}

.footer-nav ul { display: flex; }
.footer-nav li + li::before { content: '\00a0/\00a0'; }

.footer-right { text-align: right; }

/* ── Credits overlay ── */
#credits-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#credits-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.credits-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 18px;
    line-height: 1;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.credits-content { text-align: center; }
.credits-content p + p { margin-top: 4px; }
.credits-content a { text-decoration: underline; text-decoration-thickness: 1px; }


/* ── Mobile ── */
@media (max-width: 768px) {
    .loading-text { margin-top: 10px; }

    .header-labels {
        width: calc(100% - 30px);
        overflow: hidden;
    }

    .site-header {
        grid-template-columns: 1fr;
        width: 100%;
        padding-top: 25px;
    }

    .header-phonetic {
        transform: translateY(-200%);
        opacity: 0;
        transition: transform 0.4s ease, opacity 0.3s ease;
    }

    .scrolled .header-phonetic {
        transform: translateY(0);
        opacity: 1;
    }

    .phonetic-inline { display: block; }

    .project-info {
        grid-template-columns: 1fr;
        width: 100%;
        padding-top: 25px;
    }

    .project-content { width: 100%; }

    .project-back {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 0;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .site-footer .project-back { margin-bottom: 26px; }

    .footer-right { text-align: left; }

    body.page-home { overflow: auto; }
    body.page-home .site-wrapper { height: auto; }

    .projects-grid {
        flex-direction: column;
        overflow-x: visible;
        height: auto;
        width: 100%;
    }

    .project-item {
        flex: none;
        width: 100%;
        height: auto;
    }

    .project-item > a:first-child { flex: none; display: block; }

    .project-item img,
    .project-item .project-placeholder,
    body.page-home .project-item img,
    body.page-home .project-item .project-placeholder {
        aspect-ratio: 4 / 5;
        height: auto;
        width: 100%;
    }
}
