/* Layout */

:root {
    --bs-code-color: darkgray;
}

header .navbar, main, footer, .content-width {
    max-width: 992px;
    margin-left: auto;
    margin-right: auto;
}

header .navbar, footer {
    padding: 0.5rem 1rem;
}

.content-width {
    padding-left: 1rem;
    padding-right: 1rem;
}

main {
    padding: 1.5rem 1rem 2rem 1rem;
}

@media screen and (min-width: 992px) {
    .full-width {
        margin-left: min(-100vw / 2 + 992px / 2 + 1rem, 0px);
        margin-right: min(-100vw / 2 + 992px / 2 + 1rem, 0px);
    }
}

footer {
    font-size: 80%;
    opacity: 70%;
}


/* Typography */

body {
    font-family: 'Fira Sans Condensed', 'Noto Color Emoji', sans-serif;
}

h1, h2, h3, h4, h5, h6,
.multipart-table th[colspan] {
    font-weight: normal;
}

@media screen and (min-width: 576px) {
    html {
        font-size: 110%;
    }

    h1, h2, h3, h4, h5, h6,
    .multipart-table th[colspan] {
        font-family: 'Fira Sans', 'Noto Color Emoji', sans-serif;
    }
}

@media screen and (min-width: 768px) {
    html {
        font-size: 120%;
    }
}

h1 {
    font-size: calc(1.375rem + 1.5vmin);
}

h2 {
    font-size: calc(1.325rem + .9vmin);
}

h3 {
    font-size: calc(1.3rem + .6vmin);
}


/* General */

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
}

section {
    margin-top: 1rem;
}

.tab-pane > section:first-child {
    margin-top: 0;
}

section ~ section {
    margin-top: 1.5rem;
}

section :is(h1, h2, h3) {
    margin-bottom: 0.5rem;
}

section h4 {
    margin-bottom: 0.25rem;
}

section :is(h5, h6) {
    margin-bottom: 0;
}

:is(h1, h2, h3, h4, h5, h6, .table-hover, .simple-links) a {
    text-decoration: none;
}

table.info td {
    padding-top: 0.2em;
    padding-bottom: 0.2em;
    vertical-align: top;
}

table.info td:first-child {
    font-weight: bold;
    padding-right: 1em;
}

table.info td:first-child::after {
    content: ":";
}

table.info :is(ul, ol) {
    padding-left: 1em;
}

.form-text {
    padding: 0 .15rem; /* looks better with rounded corner inputs */
}

/* rounded corners in list group even if last item is hidden */
.list-group-item:nth-last-child(2) {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* and a fix for apparently incomplete select2-bootstrap-5 css */
.input-group > .form-control ~ .select2-container--bootstrap-5 .select2-selection {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.multipart-table tbody:not(:last-child)::after {
    content: '';
    display: block;
    height: 1.5rem;
}

.multipart-table th[colspan] {
    font-size: calc(1.3rem + .6vmin);
    font-weight: 500;
    padding-top: 0;
    padding-left: 0;
    line-height: 1.2;
}

.table td {
    border-top-width: 1px;
}

.equipment-row td:first-child:not(:empty):after {
    content: '×';
}

.equipment-row td:first-child {
    width: 0;
    text-align: right;
    padding-right: 0;
}

.nav-pills-sm .nav-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    border: 1px solid transparent;
}

.nav-pills-sm .nav-link.active {
    border-color: var(--bs-nav-pills-link-active-bg);
}

.mini-btn {
    cursor: pointer;
    color: var(--bs-secondary);
    transition: color .15s ease-in-out;
}

.mini-btn:hover {
    color: #5c636a; /* copied from .btn-secondary */
}


/* Editor */

.asciidoc-editor :is(textarea, .card-body) {
    padding: 0.5rem 0.75rem;
}

.asciidoc-editor .tab-content {
    display: flex;
}

.asciidoc-editor .tab-content > .tab-pane {
    display: block;
    visibility: hidden;
    width: 100%;
    margin-right: -100%;
}

.asciidoc-editor .tab-content > .active {
    visibility: visible;
}

.asciidoc-editor .tab-pane .card {
    height: 100%;
}

.asciidoc-editor .tab-pane .card-body {
    position: relative;
}

.asciidoc-editor .tab-pane .card-body > div {
    position: absolute;
    width: calc(100% - 1.25rem); /* padding of card, almost */
    height: calc(100% - 1rem);  /* padding of card */
    overflow: auto;
}


/* Team */

.team {
    --team-gap: 0.25em;
}

.team a {
    text-decoration: none;
}

.team > * {
    white-space: nowrap;
}

.team > :not(:last-child) {
    margin-right: var(--team-gap);
}

.team .emoji {
    margin-left: -2pt;
    margin-right: -1pt;
}

.team .responsible .name {
    text-decoration: underline;
}

:is(.minimize-team, .minimize-team-xs) .team > :not(:last-child) {
    margin-right: 0;
}

:is(.minimize-team, .minimize-team-xs) .team .name {
    display: none;
}

@media screen and (min-width: 576px) {
    .minimize-team-xs .team > :not(:last-child) {
        margin-right: var(--team-gap);
    }

    .minimize-team-xs .team .name {
        display: revert;
    }
}


/* Layout of job and equipment list on really small devices */

#equipment :is(.form-control, .input-group-text) {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

#equipment .select2-selection {
    padding-left: 0.25rem;
    padding-right: 1rem;
    background-position-x: right 0.25rem;
}

#equipment input:first-child {
    max-width: 1.8rem;
}

#equipment .select2 {
    max-width: 6rem;
}

#jobs .select2 {
    max-width: 7.5rem;
}

