/* Fixes for the static ASEM27 copy (build_static.py adds this after the template's own CSS).
   Every screen: logos at their own proportions and sizes that sit together, the shortcut cards without white
   corners, room above the footer. Phones, tablets and narrow windows (below 1200px): the template was made for a 1240px desktop (fixed widths,
   a menu that never folds, side column beside the text). */

/* organisers and sponsors: the template forced width and height on each logo (KTA and KAIST came out squashed) */
.aside .organizer > div, .aside .sponser > div { padding-left: 0; }
.aside .organizer img, .aside .sponser img { display: block; width: auto !important; height: auto !important; max-width: 150px; margin: 0 0 16px !important; }
.aside img[src$="iasem.jpg"] { height: 64px !important; }
.aside img[src$="techno-press-logo.svg"] { width: 150px !important; }
.aside img[src$="kta.png"] { width: 150px !important; }
.aside img[src$="kaist_logo.png"] { height: 34px !important; }
.aside img[src$="visitkorea.png"] { height: 50px !important; }
.aside img[src$="incheon.jpg"] { width: 140px !important; }
.aside img[src$="ITO.png"] { width: 140px !important; }
.aside .organizer > div > a, .aside .sponser > div > a { display: block; }
.aside .sponser > div > br { display: none; }

/* home: the four shortcut cards (PNG with transparent corners) and space before the footer */
/* the old markup leaves #cta open, so the footer sits inside it: the room goes under the cards' row, none under the footer */
#cta { padding-bottom: 0 !important; }
#cta > .container { padding-bottom: 40px; }

/* no sideways scrolling on narrower desktop windows: the menu row was fixed at 1240px, the page at 1100px */
html, body { overflow-x: hidden; }
#header .navbar-collapse { min-width: 0 !important; }
.content { width: auto !important; max-width: 1100px; }
#cta .quick img { border-radius: 14px; }

/* below 1200px the menu row and the two columns no longer fit: the phone layout (Bootstrap would show the menu
   open from 768px, so its collapse is overridden here) */
@media (max-width: 1199px) {
    #header .navbar-collapse.collapse { display: none !important; }
    #header .navbar-collapse.collapse.in, #header .navbar-collapse.collapsing { display: block !important; }
    #header .navbar-nav, #header .navbar-nav > li { float: none; }

    html, body { overflow-x: hidden; }
    body { padding-top: 64px !important; }
    .index { margin-top: 0 !important; }
    img { max-width: 100%; height: auto; }

    /* header: one row with the logo and the menu button; the menu opens below it */
    #header .container { width: auto; padding-left: 16px; padding-right: 16px; }
    #header .navbar-header { position: relative; float: none; min-height: 64px; margin: 0; }
    #header .navbar-brand { height: auto; padding: 14px 0; margin: 0 !important; }
    #header .navbar-brand img { max-height: 34px; width: auto; margin-top: 0 !important; }
    #header nav > .container:first-child > div[style*="float"] { display: none; }
    #header .navbar-toggle { display: block; position: absolute; right: 0; top: 14px; margin: 0; padding: 9px 10px; border: 1px solid #ccd3e0; border-radius: 6px; background: #fff; }
    #header .navbar-toggle .icon-bar { display: block; width: 20px; height: 2px; background: #00123f; border-radius: 1px; }
    #header .navbar-toggle .icon-bar + .icon-bar { margin-top: 4px; }
    #header .navbar-collapse { min-width: 0 !important; max-width: none !important; border-top: 1px solid #e5e7eb; }
    #header .navbar-nav { margin: 0; }
    #header .navbar-nav > li[style] { display: none; }
    #header .navbar-nav > li > a { padding: 12px 0; font-size: 16px; }

    /* the page: one column, the section menu first, the text, then the organisers and sponsors */
    .content { width: auto !important; margin: 0 !important; padding: 20px 16px 32px; display: flex; flex-direction: column; }
    .content .aside { display: contents; }
    .content .aside > h3 { order: 1; margin: 0 0 12px; font-size: 22px; text-align: left; }
    .content .aside > ul { order: 2; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
    .content .aside > ul > li { margin: 0 !important; padding: 0; border: 1px solid #d5dbe6; border-radius: 6px; background: #fff; }
    .content .aside > ul > li > a { display: block; padding: 8px 12px; font-size: 14px; color: #00123f; }
    /* a group inside the menu (Venue: Incheon, Convensia): its name as a label, its pages as buttons beside it */
    .content .aside > ul > li:has(> ul) { display: contents; }
    .content .aside > ul > li > ul { display: contents; }
    .content .aside > ul > li > ul > li { margin: 0 !important; padding: 0; border: 1px solid #d5dbe6; border-radius: 6px; background: #fff; list-style: none; }
    .content .aside > ul > li > ul > li > a { display: block; padding: 8px 12px; font-size: 14px; color: #00123f; }
    .content .aside > ul > li > ul > li.active { background: #00123f; border-color: #00123f; }
    .content .aside > ul > li > ul > li.active > a { color: #fff !important; }
    .content .aside > ul > li > span { align-self: center; padding: 0 2px; font-size: 14px; font-weight: 700; color: #00123f; }
    .content .aside > ul > li.active { background: #00123f; border-color: #00123f; }
    .content .aside > ul > li.active > a { color: #fff !important; }
    .content .article { order: 3; float: none !important; width: auto !important; min-width: 0; margin: 0 !important; padding: 0 !important; overflow-wrap: anywhere; }
    .content .aside > .row { order: 4; margin: 32px 0 0; }
    .content .aside > .row > h4 { margin: 0 0 12px; }
    .content .aside > .row > div { width: auto; float: none; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
    .content .aside > .row > div > br { display: none; }
    .content .aside > .row img { margin: 0 !important; }

    .content .article table { display: block; max-width: 100%; overflow-x: auto; }
    .content .article table th, .content .article table td { overflow-wrap: normal; word-break: keep-all; min-width: 72px; }
    .content .article iframe { max-width: 100%; }
    .content .article [style*="width"] { max-width: 100%; }

    /* home: the dates beside their names, the four shortcuts two by two */
    #cta { padding: 24px 0; }
    #cta .container { width: auto; padding-left: 16px; padding-right: 16px; }
    #cta .row { margin: 0; }
    #cta [class*="col-"] { float: none; width: auto; padding: 0; }
    #cta h2 { margin-top: 0; }
    #cta .imp_content, #cta .imp_date { float: left; width: 58%; font-size: 14px; }
    #cta .imp_date { width: 42%; margin-left: 0; }
    #cta .imp_content ul { padding-left: 18px; }
    #cta .imp_date ul { padding-left: 0; }
    #cta .imp_content li, #cta .imp_date li { line-height: 1.7; white-space: nowrap; }
    #cta .quick { clear: both; margin: 16px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    #cta .quick img { float: none; width: 100% !important; margin: 0; }
}
