/* Import Assets */
@import './modal/modal.css';

/* * * * * * * * * * * *\
 *      Weather        *
 *                     *
 *  By: Dean Wagner    *
 * info@deanwagner.net *
 *                     *
 *   Assignment for:   *
 *  The Odin Project   *
 * theodinproject.com  *
\* * * * * * * * * * * */

:root {
    /* Default Colors */
    --color-text   : #F6F8F7;
    --color-title  : #FCF2AE;
    --color-accent : #8DDDE2;
    --color-item   : #45595F;
    --color-shadow : #313031;

    /* Shadow/Glow */
    --shadow-box   : 0 0 1rem;
    --shadow-title : 0.15rem 0.15rem 0.01rem;
    --shadow-link  : 0.1rem 0.1rem 0.1rem;
    --shadow-text  : 0.05rem 0.05rem 0.2rem;
    --glow-box     : 0 0 0.3rem;
    --glow-text    : 0 0 0.2rem;

    /* Borders */
    --border-solid  : 1px solid;
    --outline-solid : 2px solid;

    /* Font Families */
    --font-base  : Tahoma, Verdana, Geneva, sans-serif;
    --font-title : Georgia, Cambria, serif;
    --font-mono  : 'Courier New', Courier, monospace;

    /* Transitions */
    --transition-all : all 0.2s ease-out;
    --enable-all     : none;

    /* Browser Theme */
    color-scheme: light;
}

* {
    box-sizing: border-box;
    cursor: default;
    accent-color: var(--color-accent);
}

/* * * * * * * * *\
 * Element Base  *
\* * * * * * * * */

html {
    margin: 0;
    padding: 0;
}

body {
    align-items: stretch;
    background-color: var(--color-shadow);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    box-shadow: inset 0 0 5em var(--color-shadow);
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    font-family: var(--font-base);
    font-size: 12pt;
    justify-content: stretch;
    margin: 0;
    min-height: 100vh;
    min-width: 380px;
    padding: 0;
    text-shadow: var(--shadow-text) var(--color-shadow);
}

body.loading header,
body.loading main,
body.loading footer {
    display: none;
}

a, a * {
    cursor: pointer;
    transition: var(--transition-all);
}

a, a:link, a:visited {
    color: var(--color-accent);
    text-decoration: none;
    text-shadow: var(--shadow-link) var(--color-shadow);
}

a:hover, a:focus, a:active {
    color: var(--color-title);
    text-decoration: underline;
    text-shadow: var(--glow-text) var(--color-title);
}

input[type='text'], input[type='number'] {
    cursor: text;
}

button, button *,
select, select *,
input[type='radio'] {
    cursor: pointer;
}

button {
    background-color: var(--color-accent);
}

select {
    background-color: var(--color-text);
}

button, select {
    border: var(--border-solid) var(--color-shadow);
    border-radius: 0.5em;
    box-shadow: var(--shadow-text) var(--color-shadow);
    color: var(--color-item);
    font-size: 1rem;
    padding: 0.7em 1em;
    text-shadow: var(--shadow-text) var(--color-shadow);
}

button:hover, button:focus, button:active,
select:hover, select:focus, select:active {
    background-color: var(--color-text);
    box-shadow: var(--glow-text) var(--color-text);
    text-shadow: var(--glow-box) var(--color-item);
}

button:focus, select:focus {
    outline: var(--outline-solid) var(--color-text);
}

select option {
    appearance: none;
    background-color: var(--color-text);
    color: var(--color-item);
    cursor: pointer;
    padding: 1em;
    text-shadow: var(--shadow-text) var(--color-shadow);
}

select option:hover,
select option:focus,
select option:active,
select option:checked {
    background-color: var(--color-item);
    color: var(--color-text);
    text-shadow: var(--glow-text) var(--color-text);
}

label {
    line-height: 2.5em;
}

svg {
    filter: drop-shadow(var(--shadow-text) var(--color-shadow));
    height: 5rem;
    width: 5rem;
    transition: var(--transition-all);
}

svg path {
    fill: var(--color-text);
    transition: var(--transition-all);
}