@media screen and (min-width: 576px) {
    #equipment :is(.form-control, .input-group-text) {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    #equipment .select2-selection {
        padding-left: 0.75rem;
        padding-right: 2.25rem;
        background-position-x: right 0.75rem;
    }

    #equipment input:first-child {
        max-width: 4rem;
    }

    #equipment .select2, #jobs .select2 {
        max-width: 12rem;
    }
}


/* Camp schedule table */

.scroll-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
}

.scroll-shadow-left {
    background: linear-gradient(
            to right,
            hsla(0, 0%, 0%, 0.36) 0%,
            hsla(0, 0%, 0%, 0.355) 9.1%,
            hsla(0, 0%, 0%, 0.343) 17.2%,
            hsla(0, 0%, 0%, 0.323) 24.5%,
            hsla(0, 0%, 0%, 0.297) 31.2%,
            hsla(0, 0%, 0%, 0.267) 37.3%,
            hsla(0, 0%, 0%, 0.233) 43%,
            hsla(0, 0%, 0%, 0.198) 48.4%,
            hsla(0, 0%, 0%, 0.162) 53.8%,
            hsla(0, 0%, 0%, 0.127) 59.2%,
            hsla(0, 0%, 0%, 0.093) 64.7%,
            hsla(0, 0%, 0%, 0.063) 70.6%,
            hsla(0, 0%, 0%, 0.037) 76.9%,
            hsla(0, 0%, 0%, 0.017) 83.8%,
            hsla(0, 0%, 0%, 0.005) 91.5%,
            hsla(0, 0%, 0%, 0) 100%
    ) no-repeat;
    background-size: 80px 100%;
}

.scroll-shadow-right {
    background: linear-gradient(
            to left,
            hsla(0, 0%, 0%, 0.22) 0%,
            hsla(0, 0%, 0%, 0.198) 2%,
            hsla(0, 0%, 0%, 0.176) 4.3%,
            hsla(0, 0%, 0%, 0.155) 7%,
            hsla(0, 0%, 0%, 0.134) 10.3%,
            hsla(0, 0%, 0%, 0.114) 14.1%,
            hsla(0, 0%, 0%, 0.095) 18.6%,
            hsla(0, 0%, 0%, 0.077) 23.9%,
            hsla(0, 0%, 0%, 0.061) 29.9%,
            hsla(0, 0%, 0%, 0.046) 36.7%,
            hsla(0, 0%, 0%, 0.033) 44.5%,
            hsla(0, 0%, 0%, 0.021) 53.3%,
            hsla(0, 0%, 0%, 0.012) 63.2%,
            hsla(0, 0%, 0%, 0.006) 74.2%,
            hsla(0, 0%, 0%, 0.001) 86.5%,
            hsla(0, 0%, 0%, 0) 100%
    ) no-repeat right;
    background-size: 40px 100%;
}

.camp-schedule {
    font-family: 'Fira Sans Extra Condensed', 'Noto Color Emoji', sans-serif;
    margin: 0 auto;
    width: min(100%, var(--cp-columns) * 12em + 2.5em);
    border-bottom: 1px solid var(--bs-border-color);
    /* rest of the border on cells */
    border-collapse: separate;
    border-spacing: 0;
}

.camp-schedule th {
    padding: 0;
    border-top: 1px solid var(--bs-border-color);
    position: relative;
}

.camp-schedule th div {
    width: calc(var(--cp-width) * 8.5rem);
}

.camp-schedule .time {
    width: 2.5em;
    text-align: center;
}

.camp-schedule th .camp-schedule-header {
    text-align: center;
    padding: 0.2em 0.3em;
}

.camp-schedule .add-item-btn {
    position: absolute;
    top: 0.2em;
    right: 0.3em;
    visibility: hidden;
}

.camp-schedule-container .camp-schedule .add-item-btn {
    visibility: visible;
}

.camp-schedule :is(th, td) {
    border-right: 1px solid var(--bs-border-color);
}

.camp-schedule th {
    border-bottom: 1px solid var(--bs-border-color);
    vertical-align: top;
}

.camp-schedule th .day-item {
    font-weight: normal;
}

.camp-schedule :is(th, td).firstCol {
    position: sticky;
    left: 0;
    z-index: 2;
    background: white;
    border-left: 1px solid var(--bs-border-color);
}

.camp-schedule :is(th, td).firstCol[rowspan="2"] {
     font-variant-numeric: tabular-nums;
     height: 1.5em;
     padding: 0 0.3em;
 }

.camp-schedule td {
    vertical-align: top;
    height: 0.75em;
    padding: 0;
    position: relative;
}

.camp-schedule td, .camp-schedule th .day-item {
    font-size: 0.8rem;
}

.camp-schedule :is(td, th) > div {
    padding: 0 0.2em;
}

.camp-schedule td.activity {
    cursor: pointer;
    overflow-wrap: anywhere;
    transition: filter .15s ease-in-out;
}

.camp-schedule td.activity > * {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    hyphens: auto;
    overflow: hidden;
    color: black;
    text-decoration: none;
}

.camp-schedule td.activity:hover {
    filter: brightness(105%);
}

.camp-schedule td.activity .team {
    float: right;
    padding-left: 5px;
    white-space: nowrap;
}

.camp-schedule .item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.camp-schedule .item:hover {
    padding-right: 1.4em;
}

.camp-schedule .schedule-item {
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    left: 0;
}

.camp-schedule .schedule-item strong {
    font-variant-numeric: tabular-nums;
}

.camp-schedule .edit-item-btn {
    position: absolute;
    right: 0.3em;
    visibility: hidden;
}

.camp-schedule-container .camp-schedule .item:hover .edit-item-btn {
    visibility: visible;
}
