/* Testadura color accents exposed to Markdown content. */
.td-green,
.td-imsd-identify {
    color: var(--td-green);
}

.td-red,
.td-imsd-model {
    color: var(--td-red);
}

.td-yellow,
.td-imsd-solve {
    color: var(--td-yellow);
}

.td-blue,
.td-imsd-deliver {
    color: var(--td-blue);
}

.td-muted {
    color: var(--td-text-muted);
}

.td-callout,
.td-note,
.td-warning,
.td-technical {
    margin: 2rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--td-border);
    border-left-width: 4px;
    background: var(--td-surface);
}

.td-callout,
.td-note {
    border-left-color: var(--td-blue);
}

.td-warning {
    border-left-color: var(--td-yellow);
}

.td-technical {
    border-left-color: var(--td-green);
}

.td-image-product {
    display: block;
    width: min(320px, 70%);
    margin: 2rem auto;
}

.td-image-portrait {
    display: block;
    width: min(220px, 60%);
    margin: 2rem 0;
}

.content-home > p:first-of-type {
    max-width: 900px;
    font-size: var(--td-font-lead);
    line-height: var(--td-line-height);
}

.article-list {
    margin-top: 2rem;
    display: grid;
    gap: 1rem;
}

.article-card {
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--td-border);
    border-radius: 6px;
    background: #ffffff;
}

.article-card h2,
.article-card h3 {
    margin-top: 0;
}

.language-selector {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.55rem;
}

.language-option {
    width: 2rem;
    height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--td-border);
    border-radius: 2px;
    background: #ffffff;
    opacity: 0.65;
    overflow: hidden;
    text-decoration: none;
    transition: opacity 120ms ease, box-shadow 120ms ease;
}

.language-option:hover,
.language-option:focus-visible {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.language-option[aria-current="page"] {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--td-border);
}

.language-flag {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.language-code {
    color: var(--td-text-muted);
    font-size: 0.7rem;
    font-weight: 650;
}

/*
 * Author-facing Markdown layout primitives.
 *
 * These classes are emitted through ::: component blocks in Markdown. Keep
 * them generic: content authors should be able to compose page layouts without
 * writing HTML or knowing the generated document structure.
 */
.td-grid {
    margin: 2rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: 1rem;
}

.td-tile {
    min-width: 0;
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--td-border);
    border-left: 3px solid var(--td-red);
    border-radius: 6px;
    background: var(--td-surface);
}

.td-tile > :first-child {
    margin-top: 0;
}

.td-tile > :last-child {
    margin-bottom: 0;
}

.td-tile h2,
.td-tile h3 {
    font-size: 1.25rem;
}

.td-gallery {
    margin: 2rem 0;
    padding: 0.25rem 0 0.75rem;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
}

.td-gallery > p {
    margin: 0;
    flex: 0 0 min(84%, 46rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.td-gallery img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--td-border);
    border-radius: 6px;
    background: var(--td-surface);
}

@media (max-width: 720px) {
    .td-gallery > p {
        flex-basis: 92%;
    }
}

/*
 * IMSD cards used on the Testadura home page.
 *
 * The four cards reuse the generic grid/tile primitives but add a small
 * logo-inspired point, an IMSD accent color, concise italic copy, and a
 * compact read-more action. The card-specific classes only select the accent;
 * the authoring structure remains ordinary Testadura Markdown components.
 */
.td-imsd-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.td-imsd-card {
    --td-imsd-accent: var(--td-red);
    display: flex;
    min-height: 13rem;
    flex-direction: column;
    border-left-color: var(--td-imsd-accent);
}

.td-imsd-identify-card {
    --td-imsd-accent: var(--td-green);
}

.td-imsd-model-card {
    --td-imsd-accent: var(--td-red);
}

.td-imsd-solve-card {
    --td-imsd-accent: var(--td-yellow);
}

.td-imsd-deliver-card {
    --td-imsd-accent: var(--td-blue);
}

.td-imsd-card h3 {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.8rem;
}

.td-imsd-card h3::before {
    content: "";
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 0.9rem;
    background: var(--td-imsd-accent);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
    box-shadow: inset -0.18rem -0.18rem 0 rgba(0, 0, 0, 0.12);
}

.td-imsd-copy {
    color: var(--td-text-muted);
    line-height: 1.5;
}

