/* Zero Shadow Day — HTML port. Dark-only solar theme (ui/theme/Color.kt), Material 3 metrics. */
@font-face {
    font-family: "Averia Serif Libre";
    src: url("fonts/averiaseriflibre.ttf") format("truetype");
    font-display: swap;
}
:root {
    color-scheme: dark;
    --primary: #FFBD2E;
    --on-primary: #452B00;
    --primary-container: #614000;
    --on-primary-container: #FFDEA9;
    --secondary: #DCC4A3;
    --secondary-container: #56442A;
    --on-secondary-container: #FAE0BC;
    --tertiary: #C4D1A1;
    --error: #FFB4AB;
    --surface: #18130B;
    --on-surface: #ECE1D3;
    --surface-variant: #50463A;
    --on-surface-variant: #D5C5B3;
    --outline: #9D8F7F;
    --outline-variant: #50463A;
    --inverse-surface: #ECE1D3;
    --inverse-on-surface: #363026;
    --surface-container-low: #211B12;
    --surface-container: #251E15;
    --surface-container-high: #302A20;
    --surface-container-highest: #3B3429;
    --radius-xs: 8px;
    --radius-s: 12px;
    --radius-m: 16px;
    --radius-l: 24px;
    --radius-xl: 32px;
    --font: "Averia Serif Libre", system-ui, sans-serif;
    --bar-h: 64px;
    --rail-w: 88px;
    font-family: var(--font);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--surface);
    color: var(--on-surface);
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0.02em;
    -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
/* Icons never take the pointer, so a button that redraws its icon mid-press still gets the click. */
.icon { width: 24px; height: 24px; fill: currentColor; flex: none; pointer-events: none; }
.icon.small { width: 16px; height: 16px; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------- Buttons and controls ---------- */
.icon-btn {
    width: 48px; height: 48px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; color: var(--on-surface-variant);
}
.icon-btn:hover, .text-btn:hover, .nav-item:hover { background-color: color-mix(in srgb, currentColor 8%, transparent); }
.icon-btn:active, .text-btn:active { background-color: color-mix(in srgb, currentColor 12%, transparent); }
.text-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-height: 40px; padding: 0 12px; border-radius: 20px;
    color: var(--primary); font-size: 14px; font-weight: 500;
}
.filled-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 24px; border-radius: 20px;
    background: var(--primary); color: var(--on-primary); font-size: 14px; font-weight: 500;
}
.tonal-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 24px; border-radius: 20px;
    background: var(--secondary-container); color: var(--on-secondary-container); font-size: 14px; font-weight: 500;
}
.card {
    background: var(--surface-container);
    border-radius: var(--radius-s);
    padding: 16px;
}
.card.elevated { background: var(--surface-container-low); box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15); }
.card.outlined { background: none; border: 1px solid var(--outline-variant); }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    height: 32px; padding: 0 16px; border-radius: var(--radius-xs);
    border: 1px solid var(--outline); color: var(--on-surface-variant); font-size: 14px; font-weight: 500;
}
.chip[aria-pressed="true"] { border-color: transparent; background: var(--secondary-container); color: var(--on-secondary-container); }
/* The language picker tints its selected chip with the primary container instead. */
.chips .chip[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); }
.chip .icon { width: 18px; height: 18px; }
.segmented { display: flex; border: 1px solid var(--outline); border-radius: 999px; overflow: hidden; }
.segmented button { flex: 1; min-height: 40px; padding: 0 12px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 500; }
.segmented button + button { border-left: 1px solid var(--outline); }
.segmented button[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); }
.segmented button .icon { width: 18px; height: 18px; display: none; }
.segmented button[aria-pressed="true"] .icon { display: block; }

