html, body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* layout */
.header {
  border-bottom: 1px solid var(--code-bg-color);
  grid-template-columns: 1fr auto 60% 1fr;
}

.wrapper {
  display: flex;
  flex-grow: 1;
}

/* logo */
.logo {
  font-weight: 900;
  color: var(--primary-color);
  font-size: 1.4em;
  grid-column: 2;
}

/* wordmark: the icon, "open" and the coral "repl" badge (same as the .brand in ui-refresh.css) */
.logo .brand {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.logo .brand::before {
  content: "";
  align-self: center;
  width: 1.25em;
  height: 1.25em;
  margin-right: 0.4em;
  background: url("../images/logo.svg") center / contain no-repeat;
}
.logo .brand__open { color: var(--primary-color); }
.logo .brand__repl {
  margin-left: 2px;
  padding: 0 6px;
  border-radius: 6px;
  color: var(--on-accent-color);
  background: var(--accent-color);
}

.logo__thin {
  font-weight: 300;
}

.logo__thin__about {
  font-weight: 100;
}

.go__color {
  color: var(--accent-color);
}

.go__color_rev {
  color: var(--rev-accent-color);
}

/* menu */
.menu {
  grid-template-columns: 1fr 180px 60% 1fr;
}

.menu__item {
  padding: 1.5rem 1rem;
}

/* doc */
.doc__bg {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 28%;
  background-color: var(--bg-color);
  z-index: -1;
}

.doc__nav {
  flex-basis: 20%;
  font-weight: 200;
}

.doc__nav ul {
  list-style: none;
  padding-left: 0;
  line-height: 1.8;
}

.doc__nav ul.fixed {
  position: fixed;
  top: 2rem;
}

.doc__nav li:hover {
  color: var(--primary-color-light);
  cursor: pointer;
  transition: color .3s ease-in-out;
}

.doc__nav .selected {
  color: var(--accent-color);
  position: relative;
}

.doc__nav .selected:after {
  position: absolute;
  content: "";
  width: 1rem;
  height: 1rem;
  background-color: var(--accent-color);
  left: -1.5rem;
  top: 0.3rem;
}

.doc__content {
  flex-basis: 80%;
  padding: 0 0 5rem 1rem;
}

.doc__content .code {
  line-height: 1.75;
}

@media (max-width: 750px) {
  .wrapper {
    flex-direction: column;
  }
  .doc__content {
    padding-left: 0;
  }
  .doc__nav ul {
    border-bottom: 1px solid var(--code-bg-color);
    padding-bottom: 0.5rem;
  }
  .doc__nav ul.fixed {
    /* nutralized the fixed menu for mobile*/
    position: relative;
    top: 0;
  }
  .doc__nav li {
    display: inline-block;
    padding-right: 1rem;
  }
  .doc__nav .selected:after {
    display: none;
  }
}

/*
blog: the list (/blog) and a post (/blog?name=...)
*/
.blog-page { max-width: 760px; margin: 0 auto; padding: 0 1rem 4rem; flex-basis: 100%; }
.blog-head { margin: 0.5rem 0 1.5rem; }
.blog-head h1 { margin: 0; font-family: var(--font-display); font-size: 2rem; }
.blog-sub { margin: 0.25rem 0 0; color: var(--medium-gray-color); }
.blog-list { display: grid; gap: 14px; }
.blog-card {
  padding: 16px 18px;
  border: 1px solid var(--light-gray-color);
  border-radius: 12px;
  background: var(--white-color);
}
.blog-card h2 { margin: 0 0 4px; font-size: 1.25rem; }
.blog-card h2 a { color: var(--primary-color); text-decoration: none; }
.blog-card h2 a:hover, .blog-card h2 a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.blog-desc { margin: 6px 0 10px; }
.post-meta { margin: 0 0 8px; color: var(--medium-gray-color); font-size: 0.85rem; }
.read-more { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.read-more:hover, .read-more:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

.blog-back { margin: 0 0 1rem; font-size: 0.9rem; }
.blog-back a { color: var(--accent-text); text-decoration: none; }
.blog-back a:hover { text-decoration: underline; }
.blog-article h1 { margin: 0 0 0.25rem; font-family: var(--font-display); font-size: 2rem; line-height: 1.2; }
.blog-body { margin-top: 1.25rem; font-size: 1.05rem; line-height: 1.7; overflow-wrap: anywhere; }
.blog-body h2, .blog-body h3 { margin: 1.8em 0 0.5em; line-height: 1.3; }
.blog-body img, .blog-body video, .blog-body iframe { max-width: 100%; height: auto; border-radius: 8px; }
.blog-body pre {
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--code-bg-color);
  font-family: var(--font-code);
  font-size: 0.9rem;
  line-height: 1.5;
}
.blog-body code { font-family: var(--font-code); font-size: 0.92em; }
.blog-body :not(pre) > code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg-color); }
.blog-body blockquote { margin: 1em 0; padding: 0.2em 1em; border-left: 3px solid var(--accent-color); color: var(--primary-color-light); }
.blog-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.blog-body a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

/* Accessibility fixes for the older pages (T15) */
.go__color { color: var(--accent-text); }
.doc__nav .selected { color: var(--accent-text); }
.doc__nav .selected:after { background-color: var(--accent-text); }
h2.section__title { font-family: inherit; font-size: 1.17em; }
.doc__links { margin: 0; padding: 0; list-style: none; }
.doc__links--bullets { padding-left: 1.2em; list-style: disc; }
.doc__content p a,
.doc__content li a { text-decoration: underline; text-underline-offset: 2px; }
.footer:not(.site-footer) .link--light { color: #FF8C8D; text-decoration: underline; text-underline-offset: 2px; }
.footer:not(.site-footer) .go__color { color: #FF8C8D; }

/* Light theme: the footer of the document and blog pages is light too (the dark theme has its own above) */
[data-theme="light"] .footer:not(.site-footer) { background-color: #EDEAE3; color: #4A4852; }
[data-theme="light"] .footer:not(.site-footer) .link--light,
[data-theme="light"] .footer:not(.site-footer) .go__color { color: #B8323A; }