h1, h2, h3, h4 {
    color: var(--color-title);
    font-family: var(--font-title);
    margin: 0 0 1em;
    text-shadow: var(--shadow-title) var(--color-shadow);
}

h1 {
    margin: 0;
    flex: 1;
    font-size: 2.5em;
}

h2 {
    color: var(--color-text);
    margin: 0 0 0.5rem;
}

h3 {
    margin: 0;
}

.container {
    background-image: linear-gradient(to bottom right, rgba(255,255,255,0.1), rgba(0,0,0,0.1));
    border: var(--border-solid) var(--color-shadow);
    border-radius: 0.5em;
    box-shadow: var(--shadow-box) var(--color-shadow);
    padding: 1em;
    transition: var(--transition-all);
}

.container * {
    transition: var(--transition-all);
}

/* * * * * * * * *\
 *    Header     *
\* * * * * * * * */

header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 1.5em;
    width: 100%;
}

header > svg {
    filter: drop-shadow(var(--shadow-title) var(--color-shadow));
    height: 2.5em;
    width: 2.5em;
}

header > svg path {
    fill: var(--color-title);
}

header #actions a:last-child {
    margin-left: 0.5em;
}

header #actions svg {
    filter: drop-shadow(var(--shadow-text) var(--color-shadow));
    height: 2.3em;
    transition: var(--transition-all);
    width: 2.3em;
}

header #actions svg path {
    fill: var(--color-accent);
}

header #actions a:hover svg,
header #actions a:focus svg,
header #actions a:active svg {
    filter: drop-shadow(var(--glow-box) var(--color-title));
    transform: rotate(360deg) scale(1.5);
}

header #actions a:hover svg path,
header #actions a:focus svg path,
header #actions a:active svg path {
    fill: var(--color-title);
}

/* * * * * * * * *\
 *     Main      *
\* * * * * * * * */

main {
    align-items: center;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-evenly;
    width: 100%;
}

/* * * * * * * * *\
 *    Section    *
\* * * * * * * * */

section {
    display: block;
    width: 100%;
}

main #current {
    align-items: stretch;
    display: flex;
    gap: 1em;
    justify-content: space-evenly;
    padding: 0 2em;
}

main #current > div {
    min-width: 30%;
}

main #current #main_cond {

}

main #current #main_cond #current_info {
    align-items: center;
    display: flex;
    justify-content: space-evenly;
}

main #current #main_cond #current_dtg {
    font-size: 1.2em;
    font-weight: bold;
    padding: 0.5em 0;
    text-align: center;
    text-shadow: var(--shadow-title) var(--color-shadow);
}

main #current #main_cond #current_temp {
    font-size: 5em;
    text-align: center;
    text-shadow: var(--shadow-title) var(--color-shadow);
}

main #current #main_cond #current_icon {
    text-align: center;
}

main #current #main_cond #current_icon svg {
    filter: drop-shadow(var(--shadow-title) var(--color-shadow));
    height: 9em;
    width: 9em;
}

main #current #main_cond #current_main {
    font-size: 2.5em;
    text-align: center;
}

main #current #main_cond #current_desc {
    font-size: 1.8em;
    text-align: center;
    text-transform: capitalize;
}

main #current #main_cond #current_sum {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr;
    grid-column-gap: 1em;
    grid-row-gap: 1em;
    margin: 1em 0 0;
}

main #current #main_cond #current_sum svg {
    height: 2rem;
    margin: 0;
    width: 2rem;
}

main #current #main_cond #current_sum > div {
    font-size: 3em;
    text-align: center;
}

main #current #main_cond #current_sum > div > div {
    color: var(--color-title);
    font-size: 1rem;
}

main #current #sub_cond {
    display: grid;
    font-size: 1.2em;
    grid-template-columns: 1.5em auto auto;
    grid-template-rows: repeat(9, auto);
    grid-column-gap: 0.5em;
    grid-row-gap: 0.5em;
}

main #current #sub_cond svg {
    height: 1.5em;
    width: 1.5em;
}

main #current #sub_cond .current_label {
    color: var(--color-title);
    white-space: nowrap;
}

main #current #sub_cond .current_data {
    font-weight: bold;
}

