@charset "utf-8";
/*! HTML5 Boilerplate v8.0.0 | MIT License | https://html5boilerplate.com/ */

/* main.css 2.1.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

:root {
  --black: black;
  --dark-gray: #6f7a89;
  --half-gray: #cacfd1;
  --blue: #1f5de1;
  --green: #1ee494;
  --orange: #e4af27;
  --gray: #e2e4e8;
  --light-gray: #f6f6f6;
  --white: white;
  --trans: transparent;
}

html {
  color: #222;
  font-size: 16px;
  padding: 1em;
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
  font-variant: tabular-nums;
  font-feature-settings: 'tnum';
  scroll-behavior: smooth;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Vendor-prefixed and regular ::selection selectors cannot be combined:
 * https://stackoverflow.com/a/16982510/7133471
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .sr-only class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.sr-only.focusable:active,
.sr-only.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * For modern browsers
 * 1. The space content is one way to avoid an Opera bug when the
 *    `contenteditable` attribute is included anywhere else in the document.
 *    Otherwise it causes space to appear at the top and bottom of elements
 *    that receive the `clearfix` class.
 * 2. The use of `table` rather than `block` is only necessary if using
 *    `:before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: " ";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx),
(min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  /*
   * Printing Tables:
   * https://web.archive.org/web/20180815150934/http://css-discuss.incutio.com/wiki/Printing_Tables
   */
  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* ==========================================================================
   Custom styles.
   ========================================================================== */

body {
  padding: 0 2rem;
  margin: 0 2rem;
}


.container {
  max-width: 980px;
  margin: 150px auto 0;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9;
  border-bottom: 4px solid #D3D3D3;
  background-color: white;
}


header > .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  padding-top: 1rem;
  padding-bottom: 1rem;
  transition: all 0.2s ease;
}

.nav-desc, .nav-links {
  display: flex;
  width: 250px;
}

.nav-links {
  flex-direction: column;
  align-items: flex-end;
}

.nav-links > a {
  color: #212529;
  text-decoration: none;
}

.nav-links p {
  margin-bottom: 0;
}

/* Header-sticky */
header.sticky > .container {
  font-size: 0.8rem;
  padding: 0;
  align-items: center;
  justify-content: center;
}

header.sticky .nav-brand h1 {
  margin: 0;
}

header.sticky .nav-desc {
  display: none;
  margin-bottom: 0;
  font-size: 0.6rem;
}

header.sticky .nav-links {
  display: none;
}

header.sticky > .container > .nav-brand {
  /*margin-right: auto;*/
  /*margin-left: auto;*/
}


/* Footer */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
}

.topic {
  margin-bottom: 3rem;
}

section.showcase {
  margin-top: 2.5rem !important;
}

section.showcase > section.nes-container {
  padding-bottom: 2.5rem !important;
}

section.showcase > section.nes-container,
section.showcase > section.samplecode {
  position: relative;
}

.nes-btn.showcode {
  position: absolute;
  font-size: 12px;
  bottom: 0;
  right: -4px;
}

.nes-btn.copycode {
  position: absolute;
  font-size: 12px;
  top: 0;
  right: 0;
}

section.showcase > section.samplecode > pre code {
  font-size: 13px;
  line-height: 1.5;
  padding: 1.5rem;
}

.item {
  margin-bottom: -1rem;
}

.item > * {
  margin-bottom: 1.5rem !important;
}

/* Containers */
.item.containers > .nes-container {
  display: inline-block;
  max-width: 400px;
}

/* Scroll back to top */
.scroll-btn {
  position: fixed;
  bottom: -60px;
  right: 2rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .6);
  transition: all 0.3s ease;
}

.scroll-btn.active {
  bottom: 25px;
}

.scroll-btn > span {
  display: block;
  transform: rotateZ(90deg);
}

.progress-container {
  width: calc(100% - 8px);
}

.progress-count {
  display: flex;
  justify-content: space-between;
}

.no-decoration a {
  text-decoration: none;
}

/* Link */
a {
  background: linear-gradient(90deg, var(--green) 50%, var(--trans) 50%) 100% 0 / 200% 100% no-repeat;
  transition: background-position 0.2s ease-out 0.05s,
  color 0.2s ease-in-out 0.1s;
}

a:is(:hover, :focus) {
  background-position: 0 0;
  color: var(--blue);
}

/* Dark Mode*/
body.dark {
  background-color: #242424;
  color: white;
}

.dark header {
  background-color: #242424;
}

.dark .nav-links a {
  color: #DEDAD6
}

.dark .nes-container:not(.is-dark).with-title > .title {
  background-color: #242424;
}

.dark .nes-progress {
  border-image-source: url('data:image/svg+xml;utf8,<?xml version="1.0" encoding="UTF-8" ?><svg version="1.1" width="5" height="5" xmlns="http://www.w3.org/2000/svg"><path d="M2 1 h1 v1 h-1 z M1 2 h1 v1 h-1 z M3 2 h1 v1 h-1 z M2 3 h1 v1 h-1 z" fill="rgb(219,219,219)" /></svg>');
}

.dark .nes-list li::before {
  color: #DEDAD6;
}

.dark .nes-list li a {
  color: #DEDAD6
}

.dark a {
  background: linear-gradient(90deg, var(--orange) 50%, var(--trans) 50%) 100% 0 / 200% 100% no-repeat;
  transition: background-position 0.2s ease-out 0.05s,
  color 0.2s ease-in-out 0.1s;
}

.dark a:is(:hover, :focus) {
  background-position: 0 0;
  color: var(--blue) !important;
}

@media (prefers-color-scheme: dark) {
  body.auto {
    background-color: #242424;
    color: white;
  }

  .auto header {
    background-color: #242424;
  }

  .auto .nav-links a {
    color: #DEDAD6
  }

  .auto .nes-container:not(.is-dark).with-title > .title {
    background-color: #242424;
  }

  .auto .nes-progress {
    border-image-source: url('data:image/svg+xml;utf8,<?xml version="1.0" encoding="UTF-8" ?><svg version="1.1" width="5" height="5" xmlns="http://www.w3.org/2000/svg"><path d="M2 1 h1 v1 h-1 z M1 2 h1 v1 h-1 z M3 2 h1 v1 h-1 z M2 3 h1 v1 h-1 z" fill="rgb(219,219,219)" /></svg>');
  }

  .auto .nes-list li::before {
    color: #DEDAD6;
  }

  .auto .nes-list li a {
    color: #DEDAD6
  }

  .auto a {
    background: linear-gradient(90deg, var(--orange) 50%, var(--trans) 50%) 100% 0 / 200% 100% no-repeat;
    transition: background-position 0.2s ease-out 0.05s,
    color 0.2s ease-in-out 0.1s;
  }

  .auto a:is(:hover, :focus) {
    background-position: 0 0;
    color: var(--blue) !important;
  }
}

/* media change */
@media screen and (max-width: calc(980px - 4rem)) {
  header > .container {
    margin: 0 4rem;
  }
}

@media screen and (max-width: 768px) {
  body {
    margin: 2rem 0.5rem;
    padding: 0;
  }

  header > .container {
    margin: 0 0.5rem;
    justify-content: center;
    padding: 0;
  }

  .nav-desc, .nav-links {
    display: none;
  }

  .nav-brand {
    margin-bottom: 0;
  }
}

@media screen and (max-width: 580px) {
  body > .container {
    margin-top: 70px;
  }

  .scroll-btn.active {
    bottom: 60px;
  }
}
