/*
 * Dhole theme. Scoped to body[data-theme~="dhole"], so it cannot leak into
 * other pages even if the file were linked from one.
 *
 * Blending rule: the theme re-points the site's own variables (--brand and
 * friends) rather than restyling components, so the top bar, sidebar, search and
 * panels stay recognisably the Methodox Wiki - only warmer. Everything bespoke is
 * inside the article and prefixed dh-.
 */

body[data-theme~="dhole"] {
    --dh-rust: #e2572b;
    --dh-amber: #f4a259;
    --dh-ink: #2a1a12;
    --dh-teal: #1fa99a;
    --brand: #d9541f;
    --brand-hover: #b9441a;
    --brand-soft: rgba(226, 87, 43, 0.12);
    background:
        radial-gradient(circle at 85% -5%, rgba(244, 162, 89, 0.32), transparent 34%),
        radial-gradient(circle at 10% 0%, rgba(65, 112, 255, 0.18), transparent 30%),
        linear-gradient(180deg, #f3eee9 0%, #eef2fb 42%, #e2edff 100%);
    background-attachment: fixed;
}

/* The sidebar still navigates the whole wiki; it only marks where Dhole is. */
body[data-theme~="dhole"] #grp_grp_root_Libraries_Libraries_Dhole {
    border-left-color: rgba(226, 87, 43, 0.45);
}

body[data-theme~="dhole"] .doc-article {
    border-color: rgba(255, 255, 255, 0.85);
}

/* Pages in this folder carried `img { border: 2px solid #333 }` from Wiki.js days;
   pictures here are diagrams and want a frame, not a border. */
body[data-theme~="dhole"] .doc-article img {
    border: 0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 10px 30px rgba(42, 26, 18, 0.10);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

    body[data-theme~="dhole"] .doc-article img:hover {
        transform: translateY(-2px);
        box-shadow: 0 16px 38px rgba(42, 26, 18, 0.16);
    }

body[data-theme~="dhole"] .doc-article h2 {
    position: relative;
    padding-bottom: 6px;
}

    body[data-theme~="dhole"] .doc-article h2::after {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        width: 48px;
        height: 3px;
        border-radius: 3px;
        background: linear-gradient(90deg, var(--dh-rust), var(--dh-amber));
    }

body[data-theme~="dhole"] .doc-article thead th {
    background: linear-gradient(180deg, rgba(244, 162, 89, 0.14), rgba(244, 162, 89, 0.06));
}

/* ------------------------------------------------------ Dhole source blocks */

body[data-theme~="dhole"] pre.dh-source {
    position: relative;
    padding-top: 0;
    border: 1px solid rgba(244, 162, 89, 0.18);
    background:
        radial-gradient(circle at 100% 0%, rgba(226, 87, 43, 0.20), transparent 45%),
        #17110f;
}

.dh-source__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 -15px 10px;
    padding: 7px 10px 7px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font: 600 0.72rem Inter, system-ui, sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dh-source__lang {
    color: var(--dh-amber);
}

.dh-source__kind {
    padding: 1px 7px;
    border-radius: 99px;
    background: rgba(244, 162, 89, 0.14);
    color: #ffd2a8;
    text-transform: none;
    letter-spacing: 0;
}

.doc-article__body a.dh-source__try {
    margin-left: auto;
    padding: 3px 9px;
    border-radius: 6px;
    background: rgba(244, 162, 89, 0.18);
    color: #ffd2a8;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    text-decoration: none;
}

    .doc-article__body a.dh-source__try:hover {
        background: rgba(244, 162, 89, 0.32);
        color: #fff;
    }

.dh-source__try + .dh-source__copy {
    margin-left: 0;
}

.dh-source__copy {
    margin-left: auto;
    padding: 3px 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #d9c7bb;
    font: inherit;
    cursor: pointer;
}

    .dh-source__copy:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
    }