/* Material 3 slider: a 16px track split around a 4×44px handle, with a stop dot at the far end. */
.slider {
    --accent: var(--primary);
    --pct: 50%;
    --track: radial-gradient(circle at calc(100% - 8px) 50%, var(--accent) 2px, transparent 2.5px),
        linear-gradient(to right, var(--accent) 0 calc(var(--pct) - 6px), transparent calc(var(--pct) - 6px) calc(var(--pct) + 6px),
            color-mix(in srgb, var(--accent) 24%, transparent) calc(var(--pct) + 6px));
    flex: 1; min-width: 0; height: 44px; margin: 0;
    appearance: none; -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
    touch-action: pan-y;
}
.slider::-webkit-slider-runnable-track { height: 16px; border-radius: 8px; background: var(--track); }
.slider::-moz-range-track { height: 16px; border-radius: 8px; background: var(--track); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 44px; margin-top: -14px; border-radius: 2px; background: var(--accent); }
.slider::-moz-range-thumb { width: 4px; height: 44px; border: 0; border-radius: 2px; background: var(--accent); }
.slider:focus-visible { outline: none; }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.control-row { display: flex; align-items: center; gap: 8px; padding: 8px; }
.degree-caption { flex: 2; color: var(--tertiary); font-size: 13px; line-height: 16px; white-space: pre-line; }
.control-row .degree-caption + .slider { flex: 5; }
.time-btn { color: var(--secondary); padding: 0 8px; min-height: 36px; }
.hidden-picker { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.date-bar { position: relative; }
.progress { height: 4px; border-radius: 2px; background: var(--secondary-container); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); border-radius: 2px; }
.date-bar-row { position: relative; display: flex; align-items: center; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.date-bar-row .step { flex: 2; touch-action: manipulation; }
.date-bar-row .step .icon { width: 20px; height: 20px; }
.date-bar-row .date-label { flex: 5; font-size: 16px; font-weight: 500; }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; color: var(--on-surface); max-height: calc(100dvh - 48px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.alert {
    width: min(560px, calc(100vw - 48px)); min-width: 280px;
    border-radius: var(--radius-xl);
    background: var(--surface-container-high);
}
.alert[open] { display: flex; flex-direction: column; }
.alert .dlg-icon { display: flex; justify-content: center; padding-top: 24px; color: var(--primary); }
.alert h2 { padding: 24px 24px 16px; font-size: 24px; line-height: 32px; font-weight: 400; }
.alert .dlg-icon + h2 { padding-top: 16px; text-align: center; }
.alert .dlg-body { padding: 0 24px; overflow-y: auto; color: var(--on-surface-variant); font-size: 14px; line-height: 20px; }
.alert .dlg-icon + .dlg-body { padding-top: 16px; }
.alert .dlg-body h4 { font-size: 1.2em; font-weight: 700; }
.alert .dlg-body hr { border: 0; }
.alert .dlg-body p { margin: 0.6em 0; }
.alert .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 24px; }

/* ---------- Shell: top bar, drawer, rail ---------- */
#topBar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 4px;
    height: var(--bar-h); padding: 0 4px;
    background: linear-gradient(to bottom right, var(--surface-container-high), var(--surface));
}
#topBar .titles { flex: 1; min-width: 0; padding-left: 4px; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
#topBar .title { font-size: 16px; line-height: 24px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topBar .place { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topBar .icon-btn { color: var(--on-surface); }
#pane { padding: 6px; }

.nav-badge {
    width: 34px; height: 34px; flex: none; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.nav-badge .icon { width: 20px; height: 20px; }
[aria-current="page"] .nav-badge { background: color-mix(in srgb, var(--accent) 32%, transparent); }

#drawer {
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    width: min(360px, 85vw); max-width: none; max-height: none; height: 100dvh; margin: 0;
    border-radius: 0 16px 16px 0; background: var(--surface-container-low);
    overflow-y: auto; padding: 0 0 12px;
}
#drawer[open] { animation: drawer-in 0.22s ease-out; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
.drawer-hero { position: relative; height: 176px; margin-bottom: 8px; overflow: hidden; }
.drawer-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.drawer-hero::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(rgba(24,19,11,.82) 0%, transparent 32%, transparent 90%, rgba(24,19,11,.85) 100%);
}
.drawer-hero h2 { position: absolute; z-index: 1; top: 16px; left: 20px; right: 20px; text-align: center; font-size: 24px; line-height: 32px; font-weight: 700; }
.nav-item {
    display: flex; align-items: center; gap: 12px; width: calc(100% - 24px);
    height: 56px; margin: 0 12px; padding: 0 16px 0 12px; border-radius: 28px;
    color: var(--on-surface); font-size: 14px; font-weight: 500; text-align: start;
}
#drawer .nav-item[aria-current="page"] { background: var(--surface-container-highest); color: var(--primary); }
.nav-divider { height: 1px; margin: 6px 28px; background: color-mix(in srgb, var(--outline-variant) 50%, transparent); }

#rail {
    position: fixed; inset: 0 auto 0 0; z-index: 5; width: var(--rail-w);
    display: flex; flex-direction: column; align-items: center;
    background: var(--surface);
}
#rail > .icon { width: 32px; height: 32px; margin: 12px 0 8px; color: var(--primary); }
#rail .rail-items { flex: 1; overflow-y: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 8px; }
#rail .nav-item { flex-direction: column; justify-content: center; gap: 4px; width: 80px; height: auto; min-height: 56px; margin: 0; padding: 4px; border-radius: 16px; font-size: 12px; line-height: 16px; text-align: center; }
#rail .nav-item[aria-current="page"] { color: var(--primary); }
body.rail #topBar, body.rail #pane { margin-left: var(--rail-w); }
body.rail #topBar .titles { padding-left: 12px; }
body.rail #menuBtn { display: none; }

/* Language picker chips; city picker list. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.alert.picker h2 { display: flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 700; font-size: 22px; padding: 20px 20px 16px; }
.alert.picker .dlg-body { padding: 0 20px 20px; }
.city-search {
    width: 100%; height: 56px; padding: 0 16px; margin-bottom: 8px;
    border: 1px solid var(--outline); border-radius: 4px; background: none; color: var(--on-surface); font: inherit; font-size: 16px;
}
.city-search:focus { outline: none; border: 2px solid var(--primary); padding-left: 15px; }
.city-list { list-style: none; margin: 0; padding: 0; max-height: 50dvh; overflow-y: auto; }
.city-list button { display: block; width: 100%; padding: 12px 8px; text-align: start; border-radius: 8px; color: var(--on-surface); }
.city-list button:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.city-list small { display: block; color: var(--on-surface-variant); font-size: 12px; }

#snackbar {
    position: fixed; z-index: 40; left: 50%; bottom: 16px; transform: translateX(-50%);
    max-width: min(600px, calc(100vw - 24px)); padding: 14px 16px; border-radius: 4px;
    background: var(--inverse-surface); color: var(--inverse-on-surface); font-size: 14px;
}
