/* For the search widget when maximized. Later I might defer it until clicked. */
body {
    --brand-text: #fff;
    --brand-text-fade: rgba(255, 255, 255, .7);
}
#dropdown {
	width: 100vw;
	position: sticky;
	top: calc(var(--header-h) - 1px);
	height: calc(100vh - var(--header-h) + 1px + 43px);
	overflow-y: scroll;
	z-index: 98;
	background-color: var(--brand);
	display: none;
	padding-top: 20px;
	padding-bottom: 140px;
}
body.dropdown-open {
	height: 100%;
	width: 100%;
	overflow: hidden;
}

/*
terrible hack, but basically iOS safari loves flashing
the body everywhere even when the viewport should be covered
*/
body.dropdown-open #masthead {
    box-shadow: 2px 0 2px 2px #00000033;
}
body.dropdown-open #dropdown {
    display: block;
}
body.dropdown-open img.search-icon {
    opacity: 1;
}

img.search-icon {
	padding: 9px;
	margin-top: 2px;
	opacity: .7;
	cursor: pointer;
}

/* only apply hover effect when hovering with a mouse cursor
// (touch "cursor" does not apply) */
@media(hover: hover) and (pointer: fine) {
    img.search-icon:hover {
        opacity: 1;
    }
}

.header-burger {
    grid-area: 1/3/2/4; /* TODO: is this right? */
	color: var(--brand-text);
}

.search-box-container {
	position: relative;
	max-width: 480px;
	margin: 0 auto 5px;
	margin-bottom: 5px;
	display: grid;
	grid-template-columns: auto 60px;
	justify-content: stretch;
}
#search_submit {
    grid-area: 1/2/2/3;
}

#search_box {
    line-height: 1.9rem;
    height: 2.5rem;
    font-size: 1.25rem;
    border: 3px solid var(--brand-text-fade);
    border-radius: 1.25rem 0 0 1.25rem;
    background-color: rgba(255,255,255,.2);
    padding: 0 15px;
    width: 100%;
    color: var(--brand-text);
    grid-area: 1/1/2/2;
}

#search_box:focus {
    outline: none;
    border-color: #fff;
    background-color: #fd2870;
}
#search_box::placeholder {
    color: var(--brand-text-fade);
    font-weight: 300;
}
#search_box::selection {
    background-color: #57182c;
}
.scroll-lock {
    overflow-y: hidden;
}

#search_result_skeleton {
    display: none;
}

#search_meta {
	color: var(--brand-text-fade);
    font-size: 0.9rem;
    text-align: center;
}

#search_tips {
	color: var(--brand-text);
	background-color: #00000044;
	padding: 10px 10px 5px;
	border-radius: 17px;
	margin: 15px auto;
	max-width: 480px;
}

#search_tips h2 {
    text-align: center;
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: var(--brand-text);
}

#search_tips strong {
    color: var(--brand-text);
}
#search_tips code {
    background-color: var(--brand-select);
    color: var(--brand-text);
    white-space: nowrap;
    padding: 2px 6px;
    border-radius: 17px;
}

#search_suggestions {
	color: var(--brand-text);
	text-align: center;
}

#search_suggestions .search-trend-list li {
    margin: 10px auto;
    font-weight: 300;
    cursor: pointer;
    font-size: 1.25rem;
    background-color: #00000044;
    padding: 8px;
    border-radius: 17px;
    transition: background-color 0.15s;
    max-width: 480px;
}
#search_suggestions .search-trend-list li:hover {
    background-color: #00000088;
}

#search_suggestions h2 {
    color: inherit;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.search-buttons {
	margin: 20px auto;
	max-width: 300px;
	display: grid;
	grid-template-columns: auto auto;
	justify-content: space-around;
	grid-column-gap: 15px;
}

.search-buttons button[data-action="prev"] {
    grid-area: 1/1/2/2;
}

.search-buttons button[data-action="next"] {
    grid-area: 1/2/2/3;
}

@keyframes search-loader {
	0% {opacity: .3;}
	15% {opacity: .3;}
	100% {opacity: 1;}
}
.search-loader {
	width: 100%;
	max-width: 300px;
	margin: auto;
	padding: 80px;
	opacity: .3;
	animation: search-loader 2s;
	animation-direction: alternate;
	animation-iteration-count: infinite;
}

.search-result-error {
	padding: 10px;
    background-color: #ffffff88;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
    border-left: 5px solid white;
}

