@import url('https://fonts.googleapis.com/css2?family=Amarante&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

/*
Breakpoints:
min-width: 42rem - tablet/desktop
min-width: 51.25rem - wider than content
*/

:root {
  --color-background: #111a1a;
  --color-background-highlight: #282b2b;
  --color-ghost-10: #f0f0f0;
  --color-ghost-80: #808080;
  --color-secondary-10: #ea1265;
  --color-primary-10: #19cbda;
  --color-primary-50: #0e8a94;
  --color-primary-75: #076c74;
  --color-primary-100: #004e54;
  --color-message: #e6cf3e;
  --color-text-muted: #d4d6d6;
  --color-text: #fcfcfc;

  --font-body: "DM Sans", sans-serif;
  --font-accent: "Amarante", serif;

  --font-size-40: 1.25rem;
  --font-size-60: 1.875rem;
  --font-size-80: 2.35rem;
  --font-size-100: 3rem;
  --font-size-base: 16px;
  --font-size-copy: 1.1rem;
  --font-size-logo: 1.5em;
  --font-size-small: 0.875rem;

  --font-weight-bold: 800;

  --line-height-body: 1.7;

  --transition: 150ms;
  --transition-med: 300ms;
  --transition-slow: 600ms;

  --border-radius: 0.25rem;
  --content-padding: 1.25rem;
  --margin-p: 1.25rem;
}

@media (min-width: 42rem) {
  :root {
    --font-size-base: 18px;
    --content-padding: 1.5rem;
  }
}

/* Layout */

html {
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  text-wrap: pretty;
}

body {
  background-color: var(--color-background);
  background-image: url('/img/bg.jpg');
  margin: 0;
  padding: 0;
  position: relative;
}

body::after {
  background-size: 100%;
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: -1;
}

body > div[role="alert"],
body > main,
body > header,
body > footer {
  margin: auto;
  max-width: 42rem;
  padding: 0 var(--content-padding);
}

body > header {
  padding-top: 2rem;
  text-align: center;
}

body > footer {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  padding-bottom: 3rem;
  margin-top: 3rem;
}

@media (min-width: 42rem) {
  body > footer {
    flex-direction: row;
  }
}

[data-no-scroll] {
  overflow: hidden;
}

/* Spacing */

.mt1 {
  margin-top: 1rem;
}

/* Messages */

[role="alert"] ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  text-align: left;
}

[role="alert"] ul li {
  background: var(--color-message);
  border-radius: var(--border-radius);
  color: var(--color-background);
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-small);
}

/* Logo */

.logo {
  align-items: center;
  display: inline-flex;
  font-family: var(--font-accent);
  font-size: var(--font-size-logo);
  height: 6rem;
  justify-content: center;
  line-height: 1;
  position: relative;
  text-shadow:
    -2px -2px 10px var(--color-background),
    2px -2px 10px var(--color-background),
    -2px 2px 10px var(--color-background),
    2px 2px 10px var(--color-background);
}

.logo,
.logo:visited,
.logo:active {
  color: var(--color-primary-10);
  text-decoration: none;
}

.logo:hover {
  color: var(--color-ghost-10);
  text-decoration: none;
}

.logo svg {
  fill: var(--color-primary-10);
  height: 100%;
  position: absolute;
  transition: fill var(--transition) ease-in-out;
  width: 100%;
  z-index: -1;
}

.logo:hover svg {
  fill: var(--color-ghost-10);
}

/* Sections */

section {
  margin: 4rem 0;
}

@media (min-width: 42rem) {

  section {
    margin: 3rem 0;
  }

}

/* Lists */

ul, ol {
  margin: var(--margin-p) 0;
  padding-left: 2.25rem;
}

