/* ==========================================================================
   Romania Magnifică

   1. Base            5. Category bar (breadcrumbs, tabs)
   2. Forms           6. Subcategory cards
   3. Sidebar + menu  7. Photo grid + lightbox
   4. Content pages   8. Small screens
   ========================================================================== */

:root {
    --sidebar-width: 290px;
    --topbar-height: 54px;
    --green: #62c462;
    --green-dark: #51a351;
    --accent: #26afd1;
}

/* 1. Base
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: #eee;
}

body {
    font-family: Hind, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 24px;
}

a {
    color: #333;
    transition: color .3s;
}

a:hover {
    color: #999;
}

img, iframe, audio {
    max-width: 100%;
}

hr {
    height: 1px;
    background-color: #eee;
    border: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.button {
    display: inline-block;
    color: white;
    background: var(--green);
    border: 0;
    border-radius: 4px;
    padding: 8px 20px;
    font: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s;
}

.button:hover {
    background: var(--green-dark);
    color: white;
}

/* 2. Forms
   ========================================================================== */

.form input,
.form textarea {
    display: block;
    width: 400px;
    max-width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    font: inherit;
    font-size: 18px;
}

.form input[type="submit"] {
    width: auto;
    color: white;
    background: var(--green);
    border: 0;
    border-radius: 4px;
    padding: 8px 20px;
    cursor: pointer;
    transition: background .2s;
}

.form input[type="submit"]:hover {
    background: var(--green-dark);
}

.form-errors {
    color: #b94a48;
    background: #f2dede;
    border-radius: 4px;
    padding: 10px 10px 10px 30px !important;
    max-width: 400px;
}

.form-wait img {
    vertical-align: middle;
    margin-right: 8px;
}

/* 3. Sidebar + menu
   ========================================================================== */

.topbar,
.backdrop {
    display: none; /* small screens only, see section 8 */
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    padding: 0 25px;
    background: #000;
    z-index: 1000;
}

.brand {
    display: block;
}

.slogan {
    position: relative;
    left: -22px;
    margin-top: 15px;
}

.logo {
    display: block;
    width: 280px;
    height: 80px;
    margin-left: -15px;
    background: url('/logo-nou.png') no-repeat;
    background-size: 270px;
}

.menu,
.menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu {
    padding: 10px 0;
    border-bottom: 1px solid #333;
}

.menu-item {
    position: relative;
}

.menu a {
    display: block;
    padding: 6px 20px;
    color: #999;
    font-size: 14px;
    letter-spacing: 1px;
    text-decoration: none;
    text-transform: uppercase;
    transition: color .2s, background .2s;
}

.menu-item:hover > a,
.menu-item.selected > a {
    color: white;
    background: #222;
}

/* The › arrow of items with subcategories. On desktop it is decoration;
   on small screens it becomes a button that expands the list. */
.submenu-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: none;
    color: #999;
    font-size: 22px;
    line-height: 36px;
    pointer-events: none;
}

.submenu-toggle::before {
    content: "›";
}

.menu-item:hover > .submenu-toggle {
    color: white;
}

/* Desktop: subcategories open in a full-height panel next to the sidebar,
   so even the longest list (Istoria) can never run off the screen. */
.submenu {
    display: none;
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(var(--sidebar-width) - 25px);
    max-width: calc(100vw - var(--sidebar-width) + 25px);
    padding: 25px 20px;
    overflow-y: auto;
    background: #222;
    box-shadow: 4px 0 12px rgba(0, 0, 0, .3);
}

.menu-item:hover > .submenu,
.menu-item:focus-within > .submenu {
    display: block;
}

.submenu ul {
    column-gap: 20px;
    column-width: 220px;
    width: 220px;
}

.submenu ul.columns-2 { column-count: 2; width: 460px; }
.submenu ul.columns-3 { column-count: 3; width: 700px; }
.submenu ul.columns-4 { column-count: 4; width: 940px; }

.submenu ul {
    max-width: 100%;
}

.submenu li {
    break-inside: avoid;
}

.submenu a {
    padding: 5px 10px;
    line-height: 18px;
    letter-spacing: 0;
    text-transform: none;
}

.submenu a:hover {
    color: white;
}

.disclaimer {
    position: absolute;
    bottom: 5px;
    left: 25px;
    right: 25px;
    margin: 0;
    color: #999;
    font-size: 12px;
    font-style: italic;
    line-height: 16px;
}

/* 4. Content pages
   ========================================================================== */

