/* Math artifacts topic page styles.

   developer:   marionm
   requires:    shared.css
   ========================================================================== */

/* ==========================================================================
   wrappers
   ========================================================================== */

#topic-wrapper {
    margin: 0 auto;
    max-width: calc(1200px - 4rem);
    padding: 0 2rem 3rem;
}

@media all and (max-width: 600px) {
    #topic-wrapper { padding: 0 0 3rem; }
}

#topic-wrapper > div {
    border: 1px solid var(--artifacts-silver);
    position: relative;
}

#topic-wrapper > div:before {
    content: '';
    display: block;
    height: 7px;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 20;
}

#topic-wrapper.topic-algebra > div:before { background: var(--artifacts-bar-algebra); }
#topic-wrapper.topic-arithmetic > div:before { background: var(--artifacts-bar-arithmetic); }
#topic-wrapper.topic-counting > div:before { background: var(--artifacts-bar-counting); }
#topic-wrapper.topic-geometry > div:before { background: var(--artifacts-bar-geometry); }
#topic-wrapper.topic-learning-journeys > div:before { background: var(--artifacts-bar-learning-journeys); }
#topic-wrapper.topic-mathematics-education > div:before { background: var(--artifacts-bar-mathematics-education); }
#topic-wrapper.topic-pi > div:before { background: var(--artifacts-bar-pi); }
#topic-wrapper.topic-polyhedra > div:before { background: var(--artifacts-bar-polyhedra); }
#topic-wrapper.topic-primes > div:before { background: var(--artifacts-bar-primes); }
#topic-wrapper.topic-pythagorean-theorem > div:before { background: var(--artifacts-bar-pythagorean-theorem); }

#topic-wrapper section {
    padding: 3rem 2rem 2rem;
    position: relative;
}

@media all and (max-width: 600px) {
    #topic-wrapper section { padding: 2rem 1rem 1rem; }
}

#topic-wrapper section.gradient { background: linear-gradient(180deg, rgba(255,255,255,1) 80%, rgba(241,241,241,1) 100%); }

/* ==========================================================================
   top
   ========================================================================== */

#topic-main .topic-icon {
    margin-top: 1rem;
    position: absolute;
    right: 0;
    top: 0;
}

@media all and (max-width: 600px) {
    #topic-main .topic-icon {
        max-height: 6rem;
        width: auto;
    }
}

#topic-main h3 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding: 1rem 8rem 0 0;
}

#topic-wrapper.topic-algebra #topic-main h3 { color: var(--artifacts-area-algebra); }
#topic-wrapper.topic-arithmetic #topic-main h3 { color: var(--artifacts-area-arithmetic); }
#topic-wrapper.topic-counting #topic-main h3 { color: var(--artifacts-area-counting); }
#topic-wrapper.topic-geometry #topic-main h3 { color: var(--artifacts-area-geometry); }
#topic-wrapper.topic-mathematics-education #topic-main h3 { color: var(--artifacts-area-mathematics-education); }
#topic-wrapper.topic-pi #topic-main h3 { color: var(--artifacts-area-pi); }
#topic-wrapper.topic-polyhedra #topic-main h3 { color: var(--artifacts-area-polyhedra); }
#topic-wrapper.topic-primes #topic-main h3 { color: var(--artifacts-area-primes); }
#topic-wrapper.topic-pythagorean-theorem #topic-main h3 { color: var(--artifacts-area-pythagorean-theorem); }

#topic-main .topic-desc {
    color: var(--artifacts-black);
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1.5;
    margin-bottom: 1rem;
}

@media all and (max-width: 600px) {
    #topic-main .topic-desc {
        font-size: 1.25rem;
        font-weight: 400;
    }
}

/* ==========================================================================
   grid
   ========================================================================== */

#topic-main .grid {
    background-color: var(--artifacts-grid-bg);
    display: grid;
    grid-auto-rows: 1fr;
    grid-gap: 1rem;
    grid-template-columns: repeat(3, 1fr);
    list-style-type: none;
    margin-top: 3rem;
    padding: 1rem;
}

