@import './vars.css';

/* FONTS -------------------------------------------------------------------- */

/*
100 Thin (Hairline)
200 Extra Light (Ultra Light)
300 Light
400 Normal (Regular)
500 Medium
600 Semi Bold (Demi Bold)
700 Bold
800 Extra Bold (Ultra Bold)
900 Black (Heavy)
950 Extra Black (Ultra Black)
*/

/* BASE -------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

body,
input,
button,
select,
textarea {
  font-family: var(--font);
  font-weight: var(--weight-regular);
  font-size: 1rem;
  letter-spacing: -0.025em;
  -webkit-font-smoothing: antialiased;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  padding: 0;
  color: var(--color);
  background: var(--bg-color);
}

p,
h1,
h2,
h3,
h4,
h5,
ul,
ol,
pre,
code,
hr,
table {
  margin-top: 0;
  margin-bottom: var(--block-bottom);
}

img {
  display: block;
}

figure {
  margin: 0 0 var(--block-bottom) 0;
}

hr {
  height: 2px;
  margin: calc(var(--block-bottom) * 2) 0;
  border: none;
  border-bottom: 1px solid var(--border-color);
}

h1,
h2,
h3 {
  color: var(--color-bold);
  font-family: var(--font-heading);
}

h1 {
  font-size: 1.5rem;
  line-height: 1em;
  font-weight: var(--weight-x-bold);
}

h1.post-title {
  font-size: 1.5rem;
}

h2 {
  margin-top: calc(var(--block-bottom) * 2);
  margin-left: -0.03em;
  font-size: 1.25rem;
  line-height: var(--line-height-heading);
  font-weight: var(--weight-bold);
}

h2.subtitle {
  margin-top: var(--block-bottom);
  color: var(--muted-color);
  font-weight: var(--weight-regular);
}

h2.subtitle + h2 {
  margin-top: var(--block-bottom);
}

h3 {
  font-size: 1rem;
  line-height: var(--line-height-heading);
}

a {
  text-decoration: none;
  color: var(--link-color);
  background-color: var(--link-bg-color);
  border-radius: var(--radius-sm);
  text-decoration: none;

  /* If link wraps to new line, have border radius close and restart */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

a:hover {
  color: var(--link-hover-color);
  background-color: var(--link-hover-bg-color);
  text-decoration: none;
}

a.reset {
  color: var(--color-bold);
  background-color: transparent;
}

a.reset:hover {
  color: var(--color-bold);
  background-color: transparent;
  text-decoration: underline;
}

button:hover {
  cursor: pointer;
}

p {
  line-height: var(--line-height);
  hyphens: auto;
  hyphenate-limit-chars: 6 3 3;
  hyphenate-limit-lines: 2;
  hyphenate-limit-last: always;
  hyphenate-limit-zone: 8%;
}

p:first-of-type {
  margin-top: 0;
}

strong {
  color: var(--color-bold);
}

ul,
ol {
  padding-left: 12px;
}

ul {
  list-style: square;
}

li {
  margin: 0 0 0.5em 1em;
  line-height: var(--line-height);
}

li:last-of-type {
  margin-bottom: 0;
}

pre,
code {
  font-family: var(--font-mono);
}

pre {
  overflow: auto;
  padding: 16px var(--gutter);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  line-height: 1.6em;
  background-color: #eee;
}

p > code,
li > code {
  padding: 2px 6px;
  border: 1px solid var(--border-color-light);
  font-size: 0.8125rem;
  border-radius: var(--radius);
  line-height: 12px;
}

detail {

}

summary {
  padding: var(--gutter);
  margin-bottom: var(--block-bottom);
  border-radius: var(--radius);
  font-weight: var(--weight-bold);
  cursor: pointer;
  outline: none;
}

summary:focus:not(:hover) {
  background: var(--recessed-bg-color);
}

summary:hover {
  color: white;
  background: var(--primary-color);
}