#content {
    position: relative;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.page {
    margin: 30px;
    padding: 30px;
    background: #fff;
    color: #666;
    overflow: hidden; /* contain floats */
}

.page h1,
.page h2 {
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: normal;
    color: #000;
}

.page ul {
    padding-left: 10px;
}

.message {
    margin: 100px 20px 0;
    font-size: 24px;
    line-height: 1.3;
    color: #999;
    text-align: center;
}

.caption {
    display: inline-block;
    margin-left: 15px;
    color: #999;
    font-size: 80%;
}

.info-entry {
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.info-entry h2 {
    margin-bottom: 0;
    font-size: 18px;
    font-weight: bold;
}

/* Contact */
.trademark {
    float: right;
    width: 300px;
    max-width: 40%;
    padding: 0 10px 20px 50px;
    text-align: center;
}

.trademark img {
    width: 180px;
}

/* Attachments ("Materiale atașate") */
.attachments ul {
    list-style: disc inside;
}

.attachments li {
    margin: 10px 0;
}

.attachments a {
    text-decoration: none;
}

.attachment-embed {
    list-style: none;
}

.attachment-extra {
    margin-top: 20px;
}

/* Home page */
#background {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--sidebar-width);
    background: #333 center / cover no-repeat;
    filter: blur(2px);
    transition: opacity .6s;
}

#background.is-fading {
    opacity: .3;
}

.page.frontpage {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 50%;
    background: transparent;
    color: white;
}

.page.frontpage p {
    font-weight: normal !important;
    font-family: Hind, Helvetica, Arial, sans-serif !important;
    font-size: 20px !important;
    line-height: 1.3 !important;
    text-shadow: 1px 1px 2px #333;
}

/* 5. Category bar (breadcrumbs, tabs)
   ========================================================================== */

.bar {
    padding: 14px 20px 12px;
    background: white;
}

.bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    min-height: 40px;
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 0;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* The separator belongs to the item before it, so a long name that wraps
   to the next line does not start with a stray arrow. */
.breadcrumbs li:not(:last-child)::after {
    content: "›";
    margin: 0 10px;
    color: #bbb;
    font-size: 18px;
}

.breadcrumbs a {
    color: #717171;
    text-decoration: none;
    border-bottom: 2px solid #ebebeb;
}

.breadcrumbs a:hover {
    border-bottom-color: var(--accent);
}

.breadcrumbs [aria-current] {
    color: #000;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.tabs a {
    display: block;
    color: #717171;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid #ebebeb;
}

.tabs .selected a,
.tabs a:hover {
    color: #333;
    border-bottom-color: var(--accent);
}

/* 6. Subcategory cards
   ========================================================================== */

.subcategories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 6px;
    margin: 0;
    padding: 8px;
    list-style: none;
}

.subcategories a {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #222;
    color: white;
    text-decoration: none;
}

.subcategories img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter .5s, transform .5s;
}

.subcategories a:hover img {
    filter: brightness(1.2);
    transform: scale(1.03);
}

.subcategories span {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 30px 12px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .75));
    font-size: 15px;
    line-height: 20px;
}

/* 7. Photo grid + lightbox
   ========================================================================== */

/* Tiles are laid out by Masonry (app.js). Without JavaScript the flex rules
   below still give a usable grid. */
.gallery {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
    margin: 8px;
}

.item {
    position: relative;
    width: calc((100% - 12px) / 3);
    margin: 0 0 6px;
    overflow: hidden;
    background: #ddd;
}

.item > a:first-child {
    display: block;
}

.item img {
    display: block;
    width: 100%;
    min-height: 60px;
    transition: filter .5s;
}

.item:hover > a:first-child img {
    filter: brightness(1.2);
}

.item-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 5px 10px 3px;
    color: white;
    background: rgba(0, 0, 0, .6);
    font-size: 14px;
    line-height: 20px;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}

.item-share {
    position: absolute;
    top: 5px;
    left: 5px;
    opacity: 0;
    transition: opacity .3s;
}

.item-share img {
    width: 39px;
    min-height: 0;
    padding: 5px 12px;
    background: #3b5998;
    border-radius: 5px;
}

.item:hover .item-caption,
.item:hover .item-share,
.item-share:focus {
    opacity: 1;
}

.load-more {
    margin: 10px 0 30px;
    text-align: center;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .92);
    touch-action: none;
    user-select: none;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-caption {
    position: absolute;
    top: 0;
    left: 0;
    right: 60px;
    margin: 0;
    padding: 15px;
    color: #fff;
    font-size: 18px;
    line-height: 24px;
    text-shadow: 0 0 2px #000;
}

