/* --- CSS Variables ---*/

:root {
  /* Font */
  --font-family: 'Rubik', system-ui, sans-serif;
  --font-monospace: monospace;

  /* Layout */
  /* --header-position: static; */
  /* --header-height: auto; */

  /* Option: Fixed header */
  /* --header-position: fixed; */
  /* --header-height: 50px; */

  /* Option: Full width */
  --layout-max-width: 100%;
  --header-max-width: 100%;
  /* --main-max-width: 100%; */
  /* --footer-max-width: 100%; */

  /* Option: Max width */
  /* --layout-max-width: 960px; */
  /* --header-max-width: 960px; */
  --main-max-width: 960px;
  --footer-max-width: 960px;

  /* Components */
  --column-width: 280px;

  /* highlight */
  --hljs-comment: #7a7a7a;
  --hljs-punctuation: #333333;
  --hljs-tag-name: #000000;
  --hljs-keyword: #0040cc;
  --hljs-string: #0066ff;
  --hljs-variable: #2b2b2b;
  --hljs-literal: #004a99;
  --hljs-built_in: #0059ff;
  --hljs-meta: #003366;
  --hljs-meta-string: #0066cc;
}

/*--- Base CSS ---*/

:where(*),
:where(*::before),
:where(*::after) {
  box-sizing: border-box;
  font-family: var(--font-family);
}

:where(html) {
  font-size: 18px;
  line-height: 1.8;
  interpolate-size: allow-keywords;
}

:where(body) {
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

:where(img),
:where(picture),
:where(video),
:where(canvas),
:where(svg) {
  display: inline-block;
  max-width: 100%;
  height: auto;
}

:where(p),
:where(h1),
:where(h2),
:where(h3),
:where(h4),
:where(h5),
:where(h6) {
  overflow-wrap: break-word;
}

:where(a),
:where(a:visited),
:where(a:active),
:where(a:hover) {
  color: #0066ff;
  text-decoration: none;
}

:where(a:hover) {
  text-decoration: underline;
}

:where(button) {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  -webkit-appearance: none;
}

:where(tr) {
  text-align: left;
}

:where(th, td) {
  padding: 5px 10px;
}

/* ---- Form Styles ---- */

:where(input),
:where(button),
:where(textarea),
:where(select) {
  font: inherit;
  padding: 5px 10px;
  max-width: 600px;
}

:where(input[type='text']),
:where(input[type='password']),
:where(input[type='email']),
:where(input[type='url']),
:where(input[type='tel']),
:where(input[type='search']),
:where(input[type='number']),
:where(input[type='date']),
:where(input[type='datetime-local']),
:where(input[type='month']),
:where(input[type='time']),
:where(input[type='week']),
:where(textarea, select) {
  width: 100%;
}

:where(input),
:where(textarea),
:where(select) {
  border: 1px solid #d1d5db;
}

:where(textarea) {
  height: 160px;
}

:where(input[type='file']) {
  border: none;
  outline: none;
  padding: 0;
  background: none;
}

:where(fieldset) {
  border-width: 0;
  margin-inline: 0;
  padding-block: 0;
  padding-inline: 0;
}

:where(legend) {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 0.5rem;
}

:where(input[type='submit']) {
  cursor: pointer;
}

:where(input span) {
  margin: 1rem;
  padding: 1rem;
}

form > div.field {
  margin-bottom: 1rem;
}

form > div.field > label {
  display: table;
}

form > div.field > small {
  display: table;
}

form > div.field > em {
  display: table;
}

form > div.controls {
  margin-bottom: 1rem;
}

form progress:not([value]) {
  display: none;
}

/* ---- Layout Styles ---- */

.layout {
  display: grid;
  grid-template-areas:
    'header'
    'main'
    'footer';
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  font-family: var(--font-family, system-ui, sans-serif);
}

/* Page */
.layout header,
.layout main,
.layout footer {
  display: flex;
  justify-content: center;
}

.layout header {
  grid-area: header;
  position: var(--header-position, static);
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height, auto);
}

.layout main {
  grid-area: main;
  margin-top: var(--header-height, 0);
}

.layout footer {
  grid-area: footer;
}

/* Inner */
.layout header > .inner,
.layout main > .inner,
.layout footer > .inner {
  width: 100%;
}

.layout header > .inner {
  max-width: var(--header-max-width, var(--layout-max-width, 100%));
}

