/* -*- css-indent-offset: 2 -*- */
/*
  Josh's Custom CSS Reset
  https://www.joshwcomeau.com/css/custom-css-reset/
*/
*, *::before, *::after {
  box-sizing: border-box;
}
* {
  margin: 0;
  line-height: calc(1em + 0.5rem);
}
html, body {
  height: 100%;
}
body {
  -webkit-font-smoothing: antialiased;
}
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}
input, button, textarea, select {
  font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}


/* Colors */

:root {
  --bg-color: #fff;
  --text-color: #333;
  --link-color: #007ACC;
  --code-bg-color: #f2f1f1;
  --blockquote-border-color: #dcdcdc;
  --title-color: #000;
  --icon-filter: none;
  --grey-bg-color: #f5f5f7;
  --testimonial-shadow-color: rgba(0, 0, 0, 0.1);
  --tooltip-bg-color: #222;
  --tooltip-text-color: #f5f5f5;
  --message-bg-color: #EEE;
  --message-mine-bg-color: rgb(0, 120, 254);
  --message-mine-text-color: #fff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #222;
    --text-color: #f5f5f5;
    --link-color: #4fc3f7;
    --code-bg-color: #333;
    --blockquote-border-color: #555;
    --title-color: #fff;
    --icon-filter: invert(1);
    --grey-bg-color: #333;
    --testimonial-bg-color: #444;
    --testimonial-shadow-color: rgba(255, 255, 255, 0.1);
    --tooltip-bg-color: #f5f5f5;
    --tooltip-text-color: #222;
    --message-bg-color: #444;
    --message-mine-bg-color: #1565c0;
    --message-mine-text-color: #fff;
  }
}


/* Styles */

html {
  overflow-x: hidden;
}

body {
  font-family: system-ui, -apple-system, Helvetica, Arial, sans-serif;
  font-size: 1.1rem;
  margin: auto;
  max-width: 50rem;
  padding: 0 15px 15px;
  background-color: var(--bg-color);
  color: var(--text-color);
}

@media (min-width: 50rem) {
  padding-bottom: 0 0 15px 0;
}

h1, h2, h3, h4 {
  margin: 1.414rem 0 .5rem;
}

small {
  font-size: 0.8em;
}

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

p, blockquote, table, hr, dl, ul, ol, pre, address, figure {
  margin-bottom: 1rem;
}

pre, code, .mono {
  font-family: Monaco, Menlo, Consolas, "Liberation Mono", monospace;
}

pre, code, .mono {
  font-size: 0.8333rem;
}

p code {
  background-color: var(--code-bg-color);
  padding: .125rem .25rem;
  border-radius: .25rem;
}

pre {
  padding: .5rem;
  overflow-x: auto;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  background-color: var(--code-bg-color) !important;
}

img, canvas, iframe, video, svg, select, textarea {
  max-width: 100%;
}

blockquote {
  border-left: 8px solid;
  border-left-color: var(--blockquote-border-color);
  padding: 1rem;
}

.tabs {
  white-space: nowrap;
  overflow-x: auto;
}

.tabs > h1 {
  display: inline-block;
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

/* Custom styles */

body > header {
  padding-top: 0.5rem;
  padding-bottom: 1rem;
  display: flex;
  justify-content: space-between;
}

#title {
  margin: 0;
  font-weight: bold;
  font-size: 1.5rem;
}

#title a {
  color: var(--title-color);
  padding: 0.3rem 0;
  display: inline-block;
}

#title a:hover {
  text-decoration: none;
}

.top-icons {
  margin: 0;
  display: inline-flex;
  gap: 0.5rem;
}

.icon   { display: inline; position: relative; width: 1rem; height: 1rem; top: 0.125rem; }
.icon15 { display: inline; position: relative; width: 1.5rem; height: 1.5rem; top: 0.1875rem; }
.icon2  { display: inline; position: relative; width: 2rem; height: 2rem; top: 0.25rem; }
.icon, .icon15, .icon2 { filter: var(--icon-filter); }
.avatar { border-radius: 50%; }

