a.skip-to-main {
    position: absolute;
    transform: translateY(-120%);
    background-color: white;
    left: 6px;
    padding: 8px;
}

a.skip-to-main:focus {
    transform: translateY(6px);
    z-index: 999;
}

/* improves punctuation in supported browsers */
html {
  hanging-punctuation: first last;
}

header.site-header {
    z-index: 2;
    background-color: $banner-color;
    border: none;
    .wrapper {
        max-width: 100%;
        padding-bottom: 3px;
    }
    .site-nav-links {
        float: right;
        line-height: 61px;
        font-size: 17px;
        @include media-query($on-palm) {
            display: block;
            line-height: 50px;
            min-width: 100%;
            text-align: center;
            float: none;
            @include media-query(349px) {
                overflow-x: scroll;
            }
        }
        a.page-link {
            color: white;
            &:not(:last-child) {
                margin-right: 13px;
            }
        }
        a.highlighted-nav-link {
            border-bottom: 1px solid white;
        }
    }
    .site-title {
        color: white;
        line-height: $base-line-height * $base-font-size * 1.5;
        padding-top: 5px;
        img {
            display: inline;
        }
        span {
            vertical-align: middle;
            display: inline-block;
        }
        @include media-query($on-palm) {
            margin: 0px 0px -12px 0px;
            min-width: 100%;
        }
    }
}

