/* defaults: move them to default.css? reset.css? --------------------------- */

a {
  color: var(--color-accent);
  font-weight: 700;
  text-decoration: underline;
  /* Long URLs on smaller viewports are very likely to overflow the available
  width. And this is something I never want to happen. However, using break-all
  creates a break at the exact place where text would otherwise overflow its
  container, and this often does NOT split a word into correct syllables. So I
  think the lesser evil is to use break-all JUST when I actually need it. */
  word-break: normal;
}

a:focus {
  outline: 0.25rem dashed var(--color-accent);
}

a:hover {
  text-decoration-color: var(--color-text);
  text-decoration-thickness: 0.25rem;
}

/* https://blog.shahednasser.com/how-to-style-an-audio-element/ */
audio {
  width: 100%;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--scale-step-0);
  line-height: 1.5;
}

blockquote p {
  color: var(--color-accent);
  font-size: var(--scale-step-1);
  font-style: italic;
  line-height: 1.25;
}

figcaption {
  font-size: var(--scale-step--1);
  display: block;
  margin-top: 0.5em;
}

h1,
h2,
h3,
h4 {
  color: var(--color-heading);
  font-family: var(--font-headings);
  font-weight: 700;
  line-height: 1;
}

h1 {
  --flow-space: var(--scale-step-3);
  font-size: var(--scale-step-3);
}

h2 {
  --flow-space: var(--scale-step-2);
  font-size: var(--scale-step-2);
}

h3 {
  --flow-space: var(--scale-step-1);
  font-size: var(--scale-step-1);
}

footer,
header {
  background-color: var(--color-accent);
}

footer a,
header a {
  /* color: var(--color-text); */
  color: var(--color-background);
  font-family: var(--font-headings);
  text-decoration: none;
}

footer a:focus,
header a:focus {
  outline: 0.25rem dashed var(--color-background);
}

footer a:hover,
header a:hover {
  /* background-color: var(--color-background); */
  text-decoration-color: var(--color-text);
  text-decoration: underline;
  /* text-decoration-thickness: var(--scale-space-3xs); */
  text-decoration-thickness: 0.25rem;
}

footer small {
  color: var(--color-background);
  font-family: var(--font-headings);
  text-align: end;
}

footer .flow > * {
  --flow-space: var(--scale-space-3xs);
}

small {
  font-size: var(--scale-step--1);
}

strong {
  font-weight: 700;
}

video {
  max-width: 100%;
}

/* WebVTT */
/* https://caniuse.com/mdn-api_texttrack_cues */
/* https://developer.mozilla.org/en-US/docs/Web/CSS/::cue */
video::cue {
  font-size: var(--scale-step--1);
}

/* #back-to-top ------------------------------------------------------------- */
#back-to-top {
  position: fixed;
  opacity: 0.75;
  bottom: 3rem;
  right: 3rem;
  z-index: 999;
}

#back-to-top > svg {
  height: 3rem;
  width: 3rem;
  fill: currentColor;
}

@media screen and (min-width: 1024px) {
  #back-to-top {
    bottom: 4rem;
    right: 4rem;
  }

  #back-to-top > svg {
    height: 4rem;
    width: 4rem;
  }
}

/* .article-list ------------------------------------------------------------ */

.article-list {
  --flow-space: var(--scale-space-l);
}

.article-list h2 a {
  color: var(--color-headings);
  text-decoration: none;
}

.article-list h2:focus-within {
  outline: 0.25rem dashed var(--color-accent);
}

.article-list h2 a:focus {
  outline: none;
}

.article-list h2 a:hover {
  text-decoration: underline;
}

.article-list li {
  --flow-space: var(--scale-space-m);
  position: relative;
}

.article-list li > * {
  --flow-space: var(--scale-space-3xs);
}

/* .callout ----------------------------------------------------------------- */

.callout {
  background: var(--color-background-code);
  /* border: 0.5rem solid var(--color-accent); */
  border-radius: 0.5rem;
}

.callout__content {
  line-break: anywhere;
  padding: var(--scale-space-xs);
}

/* .card ------------------------------------------------------------------- */

.card-grid {
  --gutters-space: var(--scale-space-s);
  /* box-sizing: border-box; */

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(321px, 1fr));
  grid-template-rows: 1fr;
  grid-column-gap: var(--gutters-space);
  grid-row-gap: var(--gutters-space);
}

