/*
 * Phone and tablet layout (added 2026-10-25, not a legacy port).
 * Every rule sits inside a media query: from 1120px up the legacy fixed 1100px layout of style.css renders unchanged
 * (the parity suite screenshots at 1280px). The markup is the legacy one; js/responsive.js only adds the menu toggle,
 * so without JS the menu simply stays expanded.
 * Colours are sampled from the legacy images: menu-even/odd/hover.png, bg-1.png, bg-wrapper-1.png, line-1.jpg.
 */

@media (max-width: 1119px) {
    :root {
        --zus-red: #cf3a24;
        --zus-red-odd: #ba3420;
        --zus-red-dark: #9c2a19;
        --zus-dark: #2f3139;
        --zus-yellow: #ffc90d;
        --zus-cream: #feefba;
        --zus-paper: #fffbdc;
        --zus-gutter: 16px;
    }

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

    html,
    body {
        height: auto;
    }

    body {
        line-height: 1.45;
    }

    div#darkLine,
    div#push {
        display: none;
    }

    div#wrapper {
        width: auto;
        min-height: 0;
        height: auto !important;
        margin: 0;
        background: none;
        overflow: visible;
    }

    /* Header: dark band with logo, name and the admissions tab, then the three obor tiles. */

    header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "logo name cta"
            "logo sub  cta"
            "obory obory obory";
        align-items: center;
        column-gap: 16px;
        width: auto;
        height: auto;
        padding: 0 var(--zus-gutter) var(--zus-gutter);
        background: var(--zus-dark) url('../images/bg-1.png') repeat-x center top;
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    }

    header > a:has(#logo) {
        grid-area: logo;
        padding-top: 14px;
    }

    header > a:has(#jakPodatPrihlasku) {
        grid-area: cta;
        align-self: start;
    }

    header > a:has(#zusZidlochoviceText) {
        grid-area: name;
        align-self: end;
        padding-top: 14px;
    }

    img#logo {
        display: block;
        float: none;
        width: 110px;
        height: auto;
        margin: 0;
    }

    img#zusZidlochoviceText {
        display: block;
        float: none;
        width: 100%;
        max-width: 560px;
        height: auto;
        margin: 0;
    }

    p.subtext {
        grid-area: sub;
        align-self: start;
        position: static;
        padding: 4px 0 0;
        font-size: 13px;
        letter-spacing: 1px;
    }

    div#jakPodatPrihlasku {
        float: none;
        width: auto;
        height: auto;
        padding: 8px 14px 9px;
        background: var(--zus-red);
        border-radius: 0 0 6px 6px;
        line-height: 1.15;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    nav#horizontalTop {
        grid-area: obory;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        float: none;
        width: auto;
        height: auto;
        margin: 14px 0 0;
        padding: 0;
    }

    nav#horizontalTop > a {
        display: block;
        min-width: 0;
    }

    div#hudebniObor,
    div#vytvarnyObor,
    div#tanecniObor {
        display: flex;
        align-items: center;
        justify-content: center;
        float: none;
        width: auto;
        height: 110px;
        margin: 0;
        padding: 0 6px;
        background-size: cover;
        background-position: center;
        border-radius: 4px;
        font-size: 22px;
        line-height: 1.1;
    }

    /* Left menu becomes a collapsible panel under the header. */

    nav#verticalLeft {
        float: none;
        width: auto;
        height: auto;
        margin: var(--zus-gutter) var(--zus-gutter) 0;
    }

    nav#verticalLeft ul {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        border-radius: 6px;
        overflow: hidden;
    }

    .zusJs nav#verticalLeft:not(.isOpen) ul {
        display: none;
    }

    .zusJs nav#verticalLeft.isOpen .navToggle {
        border-radius: 6px 6px 0 0;
    }

    .zusJs nav#verticalLeft.isOpen ul {
        border-radius: 0 0 6px 6px;
    }

    nav#verticalLeft li {
        width: auto;
        height: auto;
        padding: 0;
        background: var(--zus-red);
        border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    }

    nav#verticalLeft li:nth-child(4n + 2),
    nav#verticalLeft li:nth-child(4n + 3) {
        background: var(--zus-red-odd);
    }

    nav#verticalLeft li:hover {
        background: var(--zus-red-dark);
    }

    nav#verticalLeft li a {
        display: flex;
        align-items: center;
        gap: 10px;
        box-sizing: border-box;
        min-height: 46px;
        padding: 10px var(--zus-gutter);
    }

    .navToggle {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        min-height: 48px;
        padding: 0 var(--zus-gutter);
        border: 0;
        border-radius: 6px;
        background: var(--zus-red);
        color: #fef0bf;
        font: 17px/1 'Anivers-Regular', Arial, sans-serif;
        letter-spacing: 1px;
        text-align: left;
        text-transform: uppercase;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(58, 60, 70, 0.25);
    }

    .navToggle:focus-visible {
        outline: 3px solid var(--zus-dark);
        outline-offset: 2px;
    }

    .navToggleCurrent {
        flex: 1;
        overflow: hidden;
        opacity: 0.85;
        font-size: 14px;
        text-align: right;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .navToggleIcon,
    .navToggleIcon::before,
    .navToggleIcon::after {
        display: block;
        width: 20px;
        height: 2px;
        background: currentColor;
        border-radius: 1px;
        transition: transform 0.2s;
    }

    .navToggleIcon {
        position: relative;
    }

    .navToggleIcon::before,
    .navToggleIcon::after {
        content: '';
        position: absolute;
        left: 0;
    }

    .navToggleIcon::before {
        top: -6px;
    }

    .navToggleIcon::after {
        top: 6px;
    }

    .isOpen .navToggleIcon {
        background: transparent;
    }

    .isOpen .navToggleIcon::before {
        transform: translateY(6px) rotate(45deg);
    }

    .isOpen .navToggleIcon::after {
        transform: translateY(-6px) rotate(-45deg);
    }

    /* Content column */

    div#contentWrapper {
        float: none;
        width: auto;
        margin: var(--zus-gutter);
        background: var(--zus-paper);
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 2px 10px rgba(58, 60, 70, 0.15);
    }

    div#heading {
        height: auto;
        padding: 16px var(--zus-gutter) 14px;
    }

    div#heading h1 {
        font-size: 28px;
        line-height: 1.15;
    }

    div.lineOne {
        float: none;
        width: auto;
    }

    div#content {
        min-height: 0;
        margin-bottom: 0;
        padding: var(--zus-gutter);
        overflow-wrap: break-word;
    }

    /* Editor content carries fixed widths from the old WYSIWYG; keep it inside the column. */
    div#content :where(img, iframe, video, object, embed) {
        max-width: 100%;
    }

    div#content img {
        height: auto;
    }

    div#content :where(div, p, ul, ol, blockquote, pre, h2, h3, h4) {
        max-width: 100%;
    }

    div#content table {
        max-width: 100%;
    }

    div#content pre {
        overflow-x: auto;
    }

    hr {
        margin: 20px calc(-1 * var(--zus-gutter));
    }

    /* Pagers: finger-sized targets */

    ul#pages {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
    }

    ul#pages li {
        margin: 0;
        border-radius: 4px;
    }

    div#content ul#pages li {
        margin-bottom: 0;
    }

    ul#pages li a,
    ul#pages li.active {
        box-sizing: border-box;
        min-width: 40px;
        padding: 10px 6px;
        text-align: center;
    }

    /* Kalendář akcí */

    div#kalendarAkci {
        margin: 0;
    }

    div#kalendarAkci hr {
        margin: 24px calc(-1 * var(--zus-gutter));
    }

    div#kalendarAkci ul {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 0;
    }

    div#kalendarAkci li {
        margin: 0;
    }

    div#content div#kalendarAkci li {
        margin-bottom: 0;
    }

    div#kalendarAkci div.h2Wrapper,
    div#kalendarAkci div.h3Wrapper {
        float: none;
        width: auto;
    }

    div#kalendarAkci div.h2Wrapper {
        margin-bottom: 10px;
    }

    div#kalendarAkci div.label {
        width: auto;
    }

    /* Galerie */

    div#galerie a[rel^="shadowbox"] img {
        box-sizing: border-box;
        width: calc(33.333% - 6px);
        margin: 0 0 6px;
    }

    div#galerie iframe {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    /* Legacy page widgets */

    div#situationOne,
    div#situationTwo,
    div#situationThree,
    div#situationFive,
    div#situationFour,
    div#situationSix {
        width: auto !important;
    }

    div#panel {
        width: auto;
    }

    .prihlaskaForm tr {
        float: none;
        width: auto;
    }

    footer {
        width: auto;
        height: auto;
        margin: 0 var(--zus-gutter) var(--zus-gutter);
    }

    footer div.lineOne {
        display: none;
    }

    footer div#footerBox {
        float: none;
        width: auto;
        height: auto;
        padding: 14px var(--zus-gutter);
        border-top: 5px solid var(--zus-yellow);
        border-radius: 6px;
        font-size: 12px;
        line-height: 1.5;
    }
}