@media all and (max-width: 900px) {
    #topic-main .grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media all and (max-width: 600px) {
    #topic-main .grid {
        grid-template-columns: 1fr;
        margin: 2rem 0;
    }
}

#topic-main .grid:before {
    content: '';
    grid-column: 1 / 1;
    grid-row: 1 / 1;
    padding-bottom: 100%;
    width: 0;
}

#topic-main .grid > *:first-child {
    grid-column: 1 / 1;
    grid-row: 1 / 1;
}

#topic-main .grid li {
    background-color: #000;
    box-shadow: 0 0 .5rem 0 rgba(0, 0, 0, 0);
    transition: box-shadow 0.2s ease;
}

#topic-main .grid li:hover { box-shadow: 0 0 .5rem 0 rgba(0, 0, 0, .35); }

#topic-main .grid figure {
    align-items: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    position: relative;
    transition: box-shadow 0.1s ease;
    width: 100%;
}

#topic-main .grid figure a {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    position: relative;
    width: 100%;
    z-index: 20;
}

#topic-main .grid figure a:first-child { display: none; }

#topic-main .grid figure:hover figcaption {
    bottom: .5rem;
    opacity: 1;
}

@media (pointer: coarse) {
    #topic-main .grid figure:hover figcaption { bottom: 0; }
}

#topic-main .grid figure img {
    height: auto;
    max-height: 15rem;
    object-fit: contain;
    position: relative;
    width: 90%;
    z-index: 15;
}

@media all and (max-width: 900px) {
    #topic-main .grid figure img { max-height: 33vw; }
}

@media all and (max-width: 600px) {
    #topic-main .grid figure img { max-height: 61vw; }
}

#topic-main .grid figcaption {
    -webkit-backdrop-filter: blur(.15rem);
    backdrop-filter: blur(.15rem);
    background: rgba(20, 20, 20, .85);
    bottom: 0;
    display: flex;
    flex-direction: column;
    height: auto;
    justify-content: center;
    opacity: 0;
    padding: .5rem 0;
    position: absolute;
    transition: opacity 0.1s ease, bottom 0.2s ease;
    width: 100%;
    z-index: 20;
}

@media (pointer: coarse) {
    #topic-main .grid figcaption {
        opacity: 1;
        width: 100%;
    }
}

#topic-main .grid figcaption p:first-child {
    color: #a1a1a1;
    font-size: .75rem;
    line-height: 1;
    margin-bottom: .25rem;
    padding: 0 1rem;
}

@media all and (max-width: 900px) {
    #topic-main .grid figcaption p:first-child { font-size: .7rem; }
}

@media all and (max-width: 600px) {
    #topic-main .grid figcaption p:first-child { font-size: .9rem; }
}

#topic-main .grid figcaption h4 {
    color: var(--artifacts-orange);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.1;
    padding: 0 1rem;
}

@media all and (max-width: 900px) {
    #topic-main .grid figcaption h4 { font-size: 1.25rem; }
}

@media all and (max-width: 600px) {
    #topic-main .grid figcaption h4 { font-size: 1.23rem; }
}

#topic-main .grid figcaption p:last-child {
    color: #bcbcbc;
    font-size: .875rem;
    line-height: 1.2;
    margin-top: .2rem;
    padding: 0 1rem;
}

@media all and (max-width: 900px) {
    #topic-main .grid figcaption p:last-child { font-size: 1rem; }
}

@media all and (max-width: 600px) {
    #topic-main .grid figcaption p:last-child {
        font-size: 1.08rem;
        margin-top: 0;
    }
}

/* ==========================================================================
   timeline
   ========================================================================== */

#topic-timeline h3 {
    color: var(--artifacts-orange);
    font-size: 2rem;
    font-weight: 300;
    margin: 0 0 2rem;
}

#topic-timeline img {
    display: block;
    height: auto;
    margin: 0 auto;
    max-width: 100%;
}