/* Layout rules that keep pages within the width of a phone.
   Loaded by every page: via scripts/analogion_head.js, or directly by the
   old pages that don't use that script. Only the navigation/footer rules
   apply on desktop; everything else is limited to small screens. */

/* Navigation bar and footer (tables written by the header/footer scripts):
   a centred row of items that wraps onto more lines when the window is
   narrow, instead of forcing the page wider than the screen. */
table.site-nav, table.site-footer, table.site-nav tr, table.site-footer tr
{
    display:block;
    text-align:center;
}
table.site-nav td, table.site-footer td
{
    display:inline-block;
    white-space:nowrap;
    padding:4px 8px;
}
table.site-footer td
{
    padding:6px 14px;
}

@media (max-width: 640px)
{
    /* On very narrow screens a single long footer item can be wider than
       the screen, so let items wrap inside themselves too. */
    table.site-nav td, table.site-footer td
    {
        white-space:normal;
    }
    table.site-footer
    {
        border-spacing:0;
    }

    /* Images and embedded media shrink to fit, keeping their proportions
       (many images have a fixed width and height set inline). */
    img, iframe, embed, object, video
    {
        max-width:100% !important;
    }
    img
    {
        height:auto !important;
    }

    /* Long words, file names and URLs break instead of overflowing. */
    body
    {
        overflow-wrap:anywhere;
    }
    pre
    {
        white-space:pre-wrap;
    }

    /* Blocks with a fixed width can't be wider than the screen. */
    div, p, h1, h2, h3, h4, center, blockquote, span
    {
        max-width:100%;
        box-sizing:border-box;
    }

    /* Content tables scroll sideways on their own instead of widening the
       whole page. */
    table:not(.site-nav):not(.site-footer)
    {
        display:block;
        max-width:100%;
        overflow-x:auto;
    }
}

/* ---------------------------------------------------------------------
   Site header (written by scripts/analogion_header.js): the site name,
   the language switch, the menu bar and its drop-down panels, over a
   faded strip of a chant manuscript (images/header-manuscript.jpg).
   --------------------------------------------------------------------- */

/* Which language the menus, footer and home page show. The switch sets
   data-lang on <html>: both (default), en or el. */
html[data-lang="en"] .l-el, html[data-lang="en"] .l-sep, html[data-lang="en"] .b-el,
html[data-lang="el"] .l-en, html[data-lang="el"] .l-sep,
.b-en
{
    display:none;
}
html[data-lang="en"] .b-en
{
    display:inline;
}
.l-sub
{
    display:block;
    font-size:0.8em;
    font-style:italic;
    color:#6B5B3E;
}
html[data-lang="en"] .l-sub
{
    display:inline;
    font-size:inherit;
    font-style:normal;
    color:inherit;
}

.site-header
{
    margin:-8px -8px 16px;
    border-bottom:1px solid #D8CBA8;
    background:linear-gradient(rgba(251,247,236,0.80), rgba(251,247,236,0.92)),
               url(./images/header-manuscript.jpg) center 40% / cover no-repeat,
               #FBF7EC;
    color:#1F1A14;
    font-size:1rem;
    text-align:left;
}
.site-header a
{
    color:#1F1A14;
    text-decoration:none;
}
.site-header a:hover, .site-header a:focus-visible
{
    color:#8E1B16;
    text-decoration:underline;
}
.site-header button
{
    font-family:inherit;
    color:#1F1A14;
    cursor:pointer;
}
.site-header :focus-visible
{
    outline:2px solid #8E1B16;
    outline-offset:2px;
}

.sh-top, .sh-nav, .sh-panel-inner
{
    max-width:1180px;
    margin:0 auto;
    box-sizing:border-box;
}
.sh-top
{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px 24px;
    padding:14px 24px 0;
}
.sh-brand
{
    margin-right:auto;
}
.sh-name
{
    display:block;
    font-size:1.5rem;
    font-weight:bold;
    letter-spacing:0.02em;
}
.sh-domain
{
    display:block;
    font-size:0.8rem;
    font-style:italic;
    color:#5A4D35;
}
.sh-lang
{
    display:flex;
    border:1px solid #B8A77E;
    border-radius:6px;
    overflow:hidden;
    background:#FBF7EC;
}
.sh-lang button
{
    min-height:36px;
    padding:0 12px;
    border:0;
    background:transparent;
    font-size:0.8rem;
}
.sh-lang button[aria-pressed="true"]
{
    background:#1F1A14;
    color:#FBF7EC;
}

.sh-nav
{
    display:flex;
    flex-wrap:wrap;
    gap:0;
    padding:6px 4px 0;
}
.sh-menu-btn, .sh-menu-link
{
    display:flex;
    align-items:center;
    gap:6px;
    min-height:48px;
    padding:0 8px;
    border:0;
    border-bottom:3px solid transparent;
    background:none;
    font-size:0.95rem;
}
.sh-menu-btn[aria-expanded="true"]
{
    border-bottom-color:#8E1B16;
}
.sh-menu-btn[aria-expanded="true"] .sh-caret
{
    transform:rotate(180deg);
}

.sh-panel
{
    border-top:1px solid #D8CBA8;
    background:#FFFDF6;
    box-shadow:0 12px 24px rgba(60,40,10,0.10);
}
.sh-panel[hidden]
{
    display:none;
}
.sh-panel-inner
{
    padding:18px 24px 24px;
}
.sh-panel-all
{
    display:inline-block;
    margin-bottom:14px;
    font-size:0.9rem;
}
.site-header .sh-panel-all
{
    color:#8E1B16;
}
.sh-cols
{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));
    gap:20px 28px;
}
.sh-col-title
{
    padding-bottom:6px;
    margin-bottom:4px;
    border-bottom:1px solid #E4D9BC;
    font-weight:bold;
    font-size:0.95rem;
    color:#8E1B16;
}
.site-header .sh-col-title a
{
    color:#8E1B16;
}
.sh-col ul
{
    list-style:none;
    margin:0;
    padding:0;
}
.sh-col li a
{
    display:block;
    padding:6px 0;
    font-size:0.9rem;
    line-height:1.35;
}

@media (max-width: 640px)
{
    .sh-top
    {
        padding:12px 14px 0;
    }
    .sh-nav
    {
        padding:4px 4px 0;
    }
    .sh-menu-btn, .sh-menu-link
    {
        padding:0 8px;
        font-size:0.95rem;
    }
    .sh-panel-inner
    {
        padding:14px 16px 20px;
    }
}

/* ---------------------------------------------------------------------
   Site footer (written by scripts/analogion_footer_plain.js).
   --------------------------------------------------------------------- */
.site-footer
{
    margin:40px -8px -8px;
    padding:24px 16px 32px;
    border-top:1px solid #D8CBA8;
    background:#FBF7EC;
    color:#4A3F2C;
    text-align:center;
    font-size:0.875rem;
}
.sf-links
{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:2px 8px;
    margin:12px 0 6px;
}
.sf-links a
{
    display:inline-block;
    line-height:44px;
    padding:0 10px;
}
.sf-rights
{
    max-width:680px;
    margin:10px auto 0;
    line-height:1.5;
    color:#5A4D35;
}
.sf-copy
{
    margin-top:14px;
}
