/* Page layout shared by every page: chalk background, the menu column and the phone menu. */

body {
    margin: 0;
    background: #C0C0C0 url('/chalk.jpg');
}

.topbar {
    display: none;
}

/* Menu: a fixed column on the left */
.menuframe {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 170px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Link to akvarellcenter.com, at the bottom of the menu (bottom of the screen when there is room) */
.menuframe .akvarellcenter {
    margin: auto 0 10px 10px;
    flex: none;
}

.menuframe .akvarellcenter img {
    display: block;
    width: 150px;
    height: auto;
}

.mainmenu {
    list-style: none;
    margin: 0;
    padding: 14px 0 6px 16px;
}

.mainmenu li {
    margin-bottom: 14px;
}

.mainmenu img {
    display: block;
    border: 0;
}

/* A button: the painted GIF in a thin grey frame, raised by a drop shadow.
   Hover and the current page look pressed: the shadow moves inside. */
.menubtn {
    position: relative;
    display: inline-block;
    border: 1px solid #8d8d8d;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.55);
    text-decoration: none;
    transition: box-shadow 0.1s ease, transform 0.1s ease;
}

.menubtn::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: box-shadow 0.1s ease;
}

a.menubtn:hover,
a.menubtn:focus-visible,
.menubtn.current {
    box-shadow: none;
    transform: translate(2px, 2px);
}

a.menubtn:hover::after,
a.menubtn:focus-visible::after,
.menubtn.current::after {
    box-shadow: inset 2px 2px 3px rgba(0, 0, 0, 0.45);
}

.menubtn .label {
    position: absolute;
    inset: 2px 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font: bold 13px/1.15 Verdana, Arial, Helvetica, sans-serif;
    color: #fff;
    text-shadow: 0 0 2px #000, 0 0 2px #000, 1px 1px 1px #000;
}

.content {
    margin-left: 170px;
    padding: 0 8px 8px 0;
}

/* Galleri: thumbnails in a grid, 3 per row, 5 on wide windows (also follows browser zoom), 2 on phones */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem 1rem;
    max-width: 600px;
    margin: 1rem auto;
    align-items: center;
    justify-items: center;
}

.gallery-grid img {
    display: block;
    max-width: 100%;
    height: auto;
}

@media screen and (min-width: 1100px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 950px;
    }
}

