/* Dekoratív kódrészletek: átlátszó, a dokumentumhoz rögzített oldalsó elrendezés. */
.code-decoration-layer {
  display: none;
}

/* 1200 px felett már van elegendő hely a két oldalsó kódsávnak. */
@media (min-width: 1200px) {
  /* A központi tartalom keskenyebb sávot kap, így a kódok nem lógnak rá. */
  main .container {
    width: min(900px, calc(100% - 48px));
  }

  .code-decoration-layer {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: visible;
    z-index: 2;
    pointer-events: none;
    user-select: none;
  }

  .code-fragment {
    /* A kódrészletek a viewport széleihez simulnak, miközben
       a központi tartalomtól legalább 20px távolságot tartanak. */
    --code-width: min(230px, calc((100vw - 900px) / 2 - 40px));
    position: absolute;
    box-sizing: border-box;
    width: var(--code-width);
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    color: #35483b;
    opacity: .92;
    mix-blend-mode: multiply;
    transform: none;
  }

  .code-fragment-left {
    left: 20px;
    text-align: left;
  }

  .code-fragment-right {
    right: 20px;
    text-align: left;
  }

  .code-fragment-label {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    background: transparent !important;
    color: #ec460a;
    font: 800 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .7px;
    white-space: nowrap;
  }

  .code-fragment pre {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: #2d3852;
    font: 600 clamp(10px, .78vw, 12px)/1.48 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 2;
  }

  .code-fragment:nth-child(4n + 1) { opacity: .86; }
  .code-fragment:nth-child(4n + 2) { opacity: .94; }
  .code-fragment:nth-child(4n + 3) { opacity: .89; }
  .code-fragment:nth-child(4n) { opacity: .92; }
}

@media (max-width: 1199px) {
  .code-decoration-layer { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .code-fragment { animation: none !important; transition: none !important; }
}


/* A kódsávok a saját görgetési pozíciójuknál érkeznek, majd betűnként íródnak ki. */
@media (min-width: 1200px) {
  .code-fragment {
    opacity: 0;
    transform: translate3d(var(--code-entry-x, -24px), 0, 0);
    transition: opacity .65s ease, transform .78s cubic-bezier(.2, .75, .25, 1);
    will-change: opacity, transform;
  }

  .code-fragment-right { --code-entry-x: 24px; }
  .code-fragment-left { --code-entry-x: -24px; }

  .code-fragment.code-fragment-active {
    opacity: .92;
    transform: translate3d(0, 0, 0);
  }

  .code-fragment pre .code-char {
    opacity: 0;
  }

  .code-fragment.is-typing pre .code-char {
    animation: code-character-type .01s linear forwards;
    animation-delay: var(--type-delay, 0ms);
  }

  @keyframes code-character-type {
    to { opacity: 1; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .code-fragment,
  .code-fragment.code-fragment-active {
    opacity: .92 !important;
    transform: none !important;
    transition: none !important;
  }
  .code-fragment pre .code-char { opacity: 1 !important; animation: none !important; }
}
