/* Apricot Days (apricotdays.com) — Армения сегодня.
   Палитра: розовый туф, чернила-слива, абрикос, севанская синь, гранат. */

:root {
    --bg: #EAD8D1;          /* розовый туф */
    --bg-raised: #F3E7E2;
    --ink: #2A1E2B;         /* чернила-слива */
    --ink-soft: #5F5560;    /* базальт */
    --rule: #D4BDB4;
    --apricot: #E07B1F;
    --apricot-ink: #A9530C; /* абрикос для текста — контраст ≥ 4.5 */
    --sevan: #1F5E7A;       /* линии данных */
    --pomegranate: #9E1B32;
    --mountain: #8C5F66;
    --snow: #FFF8F4;
    --good: #2F7D4F;
    --warning: #A86A12;
    --serious: #C2410C;
    --critical: #9E1B32;

    --font-display: "Unbounded", "Golos Text", system-ui, sans-serif;
    --font-text: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-hy: "Noto Serif Armenian", "Golos Text", serif;

    --gutter: clamp(1rem, 4vw, 3rem);
    --max: 84rem;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1C181D;
        --bg-raised: #262028;
        --ink: #F1E4DE;
        --ink-soft: #B6A8AE;
        --rule: #3B3240;
        --apricot: #F0953F;
        --apricot-ink: #F4A65C;
        --sevan: #6FB3D2;
        --pomegranate: #E0566C;
        --mountain: #6E4A52;
        --snow: #E9DCD8;
        --good: #5FBF85;
        --warning: #E2A43B;
        --serious: #F08045;
        --critical: #F06A7E;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #1C181D; --bg-raised: #262028; --ink: #F1E4DE; --ink-soft: #B6A8AE; --rule: #3B3240;
    --apricot: #F0953F; --apricot-ink: #F4A65C; --sevan: #6FB3D2; --pomegranate: #E0566C;
    --mountain: #6E4A52; --snow: #E9DCD8; --good: #5FBF85; --warning: #E2A43B; --serious: #F08045; --critical: #F06A7E;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 1rem/1.55 var(--font-text);
    font-feature-settings: "tnum" 1;
    overflow-x: hidden;
}

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--apricot); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: -.01em; }
small { font-size: .8125rem; color: var(--ink-soft); }

.skip { position: absolute; left: -999px; top: 0; padding: .5rem 1rem; background: var(--ink); color: var(--bg); z-index: 10; }
.skip:focus { left: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Шапка ---------- */

.masthead {
    display: flex;
    align-items: center;
    gap: 1rem 2rem;
    flex-wrap: wrap;
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.25rem var(--gutter);
}

.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand-mark {
    display: grid; place-items: center;
    width: 2.5rem; height: 2.5rem;
    border-radius: 50%;
    background: var(--apricot);
    color: #2A1E2B;
    font: 600 1.35rem/1 var(--font-hy);
}
.brand-name { font: 800 1.25rem/1 var(--font-display); display: flex; flex-direction: column; gap: .2rem; }
.brand-sub { font: 400 .8125rem/1 var(--font-text); color: var(--ink-soft); }

.nav { display: flex; gap: 1.5rem; margin-left: auto; font-weight: 500; }
.nav a { text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current] { border-bottom-color: var(--apricot); }

.clock { margin: 0; display: flex; gap: .5rem; align-items: baseline; color: var(--ink-soft); font-size: .875rem; }
.clock time { font: 600 1.125rem/1 var(--font-display); color: var(--ink); }

/* ---------- Первый экран: Арарат ---------- */

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 1fr);
    gap: 2rem 4rem;
    align-items: start;
    max-width: var(--max);
    margin: 0 auto;
    /* Горы занимают нижнюю полосу высотой --mountains; вершина Масиса — на 16% её высоты. */
    --mountains: max(11rem, 25vw);
    padding: clamp(2rem, 6vw, 5rem) var(--gutter) calc(var(--mountains) * .88);
    isolation: isolate;
}

.hero-title {
    font-weight: 800;
    font-size: clamp(2.75rem, 8.5vw, 7.25rem);
    line-height: .94;
    letter-spacing: -.035em;
    max-width: 9ch;
    text-wrap: balance;
}
.hero-lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 34rem; margin: 1.5rem 0 .75rem; }
.hero-note { color: var(--ink-soft); font-size: .875rem; margin: 0; max-width: 34rem; }

