﻿/* Start page widgets: weather and news. */

.weather__place svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Weather icons ---------- */

.weather-icon {
    width: 28px;
    height: 28px;
    flex: none;
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

.weather-icon--large { width: 72px; height: 72px; stroke-width: 1.2; filter: drop-shadow(var(--glow, none)); }

.wi-sun { stroke: var(--accent); }
.wi-moon { stroke: var(--accent); }
.wi-cloud { fill: var(--wi-fill, var(--bg)); stroke: var(--ink); }
.wi-drop, .wi-bolt { stroke: var(--accent); }
.wi-flake { stroke: var(--ink); stroke-width: 2.6; }
.wi-fog { stroke: var(--ink-muted); }

/* ---------- Weather card ---------- */

.weather {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px 40px;
    padding: 24px 28px;
}

.weather__now { display: flex; align-items: center; gap: 20px; }

.weather__temp {
    font-family: var(--font-display);
    font-size: 3.4rem;
    font-weight: 200;
    line-height: 1;
    letter-spacing: -0.03em;
    text-shadow: var(--glow);
}

.weather__info { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.weather__info strong { font-size: 1.05rem; font-weight: 600; }

.weather__place {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-muted);
    cursor: pointer;
}

.weather__place:hover { color: var(--ink); }
.weather__details { color: var(--ink-muted); font-size: var(--text-sm); }

.weather__days {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.weather__days li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 64px;
    padding: 10px 6px;
    border-radius: 14px;
    font-size: var(--text-sm);
}

.weather__days li:first-child { background: var(--surface-2); }
/* Narrow phones (Fold cover screen): the five days share the width instead of 64px each. */
@media (max-width: 420px) {
    .weather { padding: 18px 16px; }
    .weather__now { gap: 12px; min-width: 0; }
    .weather__now .weather-icon--large { width: 52px; height: 52px; }
    .weather__temp { font-size: 2.8rem; }
    .weather__info { min-width: 0; }
    .weather__days { gap: 2px; }
    .weather__days li { flex: 1 1 0; min-width: 0; padding: 8px 2px; font-size: 0.8rem; }
}
.weather__day { color: var(--ink-muted); font-weight: 600; letter-spacing: 0.04em; }
.weather__range { white-space: nowrap; }
.weather__range span { color: var(--ink-muted); margin-left: 4px; }
.weather__rain { min-height: 1.2em; color: var(--accent); font-size: var(--text-xs); }

.weather__status { margin: 0; color: var(--ink-muted); }

.weather__setup { display: flex; align-items: flex-start; gap: 24px; width: 100%; }
.weather__setup h2 { margin: 0 0 4px; font-size: var(--text-lg); font-weight: 600; }
.weather__setup p { margin: 0 0 14px; color: var(--ink-muted); }
.weather__setup-body { flex: 1; min-width: 0; max-width: 460px; }
.weather__actions { display: flex; gap: 12px; margin-bottom: 12px; }

/* ---------- Place picker ---------- */

.place-picker { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

.place-picker input {
    width: 100%;
}

.place-picker__hint { margin: 0; color: var(--ink-muted); font-size: var(--text-sm); }

.place-picker__results { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }

.place-picker__results button {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 8px 12px;
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--bg);
    text-align: left;
    cursor: pointer;
}

.place-picker__results li:first-child button { border-top: 0; }
.place-picker__results button:hover { background: var(--surface-2); }
.place-picker__results small { color: var(--ink-muted); }

.field__value { color: var(--ink); font-weight: 600; }

/* ---------- News ---------- */

.news { display: flex; flex-direction: column; gap: 14px; }

.news__header { display: flex; align-items: center; justify-content: space-between; }

.news__header h2 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

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

.news__manage { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.news__intro { margin: 0; color: var(--ink-muted); }
.news__manage + .news__list { margin-top: 6px; }

.feed-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.feed-list:empty { display: none; }

.feed-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 12px;
    border-radius: var(--radius-md);
    background: var(--bg);
}

.feed-list__name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.feed-list__name small { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-list__name small.is-error { color: var(--danger); }

.feed-add { display: flex; gap: 8px; }

.feed-add input {
    flex: 1;
    min-width: 0;
}


.news__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.news-item {
    height: 100%;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.news-item:hover { border-color: var(--accent); transform: translateY(-1px); }

.news-item__meta {
    color: var(--ink-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-item__title {
    font-weight: 500;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-item__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.news-item__thumb {
    width: 96px;
    height: 96px;
    flex: none;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.news__more { align-self: center; }

/* ---------- Article popup ---------- */

html:has(.article-backdrop) { overflow: hidden; }

.article-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    /* One row as high as the screen: the dialog's max-height (100%) is measured against it, not against its own
       content (an auto row grows with the dialog, and a tall one was cut off without a scrollbar). */
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    place-items: center;
    padding: clamp(0px, 4vh, 40px) clamp(0px, 3vw, 32px);
    background: rgb(0 0 0 / 45%);
    animation: shani-fade 0.2s ease;
}

.article-dialog {
    width: min(760px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 80px rgb(0 0 0 / 35%);
    overflow: hidden;
    outline: none;
    animation: shani-rise 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.article-dialog__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 12px 24px;
    border-bottom: 1px solid var(--line);
}

.article-dialog__meta {
    color: var(--ink-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-dialog__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.article-dialog__actions .text-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; }

.article-dialog__actions .text-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.article-dialog__body {
    /* May shrink below its content inside the dialog's column, so it scrolls instead of being cut off. */
    min-height: 0;
    overflow-y: auto;
    padding: 28px clamp(20px, 5vw, 56px) 48px;
    font-size: 1.05rem;
    line-height: 1.7;
}

.article-dialog__body h1 {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.article-dialog__body h2 { margin: 1.6em 0 0.4em; font-size: 1.15rem; line-height: 1.35; }
.article-dialog__body p { margin: 0 0 1em; }

.article-dialog__body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.2em auto;
    border-radius: 12px;
}

.article-dialog__body .article-dialog__hero { width: 100%; max-height: 360px; object-fit: cover; margin: 0 0 24px; }

.article-dialog__body blockquote {
    margin: 1.2em 0;
    padding: 2px 0 2px 18px;
    border-left: 3px solid var(--accent);
    color: var(--ink-muted);
}

.article-dialog__item { position: relative; padding-left: 18px; }
.article-dialog__item::before { content: "â€¢"; position: absolute; left: 2px; color: var(--accent); }

.article-dialog__byline { margin: 0 0 20px; color: var(--ink-muted); font-size: 0.9rem; }
.article-dialog__lead { font-weight: 500; }

.article-dialog__notice {
    margin-top: 12px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.article-dialog__notice p { margin: 0 0 12px; color: var(--ink-muted); font-size: var(--text-md); }
.article-dialog__notice .primary-button { text-decoration: none; }

.article-dialog__loading { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.article-dialog__loading p { margin: 4px 0 0; color: var(--ink-muted); font-size: 0.9rem; }

.article-dialog__loading span {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
    background-size: 200% 100%;
    animation: shani-shimmer 1.2s linear infinite;
}

.article-dialog__loading span:nth-child(2) { width: 92%; }
.article-dialog__loading span:nth-child(3) { width: 70%; }


@media (max-width: 600px) {
    .article-dialog { border-radius: 0; height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .article-backdrop, .article-dialog, .article-dialog__loading span { animation: none; }
}
.news__status { margin: 0; color: var(--ink-muted); }

@media (prefers-reduced-motion: reduce) {
    .spin { animation: none; }
    .news-item { transition: none; }
}
