/*
    This file is part of m.css.

    Copyright © 2017, 2018, 2019, 2020, 2021, 2022, 2023
              Vladimír Vondruš <mosra@centrum.cz>

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    DEALINGS IN THE SOFTWARE.
*/

/* Important basics */
*, ::before, ::after { box-sizing: border-box; }
body { margin: 0; }

/* 12-column layout. Inspired by Bootstrap and
   https://www.w3schools.com/css/css_rwd_grid.asp. The container is padded from
   sides, the row inside removes the padding and columns add it back. */
.m-container {
  width: 100%;
  margin: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
.m-row {
  margin-left: -1rem;
  margin-right: -1rem;
}
.m-row::after { /* avoid rows floating around each other */
  content: ' ';
  clear: both;
  display: table;
}
.m-row > [class*='m-col-'] {
  position: relative;
  padding: 1rem;
}
[class*='m-clearfix-']::after {
  display: block;
  content: ' ';
  clear: both;
}
[class*='m-show-'] {
  display: none;
}

/* Margin for inflated / floating columns behaves as "padding-after" by default
   -- there's only padding on the bottom but not when the column is last. */
.m-container-inflate, :not(.m-row) > [class*='m-col-'] {
  margin-bottom: 1rem;
}
.m-container-inflate:last-child, :not(.m-row) > [class*='m-col-']:last-child {
  margin-bottom: 0;
}

/* Padding overrides for container and columns. Works for both columns inside
   rows and floating columns. */
.m-container.m-nopad, [class*='m-col-'].m-nopad,
.m-container.m-nopadx, [class*='m-col-'].m-nopadx,
.m-container.m-nopadl, [class*='m-col-'].m-nopadl {
  padding-left: 0;
}
.m-container.m-nopad, [class*='m-col-'].m-nopad,
.m-container.m-nopadx, [class*='m-col-'].m-nopadx,
.m-container.m-nopadr, [class*='m-col-'].m-nopadr {
  padding-right: 0;
}
[class*='m-col-'].m-nopad, [class*='m-col-'].m-nopady, [class*='m-col-'].m-nopadt {
  padding-top: 0;
}
[class*='m-col-'].m-nopad, [class*='m-col-'].m-nopady, [class*='m-col-'].m-nopadb,
.m-container-inflate.m-nopadb {
  padding-bottom: 0;
}

/* 12-column layout -- T (portrait phones) */
[class*='m-col-t-'] { float: left; }

.m-left-t {
  padding-right: 1rem;
  float: left;
}
.m-right-t, [class*='m-col-t-'].m-right-t {
  padding-left: 1rem;
  float: right;
}
.m-center-t, [class*='m-col-t-'].m-center-t {
  float: none;
}
.m-center-t, [class*='m-col-t-'].m-center-t {
  margin-left: auto;
  margin-right: auto;
  float: none;
}

.m-col-t-1  { width: calc(1  * 100% / 12); }
.m-col-t-2  { width: calc(2  * 100% / 12); }
.m-col-t-3  { width: calc(3  * 100% / 12); }
.m-col-t-4  { width: calc(4  * 100% / 12); }
.m-col-t-5  { width: calc(5  * 100% / 12); }
.m-col-t-6  { width: calc(6  * 100% / 12); }
.m-col-t-7  { width: calc(7  * 100% / 12); }
.m-col-t-8  { width: calc(8  * 100% / 12); }
.m-col-t-9  { width: calc(9  * 100% / 12); }
.m-col-t-10 { width: calc(10 * 100% / 12); }
.m-col-t-11 { width: calc(11 * 100% / 12); }
.m-col-t-12 { width: calc(12 * 100% / 12); }

.m-push-t-1  { left: calc(1  * 100% / 12); }
.m-push-t-2  { left: calc(2  * 100% / 12); }
.m-push-t-3  { left: calc(3  * 100% / 12); }
.m-push-t-4  { left: calc(4  * 100% / 12); }
.m-push-t-5  { left: calc(5  * 100% / 12); }
.m-push-t-6  { left: calc(6  * 100% / 12); }
.m-push-t-7  { left: calc(7  * 100% / 12); }
.m-push-t-8  { left: calc(8  * 100% / 12); }
.m-push-t-9  { left: calc(9  * 100% / 12); }
.m-push-t-10 { left: calc(10 * 100% / 12); }
.m-push-t-11 { left: calc(11 * 100% / 12); }

.m-pull-t-1  { right: calc(1  * 100% / 12); }
.m-pull-t-2  { right: calc(2  * 100% / 12); }
.m-pull-t-3  { right: calc(3  * 100% / 12); }
.m-pull-t-4  { right: calc(4  * 100% / 12); }
.m-pull-t-5  { right: calc(5  * 100% / 12); }
.m-pull-t-6  { right: calc(6  * 100% / 12); }
.m-pull-t-7  { right: calc(7  * 100% / 12); }
.m-pull-t-8  { right: calc(8  * 100% / 12); }
.m-pull-t-9  { right: calc(9  * 100% / 12); }
.m-pull-t-10 { right: calc(10 * 100% / 12); }
.m-pull-t-11 { right: calc(11 * 100% / 12); }

/* 12-column layout -- S, 576px and up (landscape phones) */
@media screen and (min-width: 576px) {
  .m-container { width: 560px; }

  .m-container-inflatable .m-col-s-10 .m-container-inflate:not([class*='m-left-']):not([class*='m-right-']) {
    margin-left: -10%;
    margin-right: -10%;
  }
  .m-container-inflatable .m-col-s-10 .m-container-inflate.m-left-s {
    margin-left: -10%;
  }
  .m-container-inflatable .m-col-s-10 .m-container-inflate.m-right-s {
    margin-right: -10%;
  }

  [class*='m-col-s-'] { float: left; }

  .m-left-s {
    padding-right: 1rem;
    float: left;
  }
  .m-right-s, [class*='m-col-s-'].m-right-s {
    padding-left: 1rem;
    float: right;
  }
  .m-center-s, [class*='m-col-s-'].m-center-s {
    margin-left: auto;
    margin-right: auto;
    float: none;
  }

  .m-col-s-1  { width: calc(1  * 100% / 12); }
  .m-col-s-2  { width: calc(2  * 100% / 12); }
  .m-col-s-3  { width: calc(3  * 100% / 12); }
  .m-col-s-4  { width: calc(4  * 100% / 12); }
  .m-col-s-5  { width: calc(5  * 100% / 12); }
  .m-col-s-6  { width: calc(6  * 100% / 12); }
  .m-col-s-7  { width: calc(7  * 100% / 12); }
  .m-col-s-8  { width: calc(8  * 100% / 12); }
  .m-col-s-9  { width: calc(9  * 100% / 12); }
  .m-col-s-10 { width: calc(10 * 100% / 12); }
  .m-col-s-11 { width: calc(11 * 100% / 12); }
  .m-col-s-12 { width: calc(12 * 100% / 12); }

  .m-push-s-0  { left: calc(0  * 100% / 12); }
  .m-push-s-1  { left: calc(1  * 100% / 12); }
  .m-push-s-2  { left: calc(2  * 100% / 12); }
  .m-push-s-3  { left: calc(3  * 100% / 12); }
  .m-push-s-4  { left: calc(4  * 100% / 12); }
  .m-push-s-5  { left: calc(5  * 100% / 12); }
  .m-push-s-6  { left: calc(6  * 100% / 12); }
  .m-push-s-7  { left: calc(7  * 100% / 12); }
  .m-push-s-8  { left: calc(8  * 100% / 12); }
  .m-push-s-9  { left: calc(9  * 100% / 12); }
  .m-push-s-10 { left: calc(10 * 100% / 12); }
  .m-push-s-11 { left: calc(11 * 100% / 12); }

  .m-pull-s-0  { right: calc(0  * 100% / 12); }
  .m-pull-s-1  { right: calc(1  * 100% / 12); }
  .m-pull-s-2  { right: calc(2  * 100% / 12); }
  .m-pull-s-3  { right: calc(3  * 100% / 12); }
  .m-pull-s-4  { right: calc(4  * 100% / 12); }
  .m-pull-s-5  { right: calc(5  * 100% / 12); }
  .m-pull-s-6  { right: calc(6  * 100% / 12); }
  .m-pull-s-7  { right: calc(7  * 100% / 12); }
  .m-pull-s-8  { right: calc(8  * 100% / 12); }
  .m-pull-s-9  { right: calc(9  * 100% / 12); }
  .m-pull-s-10 { right: calc(10 * 100% / 12); }
  .m-pull-s-11 { right: calc(11 * 100% / 12); }

  .m-clearfix-t::after { display: none; }

  .m-hide-s { display: none; }
  .m-show-s { display: block; }

  .m-col-s-none {
    width: auto;
    float: none;
  }
}

/* 12-column layout -- M, 768px and up (tablets, small desktops) */
@media screen and (min-width: 768px) {
  .m-container { width: 750px; }

  .m-container-inflatable .m-col-m-10 .m-container-inflate:not([class*='m-left-']):not([class*='m-right-']) {
    margin-left: -10%;
    margin-right: -10%;
  }
  .m-container-inflatable .m-col-m-10 .m-container-inflate.m-left-m {
    margin-left: -10%;
  }
  .m-container-inflatable .m-col-m-10 .m-container-inflate.m-right-m {
    margin-right: -10%;
  }

  [class*='m-col-m-'] { float: left; }

  .m-left-m {
    padding-right: 1rem;
    float: left;
  }
  .m-right-m, [class*='m-col-m-'].m-right-m {
    padding-left: 1rem;
    float: right;
  }
  .m-center-m, [class*='m-col-m-'].m-center-m {
    margin-left: auto;
    margin-right: auto;
    float: none;
  }

  .m-col-m-1  { width: calc(1  * 100% / 12); }
  .m-col-m-2  { width: calc(2  * 100% / 12); }
  .m-col-m-3  { width: calc(3  * 100% / 12); }
  .m-col-m-4  { width: calc(4  * 100% / 12); }
  .m-col-m-5  { width: calc(5  * 100% / 12); }
  .m-col-m-6  { width: calc(6  * 100% / 12); }
  .m-col-m-7  { width: calc(7  * 100% / 12); }
  .m-col-m-8  { width: calc(8  * 100% / 12); }
  .m-col-m-9  { width: calc(9  * 100% / 12); }
  .m-col-m-10 { width: calc(10 * 100% / 12); }
  .m-col-m-11 { width: calc(11 * 100% / 12); }
  .m-col-m-12 { width: calc(12 * 100% / 12); }

  .m-push-m-0  { left: calc(0  * 100% / 12); }
  .m-push-m-1  { left: calc(1  * 100% / 12); }
  .m-push-m-2  { left: calc(2  * 100% / 12); }
  .m-push-m-3  { left: calc(3  * 100% / 12); }
  .m-push-m-4  { left: calc(4  * 100% / 12); }
  .m-push-m-5  { left: calc(5  * 100% / 12); }
  .m-push-m-6  { left: calc(6  * 100% / 12); }
  .m-push-m-7  { left: calc(7  * 100% / 12); }
  .m-push-m-8  { left: calc(8  * 100% / 12); }
  .m-push-m-9  { left: calc(9  * 100% / 12); }
  .m-push-m-10 { left: calc(10 * 100% / 12); }
  .m-push-m-11 { left: calc(11 * 100% / 12); }

  .m-pull-m-0  { right: calc(0  * 100% / 12); }
  .m-pull-m-1  { right: calc(1  * 100% / 12); }
  .m-pull-m-2  { right: calc(2  * 100% / 12); }
  .m-pull-m-3  { right: calc(3  * 100% / 12); }
  .m-pull-m-4  { right: calc(4  * 100% / 12); }
  .m-pull-m-5  { right: calc(5  * 100% / 12); }
  .m-pull-m-6  { right: calc(6  * 100% / 12); }
  .m-pull-m-7  { right: calc(7  * 100% / 12); }
  .m-pull-m-8  { right: calc(8  * 100% / 12); }
  .m-pull-m-9  { right: calc(9  * 100% / 12); }
  .m-pull-m-10 { right: calc(10 * 100% / 12); }
  .m-pull-m-11 { right: calc(11 * 100% / 12); }

  .m-clearfix-s::after { display: none; }

  .m-hide-m { display: none; }
  .m-show-m { display: block; }

  .m-col-m-none {
    width: auto;
    float: none;
  }
}

/* 12-column layout -- L, 992px and up (desktops, very large tablets) */
@media screen and (min-width: 992px) {
  .m-container { width: 960px; }

  .m-container-inflatable .m-col-l-10 .m-container-inflate:not([class*='m-left-']):not([class*='m-right-']) {
    margin-left: -10%;
    margin-right: -10%;
  }
  .m-container-inflatable .m-col-l-10 .m-container-inflate.m-left-l {
    margin-left: -10%;
  }
  .m-container-inflatable .m-col-l-10 .m-container-inflate.m-right-l {
    margin-right: -10%;
  }

  [class*='m-col-l-'] { float: left; }

  .m-left-l {
    padding-right: 1rem;
    float: left;
  }
  .m-right-l, [class*='m-col-l-'].m-right-l {
    padding-left: 1rem;
    float: right;
  }
  .m-center-l, [class*='m-col-l-'].m-center-l {
    margin-left: auto;
    margin-right: auto;
    float: none;
  }

  .m-col-l-1  { width: calc(1  * 100% / 12); }
  .m-col-l-2  { width: calc(2  * 100% / 12); }
  .m-col-l-3  { width: calc(3  * 100% / 12); }
  .m-col-l-4  { width: calc(4  * 100% / 12); }
  .m-col-l-5  { width: calc(5  * 100% / 12); }
  .m-col-l-6  { width: calc(6  * 100% / 12); }
  .m-col-l-7  { width: calc(7  * 100% / 12); }
  .m-col-l-8  { width: calc(8  * 100% / 12); }
  .m-col-l-9  { width: calc(9  * 100% / 12); }
  .m-col-l-10 { width: calc(10 * 100% / 12); }
  .m-col-l-11 { width: calc(11 * 100% / 12); }
  .m-col-l-12 { width: calc(12 * 100% / 12); }

  .m-push-l-0  { left: calc(0  * 100% / 12); }
  .m-push-l-1  { left: calc(1  * 100% / 12); }
  .m-push-l-2  { left: calc(2  * 100% / 12); }
  .m-push-l-3  { left: calc(3  * 100% / 12); }
  .m-push-l-4  { left: calc(4  * 100% / 12); }
  .m-push-l-5  { left: calc(5  * 100% / 12); }
  .m-push-l-6  { left: calc(6  * 100% / 12); }
  .m-push-l-7  { left: calc(7  * 100% / 12); }
  .m-push-l-8  { left: calc(8  * 100% / 12); }
  .m-push-l-9  { left: calc(9  * 100% / 12); }
  .m-push-l-10 { left: calc(10 * 100% / 12); }
  .m-push-l-11 { left: calc(11 * 100% / 12); }

  .m-pull-l-0  { right: calc(0  * 100% / 12); }
  .m-pull-l-1  { right: calc(1  * 100% / 12); }
  .m-pull-l-2  { right: calc(2  * 100% / 12); }
  .m-pull-l-3  { right: calc(3  * 100% / 12); }
  .m-pull-l-4  { right: calc(4  * 100% / 12); }
  .m-pull-l-5  { right: calc(5  * 100% / 12); }
  .m-pull-l-6  { right: calc(6  * 100% / 12); }
  .m-pull-l-7  { right: calc(7  * 100% / 12); }
  .m-pull-l-8  { right: calc(8  * 100% / 12); }
  .m-pull-l-9  { right: calc(9  * 100% / 12); }
  .m-pull-l-10 { right: calc(10 * 100% / 12); }
  .m-pull-l-11 { right: calc(11 * 100% / 12); }

  .m-clearfix-m::after { display: none; }

  .m-hide-l { display: none; }
  .m-show-l { display: block; }

  .m-col-l-none {
    width: auto;
    float: none;
  }
}