article header ol,
footer ul {
  display: flex;
  font-size: var(--font-size-small);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

article header ol li:not(:last-child)::after,
footer ul li:not(:last-child)::after {
  content: '/';
  padding: 0.5rem;
}

footer ul li:not(:last-child)::after {
  content: '|';
}

ul ul {
  margin: 1rem 0;
}

/* Detail lists */

dl {
  font-size: var(--font-size-small);
  display: grid;
  grid-template-columns: 60px 1fr;
  margin: 0;
}

dl dt,
dl dd {
    margin: 0.125rem 0;
}

dl dd {
    margin-left: 2rem;
}

/* Images */

img {
  box-sizing: content-box;
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

img + img {
  margin-top: 1rem;
}

img + em {
  margin: 0.5rem 0 2rem 0;
  display: block;
  text-align: center;
}

/* Code */

pre,
code {
  background-color: var(--color-primary-100);
  border-radius: var(--border-radius);
  font-family: monospace;
  padding: 0.5rem 1rem;
  overflow-x: scroll;
}

pre code {
    padding: 0;
}

/* Focus */

*:focus {
  outline: 2px solid var(--color-ghost-10);
  outline-offset: 0.25rem;
  border-radius: 2px;
}

/* Links */

a,
a:visited,
a:active {
  color: var(--color-primary-10);
  text-decoration: underline;
  transition: color var(--transition) ease-in-out;
}

a:hover,
a:focus {
  color: var(--color-ghost-10);
}

a[target="_blank"]::after {
  margin-left: 0.25rem;
  content: url('/img/icon/new-tab.png') / "(opens in new tab)";
}

/* Typography */

p {
  font-size: var(--font-size-copy);
  margin: var(--margin-p) 0;
}

strong {
  color: var(--color-primary-10);
  font-weight: var(--font-weight-bold);
}

h1, h2, h3 {
  font-family: var(--font-accent);
  line-height: 1.3;
  margin: 2rem 0;
}

h1, h2 {
  color: var(--color-primary-10);
}

h2, h3 {
  text-wrap: pretty;
}

h1 {
  font-size: var(--font-size-100);
  text-align: center;
  text-wrap: balance;
}

h2 {
  margin: 3rem 0 1rem 0;
  font-size: var(--font-size-80);
}

h3 {
  margin: 2.5rem 0 1rem 0;
  font-size: var(--font-size-60);
}

hr {
  border: 0;
  border-top: 1px solid var(--color-primary-10);
  margin: 0;
}

ol p,
blockquote p {
  text-align: left;
}

blockquote {
  border-left: 3px solid var(--color-primary-10);
  color: var(--color-text-muted);
  margin:  0 2rem;
  padding: 0 1rem;
}

.center {
  text-align: center;
}

/* Tables */

.table-box {
  width: 100%;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  margin: 1.75rem 0;
  width: 100%;
}

table th,
table td {
  text-align: left;
  padding: 0.5rem 1rem;
}

table th {
  background-color: var(--color-primary-100);
}

table thead th {
  padding-bottom: 0.33rem;
  padding-top: 0.33rem;
}

tbody tr:nth-child(even) {
  background-color: var(--color-background-highlight);
}

/* Buttons */

button,
a.button,
.home article p:last-of-type a:last-of-type,
.home article li:last-of-type a:last-of-type {
  background: var(--color-primary-50);
  border-radius: var(--border-radius);
  border: 0;
  box-sizing: border-box;
  color: #fff;
  cursor: pointer;
  display: block;
  font-size: var(--font-size-base);
  padding: 0.6rem 1rem;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition);
  width: 100%;
}

button:hover,
a.button:hover {
  background: var(--color-primary-75);
}

button:focus,
a.button:focus {
  outline: 2px solid var(--color-ghost-10);
  outline-offset: 4px;
}

button[disabled] {
  opacity: 0.5;
  cursor: default;
}

button[data-size="small"] {
  padding-bottom: 0.5rem;
  padding-top: 0.5rem;
  width: auto;
}

@media (min-width: 42rem) {
  form button {
    width: auto;
    min-width: 10rem;
  }
}

/* Forms */

form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--margin-p);
}

form div {
  width: 100%;
}

form label {
  font-size: var(--font-size-small);
  display: block;
}

input,
textarea {
  background-color: var(--color-background);
  border-radius: 0;
  border: 1px solid var(--color-ghost-80);
  box-sizing: border-box;
  color: var(--color-text);
  display: block;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  transition: border var(--transition-slow), box-shadow var(--transition-slow);
  width: 100%;
}

input:hover,
textarea:hover {
  border-color: var(--color-primary-10);
}

input:focus,
textarea:focus {
  border-color: var(--color-primary-10);
  box-shadow: 0 0 0.25rem 1px var(--color-primary-10);
  outline: 0;
}

.honeypot {
  position: absolute;
  left: -5000px;
}

/* Screen Reader Only */

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

/* Scrollbars */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-50) var(--color-background);
}

/* Articles */

article {
  margin: 2rem 0;
}

article header {
  position: relative;
}

article header .attribution {
  display: flex;
  flex-direction: column;
  margin: 2rem 0 2.65rem 0;
  text-align: center;
}

article header div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 42rem) {
  article header div {
    flex-direction: row;
    justify-content: space-between;
  }
}

article header time {
  font-size: var(--font-size-small);
  white-space: nowrap;
}