main #forecast {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: 1fr;
    grid-column-gap: 1em;
    grid-row-gap: 1em;
    padding: 1em 2em;
}

main #forecast > div > div {
    white-space: nowrap;
}

main #forecast .forecast_main {
    font-weight: bold;
    text-align: center;
    text-transform: capitalize;
}

main #forecast .forecast_desc {
    text-align: center;
    text-transform: capitalize;
}

main #forecast .forecast_sum {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(6, auto);
    grid-column-gap: 0.3em;
    grid-row-gap: 0.3em;
    margin: 1em 0 -0.5em;
}

main #forecast .forecast_label {
    color: var(--color-title);
}

main #forecast svg {
    height: 1em;
    margin-right: 0.2em;
    width: 1em;
}

main #forecast .forecast_icon {
    text-align: center;
}

main #forecast .forecast_icon svg {
    height: 5em;
    margin: 0 auto;
    width: 5em;
}

/* * * * * * * * *\
 *    Footer     *
\* * * * * * * * */

footer {
    align-items: flex-start;
    display: flex;
    font-size: 0.7em;
    justify-content: space-between;
    padding: 0.5em;
    width: 100%;
}

footer cite {
    font-style: normal;
}

/* * * * * * * * *\
 *    Modals     *
\* * * * * * * * */

#modal > div {
    background-color: var(--color-item);
    box-shadow: var(--shadow-box) var(--color-shadow);
    padding: 2em;
}

#modal .close_modal {
    right: 1.5em;
    top: 0.5em;
}

#modal .close_modal svg {
    height: 2em;
    width: 2em;
}

#modal div h3 {
    font-size: 2rem;
    font-weight: normal;
    margin: 0 0 1em;
    text-align: center;
}

#modal .close_modal svg {
    filter: drop-shadow(var(--shadow-link) var(--color-shadow));
}

#modal .close_modal svg path {
    fill: var(--color-accent);
}

#modal .close_modal:hover svg {
    filter: drop-shadow(var(--glow-text) var(--color-shadow) var(--color-title));
}

#modal .close_modal:hover svg path {
    fill: var(--color-title);
}

/* * * * * * * * *\
 *   Settings    *
\* * * * * * * * */

#modal_settings form {
    display: grid;
    grid-gap: 1em;
    grid-template-columns: 1fr 1fr;
}

#modal_settings form label {
    font-size: 1.4em;
}

/* * * * * * * * *\
 *   Location    *
\* * * * * * * * */

#modal_location button {
    display: block;
    width: 100%;
}

#modal_location #location_info {
    display: grid;
    grid-gap: 0.5em;
    grid-template-columns: 1fr 1fr;
    margin: 0 0 1em;
}

#modal_location .location_label {
    color: var(--color-title);
}

#modal_location #location_api {
    text-align: center;
}

#modal_location #location_api span {
    font-size: 0.8rem;
    font-style: italic;
}

#modal_location #location_set form {
    align-items: center;
    background-color: var(--color-text);
    border: var(--border-solid) var(--color-shadow);
    border-radius: 0.5em;
    box-shadow: inset var(--shadow-text) var(--color-shadow);
    display: flex;
    justify-content: stretch;
    margin: 1em 0;
}

#modal_location #location_set form label {
    display: none;
}

#modal_location #location_set form input {
    background-color: transparent;
    border: none;
    border-radius: 0.5em;
    box-shadow: none;
    color: var(--color-item);
    cursor: text;
    flex: 1;
    font-family: var(--font-mono);
    padding: 1em 0 1em 1em;
}

#modal_location #location_set form button,
#modal_location #location_set form button:hover {
    background-color: transparent;
    border: none;
    border-radius: 0.5em;
    box-shadow: none;
    height: 2em;
    margin: 0;
    padding: 0.5em;
    width: 2em;
}

#modal_location #location_set form svg {
    height: 1em;
    width: 1em;
}

#modal_location #location_set form svg path {
    fill: var(--color-item);
}

#modal_location #location_actions,
#modal_location #confirm_actions {
    align-items: stretch;
    display: flex;
    justify-content: stretch;
    gap: 1em;
}

#modal_location #location_confirm {
    display: none;
}

