*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --viewport-height: 100vh;
  --bg: #fff;
  --text: rgba(0,0,0,.8);
  --text-light: #79828B;
  --border: #e6e6e6;
  --tooltip-bg: #292927;
  --tooltip-text: #fff;
  --accent: #33a;
  --font-sans: -apple-system, 'Helvetica Neue', 'Lucida Grande', Arial, sans-serif;
  --font-serif: Georgia, Cambria, 'Times New Roman', serif;
  --font-mono: Menlo, 'Courier New', Courier, monospace;
}

html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.58;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tl_page_wrap {
  display: flex;
  flex-direction: column;
  min-height: var(--viewport-height, 100vh);
}

.tl_page {
  max-width: 732px;
  margin: 0 auto;
  padding: 21px 0;
  flex-grow: 1;
  width: 100%;
}

/* Article Header */
.tl_article_header {
  word-wrap: break-word;
  padding: 42px 21px 0;
}

.tl_article_header h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 32px;
  line-height: 34px;
  outline: none;
  min-height: 34px;
  color: #000;
}

.tl_article_header h1:empty::before,
.tl_article_header h1:blank::before,
.tl_article_header h1[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: rgba(0,0,0,.2);
  font-weight: 400;
}

.tl_article_header h1:focus::before {
  color: rgba(0,0,0,.2);
}

.tl_article_header address {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 18px;
  color: var(--text-light);
  padding: 10px 0 0;
  outline: none;
}

.tl_article_header address a {
  color: var(--text-light);
  text-decoration: none;
  outline: none;
}

.tl_article_header address a:empty::before,
.tl_article_header address a[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: rgba(0,0,0,.2);
}

.tl_article_header address time {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 18px;
  color: var(--text-light);
}

.tl_article_header address time::before {
  content: ' . ';
}

/* Article Content */
.tl_article_content {
  padding: 33px 21px 42px;
  outline: none;
  min-height: calc(100vh - 400px);
  word-wrap: break-word;
}

.tl_article_content_wrap {
  position: relative;
}

.tl_article_content p,
.tl_article_content div {
  margin: 0 0 12px;
  min-height: 1.58em;
}

.tl_article_content p.tl_placeholder {
  color: rgba(0,0,0,.25);
  font-style: normal;
  cursor: text;
}

.tl_article_content p.tl_media_url {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.tl_article_content h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 28px;
  line-height: 34px;
  margin: 0 0 12px;
}

.tl_article_content h2 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 24px;
  line-height: 34px;
  color: rgba(0,0,0,.44);
  margin: 0 0 12px;
}

.tl_article_content h3,
.tl_article_content h4,
.tl_article_content h5,
.tl_article_content h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  margin: 0 0 12px;
}

.tl_article_content blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.58;
  border-left: 3px solid #000;
  padding: 2px 0 2px 15px;
  margin: 0 0 12px;
  color: var(--text);
}

.tl_article_content figcaption {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 18px;
  color: var(--text-light);
  text-align: center;
  padding: 6px 0 0;
}

.tl_article_content pre,
.tl_article_content code {
  font-family: var(--font-mono);
  font-size: 16px;
  background: #F5F8FC;
  border-radius: 3px;
  padding: 2px 4px;
}

.tl_article_content pre {
  padding: 12px 15px;
  overflow-x: auto;
  line-height: 1.45;
}

.tl_article_content pre code {
  background: none;
  padding: 0;
}

.tl_article_content ul,
.tl_article_content ol {
  margin: 0 0 12px;
  padding-left: 1.5em;
}

.tl_article_content li {
  margin: 0 0 6px;
}

.tl_article_content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.tl_article_content a {
  color: var(--accent);
  text-decoration: underline;
}

.tl_article_content img,
.tl_article_content video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 3px;
}

.tl_article_content figure {
  margin: 24px 0 18px;
  text-align: center;
}

.tl_article_content figure > img,
.tl_article_content figure > video,
.tl_article_content figure > iframe,
.tl_article_content figure > object,
.tl_article_content figure > embed {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  border: 0 !important;
}

.tl_article_content figure > iframe[src*="youtube.com/embed"],
.tl_article_content figure > iframe[src*="youtube-nocookie.com/embed"],
.tl_article_content figure > iframe[src*="player.vimeo.com"],
.tl_article_content figure > iframe.tl_video_embed {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.tl_article_content figure > iframe[src*="platform.twitter.com"],
.tl_article_content figure > iframe.tl_social_embed {
  width: 100%;
  max-width: 550px;
}

body:not(.tl_editing) .tl_article_content figcaption:empty {
  display: none;
}

body:not(.tl_editing) .tl_article_content figcaption[data-placeholder]:empty::before {
  content: none;
}

body.tl_editing .tl_article_content figcaption[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: rgba(0,0,0,.25);
  pointer-events: none;
}

/* Toolbar */
.tl_tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--tooltip-bg);
  border-radius: 6px;
  padding: 9px 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 16px, 0);
  transition: opacity .2s .06s, transform .2s .06s;
}