.hero-now { padding-top: .5rem; }
.hero-temp { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.hero-temp .wx { width: 3rem; height: 3rem; color: var(--apricot-ink); }
.hero-temp-value { font: 600 clamp(3.5rem, 7vw, 5.5rem)/1 var(--font-display); letter-spacing: -.04em; }
.hero-cond { margin: .5rem 0 1.25rem; font-size: 1.0625rem; }

.hero-facts { display: grid; gap: .35rem; margin: 0 0 1.5rem; }
.hero-facts div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dotted var(--rule); padding-bottom: .35rem; }
.hero-facts dt { color: var(--ink-soft); }
.hero-facts dd { margin: 0; text-align: right; }

.hero-rates { list-style: none; margin: 0; padding: 0; display: flex; gap: .5rem; flex-wrap: wrap; }
.hero-rates a {
    display: flex; flex-direction: column; gap: .15rem;
    padding: .6rem .9rem;
    border-radius: .75rem;
    background: var(--bg-raised);
    text-decoration: none;
}
.hero-rates a:hover { background: color-mix(in srgb, var(--apricot) 18%, var(--bg-raised)); }
.hero-rate-code { font-size: .8125rem; color: var(--ink-soft); }
.hero-rate-value { font: 600 1.125rem/1 var(--font-display); }
.hero-updated { margin: 1rem 0 0; font-size: .8125rem; color: var(--ink-soft); }

.ararat {
    position: absolute;
    z-index: -1;
    left: 50%;
    bottom: 0;
    width: 100vw;
    height: var(--mountains);
    transform: translateX(-50%);
}
.ararat-body { fill: var(--mountain); }
.ararat-snow { fill: var(--snow); }
.ararat-clouds rect { fill: var(--bg-raised); opacity: 0; }
.ararat-stars circle { fill: var(--snow); opacity: 0; }

