/*
    Responsive breakpoints (https://getbootstrap.com/docs/5.0/layout/breakpoints/) : 
    - xsmall: < 576px (36rem)
    - small >= 576px (36rem)
    - medium >= 768px (48rem)
    - large >= 992px (62rem)
    - extra large >= 1200px (75rem)
    - extra, extra large >= 1400px (87.5rem)
*/

@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local("styles/fonts/poppins-normal-400.woff2") format("woff2");
}

@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local("styles/fonts/poppins-normal-700.woff2") format("woff2");
}

:root {
    --color-beige-light: #f9f4f0;
    --color-blue-dark: #3300FF;
    --color-blue-light: #a6faff;
    --color-blue-very-pale: #F0F8FF /*aliceblue*/;
    --color-orange-mid: #ffc29f;
    --color-green-mid: #2fff2f;
    --color-magenta-dark: #ff00f5;
    --color-red-mid: #dc341e;
    --color-yellow-mid: #FFFF00;
    --border-color: #000;
    --border-heavy-weight: 0.375rem;
    --border-light-weight: 0.0625rem;
    --border-medium-color: #000;
    --border-medium-type: solid;
    --border-medium-weight: 0.125rem;
    --border-radius-medium: 0.375rem;
    --box-shadow-color: #000;
    --box-shadow-x-offset: 0.125rem;
    --box-shadow-y-offset: 0.25rem;
    --box-shadow-y-offset-active: 0rem;
    --box-shadow-y-offset-hover: 0.375rem;
}
html {
    height: 100%;
    margin: 0;
}
/** {
    border: solid 1px black;
}*/

h1,h2,h3,h4,p {
    margin: 0;
}

body {
    background-color: var(--color-beige-light);
    box-sizing: border-box;
    display: grid;
    font-family: "Poppins", sans-serif;
    grid-template-areas: 
        "header"
        "main"
        "footer"
    ;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    margin: 0;
    min-height: 100%;
    overflow-y: scroll;
}

#all_results_message {
    margin-bottom: 2.25rem;
}

.app-header {
    background: var(--color-beige-light);
    border-bottom: var(--border-medium-type) var(--border-heavy-weight) var(--border-color);
    box-sizing: border-box;
    margin: 0;
    margin-bottom: 1rem;
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 3;
}

article {
    background-color: #FFF;
    border: var(--border-medium-type) var(--border-medium-weight) var(--border-color);
    border-radius: var(--border-radius-medium);
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-y-offset) 0 0 var(--box-shadow-color);
    margin: 0 auto 2.25rem;
    max-width: 24rem;
    width: 100%;
}


article > div {
	padding: 0 1rem;
}

article > footer {
	align-items: center;
    border-top: var(--border-medium-type) var(--border-medium-weight) var(--border-color);
	display: flex;
	justify-content: center;
    padding: 1rem 0;
}

body > aside {
    display: none;
}
/* todo: remove */
.beer-aside {
    grid-area: beer-aside
}

.beer-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.beer-figure {
	background: var(--color-blue-very-pale);
    border-bottom: var(--border-medium-type) var(--border-medium-weight) var(--border-color);
    margin: 0 0 1rem;
    min-height: 8rem;
    overflow: hidden;
}

.beer-figure > img {
    display: block;
    line-height: 2;
    /* margin pushes parent figure down */
    padding: 1rem 0;
    margin: 0 auto;
    min-height: 4rem;
    max-height: 6rem;
    max-width: 8rem;
    width: auto;
}

.beer-info {
    min-height: 11rem;
}

.beer-info > h3 {
    margin-bottom: 0;;
}

.beer-nav {
    grid-area: beer-nav
}

.beer-note {
    color: #999;
    font-style: italic;
}

beer-type-list {
    display: block;
    min-height: 15rem;
}

.beer-type {
    margin-bottom: 1rem;
}

.beer-types {
    background: #fff;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
    max-width: 100%;
    overflow: auto;
    padding: 1rem 0.5rem 0;
    scrollbar-width: thin;
}

.beer-types > label {
    flex: 0 0 auto;
}

.beer-types > label > input {
    margin-bottom: 0.25rem;
}

.brewery-note {
    margin-bottom: 1rem;
}

.btn {
    display: block;
    margin: 0 auto;
}

button, input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: inherit;
    border: 0.125rem solid #000;
    border-radius: 0;
    color: #000;
}

button {
  border-radius: var(--border-radius-medium);
  border: var(--border-medium-type) var(--border-medium-weight) var(--border-color);
  box-sizing: border-box;
  box-shadow: var(--box-shadow-x-offset) var(--box-shadow-y-offset) 0 0 var(--box-shadow-color);
  font-size: 1.125rem;
  padding: 0.5rem 1.25rem;
}