.lead {
  font-size: 1.5rem;
  font-weight: 200;
}

h1 a {
  color: var(--title-color);
}

h1 a:hover {
  text-decoration: none;
}

.hover-target { display: none; user-select: none; }
.hover-target::before { content: " "; }
h1:hover .hover-target, h2:hover .hover-target, h3:hover .hover-target { display: inline; }


#post img, #post iframe {
  margin: 0 auto;
}

@media (min-width: 640px) {
  #post img, #post iframe {
    margin-left: 1rem;
    float: right;
    max-width: 400px;
    max-height: 300px;
  }
}

footer {
  margin-top: 5rem;
  font-size: 0.8em;
}

.button {
  padding: 0.5rem 1rem;
  border: 1px solid;
  border-radius: 0.5rem;
}


.mosaic { display: flex; flex-wrap: wrap; gap: 1rem; }
.mosaic > * {
  flex-basis: 100%;
  aspect-ratio: 2/1;
}

@media (min-width: 768px) {
  .mosaic > * {
    flex-basis: calc(50% - 1rem);
    aspect-ratio: 16/9;
  }
}

/* blog post */

article > header {
  padding-bottom: 1rem;
}

article > header > h1 {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .article-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
  }

  .article-grid > :last-child {
    grid-column: span 3;
  }
}

header.cover {
  background-size: cover;
  background-position: center;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

header.cover[style] {
  background-image: linear-gradient(rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.5)),
                    var(--cover);
}