/* Nav ------------ */

.nav {
  display: flex;
  overflow-x: auto;
  margin: var(--gutter) 0 calc(var(--gutter) * 4) 0;
  padding: 0 var(--gutter);
  transition: opacity 0.2s, transform 0.2s;
}

.nav__list {
  display: flex;
  margin-bottom: var(--gutter);
  margin-right: var(--gutter);
}

a.nav__item {
  display: inline-block;
  padding: 0.65em 0.35em;
  margin-right: 0.5em;
  color: var(--muted-color);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: var(--weight-bold);
  background-color: transparent;
}

a.nav__item:hover {
  color: var(--color-bold);
}

.nav__divider {
  display: none;
}

@media (min-width: 800px) {
  .nav {
    display: block;
    position: fixed;
    left: 0;
    padding: 0;
    margin: 0 0 0 var(--gutter);
  }

  .nav__list {
    display: block;
    margin-right: 0;
    margin-bottom: var(--gutter);
    border: none;
  }

  a.nav__item {
    display: block;
    padding: 0.25em 1em 0.25em 0.5em;
    margin-right: 0;
    border: 0;
    border-radius: var(--radius);
  }
}

/* Page layout ------------ */

.page {
  position: relative;
  max-width: var(--page-max-width);
  margin-top: 64px;
  margin-bottom: 64px;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.page.page--full-width {
  max-width: none;
}

@media (min-width: 800px) {
  .page {
    margin-left: var(--nav-width);
  }
}


/* Page & Post content ---------- */

/* For displaying html content in image like container.
Useful when creating diagrams with html */
.html-figure {
  background: white;
  padding: var(--gutter);
}

figure img,
figure video,
figure .html-figure {
  width: calc(100% + var(--gutter) * 2);
  margin-left: calc(var(--gutter) * -1);
  margin-right: calc(var(--gutter) * -1);
  border-radius: 0;
}

figure.border img,
figure.border video,
figure.border .html-figure {
    border: 1px solid var(--border-color-light);
    border-width: 1px 0;
}

figure.small img {
  width: auto;
  margin-left: 0;
  margin-right: 0;
}

figure.small.border img {
  border-radius: var(--radius-lg);
  border-width: 1px;
}

@media (min-width: 800px) {
  figure img,
  figure video,
  figure .html-figure {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    border-radius: var(--radius-lg);
  }

  figure.large img,
  figure.large .html-figure {
    width: auto;
    /* Some fuzzy math but this prevents xlarge images from extending past
    viewport's right edge. */
    max-width: calc(100vw - var(--nav-width) - 100px);
  }

  figure.border img,
  figure.border video,
  figure.border .html-figure {
    border-width: 1px;
  }
}

/* Notice ------------ */

.notice {
  margin-bottom: var(--block-bottom);
  padding: 1em;
  background: var(--recessed-bg-color);
  border-radius: var(--radius-lg);
  font-weight: var(--weight-bold);
}

.notice p:last-child {
  margin-bottom: 0;
}

/* Items (e.g. Notes, Sketches) ------------ */

.item-grid {
  display: grid;
}

.item {
  margin-bottom: var(--block-bottom);
  padding-bottom: var(--block-bottom);
  border-bottom: 1px solid var(--border-color-light);
}

.item.item--dense {
  margin-bottom: calc(var(--block-bottom) / 2);
  padding-bottom: calc(var(--block-bottom) / 2);
}

.item-title {
  font-weight: var(--weight-bold);
}

.item-title a {
  text-decoration: none;
  color: var(--color-bold);
  background: none;
}

.item-title a:hover {
  text-decoration: underline;
}

.item-meta {
  color: var(--muted-color);
}

.item-credits {
  color: var(--muted-color);
}

.item-body {
  font-size: 0.9375rem;
  line-height: var(--line-height);
}

.item-body p:last-of-type{
  margin-bottom: 8px;
}
