/* Style of both pages. System fonts only; nothing is loaded from anywhere. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1d1d1f;
  --muted: #5b5f66;
  --panel: #f5f5f7;
  --border: #d6d6dc;
  --accent: #8c1515;
  --accent-fg: #ffffff;
  --link: #0b5cad;
  --chip-bg: #ffffff;
  --chip-on-bg: #8c1515;
  --chip-on-fg: #ffffff;
  --badge-bg: #ececf0;
  --pick: #8a5300;
  --pick-bg: #fff1d6;
  --bad: #b3261e;
  --bad-bg: #fde7e6;
  --good: #1e6b34;
  --good-bg: #e3f4e7;
  --warn: #7a5a00;
  --warn-bg: #fdf3cf;
  --focus: #0b5cad;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417;
    --fg: #e8e8eb;
    --muted: #a3a7af;
    --panel: #1d1f23;
    --border: #3a3d44;
    --accent: #e57373;
    --accent-fg: #131417;
    --link: #8ab4f8;
    --chip-bg: #1d1f23;
    --chip-on-bg: #e57373;
    --chip-on-fg: #131417;
    --badge-bg: #2a2d33;
    --pick: #ffcc80;
    --pick-bg: #3d2e12;
    --bad: #f28b82;
    --bad-bg: #3c1f1d;
    --good: #81c995;
    --good-bg: #1b3323;
    --warn: #fdd663;
    --warn-bg: #3a3215;
    --focus: #8ab4f8;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

a {
  color: var(--link);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  font-size: 1.6rem;
  margin: 0.5rem 0 0.25rem;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* header */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
}

.site-name {
  margin: 0;
  font-weight: 700;
  color: var(--accent);
}

