* { box-sizing: border-box }

:root {
  --bg: #fff;
  --text: #222;
  --link: #3377BB;
  --link-hover: #225577;
  --red: #74120F;
  --border: rgba(36,51,64, 0.5);
  --muted: rgba(36,51,64, 0.6);
  --topbar-bg: rgba(255,255,255, 0.92);
  --topbar-border: rgba(36,51,64, 0.15);
  --topbar-hover: rgba(36,51,64, 0.06);
  --img-filter: none;
}

[data-theme="dark"] {
  --bg: #16191c;
  --text: #dcdedf;
  --link: #6fb1ea;
  --link-hover: #97cbf5;
  --red: #e2726c;
  --border: rgba(255,255,255, 0.25);
  --muted: rgba(255,255,255, 0.6);
  --topbar-bg: rgba(22,25,28, 0.92);
  --topbar-border: rgba(255,255,255, 0.12);
  --topbar-hover: rgba(255,255,255, 0.08);
  --img-filter: brightness(.88) contrast(1.05);
}

html {
  scroll-padding-top: 4rem;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    'Helvetica Neue',
    Helvetica,
    sans-serif;
  line-height: 1.5;
  margin: 0;
  padding-top: 52px;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color .15s ease, color .15s ease;
}

img { filter: var(--img-filter); }

.medium { font-weight: 500 }
strong { font-weight: 600 }

.white { color: #fff }
.red  { color: var(--red) }
.muted { color: var(--muted) }
.center { text-align: center }

.bd { border: 3px solid }
.bt { border-top: 3px solid }
.br { border-right: 3px solid }
.bb { border-bottom: 3px solid }
.bl { border-left: 3px solid }

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.codelike {
  font-family: monospace;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

table.table-light {
  margin-left: -10px;
  margin-right: -10px;
}

th {
  text-align: left;
  font-weight: bold;
}

th,
td {
  padding: 8px 10px 10px;
  line-height: inherit;
}

th { vertical-align: bottom }
td { vertical-align: top }

.table-light th,
.table-light td {
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: var(--border);
}

.table-light tr:last-child td {
  border-bottom: 0;
}

@media (min-width: 52em) {
  .md-p4  { padding: 4rem !important }
  .md-py4 { padding-top: 4rem !important; padding-bottom: 4rem !important; }
}

@media (max-width: 52em) {
  #tldr-table thead {
    display: none !important;
  }
  #tldr-table td {
    display: block;
    border-bottom: 0;
    padding: 4px 10px 6px;
  }
  #tldr-table td:nth-of-type(3):before { content: "Найкраща книга: "; }
  #tldr-table td:nth-of-type(4):before { content: "Найкращі відео: "; }

  #tldr-table td:last-child {
    padding-bottom: 2em;
  }
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 52px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar-inner {
  max-width: 64rem;
  height: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: 32px;
  padding: 0 .65rem;
  border: 1px solid var(--topbar-border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: .8rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}

.topbar-btn:hover {
  background: var(--topbar-hover);
  color: var(--text);
  text-decoration: none;
}

.topbar-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.topbar-btn .icon-sun { display: none; }
[data-theme="dark"] .topbar-btn .icon-sun { display: inline-flex; }
[data-theme="dark"] .topbar-btn .icon-moon { display: none; }

@media (max-width: 52em) {
  .topbar-collapsible span {
    display: none;
  }
  .topbar-collapsible {
    padding: 0;
    width: 32px;
    justify-content: center;
  }
}