article footer {
  margin: 3rem 0;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

article aside {
  border: 1px solid var(--color-ghost-80);
}

article aside p {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
  margin: 0.75rem 1rem;
}

article > ul li,
article > ol li {
  margin: 0.25rem 0;
}

article > ul:has(li > img) {
  display: grid;
  list-style: none;
  padding: 0;
  gap: 1rem;
  grid-template-columns: auto auto;
}

article > ul:has(li > img) li {
  margin: 0;
}

/* Article Alerts */

article .alert {
  border: 1px solid var(--color-primary-10);
  margin: var(--margin-p) 0;
  padding: 0.5rem;
  text-align: center;
}

@media (min-width: 42rem) {
  article .alert {
    padding: 1rem;
  }
}

/* Article TOC */

article.toc > ul:first-of-type::before {
  border-bottom: 1px solid var(--color-ghost-80);
  content: 'Table of Contents';
  display: block;
  font-family: var(--font-accent);
  font-size: var(--font-size-60);
  margin-bottom: 0.5rem;
  margin-left: -2.25rem;
  padding-bottom: 0.5rem;
}

article.toc > ul:first-of-type li {
  margin: 0;
}

/* Article Rating */

figure[data-rating] {
  margin: var(--margin-p);
  text-align: center;
}

figure[data-rating] figcaption::before {
  content: 'Rating';
  display: block;
  font-size: var(--font-size-small);
  font-family: var(--font-body);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
}

figure[data-rating] figcaption {
  font-family: var(--font-accent);
  font-size: var(--font-size-60);
  line-height: 1;
  margin: 0;
}

figure[data-rating]::after {
  --rating-icon-size: 4rem;
  background-repeat: repeat-x;
  background-size: var(--rating-icon-size) var(--rating-icon-size);
  content: '';
  display: block;
  height: var(--rating-icon-size);
  margin: auto;
}

figure[data-rating][data-icon="brain"]::after {
  background-image: url('/img/brain.png');
}

figure[data-rating="1"]::after { width: var(--rating-icon-size); }
figure[data-rating="2"]::after { width: calc(var(--rating-icon-size) * 2); }
figure[data-rating="2.5"]::after { width: calc(var(--rating-icon-size) * 2.5); }
figure[data-rating="3"]::after { width: calc(var(--rating-icon-size) * 3); }
figure[data-rating="4"]::after { width: calc(var(--rating-icon-size) * 4); }
figure[data-rating="5"]::after { width: calc(var(--rating-icon-size) * 5); }

/* Article Comments */

[role="comment"] {
  display: flex;
  align-items: start;
  margin: 3rem 0;
}

[role="comment"] img {
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 1.5rem;
  width: 3.5rem;
}

[role="comment"] div {
  flex-grow: 1;
}

[role="comment"] strong {
  display: block;
  font-size: var(--font-size-copy);
}

[role="comment"] time {
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 0.5rem;
  font-size: var(--font-size-small);
}

/* Cards */

.cards aside {
  border: 0;
  flex-shrink: 0;
}

.cards h2 {
  margin: 1rem 0 0 0;
  text-align: center;
}

.cards h2 + p:has(em:only-child) {
  margin: 0;
  text-align: center;
}

@media (min-width: 42rem) {

  .cards section {
    display: flex;
  }

  .cards aside {
    max-width: 12rem;
  }

  .cards h2 {
    margin: 0;
  }

  .cards aside {
    margin-right: 1.5rem;
  }

  .cards h2,
  .cards h2 + p:has(em:only-child) {
    text-align: left;
  }

}

/* Lightbox */

.lightbox-trigger,
.lightbox-trigger:hover {
  background: none;
  padding: 0;
}

.lightbox {
  align-items: center;
  background-color: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  inset: 0;
  justify-content: space-between;
  margin: 0;
  padding-bottom: 1rem;
  padding-top: 1rem;
  position: fixed;
}

.lightbox > div {
  display: flex;
  min-height: 0;
}

.lightbox img {
  cursor: pointer;
  object-fit: contain;
}

.lightbox header,
.lightbox footer {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  padding: 0 1rem;
  width: 100%;
  gap: 1rem;
}

.lightbox header {
  align-items: start;
}

.lightbox header p {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox footer {
  justify-content: center;
}

.lightbox footer button {
  min-width: 6rem;
}

@media (min-width: 42rem) {
  .lightbox {
    padding: 1rem;
  }

  .lightbox header {
    padding: 0 0 0 0.25rem;
  }
}

/* Pages */

/* Home & Tag Page Article Lists */

ul.articles {
  list-style: none;
  padding: 0;
}

ul.articles > li {
  margin-bottom: 4rem;
}

ul.articles > li h1 {
  display: block;
  font-family: var(--font-accent);
  font-size: var(--font-size-60);
  margin: 2rem 0 0.5rem 0;
}

ul.articles > li time {
  text-align: center;
  display: block;
  font-size: var(--font-size-small);
}

ul.articles article p:last-of-type a:last-of-type,
ul.articles article li:last-of-type a:last-of-type {
  background: var(--color-primary-100);
  display: inline;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  width: auto;
}

ul.articles article p:last-of-type a:last-of-type:hover,
ul.articles article li:last-of-type a:last-of-type:hover {
  background: var(--color-primary-75);
}

/* Tag Grids */

ul.tags {
  display: grid;
  gap: var(--margin-p);
  grid-template-columns: auto;
  list-style: none;
  margin: 2rem 0 4rem 0;
  padding: 0;
}

ul.tags li {
  margin: 0;
  width: 100%;
}

ul.tags li a {
  align-items: center;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-primary-10);
  display: flex;
  gap: 1rem;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
  padding: 1.5rem 1rem;
  text-align: center;
  text-decoration: none;
  transition: color var(--transition) ease-in-out, border-color var(--transition) ease-in-out;
}

ul.tags li a span:first-child {
  font-size: var(--font-size-60);
}

ul.tags li a:hover,
ul.tags li a:focus {
  border-color: var(--color-ghost-10);
  outline-offset: 0;
}

@media (min-width: 42rem) {
  ul.tags {
    grid-template-columns: repeat(3, 1fr);
  }
}