/* Phones */

@media (max-width: 639px) {
    header {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "logo cta"
            "logo name"
            "logo sub"
            "obory obory";
        column-gap: 12px;
    }

    header > a:has(#logo) {
        align-self: end;
        padding-top: 0;
    }

    header > a:has(#jakPodatPrihlasku) {
        justify-self: end;
    }

    header > a:has(#zusZidlochoviceText) {
        padding-top: 8px;
    }

    img#logo {
        width: 68px;
    }

    p.subtext {
        font-size: 11px;
        letter-spacing: 0.5px;
    }

    div#jakPodatPrihlasku {
        padding: 7px 12px 8px;
        font-size: 13px;
    }

    nav#horizontalTop {
        gap: 4px;
        margin-top: 12px;
    }

    div#hudebniObor,
    div#vytvarnyObor,
    div#tanecniObor {
        height: 76px;
        font-size: 16px;
        /* One word per line, so all three labels wrap the same way. */
        word-spacing: 100vw;
        overflow: hidden;
    }

    nav#verticalLeft ul {
        grid-template-columns: 1fr;
    }

    nav#verticalLeft li:nth-child(n) {
        background: var(--zus-red);
    }

    nav#verticalLeft li:nth-child(even) {
        background: var(--zus-red-odd);
    }

    div#contentWrapper {
        margin: 12px 0 0;
        border-radius: 0;
    }

    nav#verticalLeft {
        margin: 12px var(--zus-gutter) 0;
    }

    div#heading h1 {
        font-size: 23px;
    }

    footer {
        margin: 0;
    }

    footer div#footerBox {
        border-radius: 0;
    }

    div#galerie a[rel^="shadowbox"] img {
        width: calc(50% - 4px);
    }

    /* Wide data tables scroll sideways instead of stretching the page. */
    div#content table#faculty,
    div#content table#charge {
        display: block;
        width: auto;
        overflow-x: auto;
    }

    div#kalendarAkci li {
        width: 104px;
        background-size: 100% 100%;
        font-size: 16px;
    }

    .prihlaskaForm th {
        width: auto;
        text-align: left;
    }

    .prihlaskaForm input[type=text],
    .prihlaskaForm input[type=email],
    .prihlaskaForm select {
        box-sizing: border-box;
        width: 100%;
    }
}

@media (min-width: 1120px) {
    .navToggle {
        display: none;
    }
}
