/* Consulting section: the technical-writing hub and its article pages.
   Depends on css/shared.css for variables, header, footer, and reset. */

.nav-active {
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.eng-hero {
    padding: 130px 0 40px;
    text-align: center;
    background: radial-gradient(ellipse at center, rgba(147, 51, 234, 0.12) 0%, transparent 70%);
}

.eng-hero .container {
    max-width: 900px;
}

.eng-kicker {
    display: inline-block;
    background: rgba(147, 51, 234, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(147, 51, 234, 0.35);
    padding: 0.35rem 0.9rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

/* On article pages the kicker is the way back up to the section hub, so it is an
   anchor rather than a span. */
.eng-kicker-link {
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.eng-kicker-link:hover {
    background: rgba(147, 51, 234, 0.28);
    border-color: var(--primary-color);
}

.eng-hero h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.eng-standfirst {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 740px;
    margin: 0 auto 2rem;
}

.eng-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem 1.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.eng-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Layout: sticky contents rail + article ──────────────────────────────── */
.eng-main {
    padding: 20px 0 80px;
}

.eng-layout {
    display: block;
}

.eng-toc {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 2.5rem;
}

.eng-toc h2 {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin-bottom: 0.9rem;
}

.eng-toc ol {
    list-style: none;
    counter-reset: toc;
    margin: 0;
    padding: 0;
}

.eng-toc li {
    counter-increment: toc;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
}

.eng-toc li::before {
    content: counter(toc) ".";
    color: var(--primary-color);
    font-weight: 700;
    margin-right: 0.45rem;
}

.eng-toc a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.eng-toc a:hover {
    color: var(--text-light);
}

/* ── Article body ────────────────────────────────────────────────────────── */
.eng-article {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem 3.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    min-width: 0;
    overflow-wrap: anywhere;
}

.eng-article h2 {
    font-size: 1.6rem;
    color: var(--secondary-color);
    margin: 3rem 0 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    scroll-margin-top: 100px;
}

.eng-article > h2:first-child {
    margin-top: 0;
}

.eng-article h3 {
    font-size: 1.15rem;
    color: var(--text-light);
    margin: 2rem 0 0.75rem;
    scroll-margin-top: 100px;
}

.eng-article p {
    color: var(--text-muted);
    margin-bottom: 1.15rem;
}

.eng-article strong {
    color: var(--text-light);
    font-weight: 600;
}

.eng-article em {
    color: var(--text-light);
}

.eng-article ul,
.eng-article ol {
    margin: 0 0 1.35rem 1.5rem;
    color: var(--text-muted);
}

.eng-article li {
    margin-bottom: 0.6rem;
    padding-left: 0.3rem;
}

.eng-article a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-word;
    transition: color 0.2s ease;
}

.eng-article a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Inline code in prose. Long tokens (error strings, preprocessor lists) must wrap
   on narrow viewports instead of overflowing the article / callout. */
.eng-article p code,
.eng-article li code,
.eng-article td code,
.eng-article h3 code {
    font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 0.87em;
    background: rgba(147, 51, 234, 0.12);
    border: 1px solid rgba(147, 51, 234, 0.22);
    border-radius: 5px;
    padding: 0.1em 0.38em;
    color: var(--text-light);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* ── Code blocks ─────────────────────────────────────────────────────────── */
.code-block {
    background: #05070C;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 1.6rem 0 1.9rem;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.code-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.55rem 1rem;
    background: rgba(147, 51, 234, 0.08);
    border-bottom: 1px solid var(--border-color);
}

.code-lang {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--secondary-color);
    flex-shrink: 0;
}

.code-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    overflow-wrap: anywhere;
}

.code-block pre {
    margin: 0;
    padding: 1.15rem 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.code-block code,
.code-block pre code.hljs {
    font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Courier New", monospace;
    font-size: 0.84rem;
    line-height: 1.65;
    background: transparent;
    padding: 0;
    border: none;
    white-space: pre;
    color: #D7DCE6;
}

/* Let the panel background show through the highlight.js theme */
.code-block .hljs {
    background: transparent !important;
    padding: 0 !important;
}

.code-caption {
    display: block;
    margin: -1.4rem 0 1.9rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Callout ─────────────────────────────────────────────────────────────── */
.eng-callout {
    background: rgba(147, 51, 234, 0.08);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-left: 4px solid var(--primary-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1.75rem 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.eng-callout p:last-child {
    margin-bottom: 0;
}

.eng-callout .eng-callout-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* ── Process-flow diagram ────────────────────────────────────────────────── */
.eng-flow {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.flow-node {
    flex: 1 1 180px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 1.1rem 1.15rem;
    text-align: center;
}

.flow-node strong {
    display: block;
    color: var(--text-light);
    font-size: 0.98rem;
    margin-bottom: 0.35rem;
}

.flow-node span {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.flow-node .flow-tag {
    display: inline-block;
    margin-bottom: 0.6rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--primary-color);
}

.flow-arrow {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    font-size: 1.3rem;
    flex: 0 0 auto;
}

/* ── Takeaways list ──────────────────────────────────────────────────────── */
.eng-takeaways {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
}

.eng-takeaways li {
    position: relative;
    padding: 0 0 0 1.9rem;
    margin-bottom: 1rem;
}

.eng-takeaways li::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary-color);
    font-weight: 700;
}

/* ── Author / contact card ───────────────────────────────────────────────── */
.eng-author {
    max-width: 900px;
    margin: 3rem auto 0;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.12), rgba(168, 85, 247, 0.04));
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 16px;
    padding: 2.25rem 2.5rem;
}

.eng-author h2 {
    font-size: 1.35rem;
    color: var(--text-light);
    margin-bottom: 0.9rem;
}

.eng-author p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.eng-author ul {
    color: var(--text-muted);
    margin: 0 0 1.35rem 1.5rem;
}

.eng-author li {
    margin-bottom: 0.5rem;
}

.eng-author strong {
    color: var(--text-light);
}

.eng-author-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ── Wide screens: sticky contents rail beside the article ──────────────── */
@media (min-width: 1080px) {
    .eng-main .container {
        max-width: 1180px;
    }

    .eng-layout {
        display: grid;
        grid-template-columns: 250px minmax(0, 1fr);
        gap: 3rem;
        align-items: start;
    }

    .eng-toc {
        position: sticky;
        top: 96px;
        margin-bottom: 0;
        max-height: calc(100vh - 130px);
        overflow-y: auto;
    }
}

@media (max-width: 1079px) {
    .eng-main .container {
        max-width: 900px;
    }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .eng-hero {
        padding: 110px 0 30px;
    }

    .eng-hero h1 {
        font-size: 2.1rem;
    }

    .eng-standfirst {
        font-size: 1.08rem;
    }

    .eng-article {
        padding: 1.75rem 1.25rem;
    }

    .eng-article h2 {
        font-size: 1.35rem;
        margin-top: 2.25rem;
    }

    .code-block pre {
        padding: 0.9rem 1rem;
    }

    .code-block code,
    .code-block pre code.hljs {
        font-size: 0.78rem;
    }

    .code-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .code-note {
        text-align: left;
    }

    .eng-author {
        padding: 1.75rem 1.35rem;
    }

    .flow-arrow {
        transform: rotate(90deg);
        justify-content: center;
        width: 100%;
    }
}