#modal_location #location_confirm fieldset {
    border: var(--border-solid) var(--color-shadow);
    border-radius: 0.5em;
    display: grid;
    grid-template-columns: 2em 1fr;
    grid-template-rows: auto;
    grid-column-gap: 0.3em;
    grid-row-gap: 0.3em;
    margin-bottom: 1em;
}

#modal_location #location_confirm legend {
    color: var(--color-title);
}

#modal_location #location_confirm label {
    font-weight: bold;
    cursor: pointer;
}

#modal_location #location_error {
    display: none;
}

#modal_location #location_error #error_message {
    margin-bottom: 1em;
}

#modal_location #location_loading {
    align-items: center;
    display: none;
    flex-direction: column;
    justify-content: center;

}

#modal_location #location_loading svg {
    filter: drop-shadow(var(--shadow-box) var(--color-shadow));
    height: 5em;
    margin-bottom: 1em;
    width: 5em;
}

#modal_location #location_loading #loading_ring  {
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 4;
}

#modal_location #location_loading #loading_ball  {
    fill: var(--color-title);
    filter: drop-shadow(var(--glow-text) var(--color-title));
}

/* * * * * * * * *\
 *  Scrollbars   *
\* * * * * * * * */

body * {
    scrollbar-color: var(--color-item) transparent;
}

body *::-webkit-scrollbar {
    width: auto;
    height: auto;
}

body *::-webkit-scrollbar-thumb {
    background-color: var(--color-item);
    background-clip: padding-box;
    border: 1px solid var(--color-shadow);
    border-radius: 5px;
    box-shadow: var(--shadow-box) var(--color-shadow);
    cursor: grab;
}

body *::-webkit-scrollbar-button,
body *::-webkit-scrollbar-corner,
body *::-webkit-scrollbar-track {
    background-color: transparent;
}

body *::-webkit-scrollbar-thumb:hover,
body *::-webkit-scrollbar-thumb:active {
    background-color: var(--color-accent);
}

/* * * * * * * * *\
 *    Loading    *
\* * * * * * * * */

#loading {
    background: transparent;
    border: 3px solid var(--color-item);
    border-radius: 50%;
    box-shadow: 0 0 1em rgba(0,0,0,0.5);
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 1.2em;
    height: 10em;
    left: 50%;
    letter-spacing: 0.5em;
    line-height: 10em;
    position: absolute;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 0.5em var(--color-accent);
    transform: translate(-50%,-50%);
    top: 50%;
    width: 10em;
}

#loading:before {
    animation: animateC 2s linear infinite;
    border: 3px solid transparent;
    border-radius: 50%;
    border-right: 3px solid var(--color-accent);
    border-top: 3px solid var(--color-accent);
    content: '';
    height: 100%;
    left: -3px;
    position: absolute;
    top: -3px;
    width: 100%;
}

#loading #words {
    margin-left: 0.5em;
}

#loading #dot {
    animation: animate 2s linear infinite;
    background: transparent;
    display: block;
    height: 4px;
    left: 50%;
    position: absolute;
    top: calc(50% - 2px);
    transform-origin: left;
    width: 50%;
}

#loading #dot:before {
    background: var(--color-accent);
    border-radius: 50%;
    box-shadow: 0 0 1em var(--color-accent);
    content: '';
    height: 1em;
    position: absolute;
    right: -8px;
    top: -6px;
    width: 1em;
}

@keyframes animateC {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes animate {
    0%   { transform: rotate(45deg); }
    100% { transform: rotate(405deg); }
}

/* * * * * * * * *\
 * Media Queries *
\* * * * * * * * */

@media screen and (max-width: 1625px) {
    main #forecast { overflow-x: auto; }
}

@media screen and (max-width: 1350px) {
    main #current { justify-content: stretch; width: 100%; }
    main #current > div { flex: 1; min-width: auto; }
}

@media screen and (orientation: portrait) {
    body { font-size: 10pt; }
    main #current { flex-direction: column; justify-content: stretch; padding: 1em 1em 0; width: 100%; }
    main #current > div { flex: 1; min-width: auto; }
    main #forecast { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr); padding: 1em; }
}

@media (prefers-color-scheme: dark) {
    :root { color-scheme: dark; }
}