/* LAYOUT */

html {
  width: 100%;
  color-scheme: light;
  --colour-text: #333;
  --colour-inactive: #919191;
  --colour-muted: #666;
  --colour-bg: #ffffff;
  --colour-rule: #f0f0f0;          /* metadata / shares rules */
  --colour-rule-strong: #e0e0e0;   /* table row border */
  --colour-blockquote-bg: #eee;
  --colour-code-bg: #333;          /* pre background */
  --colour-code-text: #ccc;
  --colour-row-hover: #f8f8f8;
  --article-width: 40rem;
  box-sizing: border-box;
}

/* DARK MODE
   Explicit override when the reader has chosen dark, plus an auto/no-JS block
   that follows the OS preference. Kept as two rules because "auto" must only be
   dark when the system is dark. */
html[data-theme="dark"] {
  color-scheme: dark;
  --colour-text: #d9d9d9;
  --colour-inactive: #7a7a7a;
  --colour-muted: #9a9a9a;
  --colour-bg: #16181c;
  --colour-rule: #2a2d33;
  --colour-rule-strong: #33373e;
  --colour-blockquote-bg: #22262c;
  --colour-code-bg: #0e0f12;
  --colour-code-text: #d0d0d0;
  --colour-row-hover: #1e2127;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]),
  html[data-theme="auto"] {
    color-scheme: dark;
    --colour-text: #d9d9d9;
    --colour-inactive: #7a7a7a;
    --colour-muted: #9a9a9a;
    --colour-bg: #16181c;
    --colour-rule: #2a2d33;
    --colour-rule-strong: #33373e;
    --colour-blockquote-bg: #22262c;
    --colour-code-bg: #0e0f12;
    --colour-code-text: #d0d0d0;
    --colour-row-hover: #1e2127;
  }
}

body {
  margin: 2rem auto;
  max-width: calc(100% - 4rem);
  margin: 2rem;
  color: var(--colour-text);
  background-color: var(--colour-bg);
  font-family: Georgia, Times, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.4rem;
}

a {
  color: var(--colour-text);
}

.content {
  margin-bottom: 2rem;
}

.small {
  font-size: 0.8rem;
  line-height: 1rem;
}

/* NAVIGATION */

.site-nav {
  /* font-size: 1.6rem; */
  line-height: 3.2rem;
  /* display: flex; */
}

.site-nav h1,
.site-nav h2 {
  font-size: 3rem;
  margin: 0;
  font-weight: normal;
}

.site-nav a.logo,
.site-nav li.active a {
  color: var(--colour-text);
}

.site-nav a {
  color: var(--colour-inactive);
  font-size: 3rem;
  text-decoration: none;
  display: block;
  padding: 0.1rem;
}

.site-nav a:hover {
  color: var(--colour-text);
}

.main-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-menu li {
  padding-right: 1rem;
}

/* LISTS */

.post-snippet {
  margin-bottom: 1rem;
}

.post-snippet h3 {
  margin-bottom: 0.25rem;
}


/* ARTICLE */
article {
  margin-top: 4rem;
}

article h2.entry-title {
  padding-top: 1rem;
  margin-left: 10rem;
  margin-bottom: 1.6rem;
  font-size: 2rem;
  line-height: 2rem;
}

article h2.entry-title a {
  text-decoration: none;
  font-weight: normal;
}

article div.metadata {
  position: absolute;
  margin-left: 0;
  height: 100%;
  margin-right: 2rem;
  width: 8rem;
  color: var(--colour-muted);
  border-top: 1rem solid var(--colour-rule);
  text-align: right;
  font-size: 0.8rem;
}

article div.entry-content {
  margin-left: 10rem;
  margin-bottom: 4rem;
}

article blockquote {
  background-color: var(--colour-blockquote-bg);
  border-left: 1rem solid var(--colour-inactive);
  padding-left: 1rem;
  font-style: italic;
}

article pre,
article blockquote {
  display: inline-block;
  max-width: 95%;
  margin: 0 2rem 0rem -1rem;
  padding: 1rem 2rem 0 1rem;
  border-radius: 1rem;
}

article blockquote,
article p,
article ul,
article img,
article video {
  max-width: var(--article-width);
}

article img,
article video {
  border-radius: 0.4rem;
}

article blockquote p {
  margin-top: 0;
  padding: 0;
}

article p.dateline {
  margin: 0;
}

article ul {
  padding-inline-start: 0;
}

article ul li {
  list-style: disc outside none;
}

article pre {
  overflow: auto;
  background-color: var(--colour-code-bg);
  color: var(--colour-code-text);
  padding-bottom: 1rem;
}

/* TABLES */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.4;
}

table th {
  text-align: left;
  font-weight: bold;
  padding: 0.5rem 0.75rem;
  border-bottom: 0.15rem solid var(--colour-text);
  color: var(--colour-text);
  white-space: nowrap;
}

table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 0.05rem solid var(--colour-rule-strong);
  vertical-align: top;
}

table tr:last-child td,
table tr.multiline td {
  border-bottom: none;
}

table tr:hover td {
  background-color: var(--colour-row-hover);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.6rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--colour-inactive);
  line-height: 0;
  opacity: 0.6;
}

.theme-toggle:hover {
  opacity: 1;
  color: var(--colour-text);
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

nav.pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

nav.pagination a {
  text-decoration: none;
}

nav.pagination a:hover span {
  text-decoration: underline;
}

nav.pagination div.older {
  text-align: right;
  justify-items: right;
}

div.shares {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
}

div.shares a {
  text-decoration: none;
}

div.shares h2 {
  font-size: 2rem;
  padding-bottom: 0.4rem;
  border-bottom: 0.4rem solid var(--colour-rule);
}

div.shares h3 {
  font-size: 1.4rem;
  line-height: 1.6rem;
  margin-bottom: 0;
}

div.shares p {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

div.shares p.meta,
div.shares p span {
  font-style: italic;
}

div.shares ol {
  padding: 0;
  text-decoration: none;
  font-size: 1em;
  outline: none;
  list-style: none;
}

div.shares li {
  margin-bottom: 3rem;
  list-style: none;
  color: var(--colour-muted);
}

@media screen and (max-width: 48rem) {

  .site-nav,
  .main-menu {
    flex-direction: column;
  }

  div.shares {
    grid-template-columns: 1fr;
  }

  .site-nav a {
    padding: 0.5rem;
    padding-left: 0;
  }

  article p {
    overflow-wrap: break-word;
    width: 100%;
  }

  article h2.entry-title {
    font-size: 1.4rem;
    margin-bottom: 0;
    margin-left: 0;
  }

  article div.metadata {
    position: unset;
    border-top: 0.4rem solid var(--colour-muted);
    width: var(--article-width);
    text-align: left;
  }

  article div.entry-content {
    margin-left: 0;
  }

  article blockquote,
  article p,
  article ul,
  article img,
  article video {
    max-width: 95%;
  }

}