.hero--haze .ararat-mountains { filter: url(#haze); opacity: .45; }
.hero--clouded .ararat-mountains { opacity: .3; }
.hero--clouded .ararat-clouds rect { opacity: .92; }

/* Ночью первый экран темнеет независимо от темы. */
.hero--night { color: #F1E4DE; --ink-soft: #B6A8AE; --rule: #4A3E4E; --bg-raised: #3A2E3D; --apricot-ink: #F4A65C; }
.hero--night::before {
    content: ""; position: absolute; z-index: -2; inset: 0 50%; margin: 0 -50vw;
    background: linear-gradient(#1A1420, #2A1E2B 70%);
}
.hero--night .ararat-body { fill: #120E15; }
.hero--night .ararat-snow { fill: #5D5266; }
.hero--night .ararat-stars circle { opacity: .8; }

.hero--empty { grid-template-columns: 1fr; }

/* ---------- Блоки ---------- */

.block, .page-head {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) 0;
}

.block-head { margin-bottom: 1.5rem; max-width: 46rem; }
.block-head h2 { font-size: clamp(1.5rem, 3vw, 2.125rem); }
.block-head p { margin: .5rem 0 0; color: var(--ink-soft); }
.block-head--row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; max-width: none; }
.block-more { margin: 1rem 0 0; font-weight: 500; }

.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--gutter);
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.split > .block { padding-left: 0; padding-right: 0; margin: 0; }

/* ---------- Города ---------- */

.cities { list-style: none; margin: 0; padding: 0; }
.city {
    display: grid;
    grid-template-columns: minmax(11rem, 1.3fr) 5rem minmax(10rem, 1.4fr) 120px minmax(11rem, 1.2fr) minmax(9rem, 1fr);
    align-items: center;
    gap: .5rem 1.25rem;
    padding: .85rem 0;
    border-top: 1px solid var(--rule);
}
.city:last-child { border-bottom: 1px solid var(--rule); }

.city-link { display: flex; flex-direction: column; text-decoration: none; }
.city-hy { font: 400 1.0625rem/1.2 var(--font-hy); color: var(--apricot-ink); }
.city-name { font-weight: 600; font-size: 1.0625rem; display: flex; gap: .5rem; align-items: baseline; }
.city-link:hover .city-name { text-decoration: underline; text-underline-offset: .2em; }

.city-temp { font: 600 1.75rem/1 var(--font-display); letter-spacing: -.03em; }
.city-temp--empty { grid-column: 2 / -1; font: 400 1rem var(--font-text); color: var(--ink-soft); }
.city-cond { display: flex; align-items: center; gap: .5rem; }
.city-cond .wx { flex: none; color: var(--ink-soft); }
.city-spark { color: var(--sevan); display: flex; }
.city-range, .city-air { display: flex; flex-direction: column; gap: .1rem; }

/* ---------- Статусы (иконка + текст, не только цвет) ---------- */

.status { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
.status-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--c); flex: none; }
.status--good { --c: var(--good); }
.status--warning { --c: var(--warning); }
.status--warning .status-dot { border-radius: 1px; transform: rotate(45deg); }
.status--serious { --c: var(--serious); }
.status--serious .status-dot, .status--critical .status-dot { border-radius: 1px; }
.status--critical { --c: var(--critical); }

/* ---------- Курсы ---------- */

.rates { width: 100%; border-collapse: collapse; }
.rates th, .rates td { padding: .6rem .5rem; border-top: 1px solid var(--rule); text-align: left; font-weight: 400; }
.rates thead th { border-top: 0; font-size: .8125rem; color: var(--ink-soft); padding-top: 0; }
.rates tbody th a { display: flex; flex-direction: column; text-decoration: none; }
.rates tbody th a:hover .rate-code { text-decoration: underline; }
.rate-code { font: 600 1rem/1.2 var(--font-display); }
.rate-name { font-size: .8125rem; color: var(--ink-soft); }
.rate-value { font-weight: 600; font-size: 1.0625rem; }
.rate-diff small { display: block; }
.rate-spark { color: var(--sevan); width: 96px; padding-right: 0; }
.num { text-align: right !important; white-space: nowrap; }

.is-up::before { content: "▲ "; font-size: .7em; color: var(--ink-soft); }
.is-down::before { content: "▼ "; font-size: .7em; color: var(--ink-soft); }

/* ---------- Землетрясения ---------- */

.quakes { list-style: none; margin: 0; padding: 0; }
.quake {
    display: grid;
    grid-template-columns: 3.75rem minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: .6rem 0;
    border-top: 1px solid var(--rule);
}
.quake-mag {
    --size: calc(1.75rem + (var(--m) - 2) * .55rem);
    display: grid; place-items: center;
    width: var(--size); height: var(--size);
    max-width: 3.75rem; max-height: 3.75rem;
    justify-self: center;
    border-radius: 50%;
    border: 2px solid var(--pomegranate);
    color: var(--ink);
    font: 600 .8125rem/1 var(--font-display);
}
.quake--felt .quake-mag { background: var(--pomegranate); color: #FFF4F2; }
.quake-place { display: flex; flex-direction: column; min-width: 0; }
.quake-place a { font-weight: 500; text-decoration: none; }
.quake-place a:hover { text-decoration: underline; }
.quake-time { font-size: .875rem; color: var(--ink-soft); text-align: right; white-space: nowrap; }

/* ---------- Страницы города и валюты ---------- */

.crumbs { margin: 0 0 1rem; font-size: .9375rem; }
.page-title { font-size: clamp(2.25rem, 6vw, 4.5rem); font-weight: 800; letter-spacing: -.03em; display: flex; flex-direction: column; gap: .35rem; }
.page-title-hy { font: 400 clamp(1.25rem, 3vw, 2rem)/1.1 var(--font-hy); color: var(--apricot-ink); letter-spacing: 0; }
.page-title-code { font-size: .45em; color: var(--apricot-ink); letter-spacing: 0; }
.page-lead { max-width: 42rem; font-size: 1.0625rem; margin: 1rem 0 0; }

.now-row { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; align-items: center; margin-top: 2rem; }
.now-temp { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0 0; font: 600 clamp(3rem, 7vw, 5rem)/1 var(--font-display); letter-spacing: -.04em; }
.now-row .now-temp { margin: 0; }
.now-temp .wx { width: 3rem; height: 3rem; color: var(--apricot-ink); }
.now-facts { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 1.5rem 0 0; }
.now-row .now-facts { margin: 0; }
.now-facts dt { font-size: .8125rem; color: var(--ink-soft); }
.now-facts dd { margin: .15rem 0 0; font-weight: 500; }

.sub-title { font-size: 1.25rem; margin: 2.5rem 0 1rem; }
.forecast { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .5rem; }
.forecast li { display: flex; flex-direction: column; gap: .35rem; padding: .9rem 1rem; background: var(--bg-raised); border-radius: .5rem; }
.forecast li:first-child { background: color-mix(in srgb, var(--apricot) 16%, var(--bg-raised)); }
.forecast .wx { color: var(--ink-soft); }
.forecast-day { font-weight: 600; }
.forecast-temp { font: 600 1.375rem/1 var(--font-display); display: flex; gap: .5rem; align-items: baseline; }
.forecast-temp small { font-family: var(--font-text); font-weight: 400; font-size: 1rem; }
.forecast-note { font-size: .875rem; }
.forecast-sun { font-size: .75rem; color: var(--ink-soft); }

.periods { display: flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border-radius: 999px; background: var(--bg-raised); }
.periods a { padding: .35rem .85rem; border-radius: 999px; text-decoration: none; font-size: .875rem; }
.periods a:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.periods a[aria-current] { background: var(--ink); color: var(--bg); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { padding: .5rem .75rem; border-top: 1px solid var(--rule); text-align: left; font-weight: 400; }
.table thead th { border-top: 0; color: var(--ink-soft); font-size: .8125rem; }
.table tbody tr:hover { background: color-mix(in srgb, var(--apricot) 8%, transparent); }

/* ---------- Графики ---------- */

.chart-title { font-size: 1.0625rem; margin: 2rem 0 .75rem; }
.block-head + .chart-title { margin-top: 0; }
.chart-note { color: var(--ink-soft); font-size: .875rem; margin: .5rem 0 0; }
.chart-empty { color: var(--ink-soft); padding: 2rem 0; margin: 0; }

.chart { position: relative; margin: 0; overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 34rem; height: auto; touch-action: pan-y; }
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { fill: var(--ink-soft); font: 400 10px var(--font-text); }
/* Атрибут hidden не действует на элементы SVG. */
.chart-hover[hidden] { display: none; }
.chart-line { fill: none; stroke: var(--sevan); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-end { fill: var(--sevan); stroke: var(--bg); stroke-width: 2; }
.chart-cross { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-dot { fill: var(--sevan); stroke: var(--bg); stroke-width: 2; }
.chart-last { font-size: .875rem; color: var(--ink-soft); margin-top: .35rem; }
.chart-last strong { color: var(--ink); }
.chart-tip {
    position: absolute; top: 0; left: 0; pointer-events: none;
    padding: .4rem .6rem; border-radius: .375rem;
    background: var(--ink); color: var(--bg);
    font-size: .8125rem; line-height: 1.3; white-space: nowrap;
    transform: translate(-50%, calc(-100% - 10px));
}
.chart-tip strong { display: block; font-size: .9375rem; }

.chart--map svg { min-width: 0; max-height: 80vh; border-radius: .75rem; }
.map-bg { fill: var(--bg-raised); }
.map-city { fill: var(--ink); }
.map-label { fill: var(--ink-soft); font: 500 13px var(--font-text); }
.map-quake { fill: color-mix(in srgb, var(--pomegranate) 35%, transparent); stroke: var(--pomegranate); stroke-width: 1.5; }
.chart--map .chart-dot { fill: none; stroke: var(--ink); stroke-width: 2; }

/* ---------- Текстовые страницы ---------- */

.prose > * { max-width: 42rem; }
.prose h2 { font-size: clamp(1.25rem, 2.5vw, 1.625rem); margin: 2.5rem 0 .75rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { margin: 0 0 1rem; }
.prose li { margin-bottom: .35rem; }

/* ---------- Подвал ---------- */

.footer {
    max-width: var(--max);
    margin: clamp(3rem, 6vw, 5rem) auto 0;
    padding: 2rem var(--gutter) 3rem;
    border-top: 1px solid var(--rule);
    color: var(--ink-soft);
    font-size: .9375rem;
}
.footer p { margin: .5rem 0 0; }
.footer-title { font: 600 1rem var(--font-display); color: var(--ink); margin-bottom: .75rem; }
.sources { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .75rem 2rem; }
.sources li { display: flex; flex-direction: column; color: var(--ink); }
.footer-cities { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: 1.5rem; }
.footer-cities a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; }
.footer-links { font-weight: 500; }
.live-status { font-size: .8125rem; }

/* Короткая подсветка блока, который только что обновился. */
[data-live].is-fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh {
    from { box-shadow: inset 4px 0 0 var(--apricot); }
    to { box-shadow: inset 4px 0 0 transparent; }
}

/* ---------- Адаптив ---------- */

@media (max-width: 64rem) {
    .city { grid-template-columns: minmax(9rem, 1fr) 4.5rem minmax(0, 1.4fr) 120px; }
    .city-range, .city-air { grid-column: span 2; flex-direction: row; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
    .city-range { grid-column: 1 / 3; }
}

@media (max-width: 52rem) {
    .hero { grid-template-columns: 1fr; }
    .split { grid-template-columns: 1fr; }
    .nav { order: 3; width: 100%; margin-left: 0; gap: 1.25rem; }
    .clock { margin-left: auto; }
}

@media (max-width: 36rem) {
    .city { grid-template-columns: minmax(0, 1fr) auto; gap: .35rem 1rem; }
    .city-cond { grid-column: 1; }
    .city-spark { grid-column: 2; grid-row: 2; justify-self: end; }
    .city-range, .city-air { grid-column: 1 / -1; }
    .city-temp { justify-self: end; }
    .rate-spark { display: none; }
    .quake { grid-template-columns: 3rem minmax(0, 1fr); }
    .quake-time { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
    .status-dot, .chart-line { forced-color-adjust: none; }
}