.layout main > .inner {
  display: grid;
  max-width: var(--main-max-width, var(--layout-max-width, 100%));
  overflow-x: auto;
  overflow-y: visible;
}

.layout footer > .inner {
  max-width: var(--footer-max-width, var(--layout-max-width, 100%));
}

/* Columns */
.layout main > .inner {
  grid-template-columns: 1fr;
}

.layout main > .inner:where(:has(> nav:not(:empty))) {
  grid-template-columns: var(--column-width, 280px) 1fr;
}

.layout main > .inner:where(:has(> aside:not(:empty))) {
  grid-template-columns: 1fr var(--column-width, 280px);
}

.layout main > .inner:where(:has(> nav:not(:empty)):has(> aside:not(:empty))) {
  grid-template-columns: var(--column-width, 280px) 1fr var(
      --column-width,
      280px
    );
}

/* Prevent content stretch */
.layout main > .inner > * {
  min-width: 0;
  min-height: 0;
}

/* Hide empty slots and columns */
.layout main > .inner > *:empty:not(:has(*)) {
  display: none;
}

/* Responsive */
@media (max-width: 992px) {
  .layout main > .inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .layout main nav {
    grid-row: 1;
  }

  .layout main article {
    grid-row: 2;
  }

  .layout main aside {
    grid-row: 3;
  }
}


.nav {
  display: flex;
  align-items: center;
  justify-content: center;
}

nav.left {
  flex-grow: 1;
}

.nav a {
  text-decoration: none;
  color: black;
  margin: 0 1rem;
}

a.logo {
  margin-left: 1rem;
}

a.logo img {
  vertical-align: middle;
  height: 20px;
  position: relative;
  bottom: 2px;
}

.dialog {
  display: grid;
  place-items: center;
  margin-top: 3rem;
}

.dialog-content {
  width: 100%;
  max-width: 750px;
  min-height: 400px;
  padding: 1rem 2rem;
}

.dialog-top {
  display: flex;
}

.dialog-top h1 {
  flex-grow: 1;
  padding: 0;
  margin: 0;
  margin-bottom: 1rem;
}

.dialog-close a {
  font-size: 40px;
  color: #111;
  cursor: pointer;
  text-decoration: none;
}

:where(.dialog input, .dialog textarea, .dialog select) {
  width: 100%;
  max-width: 600px;
}

button {
  background-color: #dfdfdf;
  padding: 3px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
}

button:hover {
  background-color: #e3e3e3;
}

code {
  background: #f5f5f5;
  padding: 2px 5px;
  font-size: 95%;
  border: 1px solid #dfdfdf;
  border-radius: 5px;
}

.flash {
  position: fixed;
  top: 18px;
  left: 0;
  z-index: 1005;
  left: 50%;
  transform: translateX(-50%);
}

.flash #flash {
    width: fit-content;
    min-width: 100px;
    max-width: 775px;
    margin: 0 auto;
    text-align: center;
    padding: 0.2rem 1rem;
    background: #333;
    border-radius: 20px;
    color: white;
    opacity: 0.7;
    transition: opacity 0.2s ease;
  }

:is(.flash #flash):first-letter {
      text-transform: uppercase;
    }

:is(.flash #flash):empty {
      display: none;
    }

footer {
  text-align: center;
}

form em {
  color: firebrick;
}

p.cta {
  margin-top: 2rem;
}

p.cta button {
  background: white;
  border: 2px solid black;
  padding: 10px 20px;
  font-size: 16px;
  transition: background 0.3s ease;
}

p.cta button:hover {
  background: #ffffdf;
}

p.cta button a {
  text-decoration: none;
  color: black;
  font-weight: 500;
}

p.sign {
  margin-top: 3rem;
}

p.sign a {
  color: black;
  text-decoration: underline;
}

picture.avatar {
  display: inline-flex;
  height: 60px;
  width: 60px;
  border-radius: 50%;
  overflow: hidden;
}

picture.avatar.small {
  height: 30px;
  width: 30px;
  position: relative;
  top: 8px;
}

picture.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile {
  display: none;
}

@media (max-width: 992px) {
  .desktop {
    display: none;
  }

  .mobile {
    display: block;
  }
}

.burger {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  width: 30px;
  height: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.burger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: #000;
  position: relative;
}

footer {
  padding: 10px 0;
}
