/*
Theme Name: trotalibros
Theme URI: https://www.trotalibros.com
Author: Iquadrat
Author URI: https://iquadrat.com
Description: Custom WordPress theme built from scratch.
Version: 0.1.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
Text Domain: trotalibros
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

*,
*::before,
*::after { box-sizing: border-box; }

:root {
    --bg : #FAF8F7;
    --primary: #00416A;
    --accent: #FFC000;
    --white: #fff;
    --disabled: #dadada; 
    --disabled-text: #909090;
}

html, body { margin: 0; padding: 0; font-size: 18px; }

body {
    font-family: "brandon-grotesque", sans-serif;
    background-color: var(--bg);
    color: var(--primary)
}

a {
    color: inherit;
}

button {
    font-size: inherit;
    outline: none;
}

.btn, .woocommerce-button  {
    font-size: .875rem;
    letter-spacing: 1.5px;
    font-weight: 500;
    text-transform: uppercase;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--tl-speed) ease;
    display: inline-block;
    &.cta {
        background-color: var(--primary);
        color: var(--white);
        padding: .5rem 1rem;
        border: 2px solid var(--primary);
    
        &:hover {
            background-color: var(--bg);
            color: var(--primary);
        }    
    }
    &.non-cta {
        color: var(--primary);
        background-color: var(--bg);
        padding: .25rem .5rem;
        border: 2px solid var(--primary);
        &.active {
            border-color: var(--bg);
            cursor: default;
        }
    }
}

main {
    display: flex;
    flex-direction: column;
    gap: 5rem;
    margin-bottom: 10rem;
    
    .content {
        max-width: 50ch;
        margin:auto;
        font-size: 1.15rem;
    }
}

.autor-img {
    aspect-ratio: 1 / 1;
    object-fit: cover!important;
    border-radius: 100rem;
}

.container {
    max-width: 1320px;
    padding: 0 1rem;
    width: 100%;
    margin: auto;
    /*
    @media (max-width: 1920px) {
        max-width: 1660px;
    }*/
    @media (min-width: 1440px) {
        max-width: 1320px;
    }     
    @media (min-width: 1600px) {
        max-width: 1440px;
    }    
   
}

.section {
    padding: 8rem 0;
}

.hero, .swiper.hero {
    min-height: calc(100dvh - 16rem);
    justify-content: center;
    display: flex;
    flex-direction: column;
}

.big-h {
    font-size: 3rem;
    line-height: 3.5rem;
    text-transform: uppercase;
    font-weight: 400;
}

section.flex-column {
    justify-content: center;
    align-items: center;
    text-align:center;
}
.flex-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;    
}

.intro {
    > * {
        max-width: 40rem;
        text-align: center;    
        text-wrap: balance;    
    }
}

.tl-slider {

    display: flex;
    align-items: center;
    .tl-slide {
        display: flex;
        align-items:center;

        @media (max-width: 992px) {
            flex-direction: column!important;  
        } 

        > * {
            flex: 1;
        }
        > figure img {
            max-width: 100%;
            max-height: 50dvh;
            height: auto;
            border-radius: .75rem;
            object-fit: cover;
        }
        .tl-slide-content > div{
            width: calc(100% - 33.3%);
            margin: auto;
            display: flex;
            flex-direction: column;
            gap: 2rem;
            @media (max-width: 576px) {
                width: calc(100%);
                gap: 1.5rem;  
            }             
            > * { margin: 0;}
            .tl-author, .tl-book {
                font-size: .875rem;
                letter-spacing: 2px;
                text-transform: uppercase;
                line-height: 1.5;
            }
            .tl-book { font-weight: 600; }
            h3 {
                font-size: 2rem;
                line-height: 1.2;
                font-weight: 400;
                letter-spacing: 1px;
                text-transform: initial;
                text-align: initial;
            }
        }
        &.right {
            flex-direction: row-reverse;
        }
    }
}

