/* =====================================================================================================================
   The 10-day forecast panel (ForecastPanel.razor), the wind window editor (WindWindowEditor.razor) and the forecast button in the status bar.
   Mobile first: on a phone the panel is a sheet from the bottom (full width, it scrolls inside itself, every control at least 44 px, nothing wider
   than the screen except the day strip, which scrolls sideways on purpose); on a wide, tall screen it is a card at the side and the map stays usable.
   Loaded after app.css, sharing.css and weather.css so it can build on their variables and the .hg-touch rule.
   ===================================================================================================================== */

/* ------------------------------------------------------------------------------------------------------ the panel -- */

.hg-forecast {
    position: fixed;
    inset: 0;
    z-index: 41;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    outline: none;
}

.hg-forecast__backdrop {
    position: absolute;
    inset: 0;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    cursor: default;
}

.hg-forecast__sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: 92dvh;
    background: var(--hg-bg-panel);
    border: 1px solid var(--hg-border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.hg-forecast__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px 8px 14px;
    border-bottom: 1px solid var(--hg-border);
}

.hg-forecast__titles {
    flex: 1 1 auto;
    min-width: 0;
}

.hg-forecast__titles h2 {
    margin: 0;
    font-size: 15px;
}

.hg-forecast__titles h2 i {
    margin-right: 6px;
    color: var(--hg-accent);
}

.hg-forecast__place {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--hg-text-dim);
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

.hg-forecast__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 10px 14px calc(16px + env(safe-area-inset-bottom, 0px));
}

.hg-forecast__body > * {
    max-width: 100%;
}

.hg-forecast__loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hg-forecast__retry {
    margin-top: 8px;
}

.hg-forecast__units {
    margin-bottom: 10px;
    padding: 8px 10px 2px;
    border: 1px solid var(--hg-border);
    border-radius: 8px;
    background: var(--hg-bg-panel-alt);
}

.hg-forecast__actions {
    margin-top: 12px;
}

/* A wide, tall screen: a card at the side under the toolbar, the map stays usable. A phone (even turned sideways) keeps the sheet. */
@media (min-width: 901px) and (min-height: 561px) {
    .hg-forecast {
        inset: var(--hg-toolbar-height) 0 var(--hg-statusbar-height) auto;
        width: 430px;
        padding: 10px;
        align-items: stretch;
        pointer-events: none;
    }

    .hg-forecast__backdrop {
        display: none;
    }

    .hg-forecast__sheet {
        width: 100%;
        max-height: none;
        pointer-events: auto;
        border-radius: 12px;
        box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
    }
}

/* -------------------------------------------------------------------------------------------------- the day strip -- */