.lang-switch {
  display: flex;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lang-switch .lang {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  padding: 0.25rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.lang-switch .lang + .lang {
  border-left: 1px solid var(--border);
}

.lang-switch .lang[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.page-nav a {
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.page-nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  padding-top: 1rem;
  padding-bottom: 2rem;
}

@media (min-width: 60rem) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 20rem;
  }

  .subscribe {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

.tagline,
.meta {
  margin: 0.25rem 0;
  color: var(--muted);
}

.meta {
  font-size: 0.9rem;
}

.meta span {
  display: block;
}

/* filters */

.filters {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  display: grid;
  gap: 0.75rem;
}

.filter {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.filter legend,
.filter label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  padding: 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.25rem;
}

.filter-row .filter {
  min-width: 0;
  max-width: 100%;
}

input[type="search"],
select {
  width: 100%;
  max-width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
}

.filter-row select {
  width: auto;
  min-width: 10rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.4rem;
}

.toggle label {
  display: inline;
  margin: 0;
}

.toggle input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
}

button {
  font: inherit;
  color: var(--fg);
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

/* A button that is unavailable but keeps the focus (the buttons of the selection bar):
   muted text and a dashed border instead of opacity, which would dim the focus ring. */
button[aria-disabled="true"] {
  cursor: default;
  border-style: dashed;
  color: var(--muted);
}

button.primary[aria-disabled="true"] {
  background: var(--panel);
  border-color: var(--border);
}

/* Forced colours (Windows High Contrast) replace the muted colours; the system colour of
   unavailable controls marks these buttons, as it marks disabled ones. */
@media (forced-colors: active) {
  button[aria-disabled="true"],
  button.primary[aria-disabled="true"] {
    color: GrayText;
    border-color: GrayText;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
}

.chip[aria-pressed="true"] {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
  color: var(--chip-on-fg);
  font-weight: 600;
}

/* list */

.count {
  margin: 0.5rem 0;
  color: var(--muted);
}

/* selection of talks to download */

.selection {
  display: grid;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.selection p {
  margin: 0;
}

.selection-status {
  font-weight: 600;
}

.selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.selection-note:empty {
  display: none;
}

.note {
  padding: 0.4rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
}

.note-saved {
  color: var(--good);
  background: var(--good-bg);
}

.note-partial {
  color: var(--warn);
  background: var(--warn-bg);
}

.note-failed {
  color: var(--bad);
  background: var(--bad-bg);
  border-color: var(--bad);
}

.selection-copy {
  color: var(--muted);
  font-size: 0.85rem;
}

/* The status and the Download button of the selection, at the bottom of the screen
   within the list while talks are selected and the bar is scrolled away (app.js adds
   is-shown). At the end of the list it rests below the last talk. It takes no room until
   the first talk is selected (app.js adds has-selected, which stays); hidden after that,
   it keeps its place, so the page keeps its height and an untick at the end of the list
   moves nothing. */
.selection-dock {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 -0.25rem 0.75rem rgb(0 0 0 / 15%);
}

.selection-dock:not(.is-shown) {
  visibility: hidden;
}

.selection-dock:not(.has-selected) {
  display: none;
}

/* Paper has no use for the dock, and Chromium prints a shown one where it stuck on the
   screen, over a talk of the list. */
@media print {
  .selection-dock {
    display: none;
  }
}

/* While the dock is shown, a control of the list column scrolled into view (a checkbox
   reached with Tab) stops above it: app.js sets --dock-space to the height of the dock,
   0 while it is hidden. The controls of the dock itself and of the subscription panel,
   which the dock never covers, scroll into view as usual. */
.talks :is(a[href], button, input, select, summary):not(.selection-dock *) {
  scroll-margin-bottom: var(--dock-space, 0px);
}

/* One line, also while it is empty: the dock keeps its height. */
.selection-dock-count {
  min-height: 1.5em;
  min-height: 1lh;
  margin: 0;
  font-weight: 600;
}

/* The note on a download that is being prepared, left talks out or failed, on a line of
   its own above the count and the button: the note of the bar is off screen. A dock held
   at the bottom of the screen grows upward with it, over the list, so the button stays
   where it was pressed (app.js sees to that for a dock that rests below the last talk). */
.selection-dock-note {
  width: 100%;
}

.selection-dock-note:empty {
  display: none;
}

.selection-dock-note .note {
  margin: 0;
}

.notice {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.notice[role="alert"] {
  color: var(--bad);
  border-color: var(--bad);
  background: var(--bad-bg);
}

.day {
  margin-top: 1.5rem;
}

.day-heading {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.event {
  display: grid;
  grid-template-columns: auto 11rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

/* The checkbox sits on the first line of the talk; the label around it widens the area
   that toggles it. */
.event-select {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  cursor: pointer;
}

.select-talk {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.event:last-child {
  border-bottom: 0;
}

.event-when {
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

.event-main {
  min-width: 0;
}

.event-title {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}

.event-title a {
  text-decoration: none;
}

.event-title a:hover {
  text-decoration: underline;
}

.is-cancelled .event-title {
  text-decoration: line-through;
  color: var(--muted);
}

.event-until {
  margin: 0 0 0.25rem;
  color: var(--muted);
}

.badges,
.speakers,
.reasons ul,
.summary,
.feeds,
.steps {
  margin: 0;
  padding: 0;
}

.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.25rem 0;
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--fg);
}

.badge-pick {
  background: var(--pick-bg);
  color: var(--pick);
  font-weight: 600;
}

.badge-cancelled {
  background: var(--bad-bg);
  color: var(--bad);
  font-weight: 600;
}

.badge-tentative {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-online {
  background: var(--good-bg);
  color: var(--good);
}

.speakers {
  list-style: none;
  margin: 0.25rem 0;
}

.speaker-name {
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.1rem 0.75rem;
  margin: 0.25rem 0;
  font-size: 0.95rem;
}

/* Labels in the first column and values in the second, also when a label has several
   values: auto-placement alone would put a second value into the column of the labels. */
.facts dt {
  grid-column: 1;
  color: var(--muted);
}

.facts dd {
  grid-column: 2;
  margin: 0;
  min-width: 0;
}

.stream {
  margin: 0.25rem 0;
}

.abstract {
  margin: 0.25rem 0;
}

.abstract summary {
  cursor: pointer;
  color: var(--link);
}

.abstract p {
  margin: 0.4rem 0 0;
  white-space: pre-line;
}

.reasons {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
}

.reasons-label {
  margin: 0;
  color: var(--pick);
  font-weight: 600;
}

.reasons ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.reasons li {
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* subscription panel */

.subscribe {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 0;
}

.subscribe h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.subscribe h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}

.steps {
  padding-left: 1.25rem;
}

.steps li + li {
  margin-top: 0.25rem;
}

.feeds {
  list-style: none;
}

.feed {
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
}

.feed-name {
  margin: 0;
  font-weight: 600;
}

.feed-description {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.feed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-top: 0.3rem;
  font-size: 0.85rem;
}

.feed-kind {
  flex: 0 0 100%;
  color: var(--muted);
}

.feed-address {
  flex: 1 1 12rem;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.copy {
  padding: 0.1rem 0.6rem;
  font-size: 0.85rem;
}

.copy-note {
  color: var(--good);
}

/* status page */

.status-page {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

.summary {
  list-style: none;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.summary li + li {
  margin-top: 0.25rem;
}

.run-ok {
  color: var(--good);
}

.run-failed {
  color: var(--bad);
}

.sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
}

.source {
  padding: 1rem;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
  min-width: 0;
}

.source.state-ok {
  border-left-color: var(--good);
}

.source.state-failed {
  border-left-color: var(--bad);
}

.source.state-empty {
  border-left-color: var(--warn);
}

.source-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
}

.source-name {
  font-size: 1.05rem;
  margin: 0;
  min-width: 0;
}

.badge-state {
  margin: 0;
}

.badge-state.state-ok {
  background: var(--good-bg);
  color: var(--good);
}

.badge-state.state-failed {
  background: var(--bad-bg);
  color: var(--bad);
  font-weight: 600;
}

.badge-state.state-empty {
  background: var(--warn-bg);
  color: var(--warn);
}

.source code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

/* footer */

.site-footer {
  padding-top: 1rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

/* phones */

@media (max-width: 40rem) {
  .event {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.75rem;
  }

  .event-select {
    grid-row: span 2;
  }

  /* The hint and the count of the selection wrap differently on a narrow screen; two
     lines for either keep the list below the bar in place when a talk is ticked. */
  .selection-status {
    min-height: 3em;
    min-height: 2lh;
  }

  /* The count above the button, whatever its length, so the dock keeps its height. */
  .selection-dock {
    flex-direction: column;
    align-items: flex-start;
  }

  .event-when,
  .event-main {
    grid-column: 2;
  }

  .filter-row select {
    width: 100%;
    min-width: 0;
  }

  .filter-row .filter:not(.toggle) {
    flex: 1 1 100%;
  }
}