.card {
  --box-space: var(--scale-space-3xs);

  background: var(--color-background);
  border: 0.15rem solid var(--color-text);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.card-tags-wrapper {
  display: flex;
  flex-direction: column;
  flex: auto; /* equivalent to flex-grow: 1; flex-shrink: 1; flex-basis: auto */
  justify-content: flex-end;
}

/* .card-tags-wrapper > ul {
  background: var(--color-background-code);
} */

/* .forms ------------------------------------------------------------------- */

.contact-form,
.send-webmention-form {
  font-size: inherit;
}

.contact-form button,
.contact-form input,
.contact-form textarea,
.send-webmention-form button,
.send-webmention-form input {
  width: 100%;
}

.contact-form button,
.send-webmention-form button {
  background: var(--color-accent);
  color: var(--color-background);
  padding: var(--scale-space-xs);
}

.contact-form button:focus,
.send-webmention-form button:focus {
  outline: 0.25rem dashed var(--color-text);
}

.contact-form button:hover {
  text-transform: uppercase;
}

.contact-form button,
.contact-form label,
.send-webmention-form button,
.send-webmention-form label {
  font-family: var(--font-headings);
}

.contact-form input[name='name'],
.contact-form input[type='email'],
.contact-form textarea,
.send-webmention-form input[name='source'] {
  border: 0.15rem solid var(--color-text);
  font-size: inherit;
  outline: none;
  padding: var(--scale-space-xs);
}

.contact-form input[name='name']:focus,
.contact-form input[type='email']:focus,
.contact-form textarea:focus,
.send-webmention-form input[name='source']:focus {
  border-color: var(--color-text);
  outline: 0.25rem dashed var(--color-accent);
}

.contact-form button[type='submit'],
.send-webmention-form button[type='submit'] {
  text-transform: capitalize;
}

/* .gotcha (honeypot field for a form --------------------------------------- */
.gotcha {
  display: none !important;
}

/* .heading-anchor ---------------------------------------------------------- */

.heading-anchor {
  text-decoration-line: none;
}

.heading-anchor:hover {
  /* is this a good use case for revert? Or should I just use underline? */
  /* https://developer.mozilla.org/en-US/docs/Web/CSS/revert */
  text-decoration-color: var(--color-text);
  text-decoration-line: underline;
}

/* .pill -------------------------------------------------------------------- */

.pill {
  --background-color: var(--color-background);
  --border-color: var(--color-accent);

  border: 0.125rem solid var(--border-color);
  border-radius: 0.5rem;
  background: var(--background-color);
  color: var(--color-text);
  font-family: var(--font-headings);
  line-height: 1;
  padding: 0.25em;
  text-decoration: none;
}

.pill:focus,
.pill:hover {
  background: var(--border-color);
  color: var(--background-color);
}

.pill:focus {
  border-color: var(--color-text);
  outline: none;
}

/* .prose ------------------------------------------------------------------- */

.prose code {
  background: var(--color-background-code);
  font-family: var(--font-code);
  /* maybe use --scale-step--1 on small viewports and step-0 on large ones */
}

.prose hr {
  border: none;
  border-top: 1px solid currentColor;
}

.prose li + li {
  margin-top: 0.5em;
}

.prose ol > li {
  list-style: decimal;
  margin-left: 1.5em;
  padding-left: 0.25em;
}

.prose pre {
  max-width: 100%;
  overflow: auto;
  padding: var(--scale-space-s);
  width: 100%;
}

.prose pre code {
  background: transparent;
  display: block;
  /* maybe use --scale-step--1 on small viewports and step-0 on large ones */
  font-size: var(--scale-step--1);
}

.prose ul:not(.cluster) > li {
  list-style: disc;
  margin-left: 1.25em;
  padding-left: 0.25em;
}

/* .prose overrides (keep these to a minimum!) ------------------------------ */
.prose .cluster li + li {
  margin-top: var(--cluster-spacing);
}

#toc {
  font-family: var(--font-headings);
}

#toc summary {
  cursor: pointer;
  font-weight: 700;
}

#toc ol > li {
  list-style: none;
  padding-left: 0;
}

/* .table-container --------------------------------------------------------- */
.table-container {
  position: relative;
}

.table-container > .table-scroll {
  overflow: auto;
}

.table-container table {
  /* table-layout: fixed; */
  margin: 0;
  padding: 0;
  width: 100%;
  /* border: 0.5rem solid magenta; */
  border-collapse: collapse;
  /* overflow: auto; */
}

.table-container caption {
  background-color: var(--color-accent);
  color: var(--color-white);
  font-weight: 700;
}

/* .table-container thead tr {
  overflow: auto;
  width: 100%;
} */

.table-container thead th {
  background-color: var(--color-bone);
  padding: 0 0.5em;
  text-align: center;
  /* text-transform: capitalize; */
}

/* .table-container tr > th + th {
  margin-left: 1em;
} */

.table-container tbody td {
  /* background-color: lightgreen; */
  text-align: center;
  padding: 0 1em;
}

/* #wrapper-for-sticky-footer ----------------------------------------------- */
#wrapper-for-sticky-footer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#wrapper-for-sticky-footer > main {
  flex: auto;
}

/* scrollbar ---------------------------------------------------------------- */

/* Works on Firefox */
* {
  scrollbar-color: var(--color-accent) var(--color-text);
  scrollbar-width: auto;
}

/* Works on Chrome, Edge, and Safari */
::-webkit-scrollbar {
  width: 1rem;
}

::-webkit-scrollbar-track {
  background: var(--color-text);
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-accent);
  border: 0.2rem solid var(--color-text);
  border-radius: 0.5rem;
  min-height: 4rem;
}