button:hover {
    box-shadow: 0 var(--box-shadow-y-offset-hover) 0 0 var(--box-shadow-color);
    transform: translateY(-0.125rem);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 var(--box-shadow-y-offset-active) 0 0 var(--box-shadow-color);
}

button:focus {
    outline: 0.25rem dashed var(--color-magenta-dark);
    outline-offset: .5rem;
}

button[data-action='modal:open']{
    background-color: var(--color-green-mid);
}

#close_modal {
    background-color: var(--color-blue-dark);
    color: #FFF;
}

.col-1, .col-2 {
    display: flex;
    flex: 1 1 50%;
    flex-direction: column;
}

.col-1 > .radio, .col-2 > .radio {
    align-items: flex-start;
}

.d-none {
    display: none !important;
}

details {
    margin-bottom: 1rem;
}

/* to hide default marker */
details > summary {
    border-bottom: solid var(--border-light-weight) var(--border-color);
    display: block;
    /* Safari workaround */
    list-style-type: none;
}

details > summary::-webkit-details-marker {
    display: none;
}

details > summary::before {
    content: '▶️';
    display:inline-block;
    margin-right: 0.5rem;
}

details[open] > summary::before {
    content: '🔽';
}

details > summary > h3,
details > summary > h4 {
    display: inline;
}

details > p {
    box-sizing: border-box;
    /* to match marker margin-right of 0.5rem */
    padding: 0 1rem 0 1.875rem;
}

dialog {
    box-sizing: border-box;
    background: var(--color-orange-mid);
    border-radius: var(--border-radius-medium);
	box-sizing: border-box;
    box-shadow: var(--box-shadow-y-offset) var(--box-shadow-y-offset-hover) 0 0 var(--box-shadow-color);
    max-width: 24rem;
    padding: 0 0 1rem;
    width: calc(100vw - 4rem);
    /* left: 0;
	max-width: 100%;
    padding: 0 0 1rem;
    position: fixed;
    top: 0;
	width: 24rem; */
}

dialog::backdrop {
	background: rgba(0,0,0,0.25);
}

.dialog-content > figure {
    margin: 0 0 1rem;
}

.dialog-content > .beer-figure > .beer-img {
    transform: scale(200%);
}


.dialog-inner {
    box-sizing: border-box;
    padding: 0 1rem;
}

.dialog-inner > form {
    position: absolute;
    top: 0;
    /* width of button */
    left: calc(100% - 4.5rem);
    right: 0;
}

.dialog-inner > .description {
    box-sizing: border-box;
    max-height: 10rem;
    overflow-y: auto;
    padding: 0 0.5rem 1rem;
    scrollbar-width: thin;
}

.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.disabled > input {
    cursor: not-allowed;
}

#fab {
    background: var(--color-yellow-mid);
    bottom: 1.5rem;
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-y-offset) var(--box-shadow-color);
    height: 3rem;
    padding: 0;
    position: fixed;
    right: 1.5rem;
    width: 3rem;
}
#fab:active {
    box-shadow: 0 var(--box-shadow-y-offset-active) 0 0 var(--box-shadow-color);
}
/* else, hovering will cause FAB to persist on screen, after being shrunk (scale 0)*/
#fab:hover {
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-x-offset) var(--box-shadow-color);
    transform: translateY(0);
}

#fab.shrunk:hover {
    transform: translateY(0) scale(0);
}

#fab > img {
    filter: invert(1);
}

.flavor {
    border: solid 0.0625rem #999;
	display: flex;
	flex-wrap: wrap;
    padding-top: 0.75rem;
}

.flavor > .radio {
    border-bottom: solid 0.0625rem #999;
    padding-bottom: 0.5rem;
}

.flavor > .radio:nth-child(odd) {
    border-right: solid 0.0625rem #999;
}

.flavor > .radio:last-of-type {
    border: none;
    margin: 0;
}

#flavor_form_selection {
    text-transform: capitalize;
}

form {
    background-color: var(--color-blue-light);
    border: var(--border-medium-type) var(--border-medium-weight) var(--border-medium-color);
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-y-offset) 0 0 var(--box-shadow-color);
    box-sizing: border-box;
    margin: 1rem auto;
    padding: 1rem 1rem 0.75rem;
}

form[data-action="show"] > button {
    background-color: var(--color-green-mid);
}

form[data-action="clear"] > button {
    background-color: var(--color-red-mid);
}

form[method="dialog"] {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
	text-align: right;
}

form[method="dialog"] > button {
    box-sizing: border-box;
	font-size: 1.25rem;
	padding: 0.5rem 1rem;
}