.hg-fstrip {
    list-style: none;
    margin: 0 -14px 4px;
    padding: 2px 14px 8px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scroll-padding: 0 14px;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.hg-fstrip__item {
    flex: 0 0 78px;
    scroll-snap-align: start;
}

.hg-fday {
    box-sizing: border-box;
    width: 100%;
    min-height: 156px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 3px 6px;
    background: var(--hg-bg-panel-alt);
    border: 1px solid var(--hg-border-control);
    border-radius: 10px;
    color: var(--hg-text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.hg-fday:hover {
    border-color: var(--hg-accent-dim);
}

.hg-fday--selected {
    border-color: var(--hg-accent);
    background: rgba(255, 209, 102, 0.12);
    box-shadow: inset 0 0 0 1px var(--hg-accent);
}

.hg-fday__name {
    font-size: var(--hg-fs-11);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--hg-text-dim);
}

.hg-fday__num {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.1;
}

.hg-fday__icon {
    font-size: 20px;
    line-height: 1.2;
    color: var(--hg-accent);
}

.hg-fday__high {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hg-fday__low {
    color: var(--hg-text-dim);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.hg-fday__wind {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-height: 54px;
}

.hg-fday__nodir {
    display: block;
    height: 26px;
    line-height: 26px;
    color: var(--hg-text-dim);
}

.hg-fday__mean {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hg-fday__gust {
    min-height: 13px;
    font-size: var(--hg-fs-11);
    line-height: 13px;
    color: var(--hg-text-dim);
    font-variant-numeric: tabular-nums;
}

.hg-fday__rain {
    min-height: 16px;
    font-size: 12px;
    line-height: 16px;
    color: #7fb8ff;
    font-variant-numeric: tabular-nums;
}

.hg-fday__flags {
    min-height: 14px;
    font-size: var(--hg-fs-11);
    line-height: 14px;
    display: flex;
    gap: 6px;
}

.hg-fday__flag--best {
    color: #7ec878;
}

.hg-fday__flag--shift {
    color: #ff9a3d;
}

/* ----------------------------------------------------------------------------------------------- the chosen day -- */

.hg-fdetail {
    min-width: 0;
}

.hg-fchips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 6px 0 8px;
}

.hg-fchip {
    margin: 0;
    padding: 8px 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-radius: 8px;
    border: 1px solid var(--hg-border);
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.hg-fchip i {
    margin-top: 2px;
    flex: 0 0 auto;
}

.hg-fchip--best {
    background: rgba(126, 200, 120, 0.12);
    border-color: rgba(126, 200, 120, 0.45);
}

.hg-fchip--best i {
    color: #7ec878;
}

.hg-fchip--none {
    color: var(--hg-text-dim);
}

.hg-fchip--shift {
    background: rgba(255, 154, 61, 0.1);
    border-color: rgba(255, 154, 61, 0.45);
}

.hg-fchip--shift i {
    color: #ff9a3d;
}

.hg-fchip--rain {
    background: rgba(127, 184, 255, 0.1);
    border-color: rgba(127, 184, 255, 0.4);
}

.hg-fchip--rain i {
    color: #7fb8ff;
}

.hg-fwindow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 8px;
}

.hg-fwindow__text {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.hg-fwindow .hg-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 96px;
}

.hg-fwindow__editor {
    margin: 0 0 10px;
    padding: 8px 10px 10px;
    border: 1px solid var(--hg-border);
    border-radius: 8px;
    background: var(--hg-bg-panel-alt);
}

.hg-fsun {
    margin: 0 0 8px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 14px;
    font-size: 12px;
}

.hg-fsun > div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 3px 0;
    border-bottom: 1px solid rgba(58, 66, 50, 0.5);
}

.hg-fsun dt {
    margin: 0;
    color: var(--hg-text-dim);
}

.hg-fsun dd {
    margin: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------------------------------------------ the hours -- */

.hg-fhours {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    border-top: 1px solid var(--hg-border);
}

/* flag, time, arrow, wind (speed and gust), temperature, chance of rain, weather picture */
.hg-fhour {
    display: grid;
    grid-template-columns: 16px 46px 28px minmax(0, 1fr) 44px 38px 22px;
    align-items: center;
    column-gap: 6px;
    min-height: 40px;
    padding: 2px 6px 2px 3px;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(58, 66, 50, 0.5);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.hg-fhour > * {
    min-width: 0;
}

.hg-fhour--night {
    background: rgba(0, 0, 0, 0.3);
    color: var(--hg-text-dim);
}

.hg-fhour--twilight {
    background: rgba(160, 130, 70, 0.14);
}

/* Legal hunting light: a gold edge. */
.hg-fhour--legal {
    border-left-color: rgba(255, 209, 102, 0.75);
}

/* A best hour: green, with a check in the first column (a colour is never the only sign). */
.hg-fhour--best {
    background: rgba(126, 200, 120, 0.2);
    box-shadow: inset 0 0 0 1px rgba(126, 200, 120, 0.4);
    color: var(--hg-text);
}

.hg-fhour--best .hg-fhour__time {
    font-weight: 700;
}

.hg-fhour--shift .hg-fhour__wind {
    color: #ffb36b;
}

.hg-fhour__flag {
    font-size: var(--hg-fs-11);
    text-align: center;
}

.hg-fhour__time {
    white-space: nowrap;
}

.hg-fhour__arrow {
    display: flex;
    justify-content: center;
}

.hg-fhour__nodir {
    color: var(--hg-text-dim);
}

.hg-fhour__wind strong {
    font-weight: 700;
}

.hg-fhour__gust {
    margin-left: 4px;
    font-size: var(--hg-fs-11);
    color: var(--hg-text-dim);
}

.hg-fhour__temp {
    text-align: right;
    white-space: nowrap;
}

.hg-fhour__rain {
    text-align: right;
    font-size: 12px;
    color: var(--hg-text-dim);
}

.hg-fhour__rain--on {
    color: #7fb8ff;
    font-weight: 700;
}

.hg-fhour__icon {
    text-align: center;
    color: var(--hg-text-dim);
}

/* The Sun events between the hours. */
.hg-fmark {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px 3px 24px;
    border-bottom: 1px solid rgba(58, 66, 50, 0.5);
    background: rgba(255, 209, 102, 0.1);
    color: var(--hg-accent);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.hg-fmark--firstlight,
.hg-fmark--lastlight {
    background: rgba(160, 130, 70, 0.12);
    color: var(--hg-text-dim);
}

/* ---------------------------------------------------------------------------------------- the wind window editor -- */

.hg-windwindow {
    min-width: 0;
}

.hg-stepper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px minmax(84px, auto) 44px;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
}

.hg-stepper__label {
    font-size: 13px;
    color: var(--hg-text);
}

.hg-stepper .hg-stepper__button {
    width: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
}

.hg-stepper__value {
    display: block;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hg-windwindow__rain {
    margin: 8px 0 4px;
}

.hg-windwindow__note {
    margin: 4px 0 8px;
}

/* ------------------------------------------------------------------------------------ the status bar: sun and forecast -- */

.hg-statusforecast {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    font-size: 12px;
}

.hg-status__sun {
    color: var(--hg-text-dim);
    font-variant-numeric: tabular-nums;
}

.hg-status__forecast {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 26px;
    min-width: 44px;
    margin: 0;
    padding: 0 10px;
    background: transparent;
    border: 1px solid var(--hg-border-control);
    border-radius: 6px;
    color: var(--hg-text);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.hg-status__forecast:hover {
    color: var(--hg-accent);
    border-color: var(--hg-accent-dim);
}

.hg-status__forecast i {
    color: var(--hg-accent);
}

/* The sun times need room: the bar of a phone held upright, or a narrow tablet, has none, so only the button stays (the times are in the panel). */
@media (max-width: 860px) {
    .hg-status__sun {
        display: none;
    }
}

/* Upright phones: the button is a thumb-sized icon (the word would not fit beside the grid reference and the position), and the bar is 46 px tall so the button can be 44. */
@media (max-width: 560px) and (orientation: portrait) {
    .hg-status__forecast-text {
        display: none;
    }
}

@media ((max-width: 640px) or (pointer: coarse)) and (min-height: 481px) {
    :root {
        --hg-statusbar-height: 46px;
    }

    .hg-status__forecast {
        height: 44px;
    }
}

/* ------------------------------------------------------------------------------------------------------- phones -- */

@media (max-width: 640px), (pointer: coarse) {
    .hg-fday {
        min-height: 160px;
    }

    .hg-fwindow .hg-button {
        min-height: 44px;
    }
}

@media (max-width: 380px) {
    .hg-fhour {
        grid-template-columns: 14px 42px 26px minmax(0, 1fr) 42px 36px 20px;
        column-gap: 4px;
        font-size: 12.5px;
    }

    .hg-fsun {
        grid-template-columns: 1fr;
    }
}