.lightbox button {
    position: absolute;
    width: 46px;
    height: 46px;
    padding: 0;
    color: #fff;
    background: rgba(0, 0, 0, .5);
    border: 3px solid #fff;
    border-radius: 50%;
    font-size: 30px;
    line-height: 34px;
    cursor: pointer;
    opacity: .6;
    transition: opacity .2s;
}

.lightbox button:hover {
    opacity: 1;
}

.lightbox-close {
    top: 10px;
    right: 10px;
    border-color: transparent !important;
}

.lightbox-prev {
    left: 15px;
    top: calc(50% - 23px);
}

.lightbox-next {
    right: 15px;
    top: calc(50% - 23px);
}

body.lightbox-open {
    overflow: hidden;
}

/* Touch screens have no hover: keep photo titles and share buttons visible. */
@media (hover: none) {
    .item-caption,
    .item-share {
        opacity: 1;
    }

    .item-share {
        opacity: .85;
    }
}

/* 8. Small screens
   The sidebar turns into a slide-in drawer opened from a top bar.
   ========================================================================== */

@media (max-width: 900px) {
    .topbar {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        z-index: 1001;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: var(--topbar-height);
        padding: 0 6px 0 12px;
        background: #000;
    }

    .topbar-logo {
        width: 150px;
        height: 44px;
        background: url('/logo-nou.png') left center / contain no-repeat;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 0 10px;
        background: none;
        border: 0;
        cursor: pointer;
    }

    .menu-toggle span {
        display: block;
        height: 2px;
        background: #fff;
        transition: transform .2s, opacity .2s;
    }

    .menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
    .menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .sidebar {
        top: var(--topbar-height);
        width: min(320px, 88vw);
        padding: 0 0 20px;
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(-100%);
        transition: transform .25s;
    }

    .menu-open .sidebar {
        transform: none;
    }

    .menu-open .backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0, 0, 0, .5);
    }

    body.menu-open {
        overflow: hidden;
    }

    .brand {
        display: none;
    }

    .menu a {
        padding: 12px 20px;
    }

    .menu-item.has-children > a {
        margin-right: 48px;
    }

    .submenu-toggle {
        width: 48px;
        height: 48px;
        line-height: 48px;
        pointer-events: auto;
        cursor: pointer;
        transition: transform .2s;
    }

    .menu-item.open > .submenu-toggle {
        transform: rotate(90deg);
        color: white;
    }

    /* Subcategories expand in place instead of opening a panel. */
    .submenu,
    .menu-item:hover > .submenu,
    .menu-item:focus-within > .submenu {
        display: none;
        position: static;
        max-width: none;
        padding: 6px 0 10px;
        box-shadow: none;
    }

    .menu-item.open > .submenu {
        display: block;
    }

    .submenu ul[class] {
        column-count: 1;
        width: auto;
    }

    .submenu a {
        padding: 8px 20px 8px 34px;
    }

    .disclaimer {
        position: static;
        padding: 15px 20px 0;
    }

    #content {
        margin-left: 0;
        padding-top: var(--topbar-height);
    }

    #background {
        top: var(--topbar-height);
        left: 0;
    }

    .page {
        margin: 10px;
        padding: 18px;
    }

    .page.frontpage {
        width: auto;
        left: 0;
    }

    .bar {
        padding: 10px 12px;
    }

    .bar-top {
        flex-wrap: wrap;
    }

    .breadcrumbs ol {
        font-size: 13px;
        letter-spacing: .5px;
    }

    .breadcrumbs li:not(:last-child)::after {
        margin: 0 7px;
    }

    .button {
        padding: 6px 14px;
        font-size: 14px;
    }

    /* One row of tabs that scrolls sideways. */
    .tabs {
        flex-wrap: nowrap;
        margin: 10px -12px 0;
        padding: 0 12px 6px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .subcategories {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .trademark {
        float: none;
        width: auto;
        max-width: none;
        padding: 0 0 10px;
    }
}

@media (max-width: 600px) {
    .item {
        width: calc((100% - 6px) / 2);
    }

    .item-caption {
        font-size: 12px;
        line-height: 16px;
    }

    .lightbox-prev,
    .lightbox-next {
        display: none; /* swipe instead */
    }

    .message {
        margin-top: 50px;
        font-size: 20px;
    }
}