#dropdown button {
	user-select: none;
	cursor: pointer;
	background-image: none;
	background-color: var(--brand);
	color: white;
	outline: none;
	border: 3px solid #ffffff88;
	border-radius: 2rem;
	min-height: 46px;
	padding: 0 10px;
}

#dropdown button#search_submit {
    min-height: 40px;
    height: 40px;
    width: 60px;
    font-size: 1.4rem;
    border-radius: 0 2rem 2rem 0;
    background-color: var(--brand);
    border-left: none;
}

#dropdown button.retry-button {
    min-width: 140px;
    margin: auto;
}

#dropdown .header-container {
	padding-top: 20px;
	padding-bottom: 80px;
}

@media(hover: hover) and (pointer: fine) {
    #dropdown button:hover {
        background-image: linear-gradient(315deg, #FD2870, #d01d59);
		border-color: #fff;
    }
}

.search-tips-container {
	text-align: center;

}
#search_tips_button {
	color: #fff;
    cursor: pointer;
	text-decoration: underline dotted #ffffff88;
	padding: 5px 10px;
	font-size: 0.9rem;
	padding: 10px 0 3px;
}
#search_form {
	margin-bottom: 20px;
}

#search_autocomplete {
	position: absolute;
	top: 4.3rem;
	z-index: 100;
	background-color: #35363a;
	color: white;
	list-style-type: none;
	width: 100%;
	max-width: 480px;
    padding: 5px 0;
	border-radius: 10px;
	overflow: hidden;
	font-size: 1.25rem;
}

#search_autocomplete li {
    padding: 5px 15px;
    width: 100%;
    transition: background-color .15s;
    cursor: pointer;
}

#search_autocomplete li:hover,
#search_autocomplete li:focus {
    background-color: rgba(255,255,255,.15);
}

#search_autocomplete li:focus {
    outline: none;
}

#search_autocomplete:empty {
    display: none;
}

.header-search-results {
	position: relative;
}

.search-result {
    color: var(--text-b);
    position: relative;
    display: grid;
    grid-template-columns: auto;
    grid-template-rows: auto auto;
    margin-bottom: 15px;
    background-color: #fff;
    box-shadow: 1px 1px 2px 1px #56011d4d;
}

.search-result-title-container.mobile {
    font-size: 1rem;
    background-color: #00000099;
    color: #fff;
    text-shadow: 1px 1px 2px 2px #000;
    position: absolute;
    bottom: 4px;
    padding: 5px;
    width: 100%;
}

.search-result-title-container.desktop {
    display: none;
    font-size: 1.25rem;
    line-height: 1.2;
}

.search-result-title-container.desktop h2 {
    color: var(--text-b);
    margin-bottom: 10px;
}

.search-result-image-container {
    position: relative;
    min-height: 150px;
    grid-area: 1/1/2/2;
}

.search-result-image-container img {
    width: 100%;
    height: auto;
}

.search-result-image-container img.no-thumbnail {
    border: 1px solid white;
    border-bottom: none;
}

.search-result-meta-container {
    grid-area: 2/1/3/2;
    font-size: 0.9rem;
    padding: 5px;
}

.search-result-caption {
    margin-bottom: 5px;
}

.search-result-caption em {
    color: var(--brand);
    font-weight: 700;
    font-style: normal;
}

.search-result-date {
    opacity: .7;
    font-size: 0.9rem;
}

@media screen and (min-width: 480px) { /* bp-mobile */
    .search-result {
        grid-template-columns: 144px auto;
        grid-template-rows: auto auto;
        grid-column-gap: 10px;
        padding: 5px;
        margin-bottom: 5px;
        background-image: linear-gradient(135deg, #fefcfd, #fff8f8);
    }
    .search-result:hover {
        background-color: #fff;
        background-image: none;
    }
    .search-result .article-click-box:hover {
        background-color: #fff;
        opacity: .1;
    }
    .search-result-image-container {
        grid-area: 1/1/3/2;
        min-height: unset;
        height: 100px;
        width: 144px;
    }

    .search-result-title-container.mobile {
        display: none;
    }
    .search-result-title-container.desktop {
        display: block;
        grid-area: 1/2/2/3;
    }
    .search-result-meta-container {
        grid-area: 2/2/3/3;
        font-size: 1rem;
        padding: 0;
    }
}
