/* 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: clamp(1.2rem, 2.4vw, 1.7rem);
    line-height: 1.55;
}

.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%;
    }
}

/* Optional compact image gallery; keeps example images readable without
 * resizing every gallery on authored websites. */
.td-gallery.td-gallery-compact > p {
    flex-basis: min(72%, 16rem);
}

/*
 * 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;
    }
}

/*
 * Curated home-page Featured slider.
 *
 * Featured items are configured in config/featured.cfg. The strip uses native
 * horizontal scrolling and scroll snapping: two tiles are visible on normal
 * desktop content widths, while smaller screens expose one prominent tile at a
 * time. No automatic motion is used.
 */
.featured-content {
    margin-top: 3rem;
}

.featured-slider {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(18rem, calc((100% - 1rem) / 2));
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 0 0 0.75rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
}

.featured-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    border: 1px solid var(--td-border);
    border-radius: 6px;
    background: var(--td-surface);
}

.featured-card-media {
    min-height: 10rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--td-border);
    background: #ffffff;
}

.featured-card-media img {
    display: block;
    width: 100%;
    height: 10rem;
    object-fit: contain;
}

.featured-card-body {
    min-height: 11rem;
    display: flex;
    flex-direction: column;
    padding: 1.15rem 1.25rem 1.25rem;
}

.featured-card h3 {
    margin: 0 0 0.7rem;
    font-size: 1.25rem;
}

.featured-card h3 a {
    color: var(--td-text);
    text-decoration: none;
}

.featured-card h3 a:hover,
.featured-card h3 a:focus-visible {
    text-decoration: underline;
}

.featured-card-summary {
    margin: 0;
    color: var(--td-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.featured-card-more {
    align-self: flex-start;
    margin-top: auto;
    padding-top: 1rem;
    font-weight: 650;
    text-decoration: none;
}

.featured-card-more:hover,
.featured-card-more:focus-visible {
    text-decoration: underline;
}

@media (max-width: 720px) {
    .featured-slider {
        grid-auto-columns: minmax(17rem, 88%);
    }
}

/* 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); }

/* Image-and-text component emitted by the existing WCM Markdown parser. */
.td-image-text { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; margin: 1.5rem 0; }
.td-image-text-right { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.td-image-text-right .td-image-text-image { order: 2; }
.td-image-text-image img { max-width: 100%; height: auto; }
@media (max-width: 700px) { .td-image-text, .td-image-text-right { grid-template-columns: minmax(0, 1fr); } .td-image-text-right .td-image-text-image { order: initial; } }

/* Fallback palette for standalone documentation websites. */
:root { --td-green: #33865a; --td-red: #b63d42; --td-yellow: #ad802b; --td-blue: #3269a6; --td-text-muted: #647084; --td-border: #d6dce2; --td-surface: #f7f8fa; }