.swiper-wrapper {
    padding-bottom: 3rem;
}
.swiper-pagination {
    gap: 1rem;
    display: flex;
    justify-content: center;
    bottom: 2rem;
    .swiper-pagination-bullet{
        background-color: var(--primary);
        opacity: 1;
    } 
    .swiper-pagination-bullet-active {  
        background-color: var(--accent);
    }
}

h2, .h2 {
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 400!important;
    letter-spacing: 1px;
    text-transform: initial;
    text-align: inherit;
}

h3, h4, .h3 {
    margin:0;
    font-size: 1.25rem;
    letter-spacing: 2px;
    line-height: 2rem;
    font-weight: 500;
    text-transform: uppercase;
    text-align: center;
    text-wrap: balance;
}

h4 { font-size: 1em;}

h5 { font-size: 1rem; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }

h3.section-title, .h3 {
    margin-bottom: 2rem;
    text-align: center;
}

section#agrupacions, section#cataleg {
    display:flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    > div {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 2rem 0;
        width: 100%;
        gap: 2rem;

        .wrapper {
            display: flex;
            flex-wrap: wrap;
            gap: 4rem;
            justify-content: center;
            a.book {
                display: flex;
                flex-basis: 224px;
                width: 224px;
                position: relative;
                flex-direction: column;
                text-decoration: none;
                align-items: center;
                gap: 1.5rem;

                > img {
                    width:100%;
                    height: auto;
                    aspect-ratio: 711 / 1024;
                    object-fit: contain;
                }
                &.packs img {
                    aspect-ratio: 1 / 1;
                }
                &.regalo img {
                    aspect-ratio: 1024 / 683;
                }
                .hover {
                    position: absolute;
                    width: 100%;
                    top: 0; left: 0;
                    opacity: 0;
                    aspect-ratio: 711 / 1024;
                    object-fit: contain;
                    /*clip-path: rect(0% 0% 100% 0%);*/
                    transition: calc(var(--tl-speed) / 3) ease-in-out;
                    > img {
                        width: 100%; height: 100%; object-fit: cover;
                    }
                }
                &:hover {
                    .hover {
                        opacity: 1;
                        position: absolute;
                        /*clip-path: rect(0% 100% 100% 0%);*/
                    }
                }

                &[href=''] {
                    pointer-events: none;
                }

                > div {
                    display: flex;
                    flex-direction: column;
                    gap: .3rem; 

                    .title, .author {
                        font-size: .875rem;
                        text-align: center;
                        text-decoration: none;
                        text-transform: uppercase;
                        letter-spacing: 1px;
                        line-height: 1.3;
                        font-weight: 600;
                    }
                    .author {
                        font-weight: 400;
                    }
                }
                &.author {
                    img {
                        aspect-ratio: 1 / 1;
                        object-fit: cover;
                        border-radius: 100rem;
                    }
                }
            }
        }
    }
}

.categories {
    font-size: .875rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1.5;
}


section#cataleg {
    margin-bottom: 4rem;
    div#categories {
        display: flex;
        gap: 1rem;
        margin-bottom: 2rem;
        @media (max-width : 768px) {
            flex-direction : column;
            gap: .5rem;
        }
    }
    > div .wrapper {
        justify-content: center;
        gap: 6rem 6rem;
    }
}

nav.pagination {
    margin: 4rem;
    ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        gap: 1rem;
        justify-content: center;
        li {
            > * { 
                border-radius: 3rem;
                display: flex;
                aspect-ratio: 1 / 1;
                align-items: center;
                justify-content: center;
                line-height: 0;
                width: 3rem;
                cursor: pointer;
                text-decoration: none; padding: 1rem; 
            }
        }
        li:has(span) > * {
            border: 2px solid var(--primary);
            cursor: initial;
        }
    }
}

