:root {
    color-scheme: light dark;
    --bg: #eef1ec;
    --surface: #ffffff;
    --tint: #f3f5f1;
    --text: #151a16;
    --dim: #647067;
    --line: #dde2da;
    --accent: #2f6f4f;
    --good: #23804a;
    --info: #5b6b7a;
    --warn: #b26a00;
    --danger: #c6392b;
    --radius: 22px;
    --radius-s: 14px;
    --shadow: 0 1px 2px rgb(20 30 22 / 0.04), 0 8px 28px rgb(20 30 22 / 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1311;
        --surface: #1a201c;
        --tint: #222a25;
        --text: #eaeeea;
        --dim: #97a39a;
        --line: #2c352f;
        --accent: #6fcf9c;
        --good: #62c78d;
        --info: #93a4b5;
        --warn: #e8ad4d;
        --danger: #f2705f;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.25);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 72px;
}

p {
    margin: 0;
}

.dim {
    color: var(--dim);
}

/* ---- Погодные значки ---- */

.wx {
    --wx-sun: #f2a93b;
    --wx-cloud: #b9c3c9;
    --wx-cloud-back: #d5dcdf;
    --wx-rain: #3f8fd6;
    --wx-snow: #7fb4e3;
    display: inline-block;
    flex: none;
    width: 1em;
    height: 1em;
    line-height: 0;
    vertical-align: middle;
}

@media (prefers-color-scheme: dark) {
    .wx {
        --wx-sun: #f5bd55;
        --wx-cloud: #8f9ca4;
        --wx-cloud-back: #64707a;
        --wx-rain: #6db0ee;
        --wx-snow: #cfe6fa;
    }
}

.wx svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.wx-sun,
.wx-moon,
.wx-bolt {
    fill: var(--wx-sun);
}

.wx-rays {
    fill: none;
    stroke: var(--wx-sun);
    stroke-width: 3;
    stroke-linecap: round;
    animation: wx-spin 24s linear infinite;
}

.wx-moon {
    animation: wx-rock 7s ease-in-out infinite;
}

.wx-cloud {
    fill: var(--wx-cloud);
    animation: wx-drift 7s ease-in-out infinite;
}

.wx-back {
    fill: var(--wx-cloud-back);
    animation-duration: 11s;
    animation-direction: reverse;
}

.wx-drop {
    stroke: var(--wx-rain);
    stroke-width: 3;
    stroke-linecap: round;
    animation: wx-rain 1.1s linear infinite;
}

.wx-flake {
    fill: var(--wx-snow);
    animation: wx-snow 2.6s linear infinite;
}

.wx-mist {
    fill: none;
    stroke: var(--wx-cloud);
    stroke-width: 4;
    stroke-linecap: round;
    animation: wx-mist 5s ease-in-out infinite;
}

.wx-mist-back {
    animation-direction: reverse;
}

.wx-bolt {
    animation: wx-flash 3.2s linear infinite;
}

@keyframes wx-spin {
    to { transform: rotate(360deg); }
}

@keyframes wx-rock {
    0%, 100% { transform: rotate(-7deg); }
    50% { transform: rotate(7deg); }
}

@keyframes wx-drift {
    0%, 100% { translate: -1.5px 0; }
    50% { translate: 1.5px 0; }
}

@keyframes wx-rain {
    0% { transform: translate(1px, -4px); opacity: 0; }
    25% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translate(-3px, 12px); opacity: 0; }
}

@keyframes wx-snow {
    0% { transform: translate(0, -4px); opacity: 0; }
    20% { opacity: 1; }
    50% { transform: translate(2.5px, 5px); }
    80% { opacity: 1; }
    100% { transform: translate(-1px, 14px); opacity: 0; }
}

@keyframes wx-mist {
    0%, 100% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
}

@keyframes wx-flash {
    0%, 62%, 70%, 78%, 100% { opacity: 1; }
    66%, 74% { opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
    .wx * {
        animation: none;
    }
}

/* ---- Шапка и поиск ---- */

.top {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 0 -24px;
    padding: 16px 24px;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.logo svg {
    display: block;
    flex: none;
    width: 48px;
    height: 48px;
    transition: transform 0.2s ease;
}

.logo:hover svg {
    transform: rotate(-6deg) scale(1.05);
}

.logo:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
    border-radius: 10px;
}

.search {
    position: relative;
    flex: 1;
    min-width: 0;
}

#search {
    width: 100%;
    height: 58px;
    padding: 0 24px 0 56px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a968d' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.8-3.8'/%3E%3C/svg%3E") 20px center / 24px no-repeat;
    box-shadow: var(--shadow);
    color: inherit;
    font: inherit;
    font-size: 20px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#search::placeholder {
    color: var(--dim);
}

#search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow), 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

#suggest {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    max-height: 64vh;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 18px 48px rgb(0 0 0 / 0.18);
}

#suggest li {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    border-radius: var(--radius-s);
}

#suggest [role=option] {
    cursor: pointer;
}

#suggest [role=option]:hover,
#suggest .active {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

#suggest .name {
    font-size: 19px;
    font-weight: 600;
}

#suggest .caption,
#suggest .meta {
    color: var(--dim);
    font-size: 15px;
}

#suggest .caption {
    padding-bottom: 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 13px;
}

/* ---- Точка и текущая погода ---- */

.status {
    margin-top: 64px;
    color: var(--dim);
    font-size: 20px;
    text-align: center;
}

.status.error {
    color: var(--danger);
}

.place {
    margin-top: 28px;
}

