/*
 * Inner pages: ornamental frame, page picture, menu, content, footer.
 * Must work on old browsers (iOS 12 / Safari 12): no flex `gap`, clamp(),
 * aspect-ratio, :is()/:where(), `inset`.
 *
 * Layouts:
 *   >= 1449px      frame no wider than 1448px, centred (white around it)
 *   >= 1000px      frame in its original size
 *   600px - 999px  frame scaled with the screen width (1px of the original = 0.1vw)
 *   <  600px       no frame, no page picture
 *
 * Spacing: steps of the golden ratio (1.618) in em of the text they belong to:
 *   0.382em  0.618em  1em  1.618em  2.618em
 * A heading has more space above than below (1.618em above, 0.618em below, in em of the
 * text; divided by the heading's own size where the margin is set on the heading), so it
 * stays with the text it introduces. Line height 1.6 is close to the same ratio.
 */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    /* The tale frame (1180px, tale.css) between the side borders (130px + 4px each):
       wider, the frame's sides would stand apart from the content on large screens */
    max-width: 1448px;
    margin: 0 auto;
    padding-top: 13px;
    background: #fff;
    color: #000;
    text-align: center;
    font-family: "Palatino Linotype", Palatino, Palladio, "URW Palladio L", "Book Antiqua", Baskerville,
        "Bookman Old Style", "Bitstream Charter", "Nimbus Roman No9 L", Garamond, "Apple Garamond",
        "New Century Schoolbook", "Century Schoolbook", Georgia, serif;
}

a {
    color: #000080;
    text-decoration: none;
}

a:visited {
    color: #4682b4;
}

a:hover,
a:focus {
    color: #00f;
}

a:active {
    color: #0000cd;
    text-decoration: underline;
}

img {
    border: 0;
}

/* 1.618em above and 0.618em below, in text size (the heading is 2.2 times bigger) */
h1 {
    margin: 0.735em 1em 0.281em;
    color: #0040a0;
    font-size: 2.2em;
    font-weight: normal;
}

/* Verse with a decorated first letter (greetings, page introductions) */
.verse {
    display: inline-block; /* ::first-letter needs a block-like box, and it centres the verse */
    margin: 0;
    text-align: left;
}

.verse::first-letter {
    color: #ff34b3;
    font-size: 1.75em;
}

/* Green woven ornament between page parts */
.ornament {
    max-width: 600px;
    height: 50px;
    margin: 13px auto;
    background: url("../img/frame/ornament.jpg") center top no-repeat;
    background-size: contain;
}

/* ---- Frame: top, with the page picture between the corners ---- */
.page-top {
    height: 180px;
    padding: 0 350px;
    background:
        url("../img/frame/SO.jpg") left top no-repeat,
        url("../img/frame/SW.jpg") right top no-repeat;
}

.page-top__logo {
    display: block;
    width: 280px;
    margin: 0 auto;
}

.page-top__logo img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---- Frame: sides, around the menu and content ---- */
.page-middle {
    min-height: 400px;
    padding: 0 130px 13px;
    background:
        url("../img/frame/OS.jpg") left top no-repeat,
        url("../img/frame/WS.jpg") right top no-repeat,
        url("../img/frame/ON.jpg") left bottom no-repeat,
        url("../img/frame/WN.jpg") right bottom no-repeat,
        url("../img/frame/O.jpg") left 118px repeat-y,
        url("../img/frame/W.jpg") right 118px repeat-y;
}

.page-content {
    max-width: 625px;
    margin: 0 auto;
    padding: 0 4px;
}

/* ---- Menu ---- */
.menu {
    /* Padding, not margin: a top margin would collapse through .page-middle
       and leave a gap between the top corners and the side borders */
    padding: 4px 0;
}

.menu__list {
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.menu__item {
    display: inline-block;
    margin: 0 4px;
    vertical-align: middle;
}

.menu__link {
    display: block;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 12px;
}

.menu__link:hover,
.menu__link:focus {
    text-shadow: 0 0 4px silver;
}

.menu__icon {
    display: block;
    width: 120px;
    height: 80px;
}

/* ---- Frame: bottom, with copyright ---- */
.page-bottom__copyright {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 55px;
    padding: 0 280px;
    background:
        url("../img/frame/NO.jpg") left top no-repeat,
        url("../img/frame/NW.jpg") right top no-repeat;
}

.page-bottom__info {
    margin: 0;
    padding: 4px;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 11px;
}

.page-bottom__end {
    height: 65px;
    background:
        url("../img/frame/NNOO.jpg") left top no-repeat,
        url("../img/frame/NNO.jpg") left 280px top no-repeat,
        url("../img/frame/NNW.jpg") right 280px top no-repeat,
        url("../img/frame/NNWW.jpg") right top no-repeat;
}

/* ---- Tablet: frame scaled with the screen ---- */
@media (max-width: 999px) {
    .page-top {
        height: 18vw;
        padding: 0 35vw;
        background-size: 35vw auto, 35vw auto;
    }

    .page-top__logo {
        width: 28vw;
    }

    .page-middle {
        padding: 0 13vw 13px;
        background-size: 13vw auto, 13vw auto, 13vw auto, 13vw auto, 13vw auto, 13vw auto;
        background-position: left top, right top, left bottom, right bottom, left 11.8vw, right 11.8vw;
    }

    .menu__icon {
        width: 13vw;
        height: auto;
    }

    .page-bottom__copyright {
        height: auto;
        min-height: 5.5vw;
        padding: 0 28vw;
        background-size: 28vw auto, 28vw auto;
    }

    .page-bottom__end {
        height: 6.5vw;
        background-size: 28vw auto, 12.5vw auto, 12.5vw auto, 28vw auto;
        background-position: left top, left 28vw top, right 28vw top, right top;
    }
}

/* ---- Mobile: no frame ---- */
@media (max-width: 599px) {
    body {
        padding-top: 0.618em;
        font-size: 17px;
    }

    /* 1.618em above and 0.618em below, in text size (the heading is 1.5 times bigger) */
    h1 {
        margin: 1.079em 4px 0.412em;
        font-size: 1.5em;
    }

    .page-top {
        display: none;
    }

    .page-middle {
        min-height: 0;
        padding: 0 8px 8px;
        background: none;
    }

    .menu__item {
        margin: 0 2px;
    }

    .menu__icon {
        width: 72px;
    }

    .menu__label {
        font-size: 11px;
    }

    .page-bottom__copyright {
        display: block;
        padding: 0 12px 16px;
        background: none;
    }

    .page-bottom__end {
        display: none;
    }
}