.tl-youtube, .video-wrapper {
    button.tl-yt {
        background: none;
        border: none;
        position: relative;
        width: 100%;
        display: block;
        cursor: pointer;
    }
    
    button.tl-yt .tl-yt__thumb {
        aspect-ratio: 16 / 9;
        object-fit: cover;
        width: 100%;
        border-radius: .5rem;
    }
    button.tl-yt .tl-yt__play {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    iframe{
        aspect-ratio: 16 / 9;
        object-fit: cover;
        width: 100%;
        border-radius: .5rem;
        position: absolute;
        top:0; left:0;
        border: 0;
    }      
}

section#packs > .container {
    display:flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;

    .swiper {
        max-width: 100%;
        &.tl-packs .swiper-slide {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            align-items: start;
            gap: 2rem;
            @media (max-width : 768px) {
                grid-template-columns: 1fr;
            }
            * {
                flex: 1;
                &:last-child {
                    flex: 1;
                }    
            }
            > a > img { max-width: 100%;}
            .covers {
                display: flex;
                flex-wrap: wrap;
                gap: 1rem;
                justify-content: flex-start;
                a {flex: 0 0 76px;}
                img {
                    width: 76px;
                    height: auto;
                       /* do not grow, do not shrink, fixed basis */
                }
            } 
            h3,h4 { text-align: start;}
            .desc {
                display: flex;
                flex-direction: column;
                gap: 2rem;
                font-size: 1.25rem;
                > * { margin: 0; padding: 0;}
    
            }   
        }
    }
}

.half-flex {
    display: flex;
    gap: 4rem;
    align-items: center;
    @media (max-width : 768px) { flex-direction : column; }
    > * {
        flex: 1;
        padding: 0rem;
        @media (max-width : 768px) { flex : initial; padding: 0; }
    }
}

span.nowrap { white-space: nowrap; }

.profile-picture { aspect-ratio: 1 / 1; border-radius: 100rem; object-fit: cover; }

.flex-editorial {
    display: grid !important;
    grid-template-columns: 90px 1fr;
    grid-gap: 2rem;
    margin-bottom: 2rem;
    @media (max-width: 576px) {
        grid-template-columns: 1fr;
        > figure {
            margin:auto;
        }
    }
}

/* Fitxa de producte (i autor) */

.book-show-wrapper {
  display: flex;
  .book-show {
    width: 100%;
    display: flex;
    align-items: start;
    gap: 4rem; /* 8rem */
    @media (max-width : 768px) {
        flex-direction : column;
        gap: 2rem;
    }
    > * {
        flex: 1;
    }
    #book-cover {
        position: sticky;
        top: 8rem;
        align-self: start;
        display: flex;
        justify-content: center;
        @media (max-width : 768px) { position : initial; }
      img {
        max-height: calc(100dvh - 8rem - 4rem);
        max-width: 100%;
        object-fit: cover;
        margin-bottom: 4rem;
        @media (max-width : 768px) { margin-bottom : 0; }
      }
    }
    .roll-div {
      .roll-wrapper {
        padding-right: calc(130px + 2rem);
        display: flex;
        flex-direction: column;
        gap: 2.5rem;
        padding-top: 2.5rem;
        
        @media (max-width : 768px) { padding-right : initial; }

        .book-title {
          display: flex;
          align-items: start;
          gap: 1rem;
          text-transform: uppercase;
          text-wrap: balance;

            h1, h2 { text-align:start; }

          h1 {
            font-size: 2.25rem;
            line-height: 2.5rem;
            font-weight: 600;
            margin: 0;  
          }
          h2 {
            font-size: 1.5rem;
            line-height: 1.2;
            font-weight: 300;
            margin: 0;  
          }
          p {
            font-size: 1rem;
            line-height: 1.2;
            font-weight: 500;
            letter-spacing: 2px;    
            margin: .5rem 0 0 0 ;        
          }
          > img {
            /* max-width: 2.25rem;
            height: auto; */
            height: 4rem;
            max-width: initial;
            width: auto;
          }
        }
        .edicion {
            text-transform: uppercase;
            font-weight: 500;
            letter-spacing: 1px;
            border: solid 1.5px var(--primary);
            border-width: 2px 0;
            padding: .25rem 0;
            display: inline;
            line-height: 0;
            font-size: 1rem;
        }
        .sinopsis {
          font-size: 1.25rem;
          line-height: 1.5;
          ul {
              padding: 0 1rem;
          }
          blockquote {
              margin: 2rem 0;
              font-size: 1rem;
          }
          p { margin: 0 0 1rem 0;}
        }

        .articulo {
            font-size: 1.25rem;
            line-height: 1.5;
            display: flex;
            flex-direction: column;
            ul {
                padding: 0 1rem;
            }
            p { margin: 0 0 1rem 0;}
            blockquote {
                display: flex;
                flex-direction: column;
                gap: .5rem;
                font-size: 1.75rem;
                line-height: 1.2;
                font-weight: 500;
                text-wrap: balance;
                margin: 0;
            }
            figcaption {
                font-size: .875rem;
            }
        }

        .citas {
          display: flex;
          flex-direction: column;
          gap: 2rem;          
          .cita {
            display: flex;
            flex-direction: column;
            gap: .5rem;
            font-size: 1.75rem;
            line-height: 1.2;
            font-weight: 500;
            text-wrap: balance;
            .fuente {
              font-size: 1.25rem;
              font-weight: 300;
            }
          }

        }
        #ficha-tecnica {

          > * {
              margin: 0;
              display: flex;
              flex-direction: column;
              > * {
                margin: 0;
              }
          }
          .btn {
            display: flex;
            flex-direction: row;
            gap: 1ch;
            margin-bottom: 2rem;
            &:before {
                content: 'Ver ';
            }
          }

          #ficha-wrapper {
            overflow: hidden;
            max-height: 0px;
            transition: max-height var(--tl-speed) ease-out;
          }
          &.open {
            .btn:before {
                content: 'Esconder ';
              }            
            #ficha-wrapper {
                max-height: 300px;
            }            
          }
        }

      }
    }
}