.place h1 {
    margin: 0 0 6px;
    font-size: clamp(32px, 5.4vw, 52px);
    font-weight: 750;
    line-height: 1.08;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.place p {
    color: var(--dim);
    font-size: 19px;
}

.place .coords {
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.now {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    margin-top: 24px;
    padding: 28px 32px;
    border-radius: var(--radius);
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
        var(--surface);
    box-shadow: var(--shadow);
    font-size: 20px;
}

.now .wx {
    font-size: 104px;
}

.now .big {
    font-size: 88px;
    font-weight: 750;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.now > div {
    flex: 1 1 280px;
}

.now .dim {
    font-size: 17px;
}

/* ---- Дни ---- */

.caption {
    margin: 0 0 12px;
    color: var(--dim);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.past-summary {
    margin-top: 10px;
    color: var(--dim);
    font-size: 16px;
}

.tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(118px, 1fr);
    gap: 10px;
    margin: -6px;
    padding: 6px 6px 10px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 16px 8px 22px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
    transform: translateY(-2px);
}

.tab:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.tab::after {
    content: "";
    position: absolute;
    bottom: 10px;
    width: 36px;
    height: 5px;
    border-radius: 999px;
    background: var(--level, transparent);
}

.tab[aria-pressed=true] {
    border-color: var(--accent);
}

.tab .weekday {
    font-size: 19px;
    font-weight: 700;
    text-transform: capitalize;
}

.tab .date,
.tab .wind,
.tab small {
    color: var(--dim);
    font-size: 15px;
}

.tab .wx {
    margin: 4px 0;
    font-size: 64px;
}

.tab .temps {
    font-size: 21px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tab small {
    margin-left: 6px;
    font-weight: 400;
}

.tab.past {
    padding: 12px 6px;
    background: color-mix(in srgb, var(--surface) 55%, transparent);
    box-shadow: none;
}

.tab.past::after {
    content: none;
}

.tab.past .weekday {
    font-size: 16px;
    font-weight: 600;
}

.tab.past .wx {
    font-size: 44px;
}

.tab.past .temps {
    font-size: 17px;
}

.tab.past .wind {
    display: none;
}

.good {
    --level: var(--good);
}

.info {
    --level: var(--info);
}

.warn {
    --level: var(--warn);
}

.danger {
    --level: var(--danger);
}

.tab.info {
    --level: transparent;
}

/* ---- Выбранный день ---- */

.day {
    margin-top: 20px;
    padding: 32px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.verdict {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
    color: var(--level);
    font-size: clamp(26px, 4vw, 36px);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.verdict.info {
    color: inherit;
}

.verdict span {
    color: var(--dim);
    font-size: 19px;
    font-weight: 400;
    letter-spacing: 0;
}

.notes {
    display: grid;
    gap: 8px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.notes li {
    display: flex;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-s);
    background: color-mix(in srgb, var(--level) 10%, transparent);
    font-size: 19px;
    line-height: 1.4;
}

.notes li::before {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    margin-top: 0.45em;
    border-radius: 50%;
    background: var(--level);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    margin: 24px 0 0;
}

.metric {
    padding: 14px 18px;
    border-radius: var(--radius-s);
    background: var(--tint);
}

.metric dt {
    color: var(--dim);
    font-size: 15px;
}

.metric dd {
    margin: 2px 0 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.hours {
    margin-top: 28px;
    overflow-x: auto;
}

.hours table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hours .wx {
    font-size: 36px;
}

.hours th,
.hours td {
    padding: 8px 14px;
    text-align: right;
}

.hours thead th {
    padding-bottom: 12px;
    color: var(--dim);
    font-size: 15px;
    font-weight: 400;
}

.hours tbody th {
    color: var(--dim);
    font-weight: 400;
    text-align: left;
}

.hours thead th:first-child {
    text-align: left;
}

.hours tbody tr:nth-child(odd) > * {
    background: var(--tint);
}

.hours tbody tr > :first-child {
    border-radius: var(--radius-s) 0 0 var(--radius-s);
}

.hours tbody tr > :last-child {
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
}

.source {
    margin-top: 32px;
    color: var(--dim);
    font-size: 15px;
    text-align: center;
}

/* ---- Главная ---- */

.home {
    margin-top: 56px;
    font-size: 20px;
}

.home h1 {
    max-width: 20ch;
    margin: 0;
    font-size: clamp(34px, 6.4vw, 64px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.home h1 em {
    color: var(--accent);
    font-style: normal;
}

.theses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin: 44px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: thesis;
}

.theses li {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 26px 26px 28px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    counter-increment: thesis;
}

.theses li::before {
    content: counter(thesis, decimal-leading-zero);
    color: var(--accent);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.theses strong {
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.theses span {
    color: var(--dim);
    font-size: 19px;
    line-height: 1.4;
}

.home h2 {
    margin: 44px 0 12px;
    color: var(--dim);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.home .source {
    margin-top: 48px;
    text-align: left;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.links a {
    display: block;
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.links a:hover {
    background: var(--accent);
    color: var(--surface);
}

/* ---- Узкие экраны ---- */

@media (max-width: 640px) {
    body {
        font-size: 17px;
    }

    main {
        padding: 0 16px 56px;
    }

    .top {
        gap: 12px;
        margin: 0 -16px;
        padding: 12px 16px;
    }

    .logo span {
        display: none;
    }

    #search {
        height: 52px;
        font-size: 18px;
    }

    .now {
        padding: 22px;
    }

    .now .wx {
        font-size: 80px;
    }

    .now .big {
        font-size: 68px;
    }

    .day {
        padding: 22px 18px;
    }

    .notes li {
        padding: 12px 14px;
        font-size: 17px;
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric dd {
        font-size: 19px;
    }

    .hours th,
    .hours td {
        padding: 8px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tab,
    .logo svg {
        transition: none;
    }
}