/* https://www.eggradients.com/category/pastel-gradient */
.gradient0 { background-image: linear-gradient(315deg, #d387ab 0%, #b279a7 74%); }
.gradient1 { background-image: linear-gradient(326deg, #030202 0%, #91221e 74%); }
.gradient2 { background-image: linear-gradient(315deg, #63d471 0%, #233329 74%); }
.gradient3 { background-image: linear-gradient(315deg, #90d5ec 0%, #fc575e 74%); }
.gradient4 { background-image: linear-gradient(319deg, #ff7d59 0%, #ff583a 37%, #f4a698 100%); }
.gradient5 { background-image: linear-gradient(10deg, rgb(139, 92, 246), rgb(217, 70, 239)); }

.fullwidth {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  height: 50vh;
  max-height: 50vh;
  left: -15px; /* body padding */
}

.fullwidth > * {
  padding-left: 15px;
}

@media (min-width: 50rem) {
  .fullwidth {
    left: calc((-100vw + 50rem) / 2);
  }
  .fullwidth > * {
    padding-left: calc((100vw - 50rem) / 2);
  }
}

header.cover, header.cover .grey, header.cover a {
  color: white;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.greyback {
  position: relative;
}
.greyback::before {
  content: "";
  background-color: var(--grey-bg-color);
  position: absolute;
  height: 100%;
  width: 100vw;
  /* that depends a lot on `body` styling */
  left: calc(25rem - max(25rem + 15px, 50vw + 15px));
  top: 0;
  z-index: -1;
}

/* Consulting */

.testimonials {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
  gap: 1rem;
}

.testimonials > div {
  flex: 1 0 25ch;
  padding: 1.5rem;
  border-radius: 1rem;
  background-color: var(--bg-color);
  box-shadow: var(--testimonial-shadow-color) 0px 10px 15px -3px,
              var(--testimonial-shadow-color) 0px 4px 6px -4px;
  /* box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px, */
  /*             rgba(17, 24, 39, 0.05) 0px 0px 0px 1px, */
  /*             rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, */
  /*             rgba(0, 0, 0, 0.1) 0px 4px 6px -4px; */
}

.testimonials blockquote {
  border: 0;
}
.testimonials figcaption {
  font-size: 0.875em;
  background: none;
}

/* Utility */

.m-auto-0 { margin: auto 0; }
.mt { margin-top: 1rem; }
.mt5 { margin-top: .5rem; }
.mt15 { margin-top: 1.5rem; }
.mb { margin-bottom: 1rem; }
.mb5 { margin-bottom: .5rem; }
.mb2 { margin-bottom: 2rem; }
.ml { margin-left: 1rem; }
.mr { margin-right: 1rem; }
.p5 { padding: .5rem; }
.p1 { padding: 1rem; }

.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.ml0 { margin-left: 0; }
.mr0 { margin-right: 0; }
.pl0 { padding-left: 0; }
.pr0 { padding-right: 0; }

.h100 { height: 100%; }

.left { text-align: left; }
.center { text-align: center; }
.right { text-align: right; }
.mcenter { margin: 0 auto; display: block; }

.small { font-size: 0.7em; }
.semibold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.o80 { opacity: 80%; }

.red { color: red; }
.blue { color: blue; }
.grey { color: grey; }

.nobullets li { list-style-type: none; }
.flex-row { display: flex; flex-direction: row; }
.flex-col { display: flex; flex-direction: column; }
.gap1 { gap: 1rem; }
.gap15 { gap: 1.5rem; }

.relative { position: relative; }
.inset { position: absolute; inset: 0; }


@media (min-width: 640px) {
  .float-left { float: left; }
  .float-right { float: right; }
}
.clear { clear: both; }
.clearfix::after {
  content: " ";
  display: block;
  height: 0;
  clear: both;
}


.opacity-75 { opacity: 0.75; }
.group:hover .opacity-75 {
  opacity: 1;
  transition: opacity 0.2s;
}


/* editor.js comments */

.permsel {
  background-color: rgba(20, 50, 120, 0.2);
  position: absolute;
}

.permsel:hover .tooltip {
  display: block;
}

.tooltip {
  display: none;
  width: 300px;
  background-color: var(--tooltip-bg-color);
  color: var(--tooltip-text-color);
  border-radius: 10px;
  padding: 10px 15px;
  position: relative;
  text-align: left;
  z-index: 10;
  left: 50%;
  transform: translate(-50%, calc(-100% - 15px));
}

.tooltip b {
  color: white;
}

.tooltip::after {
  content: '';
  position: absolute;
  display: block;
  top: 100%;
  left: 50%;
  width: 0;
  height: 0;
  border-width: 15px;
  border-style: solid;
  border-color: var(--tooltip-bg-color) transparent transparent transparent;
}


/* message bubbles */

.chat {
  display: flex;
  flex-direction: column;
  padding: 3rem 0;
}

.messages {
  margin-bottom: 30px;
  display: flex;
  flex-direction: row;
  gap: 1em;
}

.messages .avatar {
  margin: auto 0 0;
}

.messages .message {
  border-radius: 20px;
  padding: 8px 15px;
  margin-top: 5px;
  margin-bottom: 5px;
  display: inline-block;
  margin-right: 25%;
  background-color: var(--message-bg-color);
  position: relative;
}

.messages.mine .message,
.messages.mine .message:last-of-type:before  {
  color: white !important;
  background: rgb(0, 120, 254) !important;
}
.messages.mine a {
  color: white;
  text-decoration: underline;
}

.messages .message:last-of-type:before {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: 0;
  left: -7px;
  height: 20px;
  width: 20px;
  background-color: var(--message-mine-bg-color);
  color: var(--message-mine-text-color);
  border-bottom-right-radius: 15px;
}
.messages .message:last-of-type:after {
  content: "";
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: -10px;
  width: 10px;
  height: 20px;
  background-color: var(--grey-bg-color);
  border-bottom-right-radius: 10px;
}

@keyframes slidein {
  from { transform: scale(0); opacity: 0; }
  80%  { transform: scale(1.15); opacity: 1; }
  to   { transform: scale(1); opacity: 1; }
}

.inserting {
  animation: slidein 200ms ease-in-out;
}