#sell-wrapper {
    flex: 0;
    position: sticky;
    top: 8rem;
    align-self: start;
    z-index: 1000;
    @media (max-width : 768px) {
        top: 4.5rem;
        align-self: start;
        margin-top: -2rem;
        transform: scale(.75);   
    }

    #sell {
      position: absolute;
      right: 0;

      #badge {
        width: 130px;
        height: 130px;
        background-color: var(--accent);
        border-radius: 130px;
        display: flex!important;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        cursor: pointer;
        border:0;
        display: block;
        font-family: inherit;
        transition: .4s ease-out;
        color: inherit;

        #badge-price {
          font-size: 1.333rem;
          font-weight: 600;

          del {
            font-size: .875rem;
            font-weight: 400;
          }

        }

        #sold-out-alt {
          font-size: 1rem;
          text-align:center;
          text-wrap: balance;
          padding: 0 1rem;
          line-height:1.2;
          display: none;
        }
        #badge-estado {
            text-transform: uppercase;
        }

        &.sold-out {
          background-color: var(--disabled);
          color: var(--disabled-text);
          pointer-events: none;
          cursor: initial;
          #badge-alt { display: none;}
          #sold-out-alt{
            display: block;
          }
        }
        &:hover {
          background-color: var(--primary);
          color: var(--white);
        }
      }
      #badge-alt, #badge-estado,#descripcion-estado  {
          font-size: .75rem;
          text-align:center;
          text-wrap: balance;
          padding: 0 1rem;
          line-height:1.2;
        }      
      #descripcion-estado {
          font-size: .875rem;
          padding: 1rem .5rem;
      }
    }
  }
}

#search-form {
    display: flex;
    justify-content: center;
    max-height: 0;
    overflow:hidden;
    transition: .4s ease-out;
    &.open {
        max-height: 100dvh;
    }
}

.wc-block-cart-item__prices, .wc-block-components-product-metadata__description {
    display: none !important;
}



/* utilities */
@media (max-width: 576px) {
    .hide-on-mobile { display:none; }
    .to-last-on-mobile { order: 100;}    
}