$ipad-margin: 40px;
@media screen and (max-width: 800px) and (min-width: 600px) { 
    .wrapper {
        max-width: -webkit-calc(#{$content-width} - (#{$ipad-margin} * 2));
        max-width: calc(#{$content-width} - (#{$ipad-margin} * 2));
        padding-right: $ipad-margin;
        padding-left: $ipad-margin; 
    }
}

main.page-content {
    z-index: 2;
    padding: 15px 0;
}

/* Better default scroll to #target behavior */
@media(prefers-reduced-motion: no-preference) {
    :has(:target) {
        scroll-behavior: smooth;
        scroll-padding-top: 3rem;
    }
}

main {
    font-family: $readable-font-family;
    font-size: $readable-font-size;
    form,header,footer,h1,h2,h3,h4,h5,h6 {
        font-family: $base-font-family;
    }
    #toc {
        font-family: $base-font-family;
    }
    .uifont, .btn, .Label, .State, .IssueLabel, .Counter, .TagLabel {
        font-family: $ui-font-family;
    }
    h1,h2,h3 {
        padding-top: 20px;
    }
    h3 {
        letter-spacing: 1px;
    }
    h4,h5 {
        padding-top: 16px;
    }
    h6 {
        padding-top: 12px;
    }
    blockquote {
        border-left: 5px solid grey;
        color: $text-color;
        background-color: lightgrey;
        letter-spacing: 0px;
        padding: 6px 20px 6px 16px;
        width: fit-content;
    }
    pre, code {
        background-color: #EEF0FC;
    }
}

.footnotes {
    font-size: 15px;
}

footer.site-footer {
    background-color: $banner-color;
    color: $background-color;
    a {
        svg {
            fill: #EEF0FC;
        }
        color: #EEF0FC;
    }
    .footer-heading, .footer-col-wrapper {
        color: $background-color;
    }
    div.footer-col-3 {
        font-family: $readable-font-family;
    }
}

a:visited {
    color: $plum;
}

img {
    display: block;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.btn i.fas {
    font-weight: 900;
}

a.btn:visited {
    color: initial;
}

a[target=_blank]:after {
    font-family: 'font awesome 6 free';
    font-weight: 900;
    content: "\00a0\f08e";
    vertical-align: super;
    font-size: 60%;
}
a.btn:after {
    content: "";
}

.Label strong {
    font-weight: bold;
}

figure figcaption {
    width: 100%;
    text-align: center;
    p {
        max-width: 40em;
        margin: auto;
    }
    p.attribution {
        font-size: 90%;
        margin-bottom: 3px;
    }
    p.description {
        font-size: 130%;
    }
}

.site-title {
    @include media-query($on-palm) {
        margin-left: 40px;
        margin-right: -3px;
        text-align: center;
    }
}

.site-content {
    @include media-query($on-palm) {
        padding: 20px 0;
    }
}

.social-media-list {
    .svg-icon {
        padding: 0;
        margin-right: 5px;
    }
    // make FontAwesome icons match the svg style
    i.fab, i.fas, i.far {
        width: 0.9em;
        font-size: 19px;
        margin-right: 4.5px;
        text-shadow: none;
    }
    i.fa-bookmark {
        transform: scaleX(1.15) translateX(1px);
    }
}

/*
   This is a pretty hacky way of making the bookmark look more
   like the real Substack logo by adding a pseudoelement with a
   background-colored border that "erases" two lines of the
   bookmark icon.
   
   This effect doesn't work if the footer has an image.

   TODO: just make a real svg icon for the Substack logo...
*/
footer:not(.footer-img) .social-media-list i.fa-bookmark::after {
    content: "";
    height: 2px;
    border: 2.5px solid $banner-color;
    display: block;
    transform: translate(-3px, -16.7px);
    width: 1em;
}

.site-nav {
    @include media-query($on-palm) {
        right: initial;
        left: 11px;
    }
    label[for="nav-trigger"] {
        float: left;
    }
    div.trigger a {
        text-align: left;
    }
}

$banner-shadow: 0 0 8px black;

.banner-img {
    background-position-x: center;
    background-repeat: no-repeat;
    background-size: cover;
    height: 240px;
    text-shadow: $banner-shadow;
}

.banner-img.smallsize {
    height: 150px;
    @media (max-width: 329px) {
        height: 167px
    }
    @media (max-width: 299px) {
        height: 200px;
    }
}

.banner-img.fullsize {
    height: 480px;
    @media (min-width: 1800px) {
        height: 680px;
    }
}

@media only screen and (max-width: 345px) {
    .banner-img .wrapper {
        text-shadow: 0 0 3px grey;
    }
}

details.banner-info {
    padding: 18px 9px 8px 18px;
    font-size: 12px;
    color: white;
    summary {
        font-size: 14px;
        text-align: center;
        &:hover {
            text-shadow: 2px 2px 2px black;
        }
    }
    div a {
        color: white;
    }
}
header details.banner-info {
    position: absolute;
    bottom: 0;
    right: 0;
}

footer details.banner-info {
    margin-left: auto;
}

footer.footer-img {
    margin-top: -65px;
    height: 650px;
    display: flex;
    flex-direction: column-reverse;
    border: 0;
    background-position-x: center;
    background-repeat: no-repeat;
    background-size: cover;
    text-shadow: 0 0 8px black;
}

h5 {
    font-size: 1em;
    font-style: italic;
}

p, li {
    text-wrap: pretty;
}

.back {
    font-family: $base-font-family;
    text-indent: -1em;
    padding-left: 1em;
}

header.post-header, div.post-content {
    margin-bottom: 24px;
}

div.content_box blockquote {
    font-size: 17px;
}

.content_desc blockquote, .content_box_desc blockquote {
    p:before {
        content: "“";
        font-size: 133%;
        line-height: 75%;
    }
    > :last-child:after {
        content: "”";
        font-size: 133%;
        line-height: 75%;
    }
}

span.inline_drive_link {
    white-space: nowrap;
}

footer a.u-email {
    overflow-wrap: break-word;
}

.content_box {
    box-sizing: border-box;
    border-radius: 13px;
    margin-bottom: 10px;
    margin-top: 8px;
}

div.with_border {
    border: 1px solid gray;
    padding: 8px;
    margin-top: 0px;
    div.content_box_desc {
        margin: 8px 1.2em 3px;
    }
}

.simple_content {
    padding: 2px 5px;
}

.content_box .content_box_desc {
    margin: 1px 1.2em 11px;
}

.content_box div.content_box_desc p,blockquote:last-child {
    margin-bottom: 0px;
}

.content_box div.course_link {
    margin: 7px 2px 2px 7px;
}

i.fac-fojing {
    font-style: normal;
}
i.fac-fojing:after {
    content: "佛經";
}
i.fac-ukraine {
    font-style: normal;
}
i.fac-ukraine:after {
    content: "🇺🇦";
}
i.fac-academia {
    font-style: normal;
}
i.fac-academia:after {
    font-family: serif;
    font-weight: bold;
    content: "A";
}

.simple_content p {
    margin-left: 1.5em;
}

.narrow {
    max-width: 40em;
}

div.author-list h3 {
    margin-bottom: 0px;
}

div.author-list ul.author-sublist {
    margin-top: 0px;
}

.catcounts {
    font-size: 12px;
    padding: 0px 25px;
}

article.home { // Blog
    ul.post-list {
        h1,h2,h3 {
            padding-top: 0px;
            margin-bottom: 3px;
        }
    }
}

article.post {
    header.post-header {
        margin-top: 6px;
    }

    header.post-header.overlay-into-banner {
        margin-top: -133px;
        @include media-query(700px) {
            margin-top: -105px;
        }
        @include media-query(350px) {
            margin-top: -72px;
        }
    }
    .PageNavigation {
      display: block;
      width: auto;
      overflow: hidden;
    }

    .PageNavigation a {
      display: block;
      width: 50%;
      float: left;
      margin: 1em 0;
    }

    .PageNavigation .next {
      text-align: right;
    }
}

header.post-header h3.translator {
    font-style: italic;
}

%overlay-into-banner {
    text-shadow: $banner-shadow;
    color: white;
    z-index: 4;
    position: absolute;
    text-align: center;
}

header.post-header.overlay-into-banner {
    @extend %overlay-into-banner;
    margin-top: -250px;
    left: 50%;
    transform: translate(-50%, -39%);
}

h1.overlay-into-banner {
    @extend %overlay-into-banner;
    top: 150px;
    left: 0;
    width: 100%;
    padding-left: 20%;
    padding-right: 20%;
}

.content_size {
  text-wrap-mode: nowrap;
}

.content_links {
    display: inline-flex;
    .intro-text {
        padding-right: 0.5em;
        text-align: center;
        margin-top: auto;
        margin-bottom: auto;
        text-wrap-mode: nowrap;
    }
    .the-links {
        display: inline-flex;
        flex-wrap: wrap;
        place-content: start; // Used by the content tables (elsewhere?) Overridden in featured content list (below) and on content-perma pages
        gap: 0.5em;
    }
    a {
        font-family: $ui-font-family;
    }
}

main header.post-header {
    h1,h2,h3,h4,h5,h6 {
        padding-top: 0px;
    }
}

.p-name {
    text-wrap: balance;
}

div.featured_content_list {
    ul {
        flex-wrap: wrap;
        display: flex;
        list-style: none;
        margin-left: 5px;
    }

    .featured_content_list_item {
        width: 47%;
        padding: 17px 17px 7px;
        margin: 5px;
        border: 1px solid lightgray;
        border-radius: 9px;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        background-color: #fdfdfd;
        img {
            @extend %olcoverimg;
            border: 15px solid white;
        }
        @include media-query(650px) {
            width: 96%;
        }
    }

    .content_title {
        font-size: 107%;
        font-weight: 500;
        line-height: 1.2;
    }
    
    .star_label {
        text-align: center;
        padding-bottom: 5px;
        padding-top: 2px;
    }

    .content_desc {
        margin-top: 3px;
        margin-bottom: 12px;
        p {
            margin-bottom: 0px;
            font-size: 99%;
        }
    }

    .content_desc blockquote {
        color: $grey-color-dark;
    }

    .data-row {
        display: flex;
        flex-direction: row;
        place-content: space-between;
        .size-info {
            place-self: center;
            padding-left: 15px;
        }
    }

    .content_links {
        text-align: end;
        margin-top: 10px;
        margin-bottom: 10px;
        .the-links {
            place-content: end;
        }
    }
}

ol {
    padding-left: 21px;
}

@include media-query($on-palm) {
    main {
        font-size: 16px;
        line-height: 1.3;
        pre, code {
            font-size: 14px;
        }
    }
}