.td-imsd-copy p {
    margin: 0;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.td-read-more {
    margin-top: auto;
    padding-top: 1.1rem;
}

.td-read-more p {
    margin: 0;
}

.td-read-more a {
    display: inline-block;
    padding: 0.42rem 0.75rem;
    border: 1px solid var(--td-imsd-accent, var(--td-blue));
    border-radius: 4px;
    color: var(--td-imsd-accent, var(--td-blue));
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease;
}

.td-read-more a:hover,
.td-read-more a:focus-visible {
    color: #ffffff;
    background: var(--td-imsd-accent, var(--td-blue));
}


@media (max-width: 620px) {
    .td-imsd-grid {
        grid-template-columns: 1fr;
    }

    .td-imsd-card {
        min-height: 0;
    }
}

/* Index components share source images with page heroes and manual tiles. */
.index-card-media { display: block; margin: -1rem -1rem 1rem; overflow: hidden; aspect-ratio: 16 / 9; }
.index-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.index-rows { display: grid; gap: 0; margin: 1.25rem 0 2rem; }
.index-row { display: flex; align-items: center; gap: 1.15rem; padding: 1rem 0; border-bottom: 1px solid var(--td-border); text-decoration: none; color: inherit; }
.index-row:hover strong, .index-row:focus-visible strong { text-decoration: underline; }
.index-row-image { flex: 0 0 7.5rem; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px; background: var(--td-surface); }
.index-row-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.index-row-content { min-width: 0; flex: 1; display: grid; gap: .3rem; }
.index-row-content strong { color: var(--td-blue); font-size: 1.08rem; }
.index-row-content time { color: var(--td-text-muted); font-size: .82rem; }
.index-row-content p { margin: 0; color: var(--td-text-muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.index-row-arrow { color: var(--td-blue); font-size: 1.5rem; }
/* An image in a manually curated tile requires no extra wrapper or metadata. */
.td-tile > p > img, .td-imsd-card > p > img { width: 100%; max-height: 11rem; object-fit: cover; display: block; border-radius: 4px; }
@media (max-width: 520px) { .index-row { gap: .75rem; } .index-row-image { flex-basis: 5.5rem; } }

/*
 * A horizontal container for reusable tiles, ordinary Markdown images, or both.
 * The same td-tile markup works in td-grid and td-slider/td-gallery; scrolling
 * stays native (keyboard, touch and trackpad) with no script dependency.
 */
.td-slider {
    margin: 2rem 0;
    padding: 0.25rem 0 0.75rem;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    align-items: stretch;
}

.td-slider > .td-tile,
.td-gallery > .td-tile {
    flex: 0 0 min(78%, 21rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    box-sizing: border-box;
}

.td-slider > p {
    margin: 0;
    flex: 0 0 min(78%, 21rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.td-slider > p > img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--td-border);
    border-radius: 6px;
    background: var(--td-surface);
}

@media (max-width: 720px) {
    .td-slider > .td-tile,
    .td-gallery > .td-tile,
    .td-slider > p {
        flex-basis: min(88%, 19rem);
    }
}

/* A live component demo and its single-source Markdown reference. */
.td-example { margin: 1.5rem 0 2rem; }
.td-example-source { margin-top: .8rem; border: 1px solid var(--td-border, #ccc); border-radius: 6px; overflow: hidden; }
.td-example-source > summary { cursor: pointer; padding: .7rem 1rem; font-weight: 600; }
.td-example-source > summary:hover { background: var(--td-surface, #f5f5f5); }
.td-example-source > pre { margin: 0; padding: 1rem; overflow-x: auto; border-top: 1px solid var(--td-border, #ccc); }

/* Homepage hero band: full available width, intrinsic aspect ratio.
 * A shallow image, rather than cropping, controls the hero height. */
.content-home > p:first-of-type {
    max-width: none;
    font-size: inherit;
    line-height: var(--td-line-height);
    margin: 0;
    padding: 0;
}
.content-home .home-hero-image {
    display: block;
    width: var(--td-home-hero-width);
    height: auto;
    max-width: 100%;
    object-fit: contain;
    margin-inline: auto;
    margin-bottom: 1.5rem;
    border-radius: 0;
}
.featured-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.featured-heading h2 { margin: 0; }
.featured-controls { display: flex; gap: .45rem; }
.featured-controls button { font: inherit; font-size: 1.65rem; line-height: 1; background: var(--td-surface); color: var(--td-text); border: 1px solid var(--td-border); border-radius: 5px; cursor: pointer; padding: .15rem .65rem .3rem; }
.featured-controls button:hover { background: var(--td-border); }
@media (min-width: 1300px) { .featured-slider { grid-auto-columns: minmax(15rem, calc((100% - 2rem) / 3)); } }

/* Homepage-only presentation: full-width artwork and a restrained editorial lead.
 * Keep text within a readable measure; do not change ordinary article layouts.
 */
.site-main:has(.content-home) > .site-main-body { padding: 0; }
.site-main:has(.content-home) .content-home { width: 100%; max-width: none; }
.content-home > h2,
.content-home > p:not(:first-of-type),
.content-home > .featured-content {
    width: min(100% - 2 * clamp(1.25rem, 5vw, 5rem), var(--td-home-content-width));
    margin-left: auto; margin-right: auto;
}
.content-home > h2 { margin-top: var(--td-home-intro-top-space); margin-bottom: 0.65rem; }
.content-home > p:not(:first-of-type) { line-height: var(--td-line-height); margin-top: 0; margin-bottom: var(--td-home-intro-paragraph-gap); }
.content-home > h2:first-of-type ~ p:not(:last-of-type) {
    font-size: var(--td-font-lead);
    font-style: italic;
    color: var(--td-text-muted);
}
/* Without a .home-intro HTML wrapper, this margin is the adjustable
 * bottom space of the intro band. A future generator wrapper can support
 * an exact independent intro min-height. */
.content-home > .featured-content {
    margin-top: var(--td-home-intro-bottom-space);
    margin-bottom: 2rem;
    min-height: var(--td-home-featured-min-height);
}
.featured-heading { margin-bottom: 1rem; }
.featured-slider {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 2rem) / 3);
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    padding: .15rem .1rem 1rem;
    align-items: stretch;
}
.featured-card {
    scroll-snap-align: start;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--td-border);
    border-radius: 8px;
    background: var(--td-background, #fff);
}
.featured-card-media { display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--td-surface); }
.featured-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.featured-card-body { flex: 1; display: flex; flex-direction: column; gap: .65rem; padding: 1rem; }
.featured-card-body h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.featured-card-summary { margin: 0; color: var(--td-text-muted); font-size: .9rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.featured-card-more { margin-top: auto; padding-top: .35rem; font-size: .9rem; }
@media (max-width: 1100px) { .featured-slider { grid-auto-columns: calc((100% - 1rem) / 2); } }
/* At the same breakpoint as the mobile site shell, use a single, full-width
 * slide. Flex items cannot collapse into narrow grid columns on small screens.
 * The existing arrow navigation and touch scroll-snap continue to work.
 */
@media (max-width: 820px) {
    .content-home .featured-slider {
        display: flex;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .content-home .featured-slider > .featured-card {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}

/* Private Markdown upload page (server-side auth is required). */
.td-upload-dropzone { margin: 1rem 0; border: 2px dashed currentColor; border-radius: .65rem; padding: 2rem; cursor: pointer; }
.td-upload-dropzone.active { background: rgba(100, 100, 100, .1); }

/* Media/text editorial layout: image left by default, responsive vertical flow.
 * Image sizing is optional; inline pixel dimensions may override defaults. */
.td-image-text { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: clamp(1rem, 3vw, 2rem); align-items: center; margin: 2rem 0; }
.td-image-text-right { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.td-image-text-image { min-width: 0; }
.td-image-text-sized { grid-template-columns: auto minmax(0, 1fr); }
.td-image-text-sized.td-image-text-right { grid-template-columns: minmax(0, 1fr) auto; }
.td-image-text-right > .td-image-text-image { order: 2; }
.td-image-text-image img { display: block; width: 100%; height: auto; object-fit: contain; }
.td-image-text-content { min-width: 0; }
@media (max-width: 720px) { .td-image-text, .td-image-text-right, .td-image-text-sized, .td-image-text-sized.td-image-text-right { grid-template-columns: minmax(0, 1fr); } .td-image-text-right > .td-image-text-image { order: 0; } }
/* Explicit image dimensions from Markdown are inline styles, allowing authored
 * sizes in tiles and galleries to override default full-width image rules. */
/* Native, keyboard-accessible details without JavaScript. */
.td-details { border: 1px solid var(--td-border); border-radius: 6px; margin: 1.4rem 0; overflow: hidden; }
.td-details > summary { cursor: pointer; padding: .75rem 1rem; font-weight: 600; background: var(--td-surface); }
.td-details > summary:hover { filter: brightness(.97); }
.td-details-body { padding: .2rem 1rem 1rem; }
.td-details-body > :last-child { margin-bottom: 0; }
/* Product and logo artwork can opt out of featured thumbnail cropping. */
.featured-card-media--contain img { object-fit: contain; }

/* Showcase-only compact image gallery: do not change article galleries. */
.td-gallery-compact > p { flex-basis: min(55%, 23rem); }
@media (max-width: 720px) { .td-gallery-compact > p { flex-basis: min(75%, 19rem); } }

/* Compact, inline social-profile logos used as linked Markdown images. */
a > img[src="/images/linkedin.svg"],
a > img[src="/images/github.svg"] {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.45rem;
    vertical-align: middle;
}
