/* === Manual pages (Template "Manual") — dark version of the printed manual === */
.ei-manual-layout {
  --ei-red: #e0383f;
  --ei-text: #ebebf5;
  --ei-muted: rgba(235, 235, 245, .62);
  --ei-rule: rgba(235, 235, 245, .12);
  --ei-card: #12121f;
  --ei-header: 32px;
  display: grid;
  grid-template-columns: 250px minmax(0, 780px);
  justify-content: center;
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
  padding: 48px var(--wp--style--root--padding-right, 24px) 120px var(--wp--style--root--padding-left, 24px);
}

/* ── Chapter navigation ───────────────────────────────────────────── */
.ei-manual-aside { position: sticky; top: var(--ei-header); align-self: start; }
.admin-bar .ei-manual-aside { top: calc(var(--ei-header) + 32px); }
.ei-manual-toc { font-size: .9rem; line-height: 1.35; }
.ei-toc-box > summary { list-style: none; cursor: default; }
.ei-toc-box > summary::-webkit-details-marker { display: none; }
.ei-toc-title { font-size: .7rem; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--ei-red); margin-bottom: .9rem; }
.ei-toc-progress { height: 2px; background: var(--ei-rule); margin-bottom: .6rem; }
.ei-toc-progress span { display: block; height: 100%; width: 0; background: var(--ei-red); transition: width .15s linear; }
.ei-toc-list { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - var(--ei-header) - 90px); overflow-y: auto; scrollbar-width: thin; }
.ei-toc-list a { display: block; padding: .38rem .6rem; border-left: 2px solid transparent; color: var(--ei-muted); text-decoration: none; transition: color .15s, border-color .15s; }
.ei-toc-list a:hover, .ei-toc-list a:focus-visible { color: var(--ei-text); }
.ei-toc-list a.is-active { color: var(--ei-text); border-left-color: var(--ei-red); }
.ei-toc-chapter > a { font-weight: 600; }
.ei-toc-num { display: inline-block; width: 2.1em; font-size: .72em; letter-spacing: .08em; color: var(--ei-red); }
.ei-toc-sub { list-style: none; margin: 0 0 .3rem; padding: 0 0 0 2.1em; display: none; }
.ei-toc-chapter.is-open > .ei-toc-sub { display: block; }
.ei-toc-sub a { font-size: .84rem; padding-top: .25rem; padding-bottom: .25rem; }

/* ── Content ──────────────────────────────────────────────────────── */
.ei-manual-content { counter-reset: chapter; line-height: 1.65; color: var(--ei-text); min-width: 0; }
.ei-manual-content :where(h1, h2, h3, h4) { scroll-margin-top: calc(var(--ei-header) + 24px); }
.ei-manual-content a { color: var(--ei-red); text-decoration: none; }
.ei-manual-content a:hover { text-decoration: underline; text-underline-offset: .15em; }
.ei-manual-content strong { color: #fff; font-weight: 600; }
.ei-manual-content p { margin: 0 0 .9em; }

.ei-kicker { font-size: .72rem; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--ei-red); margin-bottom: 1rem !important; }
.ei-manual-hero { padding-bottom: 2.5rem; border-bottom: 1px solid var(--ei-rule); margin-bottom: 1rem; }
.ei-manual-content h1.ei-manual-title { font-size: clamp(2.6rem, 6vw, 4.2rem); line-height: 1; letter-spacing: -.03em; margin: 0 0 1.4rem; }
.ei-manual-content h1 em, .ei-outro-title em { font-style: normal; color: var(--ei-red); }
.ei-manual-content .ei-lead { font-size: 1.15rem; color: var(--ei-muted); max-width: 40em; }
.ei-manual-actions { margin: 1.6rem 0 2rem; gap: .75rem; }
.ei-manual-actions .wp-block-button__link { border-color: var(--ei-rule); color: var(--ei-text); background: transparent; }
.ei-manual-actions .wp-block-button__link:hover { border-color: var(--ei-text); text-decoration: none; }
.ei-engine-icons { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; max-width: 560px; opacity: .85; }
.ei-engine-icons img { width: 100%; height: auto; display: block; }

/* Chapter opener: tracked label, big headline, short red bar */
.ei-manual-content h2.ei-chapter { counter-increment: chapter; position: relative; font-size: clamp(2rem, 3.6vw, 2.75rem); line-height: 1.05; letter-spacing: -.02em; margin: 5rem 0 2rem; padding-bottom: 1.1rem; }
.ei-manual-content h2.ei-chapter::before { content: "Chapter " counter(chapter, decimal-leading-zero); display: block; font-size: .72rem; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--ei-red); margin-bottom: 1rem; font-family: var(--wp--preset--font-family--manrope, inherit); }
.ei-manual-content h2.ei-chapter::after { content: ""; position: absolute; left: 0; bottom: 0; width: 48px; height: 5px; background: var(--ei-red); }
.ei-manual-content h3 { font-size: 1.45rem; color: var(--ei-red); margin: 2.6em 0 .6em; line-height: 1.2; }
.ei-manual-content h4 { font-size: .74rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; margin: 2.2em 0 .7em; padding-top: 1em; border-top: 1px solid var(--ei-rule); font-family: var(--wp--preset--font-family--manrope, inherit); }

