/* The Downloads page (/downloads/), on top of ../assets/site.css. The numbers, the chart and the
   bars are drawn by downloads.js from downloads.json. */

/* The two systems: Windows in the accent's green, Mac in a slate, dark to light so they also differ
   in lightness. Light: #1F6B4E and #64748B on #FFFFFF, 6.4:1 and 4.8:1; Dark: #4CB88A and #94A3B8 on
   #11161D, 7.4:1 and 7.1:1; High contrast: black and a mid grey (3.4:1, a fill, never text), told apart by the legend. */
:root { --dl-win: #1F6B4E; --dl-mac: #64748B; --dl-track: #F3F4F6 }
:root[data-theme="dark"] { --dl-win: #4CB88A; --dl-mac: #94A3B8; --dl-track: #1A212B }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"], [data-theme="contrast"]) { --dl-win: #4CB88A; --dl-mac: #94A3B8; --dl-track: #1A212B }
}
:root[data-theme="contrast"] { --dl-win: #000000; --dl-mac: #8C8C8C; --dl-track: #E6E6E6 }

.page-body > div > section { padding-block: 32px 32px }

/* A card: the chart, the files and the Archicad versions. */
.dl-card { border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); padding: 24px }
.dl-card h3 { margin: 0 0 4px }
.dl-card .dl-note { margin: 0 0 16px; font-size: .8125rem; color: var(--muted) }
.figures .change { display: block; margin-top: 4px; color: var(--link) }

/* The chart's head: the legend, and the time span chips on the right. */
.dl-chart-figure { margin: 0 0 16px }
.dl-chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px }
.dl-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .875rem; font-weight: 600; color: var(--muted) }
.dl-legend li { display: inline-flex; align-items: center; gap: 8px }
.swatch { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 2px }
.swatch.win { background: var(--dl-win) }
.swatch.mac { background: var(--dl-mac) }
.dl-ranges { display: flex; flex-wrap: wrap; gap: 8px }

/* The chart, inline SVG. Its labels stay in px: they are part of the drawing, which scales with its
   width, and every number is also in the table below it. */
.dl-chart { position: relative; touch-action: pan-y }
.dl-chart svg { display: block; width: 100%; height: auto }
.dl-chart:focus { outline: none }
.dl-chart:focus-visible { outline: 2px solid var(--link); outline-offset: 4px }
.dl-chart .layer-win { fill: var(--dl-win) }
.dl-chart .layer-mac { fill: var(--dl-mac) }
.dl-chart .axis { stroke: var(--border-strong); stroke-width: 1 }
.dl-chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4 }
.dl-chart text { fill: var(--muted); font: 400 11px var(--body); font-variant-numeric: tabular-nums }
.dl-chart .readout { pointer-events: none }
.dl-chart .guide { stroke: var(--fg); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6 }
.dl-chart .focus-dot { stroke: var(--surface); stroke-width: 2 }
.dl-chart .focus-win { fill: var(--dl-win) }
.dl-chart .focus-mac { fill: var(--dl-mac) }
.dl-tip {
    position: absolute; top: 8px; z-index: 1; display: grid; gap: 4px; max-width: calc(50% - 16px);
    padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface);
    color: var(--fg); font-size: .8125rem; font-variant-numeric: tabular-nums; line-height: 1.3; pointer-events: none;
    box-shadow: var(--shadow-menu)
}
.dl-tip[hidden] { display: none }
.dl-tip .tip-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px }
.dl-tip .tip-name { display: inline-flex; align-items: center; gap: 8px; color: var(--muted) }
.dl-tip .tip-value { font-weight: 600; white-space: nowrap }
.dl-tip .tip-total { padding-top: 4px; border-top: 1px solid var(--line) }
.dl-tip .tip-total .tip-name { color: var(--fg) }
.dl-chart-figure figcaption { margin-top: 8px; font-size: .8125rem; color: var(--muted); max-width: 46em }

/* The releases under the chart. */
.dl-details > summary { cursor: pointer; color: var(--link); font-weight: 600; min-height: 44px; display: flex; align-items: center }
.dl-table-wrap { overflow-x: auto; margin-top: 8px }
.dl-table { border-collapse: collapse; font-size: .875rem; font-variant-numeric: tabular-nums }
.dl-table th, .dl-table td { padding: 8px 16px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap }
.dl-table th:first-child, .dl-table td:first-child { text-align: left; padding-left: 0 }
.dl-table th { font-weight: 600 }
.dl-table td { color: var(--muted) }
.dl-table td:last-child { color: var(--fg); font-weight: 600 }

/* By file: a row per kind of file, with its share of all downloads as a bar. */
.dl-kinds { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 20px }
.dl-kinds li { display: grid; gap: 8px }
.dl-kinds p { margin: 0; font-size: .8125rem; color: var(--muted) }
.dl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px }
.dl-name { font-weight: 600 }
.dl-count { font-weight: 700; font-variant-numeric: tabular-nums }
.dl-bar { height: 8px; border-radius: 4px; background: var(--dl-track); overflow: hidden }
.dl-bar i { display: block; height: 100%; border-radius: 4px; background: var(--dl-win) }

/* By Archicad version: Windows and Mac side by side in one bar per version. */
.dl-versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px }
.dl-versions li { display: grid; grid-template-columns: 7em minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: .875rem }
.dl-versions .label { font-weight: 600 }
.dl-versions .bars { display: flex; height: 16px; gap: 2px }
.dl-versions .bars i { display: block; height: 100%; border-radius: 2px }
.dl-versions .bars .win { background: var(--dl-win) }
.dl-versions .bars .mac { background: var(--dl-mac) }
.dl-versions .count { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right }

@media (max-width: 640px) {
    .dl-card { padding: 16px }
    .dl-tip { padding: 8px; font-size: .75rem }
    .dl-versions li { grid-template-columns: 6em minmax(0, 1fr) auto; gap: 8px }
}