.tl_tooltip.shown {
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.tl_tooltip .buttons {
  display: flex;
  align-items: center;
}

.tl_tooltip .button_group {
  display: inline-flex;
  align-items: center;
}

.tl_tooltip .button_group + .button_group {
  margin-left: 6px;
  padding-left: 6px;
  border-left: 1px solid rgba(255,255,255,.2);
}

.tl_tooltip button {
  display: inline-block;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  opacity: .6;
  transition: opacity .15s;
  padding: 0;
}

.tl_tooltip button:hover,
.tl_tooltip button.active {
  opacity: 1;
}

.tl_tooltip .prompt {
  display: none;
  align-items: center;
}

.tl_tooltip .prompt.shown {
  display: flex;
}

.tl_tooltip .prompt .close {
  width: 12px;
  height: 12px;
  cursor: pointer;
  opacity: .6;
  margin-right: 8px;
}

.tl_tooltip .prompt .close:hover {
  opacity: 1;
}

.tl_tooltip .prompt_input_wrap {
  flex: 1;
}

.tl_tooltip .prompt_input {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,.3);
  color: var(--tooltip-text);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  width: 200px;
  padding: 4px 0;
}

.tl_tooltip .prompt_input::placeholder {
  color: rgba(255,255,255,.4);
}

.tl_tooltip .button_hover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Block buttons (image/embed) */
.tl_blocks {
  position: absolute;
  left: -58px;
  top: 0;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  z-index: 5;
}

.tl_blocks.shown {
  opacity: 1;
  pointer-events: auto;
}

.tl_blocks .buttons {
  display: flex;
  gap: 6px;
}

.tl_blocks button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, background .15s;
  padding: 0;
}

.tl_blocks button:hover {
  border-color: #999;
  background: #f5f5f5;
}

.tl_blocks button svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 960px) {
  .tl_blocks {
    left: 21px;
  }
}

@media (max-width: 400px) {
  .tl_blocks {
    left: 15px;
  }
}

/* Link tooltip */
.tl_link_tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--tooltip-bg);
  border-radius: 6px;
  font-size: 14px;
  color: var(--tooltip-text);
  max-width: 300px;
  text-align: center;
  padding: 9px 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 8px, 0);
  transition: opacity .2s, transform .2s;
}

.tl_link_tooltip.shown {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.tl_link_tooltip a {
  color: #fff;
  text-decoration: underline;
}

/* Article buttons */
.tl_article_buttons {
  text-align: center;
  padding: 21px;
}

.tl_article_buttons .publish_button {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 17px;
  border: 2px solid #333;
  border-radius: 16px;
  text-transform: uppercase;
  padding: 4px 12px;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: opacity .2s, transform .2s;
  letter-spacing: .02em;
  position: fixed;
  left: 50%;
  top: 0;
  margin: 46px 0 0 382px;
  z-index: 100;
}

.tl_article_buttons .publish_button:hover {
  background: #f5f5f5;
}

.tl_article_buttons .publish_button.saving {
  opacity: .5;
  pointer-events: none;
}

.tl_article_buttons .publish_button.published {
  border-color: #4caf50;
  color: #4caf50;
}

/* Toast notification */
.tl_toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 8px;
  opacity: 0;
  transition: all .3s;
  z-index: 2000;
  white-space: nowrap;
  pointer-events: none;
}

.tl_toast.shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 1100px) {
  .tl_article_buttons .publish_button {
    left: auto;
    right: 21px;
    top: 21px;
    margin: 0;
  }

  .tl_article_header {
    padding-top: 21px;
    padding-right: 140px;
  }
}

@media (max-width: 400px) {
  .tl_article_header {
    padding-left: 15px;
    padding-right: 124px;
  }

  .tl_article_buttons .publish_button {
    right: 15px;
    top: 15px;
    font-size: 16px;
    padding: 4px 10px;
  }

  .tl_article_content {
    padding-left: 15px;
    padding-right: 15px;
  }
}

/* Placeholder for empty editor */
[contenteditable=true]:empty:before {
  content: attr(data-placeholder);
  color: rgba(0,0,0,.2);
  pointer-events: none;
}

/* Selection style */
::selection {
  background: #b3d4fc;
}

/* Prevent user select on toolbar */
.tl_tooltip,
.tl_blocks {
  user-select: none;
  -webkit-user-select: none;
}

/* Resizable figures */
.tl_article_content figure img {
  cursor: default;
}
