/* Define color scheme variables */
:root {
  --background-color: #ffffff;
  --text-color: #333333;
  --heading-color: #1a1a1a;
  --link-color: #0066cc;
  --link-hover-color: #004499;
}

/* Dark mode color scheme */
@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #1a1a1a;
    --text-color: #e0e0e0;
    --heading-color: #ffffff;
    --link-color: #6699ff;
    --link-hover-color: #99ccff;
  }
}

/* Base styles */
* {
  transition: all 0.3s ease-in-out;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  line-height: 1.5;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container for main content */
body > main, body > header {
  max-width: 1200px;
  margin: 0;
  flex: 1;
  display: flex;
  flex-flow: column wrap;
}

body.settings > header, body.wtf > header {
  flex: 0;
}

body.settings > main { 
  gap: 2rem;
}

body > main {
  padding: 0 1rem 2em;
}

body > header {
  padding: 1rem;
}

/* Typography */
h1, h2, h3 {
  color: var(--heading-color);
  margin: 0;
}

h1 {
  font-size: 3rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.75rem;
}

p {
  font-size: 1rem;
   margin: 0;
  padding: 1rem 0;
}

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

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

button {
  background-color: unset;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0 0.25rem;
}

nav > a, nav > button {
  padding: 0 0.25rem;
}

footer {
  font-size: small;
  padding: 1em 1em 2em 1em;
  display: flex;
  justify-content: center;
}

div#header {
  flex-flow: row nowrap;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
}

article#sponsored {
  margin: 1rem;
  padding-left: 1rem;
}

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

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

article {
  margin: 0.5rem 1rem 1rem;
  opacity: 0;
  animation: fadeIn 0.3s ease-in-out forwards;
  display: flex;
  flex-flow: column nowrap;
}

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

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

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

header > small > a:hover {
  color: var(--link-hover-color);
} 

iframe, audio, video {
  width: 530px;
}

iframe {
  height: 310px;
  border: none;
  border-radius: 0.5rem;
}

img {
  max-width: 30rem;
}

article p {
  max-width: 40rem;
  text-align: left;
  font-size: small;
}

small.pin {
  margin-right: 0.5rem;
}

span#check {
  animation: fadeIn 0.3s ease-in-out forwards;
}

div#loader {
  font-size: 2.5rem;
  flex: 1;
  display: flex;
  align-content: center;
  flex-flow: row wrap;
  justify-content: center;
}

div#error {
  font-size: 2.5rem;
  flex: 1;
  display: flex;
  flex-flow: column wrap;
  justify-content: center;
  align-items: center;
}

div#error > p {
  padding: 0;
}

div#subheader {
  display: flex;
  flex-flow: row wrap;
  padding: 1rem 2rem;
  gap: 4rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

dialog {
  background-color: inherit;
  color: inherit;
  border-radius: 1rem;
  max-width: min-content;
  padding: 1rem 2.5rem;
  animation: fadeIn 0.3s ease-in-out forwards;
}
dialog.closing {
  animation: fadeOut 0.3s ease-in-out forwards;
}
dialog::backdrop {
  backdrop-filter: blur(0.5rem);
  opacity: 0;
}

dialog[open]::backdrop {
  animation: fadeIn 0.3s ease-in-out forwards;
}

dialog.closing::backdrop {
  animation: fadeOut 0.3s ease-in-out forwards;
}

dialog > form {
  display: flex;
  flex-direction: column;
}

dialog > h3 {
  min-width: max-content;
  margin: 0 12rem 0 0;
}

dialog > form label {
  font-size: smaller;
}

dialog > form select, input {
  margin-bottom: 1rem;
  padding: 0.25rem;
  border-radius: 0.25rem;
  border: 1px solid var(--heading-color);
}

dialog > ul {
  list-style: none;
  padding-inline-start: 0;
}

.button-group {
  display: flex;
  justify-content: end;
  margin-top: 2rem;
  gap: 1rem;
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  div#header {
    justify-content: center;
  }
  div#subheader {
    gap: 1rem;
    justify-content: center;
  }
  iframe, audio, video {
    width: auto;
  }
  iframe {
    min-height: 16rem;
  }
  img {
    max-width: 98%;
  }
  a, button {
    color: var(--link-color);
    text-decoration: underline;
  }
  article a {
    color: var(--text-color);
    text-decoration: underline;
  }
}