.form-field {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;

}
.form-field > input {
    align-items: center;
    flex: 1 1 4rem;
    max-width: 95%;
}
.form-field > span {
    padding-right: 0.5rem;
}
.form-wrapper {
    border-bottom: 0.125rem solid #000;
    margin-bottom: 2.25rem;
	padding: 1rem 0;
    text-align: center;
}
footer {
    background-color: #999;
    grid-area: footer;
    min-height: 3rem;
}
article > footer {
	background: none;
}

.force-show, .hide-beers > li.force-show {
    display: block;
}

h1,h2,h3, h4 {
	margin-bottom: 1rem;
}
h1 {
	font-size: 2.25rem
}
h2 {
	font-size: 1.75rem;
}
h3 {
	font-size: 1.5rem;
}
h4 {
	font-size: 1.125rem;
}
h5 {
    font-size: 1.0625rem;
}

.hide, .hide-beers > li {
    display: none;
}

.icon {
    height: auto;
    max-width: 100%;
    width: 1.5rem;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    width: 100%;
}

img.generic {
    filter: drop-shadow(var(--box-shadow-x-offset) var(--box-shadow-x-offset) var(--box-shadow-color)) invert(75%);
}

input {
    background: white;
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-x-offset) 0 0 var(--box-shadow-color);
    display: inline-block;
    /* Safari zoom issue (iOS) */
    font-size: 1rem;
    min-height: 2rem;
    position: relative;
}

input[type='radio']:checked {
    font-weight: 700;
}

input:focus {
    outline: 0.25rem solid var(--color-magenta-dark);
}

input:hover {
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-y-offset) 0 0 var(--box-shadow-color);   
}


input[type='radio']:checked:before {
    position: absolute;
    background: var(--color-magenta-dark);
    content: ' ';
    height: 100%;
    left: 0;
    width: 100%;
    top: 0;
}

label, input {
	box-sizing: border-box;
    display: block; 
}

label.radio {
    padding: 0 0.5rem;
}

label.radio.checked {
    background-color: var(--color-yellow-mid);
    font-weight: 700;
}

label[for="search_term"] {
    padding-bottom: 1rem;
}

li {
    list-style-type: none;
}

main {
    box-sizing: border-box;
    /* don't know if dialog responsible, but horizontal overflow on mobile */
    overflow-x: hidden;
    padding: 0 1rem;
}

main > header {
    background-color: white;
    margin-bottom: 1.5rem;
    text-align: center;
}

main > section {
    box-sizing: border-box;
    padding: 0 1rem;
}

.make-white {
    /* ✖ is rendered as grey emoji in iOS safari, ignoring font color */
    filter: brightness(0) invert(1);
}

.mb-1 {
    margin-bottom: 1rem;
}


noscript {
    background: #eee;
    border: solid 0.125rem black;
    display: block;
    margin: 0 auto;
    padding: 0 1rem;
    width: fit-content;
}

ol, output > ul {
    padding: 0;
}

output {
    display: block;
    padding-top: 1rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    grid-area: header;
}
.page-header > div {
    flex: 1 1 50%;
    max-width: 3rem;
}

.radio {
	align-items: center;
	display: flex;
	flex: 1 1 50%;
	margin-bottom: 1rem;
}

.radio > input {
	margin: 0 1rem;
	min-width: 2rem;
}

.radio > small {
	font-style: italic;
	margin: 0 0.5rem;
}

.ratings {
    display: flex;
    justify-content: space-between;
}


ul.results, ol.results {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

ul.results > li, ol.results > li {
    flex: 1 1 20rem;
    margin: 1rem;
    min-height: 22rem;
}

.sideblade-results-msg {
    margin: 0 auto;
    text-align: center;
}

.shrunk {
    transform: scale(0);
}

.sideblade {
    background: var(--color-orange-mid);
    border-right: solid 0.125rem #000;
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-y-offset) 0 0 var(--box-shadow-color);
    box-sizing: border-box;
    height: 100vh;
    left: 0;
    padding: 1rem 0;    
    position: fixed;
    top: 0;
    width: 100vw;
    z-index: 4;
}

.sideblade.closed {
    transform: translateX(-100vw);
}

.sideblade.opened {
    /* on closed, hides the transformed click search button */
    overflow: auto;
}

.sideblade > section {
    box-sizing: border-box;
    padding: 1rem;
}
.sideblade-control-wrapper {
    margin-bottom: 1.5rem;
    text-align: right;
}

#sideblade_control {
    background: var(--color-blue-dark);
    box-sizing: border-box;
}

#sideblade_control > .icon {
    display: none;
    width: 2.25rem;
}
#sideblade_control[data-action='close'] {
    padding-left: 0.67rem;
    padding-right: 1.5rem;
}