@media screen and (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Gallery lightbox (js/lightbox.js) */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: calc(100vw - 7rem);
    max-height: calc(100vh - 4rem);
    object-fit: contain;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.lightbox button {
    position: absolute;
    border: 0;
    border-radius: 50%;
    width: 2.75rem;
    height: 2.75rem;
    background: rgba(255, 255, 255, 0.8);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox button:hover,
.lightbox button:focus-visible {
    background: #fff;
}

.lightbox .lb-close {
    top: 1rem;
    right: 1rem;
}

.lightbox .lb-prev,
.lightbox .lb-next {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox .lb-prev {
    left: 1rem;
}

.lightbox .lb-next {
    right: 1rem;
}

html.lightbox-open,
html.lightbox-open body {
    overflow: hidden;
}

@media screen and (max-width: 768px) {
    .lightbox img {
        max-width: 100vw;
        max-height: calc(100vh - 8rem);
    }

    .lightbox .lb-prev,
    .lightbox .lb-next {
        top: auto;
        bottom: 1.5rem;
        transform: none;
    }
}

/* Start page */
.start {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 8px); /* one screen minus the content's bottom padding */
    text-align: center;
}

/* The name in watercolour: the old header painting shows through the letters.
   Same lettering as the phone top bar (.sitename). */
.start .name,
.topbar .sitename {
    background: #4a6a8a url('/img/main.gif') center / cover;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: saturate(1.4) contrast(1.15);
    -webkit-text-stroke: 1.1px rgba(35, 45, 65, 0.85);
}

.start .name {
    margin: 0.5rem 0 0 0;
    font: italic bold 2.75rem Georgia, 'Times New Roman', serif;
}

.start .photo {
    display: block;
    margin: 1rem auto 0 auto;
    border: 1px solid #000;
}

.fader {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: min(70vh, 520px, 90vw);
    margin: 1rem auto 0 auto;
}

.fader .slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.fader .slide.active {
    opacity: 1;
}

.fader button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.fader button:hover {
    background: rgba(255, 255, 255, 0.95);
}

.fader .prev {
    left: 0.5rem;
}

.fader .next {
    right: 0.5rem;
}

/* Pushed to the bottom of the page, in grey */
.start .publisher {
    margin: auto 0 0.5rem 0;
    padding-top: 1.5rem;
    text-align: right;
    font-size: 8pt;
    color: #777;
}

/* Om konstnären */
.om {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.om .portratt {
    float: left;
    margin: 0.3rem 1.5rem 1rem 0;
    border: 1px solid #000;
}

.om::after {
    content: "";
    display: block;
    clear: both;
}

/* Kontakt och info */
.kontakt {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1rem;
    font-size: 11pt;
    line-height: 1.5;
}

.kontakt form {
    margin: 0.5rem 0 2rem 0;
}

.kontakt input[type="email"] {
    width: 16rem;
    max-width: 100%;
    padding: 0.3rem;
    font-size: 11pt;
}

.kontakt button {
    padding: 0.3rem 0.8rem;
    font-size: 11pt;
}

/* Phones: a top bar with the name and a hamburger that slides the menu in */
@media screen and (max-width: 768px) {
    .topbar {
        position: sticky;
        top: 0;
        z-index: 1001;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 3.5rem;
        padding: 0 0.75rem;
        background: #C0C0C0 url('/chalk.jpg');
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
    }

    .sitename,
    .sitename:link,
    .sitename:visited {
        font: italic bold 1.5rem Georgia, 'Times New Roman', serif;
        color: #333;
        text-decoration: none;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 0 9px;
        border: 1px solid #999;
        border-radius: 6px;
        background: transparent;
        cursor: pointer;
    }

    .menu-toggle span {
        display: block;
        height: 3px;
        background: #333;
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.2s ease;
    }

    body.menu-open .menu-toggle {
        background: #fff;
    }

    body.menu-open .menu-toggle span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    body.menu-open .menu-toggle span:nth-child(2) {
        opacity: 0;
    }

    body.menu-open .menu-toggle span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .menuframe {
        top: 3.5rem;
        z-index: 1000;
        width: 11rem;
        padding: 0.75rem 0;
        background: #C0C0C0 url('/chalk.jpg');
        border-radius: 0 8px 8px 0;
        box-shadow: 3px 0 16px rgba(0, 0, 0, 0.4);
        transform: translateX(-110%);
        transition: transform 0.25s ease;
    }

    body.menu-open .menuframe {
        transform: translateX(0);
    }

    body::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    body.menu-open::after {
        opacity: 1;
        pointer-events: auto;
    }

    html.menu-open,
    body.menu-open {
        overflow: hidden;
    }

    .mainmenu {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.9rem;
        padding: 0;
    }

    .mainmenu li {
        margin: 0;
    }

    .content {
        margin-left: 0;
        padding: 0.5rem 0.75rem;
        overflow-x: auto;
    }

    .content img {
        max-width: 100%;
        height: auto;
    }

    /* Old pages use fixed-width tables (e.g. width="720" on Press); let them fit the screen */
    .content table[width] {
        width: auto;
        max-width: 100%;
    }

    /* Old pages use 1px-high images as divider lines */
    .content img[height="1"] {
        height: 1px;
    }

    /* Gallery year links: let them wrap instead of forming one wide row */
    .years,
    .years tbody,
    .years tr {
        display: block;
        text-align: center;
    }

    .years td {
        display: inline-block;
    }

    /* Exactly one screen below the 3.5rem top bar and the 0.5rem content padding,
       so "Ansvarig utgivare" sits at the bottom without scrolling */
    .start {
        min-height: calc(100vh - 4.5rem);
        min-height: calc(100dvh - 4.5rem);
    }

    /* The top bar already shows the name */
    .start .name {
        display: none;
    }

    .om .portratt {
        float: none;
        display: block;
        margin: 0 auto 1rem auto;
    }
}