/* Lists with small red squares */
.ei-manual-content ul.wp-block-list { list-style: none; padding: 0; margin: .3em 0 1.2em; }
.ei-manual-content ul.wp-block-list li { position: relative; padding-left: 1.4em; margin-bottom: .35em; }
.ei-manual-content ul.wp-block-list li::before { content: ""; position: absolute; left: .2em; top: .62em; width: 6px; height: 6px; background: var(--ei-red); }

/* Screenshots */
.ei-manual-content .ei-shot { margin: 1.4em 0 1.6em; }
.ei-manual-content .ei-shot img { display: block; width: auto; max-width: 100%; height: auto; max-height: 560px; margin: 0 auto; border-radius: 10px; }
.ei-manual-content .ei-shot.app-overview img { width: 100%; max-height: none; }
.ei-manual-content .ei-shot.tight { margin: .4em 0 .8em; }
.ei-manual-content .ei-shot.tight img { border-radius: 6px; width: 100%; max-height: none; }

/* Quotes and promo boxes */
.ei-manual-content .ei-quote, .ei-manual-content .ei-promo { margin: 1.6em 0; padding: 1.1rem 1.4rem; background: var(--ei-card); border-left: 4px solid var(--ei-red); border-radius: 0 8px 8px 0; font-style: normal; }
.ei-manual-content .ei-quote p:last-child, .ei-manual-content .ei-promo p:last-child { margin-bottom: 0; }
.ei-manual-content .ei-quote::before, .ei-promo-heading { display: block; font-size: .68rem; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--ei-red); margin-bottom: .6rem !important; }
.ei-quote-plaits-manual::before { content: "From the Plaits manual"; }
.ei-quote-creator::before { content: "Elastic Instruments"; }

/* Engine table */
.ei-table-wrap { overflow-x: auto; margin: 1.2em 0 1.6em; }
.ei-table-wrap table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.45; }
.ei-table-wrap thead th { text-align: left; font-size: .68rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; background: #1c1c30; padding: .7rem .9rem; }
.ei-table-wrap td { padding: .6rem .9rem; border-bottom: 1px solid var(--ei-rule); vertical-align: top; }
.ei-table-wrap td:first-child { width: 34%; font-weight: 600; color: #fff; }

/* Footnotes */
.ei-manual-content .fn-ref { font-size: .7em; font-weight: 600; color: var(--ei-red); }
.ei-manual-content .ei-note { margin-top: 2em; padding-top: .8em; border-top: 1px solid var(--ei-rule); font-size: .85rem; color: var(--ei-muted); }
.ei-manual-content .ei-note sup { color: var(--ei-red); font-weight: 600; }

/* Outro */
.ei-manual-outro { margin-top: 6rem; padding: 2.4rem; background: var(--ei-card); border-radius: 12px; }
.ei-manual-content h2.ei-outro-title { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 .6rem; }
.ei-stats { display: flex; gap: 2.5rem; list-style: none; margin: 1.6rem 0; padding: 1rem 0 0; border-top: 1px solid var(--ei-rule); }
.ei-stats b { display: block; font-size: 2rem; line-height: 1; color: #fff; }
.ei-stats span { display: block; margin-top: .3rem; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ei-muted); }

/* ── Mobile: navigation becomes a collapsible bar on top ─────────── */
@media (max-width: 900px) {
  .ei-manual-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .ei-manual-aside { top: 0; z-index: 20; margin: 0 calc(-1 * var(--wp--style--root--padding-left, 24px)) 1.5rem; padding: .8rem var(--wp--style--root--padding-left, 24px); background: rgba(7, 7, 15, .96); border-bottom: 1px solid var(--ei-rule); }
  .ei-toc-box > summary { cursor: pointer; margin: 0; display: flex; justify-content: space-between; align-items: center; }
  .ei-toc-box > summary::after { content: "+"; font-size: 1.1rem; letter-spacing: 0; }
  .ei-toc-box[open] > summary::after { content: "–"; }
  .ei-toc-box[open] .ei-toc-progress { margin-top: .8rem; }
  .ei-toc-box:not([open]) .ei-toc-progress { margin: .6rem 0 0; }
  .ei-toc-list { max-height: 60vh; }
  .ei-manual-content h2.ei-chapter { margin-top: 3.5rem; }
  .ei-engine-icons { grid-template-columns: repeat(8, 1fr); }
}
.ei-toc-current { display: none; }
@media (max-width: 900px) {
  .ei-toc-current { display: inline; margin-left: .6em; letter-spacing: .02em; text-transform: none; font-size: .9rem; font-weight: 600; color: var(--ei-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
  .admin-bar .ei-manual-aside { top: 46px; }
}

/* "View Manual" button next to "Buy Desktop" on product pages */
.wp-block-button.ei-btn-muted .wp-block-button__link { background: transparent; color: rgba(235, 235, 245, .72); border-color: rgba(235, 235, 245, .22); }
.wp-block-button.ei-btn-muted .wp-block-button__link:hover, .wp-block-button.ei-btn-muted .wp-block-button__link:focus-visible { color: #ebebf5; border-color: rgba(235, 235, 245, .55); text-decoration: none; }