/* Warmer token colours inside Dhole blocks; other languages keep the site's. */
pre.dh-source .tok-keyword { color: #ff9b6a; font-weight: 600; }
pre.dh-source .tok-variable { color: #f6e7da; }
pre.dh-source .tok-operator { color: #f4a259; }
pre.dh-source .tok-attribute { color: #6fd6c8; }
pre.dh-source .tok-string { color: #ffd479; }
pre.dh-source .tok-markup { color: #f6e7da; }

/* ------------------------------------------------- "you write / Dhole draws" */

.dh-pair {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 0;
    margin: 20px 0 24px;
    overflow: hidden;
    border: 1px solid rgba(42, 26, 18, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 18px 44px rgba(42, 26, 18, 0.10);
}

    .dh-pair pre.dh-source {
        height: calc(100% - 30px);
        margin: 0;
        border: 0;
        border-radius: 0;
    }

.dh-pair__write {
    background: #17110f;
}

.dh-pair__get {
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 14px;
    background:
        linear-gradient(rgba(42, 26, 18, 0.04) 1px, transparent 1px) 0 0 / 18px 18px,
        linear-gradient(90deg, rgba(42, 26, 18, 0.04) 1px, transparent 1px) 0 0 / 18px 18px,
        #fffdfb;
}

    body[data-theme~="dhole"] .dh-pair__get img {
        max-height: 460px;
        width: auto;
        box-shadow: none;
        background: transparent;
    }

.dh-pair__label {
    padding: 8px 15px;
    font: 700 0.7rem Inter, system-ui, sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dh-pair__write .dh-pair__label {
    color: #b9a596;
}

.dh-pair__get .dh-pair__label {
    justify-self: start;
    padding: 0 0 8px;
    color: var(--brand);
}

.dh-pair figcaption {
    grid-column: 1 / -1;
    padding: 9px 15px;
    border-top: 1px solid rgba(42, 26, 18, 0.06);
    color: var(--muted);
    font-size: 0.82rem;
}

.dh-pair--stacked {
    grid-template-columns: minmax(0, 1fr);
}

    .dh-pair--stacked pre.dh-source {
        height: auto;
    }

@media (max-width: 900px) {
    .dh-pair {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ----------------------------------------------------------------- hero */

.dh-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 28px;
    align-items: center;
    margin: -26px -30px 26px;
    padding: 44px 30px 38px;
    overflow: hidden;
    border-bottom: 1px solid rgba(42, 26, 18, 0.06);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background:
        radial-gradient(circle at 0% 0%, rgba(244, 162, 89, 0.22), transparent 45%),
        radial-gradient(circle at 100% 100%, rgba(63, 111, 255, 0.14), transparent 45%),
        linear-gradient(rgba(42, 26, 18, 0.035) 1px, transparent 1px) 0 0 / 22px 22px,
        linear-gradient(90deg, rgba(42, 26, 18, 0.035) 1px, transparent 1px) 0 0 / 22px 22px;
}

.dh-hero__eyebrow {
    display: inline-flex;
    padding: 5px 11px;
    border-radius: 99px;
    background: rgba(226, 87, 43, 0.1);
    color: var(--brand);
    font-size: 0.74rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.doc-article .dh-hero__title {
    margin: 14px 0 10px;
    font-size: clamp(3.2rem, 6vw, 5.2rem);
    font-weight: 850;
    letter-spacing: -0.055em;
    line-height: 0.95;
    background: linear-gradient(100deg, var(--dh-rust) 10%, var(--dh-amber) 45%, #3f6fff 95%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: dh-shine 8s ease-in-out infinite alternate;
}

@keyframes dh-shine {
    to { background-position: 100% 50%; }
}

.doc-article .dh-hero__lead {
    max-width: 34em;
    margin: 0;
    color: #4a3a30;
    font-size: 1.12rem;
    line-height: 1.6;
}

.dh-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.doc-article__body a.dh-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border: 1px solid rgba(42, 26, 18, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--dh-ink);
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .doc-article__body a.dh-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(42, 26, 18, 0.12);
    }

.doc-article__body a.dh-btn--primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--dh-rust), #f0803c);
    box-shadow: 0 10px 24px rgba(226, 87, 43, 0.28);
    color: #fff;
}

.doc-article__body a.dh-btn--ghost {
    border-color: transparent;
    background: transparent;
    color: var(--brand);
}

.dh-hero__demo {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    min-height: 330px;
    overflow: hidden;
    border: 1px solid rgba(42, 26, 18, 0.1);
    border-radius: 14px;
    background: #fffdfb;
    box-shadow: 0 30px 70px rgba(42, 26, 18, 0.18), 0 0 0 6px rgba(255, 255, 255, 0.5);
}

.dh-hero__editor {
    display: flex;
    flex-direction: column;
    background: #17110f;
}

.dh-hero__dots {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #8f7b6e;
    font: 600 0.7rem ui-monospace, Menlo, Consolas, monospace;
}

    .dh-hero__dots i {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: #ff6159;
    }

        .dh-hero__dots i:nth-child(2) { background: #ffbd2e; }
        .dh-hero__dots i:nth-child(3) { background: #28c941; }

    .dh-hero__dots span {
        margin-left: 6px;
    }

.doc-article pre.dh-hero__code {
    flex: 1;
    margin: 0;
    padding: 12px 14px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    white-space: pre-wrap;
    word-break: break-word;
}

    .dh-hero__code code {
        color: #f6e7da;
        font-size: 0.78rem;
        line-height: 1.75;
    }

    .dh-hero__code .tok-keyword { color: #ff9b6a; font-weight: 600; }
    .dh-hero__code .tok-variable { color: #f6e7da; }
    .dh-hero__code .tok-operator { color: #f4a259; }
    .dh-hero__code .tok-attribute { color: #6fd6c8; }
    .dh-hero__code .tok-string { color: #ffd479; }
    .dh-hero__code .tok-markup { color: #f6e7da; }

.dh-caret {
    display: inline-block;
    width: 7px;
    height: 1.05em;
    margin-left: 1px;
    vertical-align: text-bottom;
    background: var(--dh-amber);
    animation: dh-blink 1s steps(1) infinite;
}

@keyframes dh-blink {
    50% { opacity: 0; }
}

.dh-hero__canvas {
    display: grid;
    place-items: center;
    padding: 10px;
    background:
        radial-gradient(circle, rgba(42, 26, 18, 0.10) 1px, transparent 1.4px) 0 0 / 16px 16px,
        #fffdfb;
}

/* Dhole's own drawing of what has been typed, when the public build could be loaded: as large as the pane allows, never larger than drawn. */
.dh-hero__canvas--live {
    padding: 12px;
}

    .dh-hero__canvas--live svg {
        display: block;
        max-width: 100%;
        max-height: 340px;
        width: auto;
        height: auto;
        border-radius: 6px;
        box-shadow: 0 2px 10px rgba(42, 26, 18, 0.08);
    }

.dh-diagram {
    width: 100%;
    max-width: 440px;
    height: auto;
    overflow: visible;
}

.dh-d__title {
    fill: var(--dh-ink);
    font: 800 15px Inter, system-ui, sans-serif;
}

.dh-d__edge {
    fill: none;
    stroke: #5d6b82;
    stroke-width: 1.8;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
}

.dh-d__label {
    fill: #5d6b82;
    font: 600 11px Inter, system-ui, sans-serif;
    opacity: 0;
    transition: opacity 0.4s 0.3s;
}

.dh-d__node rect,
.dh-d__node path {
    fill: #fff3e8;
    stroke: var(--dh-rust);
    stroke-width: 1.6;
}

.dh-d__node text {
    fill: var(--dh-ink);
    font: 600 13.5px Inter, system-ui, sans-serif;
    text-anchor: middle;
}

.dh-d__node--start rect { fill: #e8efff; stroke: #3f6fff; }
.dh-d__node--ask path { fill: #fff8d9; stroke: #d79b00; }
.dh-d__node--ask text { font-size: 12px; }
.dh-d__node--good rect { fill: #dcf5ea; stroke: #19a06d; }

.dh-diagram [data-part] {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
    transform-box: fill-box;
    transform-origin: center;
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

    .dh-diagram [data-part].is-shown {
        opacity: 1;
        transform: none;
    }

        .dh-diagram [data-part].is-shown .dh-d__edge {
            stroke-dashoffset: 0;
            transition: stroke-dashoffset 0.6s ease;
        }

        .dh-diagram [data-part].is-shown .dh-d__label {
            opacity: 1;
        }

@media (max-width: 1100px) {
    .dh-hero {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .dh-hero {
        margin: -17px -17px 20px;
        padding: 28px 17px;
    }

    .dh-hero__demo {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ------------------------------------------------------------ kind cards */

.dh-kinds {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin: 16px 0 8px;
}

.doc-article__body a.dh-kind,
.dh-kind {
    position: relative;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 11px;
    align-items: center;
    padding: 14px;
    overflow: hidden;
    border: 1px solid rgba(42, 26, 18, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--dh-ink);
    font-weight: 400;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

    .doc-article__body a.dh-kind:hover {
        border-color: rgba(226, 87, 43, 0.35);
        box-shadow: 0 14px 30px rgba(42, 26, 18, 0.12);
        transform: translateY(-3px);
        color: var(--dh-ink);
    }

    .dh-kind::after {
        content: "→";
        position: absolute;
        top: 12px;
        right: 13px;
        color: var(--brand);
        opacity: 0;
        transform: translateX(-4px);
        transition: opacity 0.18s, transform 0.18s;
    }

    a.dh-kind:hover::after {
        opacity: 1;
        transform: none;
    }

.dh-kind__icon {
    grid-row: 1 / span 2;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(226, 87, 43, 0.14), rgba(244, 162, 89, 0.10));
    color: var(--dh-rust);
}

.dh-kind:nth-child(3n + 2) .dh-kind__icon {
    background: linear-gradient(135deg, rgba(63, 111, 255, 0.14), rgba(63, 111, 255, 0.06));
    color: #3f6fff;
}

.dh-kind:nth-child(3n) .dh-kind__icon {
    background: linear-gradient(135deg, rgba(31, 169, 154, 0.16), rgba(31, 169, 154, 0.06));
    color: var(--dh-teal);
}

.dh-kind__name {
    padding-right: 14px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

.dh-kind__words {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
}

    .dh-kind__words code {
        font-size: 0.74rem;
    }

/* ----------------------------------------------------- kind page title */

.dh-title__kicker a {
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
}

.doc-article h1.dh-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
}

.dh-title__badge {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--dh-rust), var(--dh-amber));
    box-shadow: 0 10px 22px rgba(226, 87, 43, 0.3);
    color: #fff;
}

    .dh-title__badge svg {
        width: 30px;
        height: 30px;
    }

/* --------------------------------------------------------- scroll reveal */

.dh-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

    .dh-reveal.dh-in {
        opacity: 1;
        transform: none;
    }

@media (prefers-reduced-motion: reduce) {
    .doc-article .dh-hero__title,
    .dh-caret {
        animation: none;
    }

    .dh-reveal {
        opacity: 1;
        transform: none;
    }
}
