/* ========================================
   GENERAL
======================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 48px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f4f2;
    color: #1d1d1f;
}

h1 {
    margin: 0 0 32px 0;
    font-size: 36px;
    letter-spacing: -1.2px;
}


/* ========================================
   FORMULARI AFEGIR PROJECTE
======================================== */

body > form {
    display: flex;
    align-items: flex-end;
    gap: 12px;

    padding: 20px;
    margin-bottom: 40px;

    background: #ffffff;
    border: 1px solid #dedede;
    border-radius: 12px;
}

body > form label {
    font-size: 12px;
    font-weight: 600;
}


/* ========================================
   INPUTS
======================================== */

input {
    width: 100%;
    padding: 10px 12px;

    font: inherit;

    background: #ffffff;
    border: 1px solid #d5d5d5;
    border-radius: 6px;

    outline: none;
}

input:focus {
    border-color: #555555;
}


/* ========================================
   BOTONS
======================================== */

button {
    padding: 10px 14px;

    font: inherit;
    font-size: 14px;
    font-weight: 600;

    color: #222222;
    background: #eeeeee;

    border: 0;
    border-radius: 6px;

    cursor: pointer;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

button:hover {
    background: #dddddd;
}

button:active {
    transform: scale(0.97);
}


/* ========================================
   GRAELLA DE PROJECTES
======================================== */

.projectes {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(300px, 1fr));

    gap: 20px;
}


/* ========================================
   TARGETA DE PROJECTE
======================================== */

.projecte {
    padding: 24px;

    background: #ffffff;

    border: 1px solid #dedede;
    border-radius: 12px;
}


/* ========================================
   TIPOGRAFIA PROJECTE
======================================== */

.projecte h3 {
    margin: 0 0 8px 0;

    font-size: 11px;
    font-weight: 700;

    color: #888888;

    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.projecte h2 {
    margin: 0 0 22px 0;

    font-size: 25px;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.projecte p {
    margin: 7px 0;

    font-size: 14px;
    line-height: 1.4;

    color: #555555;
}


/* ========================================
   FORMULARIS DINS DEL PROJECTE
======================================== */

.projecte form {
    margin: 10px 0 0 0;
}


/* ========================================
   AFEGIR HORES
======================================== */

.projecte form:first-of-type {
    display: flex;
    gap: 8px;

    margin-top: 22px;
    padding-top: 20px;

    border-top: 1px solid #eeeeee;
}

.projecte form:first-of-type input[type="number"] {
    min-width: 0;
}

.projecte form:first-of-type button {
    white-space: nowrap;
}


/* ========================================
   PROJECTE FINALITZAT
======================================== */

.projecte p:nth-last-of-type(1) {
    font-weight: 600;
}


/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 900px) {

    body {
        padding: 30px;
    }

    body > form {
        align-items: stretch;
        flex-direction: column;
    }

}


@media (max-width: 600px) {

    body {
        padding: 20px;
    }

    h1 {
        font-size: 30px;
    }

    .projectes {
        grid-template-columns: 1fr;
    }

}

/* ========================================
   CAPÇALERA
======================================== */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 32px;
}

header h1 {
    margin: 0;
}


/* ========================================
   TANCAR SESSIÓ
======================================== */

header a {
    padding: 10px 14px;

    font-size: 13px;
    font-weight: 600;

    color: #555555;
    text-decoration: none;

    background: #ffffff;

    border: 1px solid #d5d5d5;
    border-radius: 6px;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

header a:hover {
    background: #eeeeee;
    color: #111111;
}

/* ========================================
   EDITAR PROJECTE
======================================== */

.editar-projecte {
    margin-top: 18px;
    border-top: 1px solid #eeeeee;
    border-bottom: 1px solid #eeeeee;
}


/* TÍTOL DEL DESPLEGABLE */

.editar-projecte summary {
    padding: 14px 0;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
    user-select: none;

    list-style: none;

    transition: opacity 0.15s ease;
}

.editar-projecte summary:hover {
    opacity: 0.6;
}


/* TREURE LA FLETXA PER DEFECTE */

.editar-projecte summary::-webkit-details-marker {
    display: none;
}


/* AFEGIR LA NOSTRA FLETXA */

.editar-projecte summary::after {
    content: "+";

    float: right;

    font-size: 18px;
    font-weight: 400;
    line-height: 1;
}


/* QUAN ESTÀ OBERT */

.editar-projecte[open] summary::after {
    content: "−";
}


/* ========================================
   FORMULARI D'EDICIÓ
======================================== */

.editar-projecte form {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 8px 14px;

    padding: 6px 0 18px 0;
}


/* LABELS */

.editar-projecte label {
    font-size: 11px;
    font-weight: 600;

    color: #777777;

    text-transform: uppercase;
    letter-spacing: 0.05em;
}


/* CAMPS */

.editar-projecte input {
    margin-bottom: 8px;
}


/* BOTÓ GUARDAR */

.editar-projecte button {
    grid-column: 1 / -1;

    margin-top: 4px;

    padding: 12px;

    background: #222222;
    color: #ffffff;
}

.editar-projecte button:hover {
    background: #444444;
}