/* sun.bg. One stylesheet, system fonts (Cyrillic webfonts are heavy; the systems have good ones).
   The page is split by a horizon: the sky above it takes the colour of the moment (.sky-night,
   .sky-dawn, .sky-day, .sky-dusk), the ground below it is plain paper. docs/technical/21-sun-bg.md */
:root {
    color-scheme: light dark;
    --paper: #ffffff;
    --paper-2: #f4f4f1;
    --ink: #16213f;
    --ink-2: #5d6584;
    --rule: #e4e4df;
    --sun: #ffb41f;
    --sun-ink: #9a5a00;
    --sun-wash: #ffe2a4;
    --dusk-wash: #ffd8cb;
    --focus: #1d6fe0;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --wrap: 680px;
    --gutter: 20px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0e1527;
        --paper-2: #182036;
        --ink: #eef1fa;
        --ink-2: #a4adc8;
        --rule: #263050;
        --sun-ink: #ffc44f;
        --sun-wash: rgba(255, 180, 31, .32);
        --dusk-wash: rgba(255, 140, 110, .28);
        --focus: #7fb3ff;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 17px/1.55 var(--font);
}
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: .18em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -.015em; font-weight: 700; }
h1 { font-size: clamp(2.3rem, 7vw, 3.4rem); }
h2 { font-size: 1.35rem; margin-bottom: .9rem; }
p { margin: 0 0 1em; }
time { white-space: nowrap; }
small { color: var(--ink-2); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
svg text { font-family: var(--font); }

/* The sky */
.sky {
    --sky-ink: #f4f6ff;
    --sky-ink-2: rgba(244, 246, 255, .72);
    --sky-line: rgba(244, 246, 255, .42);
    --field: rgba(255, 255, 255, .96);
    color: var(--sky-ink);
    background: #0f1b3d;
    overflow: hidden;
}
.sky-night { background: linear-gradient(180deg, #060d22 0%, #0f1b40 55%, #1c2c5c 100%); }
.sky-dawn { background: linear-gradient(180deg, #202a5f 0%, #5b4c8b 42%, #b05d74 76%, #d7765d 100%); }
.sky-dusk { background: linear-gradient(180deg, #171f4c 0%, #4a3a7b 42%, #a3476d 76%, #cd675b 100%); }
.sky-day {
    --sky-ink: #16213f;
    --sky-ink-2: rgba(22, 33, 63, .66);
    --sky-line: rgba(22, 33, 63, .32);
    background: linear-gradient(180deg, #7ab8f2 0%, #b4d9fa 55%, #e2f1ff 100%);
}
.masthead { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { fill: var(--sun); stroke: var(--sun); }
.hero { padding: 26px 0 0; }
.crumbs { font-size: .95rem; color: var(--sky-ink-2); margin-bottom: 10px; }
.crumbs span[aria-hidden] { margin: 0 .5em; }
.crumbs a { color: inherit; }
.hero-date { color: var(--sky-ink-2); font-size: 1.05rem; margin: 6px 0 14px; }
.hero-next { font-size: clamp(1.3rem, 4.5vw, 1.7rem); font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
.home-hero .hero-next { font-weight: 500; font-size: 1.15rem; max-width: 36em; }

/* the arc of the day */
.arc { display: block; width: 100%; height: auto; margin: 4px 0 0; }
.arc-path { fill: none; stroke: var(--sky-line); stroke-width: 2; }
.arc-golden { fill: none; stroke: var(--sun); stroke-width: 3.5; stroke-linecap: round; opacity: .9; }
.arc-label { font-size: 15px; fill: var(--sky-ink-2); }
.horizon { stroke: var(--sky-line); stroke-width: 1.5; }
.sun-disc { fill: #ffd34d; }
.sky-day .sun-disc { fill: #ffb41f; }
.sun-now { animation: sun-in .9s ease-out both; }
@keyframes sun-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sun-now { animation: none; } }
@media (max-width: 600px) { .arc-label { font-size: 24px; } }

/* the times at the ends of the horizon */
.horizon-times { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 10px 0 26px; }
.ht { display: flex; flex-direction: column; margin: 0; text-decoration: none; }
.ht time { font-size: clamp(2.1rem, 8vw, 3rem); font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.ht span { color: var(--sky-ink-2); font-size: .95rem; margin-top: 6px; }
.ht-set { text-align: right; align-items: flex-end; }
a.ht:hover time { text-decoration: underline; text-decoration-color: var(--sky-line); text-underline-offset: .12em; }

/* the search, on the home sky */
.search { position: relative; margin: 18px 0 8px; }
.search label { display: block; font-weight: 600; margin-bottom: 8px; }
.search-field { position: relative; color: #16213f; }
.search-field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .55; pointer-events: none; }
.search input {
    width: 100%; font: inherit; font-size: 1.15rem; padding: 14px 16px 14px 46px;
    border: 0; border-radius: 14px; background: var(--field); color: #16213f;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 12px 32px -16px rgba(0, 0, 0, .5);
}
.search input::placeholder { color: #6b7390; }
.search input:focus { outline: none; box-shadow: 0 0 0 4px rgba(255, 180, 31, .55), 0 12px 32px -16px rgba(0, 0, 0, .5); }
.results {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin: 6px 0 0; padding: 6px; list-style: none;
    background: var(--field); color: #16213f; border-radius: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 18px 40px -16px rgba(0, 0, 0, .55);
}
.results li a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 9px; text-decoration: none; }
.results li a small { color: #6b7390; }
.results li.active a, .results li a:hover { background: #fff1d2; }

/* the map of Bulgaria, on the home sky */
.map { display: block; width: 100%; height: auto; margin: 14px 0 0; }
.map .dot circle { transition: r .15s; }
.map .dot-up circle { fill: #ffc233; }
.map .dot-twilight circle { fill: #ff9f82; }
.map .dot-night circle { fill: rgba(255, 255, 255, .88); }
.sky-day .map .dot-night circle { fill: #16213f; }
.map .dot text { font-size: 26px; font-weight: 600; fill: var(--sky-ink); paint-order: stroke; stroke: rgba(0, 0, 0, .18); stroke-width: 4px; stroke-linejoin: round; }
.sky-day .map .dot text { stroke: rgba(255, 255, 255, .55); }
.map .dot:hover circle, .map .dot:focus circle { r: 16; }
@media (max-width: 600px) { .map .dot text { font-size: 38px; } }

/* The ground */
.ground { padding: 28px 0 24px; }
.lead { font-size: 1.15rem; line-height: 1.5; max-width: 34em; margin: 0 0 8px; }
.lead strong { font-weight: 600; }
.ground section { padding-top: 40px; }

/* today, hour by hour */
.timeline { list-style: none; margin: 0; padding: 4px 0 0 26px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 10px; bottom: 10px; width: 2px; background: var(--rule); }
.timeline li { position: relative; display: grid; grid-template-columns: 3.6em 1fr; column-gap: 12px; align-items: baseline; padding: 7px 0; }
.timeline li::before {
    content: ""; position: absolute; left: -24px; top: calc(7px + .55em); width: 8px; height: 8px; border-radius: 50%;
    background: var(--paper); border: 2px solid var(--ink-2);
}
.timeline time { font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline .what { font-weight: 500; }
.timeline .note { grid-column: 2; color: var(--ink-2); font-size: .92rem; }
.timeline .key::before { background: var(--sun); border-color: var(--sun); }
.timeline .key .what { font-weight: 700; }
.timeline .past { color: var(--ink-2); }
.timeline .past time { font-weight: 500; }
.timeline .now { color: var(--sun-ink); padding: 3px 0; }
.timeline .now::before { background: var(--sun-ink); border-color: var(--sun-ink); width: 10px; height: 10px; left: -25px; top: calc(3px + .5em); }
.timeline .now .what { font-weight: 600; }

/* ads: hidden until a network exists; a fixed height then keeps the page from shifting */
.ad-slot { display: none; min-height: 90px; margin: 32px 0 0; }

/* the year */
.chart { margin: 0; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { font-size: 12px; fill: var(--ink-2); }
.chart .note { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.chart .twilight { fill: var(--dusk-wash); }
.chart .daylight { fill: var(--sun-wash); }
.chart .today-line { stroke: var(--ink); stroke-width: 1.5; }
.chart .today-dot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.chart .today-label { fill: var(--ink); font-weight: 600; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; pointer-events: none; }
.chart .cross[hidden] { display: none; }
@media (max-width: 600px) {
    /* the SVG scales down with the screen; bigger glyphs in SVG units keep the text readable */
    .chart .axis { font-size: 19px; }
    .chart .note { font-size: 20px; }
}
.chart-tip {
    position: absolute; z-index: 4; pointer-events: none; padding: 8px 10px; border-radius: 10px; font-size: .85rem; line-height: 1.35;
    background: var(--ink); color: var(--paper); box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .4); white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.chart-tip strong { display: block; font-weight: 600; margin-bottom: 2px; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; color: var(--ink-2); margin-top: 8px; }
.legend::before { content: ""; display: inline-block; width: 14px; height: 10px; margin-right: 7px; vertical-align: -1px; border-radius: 2px; }
.legend.daylight::before { background: var(--sun-wash); }
.legend.twilight::before { background: var(--dusk-wash); }
.legend.today::before { background: var(--ink); width: 2px; height: 12px; vertical-align: -2px; }
.legend-note { flex-basis: 100%; }

/* tables: the year, the big towns */
details { margin-top: 16px; }
summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
summary small { font-weight: 400; margin-left: .35em; }
table { width: 100%; border-collapse: collapse; font-size: .97rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); }
thead th { font-size: .82rem; font-weight: 500; color: var(--ink-2); padding-top: 0; }
tbody th { font-weight: 500; }
.year-table table { margin-top: 6px; }
.year-table thead th { position: sticky; top: 0; background: var(--paper); }
tr.today { background: var(--sun-wash); font-weight: 600; }
tr.today th { font-weight: 600; }
tr.today > :first-child { box-shadow: inset 3px 0 var(--sun); padding-left: 8px; }
.town-list th[scope="row"] a { text-decoration: none; font-weight: 600; }
.town-list th[scope="row"] a:hover { text-decoration: underline; }
@media (min-width: 600px) { .town-list { font-size: 1rem; } }

/* the next dates */
.dates { list-style: none; margin: 0; padding: 0; }
.dates li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.dates li:last-child { border-bottom: 1px solid var(--rule); }
.dates .what { font-weight: 600; }
.dates time { color: var(--ink-2); grid-row: 2; }
.dates .when { color: var(--sun-ink); font-weight: 600; text-align: right; grid-column: 2; grid-row: 1 / span 2; align-self: center; white-space: nowrap; }
.dates .note { grid-column: 1; color: var(--ink-2); font-size: .92rem; margin-top: 2px; }

/* towns of the oblast, the lists on the home page */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 7px 13px; border-radius: 999px; background: var(--paper-2); text-decoration: none; font-size: .95rem; }
.chips a:hover { background: var(--sun-wash); }
.all-towns details { border-top: 1px solid var(--rule); margin: 0; }
.all-towns details:last-child { border-bottom: 1px solid var(--rule); }
.all-towns .chips { padding: 4px 0 16px; }

/* footer */
.site-footer { padding: 24px 0 36px; color: var(--ink-2); font-size: .85rem; border-top: 1px solid var(--rule); }
.site-footer p { margin: .35rem 0; }

/* the not-found page */
.not-found { padding: 0 0 32px; }
.button { display: inline-block; padding: 12px 18px; border-radius: 12px; background: var(--sun); color: #16213f; text-decoration: none; font-weight: 600; }

@media print {
    .masthead, .search, .ad-slot, .all-towns, .map, .site-footer .colophon { display: none; }
    .sky { background: none; color: #000; }
    details { display: block; }
    details > *:not(summary) { display: block; }
}