#sideblade_control[data-action='open'] {
    padding-left: 2.25rem;
    padding-right: 1rem;
    transform: translateX(4rem);
}

#sideblade_control[data-action='open'] > .icon:first-of-type {
    display: block;
    margin-right: 100%;
 }

 #sideblade_control[data-action='close'] > .icon:last-of-type {
    display: block;
    margin-right: 100%;
 }

.sideblade.opened > button {
    padding-right: 2rem;
}

#search-all-beers {
    background: var(--color-orange-mid);
    max-width: 12rem;
    min-width: fit-content;
}

.subflavor-panel {
    border-bottom: var(--border-medium-type) var(--border-heavy-weight) var(--border-color);
}

.subtype-tabs {
    background-color: var(--color-beige-light);
    border: var(--border-medium-type) var(--border-medium-weight) var(--border-medium-color);
    box-shadow: var(--box-shadow-x-offset) var(--box-shadow-y-offset) 0 0 var(--box-shadow-color);
    box-sizing: border-box;
	margin: 0 1rem 1rem;
    overflow: auto;
    padding: 1rem 0.5rem;
    scrollbar-width: thin;
    text-align: center;
}

.subtype-tabs > button {
    box-sizing: border-box;
    /* as wanting scroll on overflow of parent */
    flex: 0 0 auto;
    margin: 0 0.5rem 1rem;
    min-width: 4rem;
    padding: 0.5rem;
}


.subtype-tabs > button.active-tab {
    background-color: var(--color-yellow-mid);
}

.tab-content {
    border: dashed var(--border-medium-weight) var(--border-medium-color);
    padding-top: 2.25rem;
}

.tab-content > h2 {
    text-align: center;
}
.tab-group {
    margin: 0 1rem;
}

.tab-nav {
	display: flex;
    flex-wrap: wrap;
    font-size: 1.875rem;
    justify-content: center;
}
.tab-nav > button {
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none;
	box-sizing: border-box;
	flex: 1 1 50%;
    font-size: inherit;
	margin: 0 0.5rem;
    max-width: 8rem;
	padding: 0.5rem;
}

.tab-nav > button.active-tab {
	background: #000;
    box-shadow: 0 var(--box-shadow-x-offset) 0 0 var(--box-shadow-color);
	color: #FFF;
}

.tab-nav > button:hover {
    transform: none;
}

.tab-nav > button:not(.active-tab) {
    color: #000;
}

.tab-nav > button:not(.active-tab):hover {
    background-color: #999;
}

.transitioned {
    transition: transform 200ms, opacity 200ms;
}

#view_all_form {
    margin: 1rem auto;
    max-width: fit-content;
    text-align: center;
}

#view_all_form > button {
    min-height: 2.75rem;
    min-width: 7.5rem;
}

.view-results {
    background-color: var(--color-green-mid);
    display: block;
    margin: 1rem auto;
}

@media screen and (min-width: 36rem) {
    input[type="search"] {
        display: inline-block;
        min-height: 2rem;
    }
    main {
        grid-area: main;
        margin: 0 auto;
        width: 100%;
    }

    main > section {
    	margin: 0 auto;
   		max-width: 34rem;
    }

    .form-wrapper > form {
        margin: 0 1rem;
        /* max-width: 20rem; */
    }
}

@media screen and (min-width: 62rem) {

    .beer-card {
        height: 100%;
    }

    main {
        display: grid;
        grid-template-areas: 
            "main-header main-header"
            "main-search main-results"
        ;
        grid-template-rows: auto 1fr;
        grid-template-columns: auto 1fr;   
    }
    .app-header {
        grid-area: main-header;
    }
    #all_results_outputs {
        box-sizing: border-box;
        grid-area: main-results;
        /* wouldn't expand otherwise to w-100 */
        max-width: 100%;
        padding: 1rem 2.25rem;
        scrollbar-width: thin;
        width: 100%;
    }

    #fab {
        bottom: 5rem;
        right: 3rem;
    }

    .flavor-subSection > hr {
        margin-bottom: 2.25rem;
        width: 100%;
    }

    .sideblade {
        grid-area: main-search;
        width: 30rem;
        /* not enough to reset z-index */
        position: static;
        max-height: 38rem;
        z-index: 0;
    }

    #sideblade_control, .sideblade-results-msg {
        display: none;
    }

    .sideblade.not-showing {
        opacity: 0.5;
    }
    
    .sideblade.not-showing:focus-within {
        opacity: 1;
    }
    
    .sideblade.not-showing:focus-within + section output[for="view_all_form"] {
        opacity: 0.5;
    }

    #view_all_form {
        margin: 0 auto;
        max-width: 15rem;
    }
    
}
