/* --- 1. GLOBAL TYPOGRAPHY & COLORS (brand: Tailwind Orange 500 on black, Inter / Inter Tight 800) --- */
[data-md-color-scheme="slate"][data-md-color-primary="custom"] {
    --md-primary-fg-color: #f97316;
    --md-primary-fg-color--light: #fb923c;
    --md-primary-fg-color--dark: #ea580c;
    --md-primary-bg-color: #ffffff;
    --md-accent-fg-color: #fb923c;
    --md-default-bg-color: #171717;
    --md-default-fg-color: #ffffff;
    --md-typeset-color: #ffffff;
    --md-typeset-a-color: #f97316;
}

/* Base heading styles */
h1, h2, h3, h4, h5, h6 {
    font-family: "Inter Tight", sans-serif !important;
    font-weight: 800 !important;
    color: #ffffff !important;
}

/* --- 2. TOOLBAR: solid black with a hairline, zynk.com-style tabs and pill search --- */
.md-header,
.md-header--shadow {
    background-color: #171717;
    border-bottom: 1px solid #404040;
    box-shadow: none;
}

.md-tabs {
    background-color: transparent;
}

.md-header__title {
    background: linear-gradient(#525252, #525252) left center / 1px 1.2rem no-repeat;
    padding-left: 0.8rem;
}

.md-header__topic:first-child {
    font-weight: 600;
}

.md-tabs__item {
    position: relative;
}

.md-tabs__link {
    opacity: 1;
    color: #a3a3a3;
    font-weight: 500;
    transition: color 0.15s;
}

.md-tabs__link:hover,
.md-tabs__item--active .md-tabs__link {
    color: #ffffff;
}

.md-tabs__item--active::after {
    content: "";
    position: absolute;
    inset-inline: 0.6rem;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: #f97316;
}

@media screen and (min-width: 60em) {
    .md-search__form {
        border-radius: 999px;
        background-color: #262626;
        box-shadow: inset 0 0 0 1px #333333;
    }

    .md-search__form:hover {
        background-color: #404040;
    }

    [data-md-toggle="search"]:checked ~ .md-header .md-search__form {
        border-radius: 0.5rem 0.5rem 0 0;
        background-color: #262626;
    }

    .md-search__output {
        border-radius: 0 0 0.5rem 0.5rem;
    }
}

/* --- 3. NAV TREE: selected page as a padded rounded rect (desktop; the mobile drawer keeps Material's own padding) --- */
@media screen and (min-width: 76.25em) {
    .md-nav--primary .md-nav__link {
        margin-top: 0.15rem;
        padding: 0.3rem 0.6rem;
        border-radius: 0.5rem;
    }

    /* section rows: the container carries the padding, not the link inside it */
    .md-nav--primary .md-nav__container > .md-nav__link {
        margin-top: 0;
        padding: 0;
    }

    .md-nav--primary .md-nav__link:not(.md-nav__link--active):hover {
        background-color: rgb(255 255 255 / 0.05);
    }

    .md-nav--primary .md-nav__link--active,
    .md-nav--primary .md-nav__container:has(> .md-nav__link--active) {
        background-color: rgb(249 115 22 / 0.12);
        color: #fb923c;
    }

    /* section index page: the container is highlighted, not the link inside it too */
    .md-nav--primary .md-nav__container > .md-nav__link--active {
        background-color: transparent;
    }
}

/* --- 4. HOME PAGE WRAPPER --- */
#zynk-home-root {
    max-width: 64rem;
    margin: 0 auto;
}

/* --- 5. TOP DASHBOARD (Navigation Grid - 3 COLUMNS) --- */
#zynk-home-root .grid.cards ul {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

@media (max-width: 960px) {
    #zynk-home-root .grid.cards ul { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
    #zynk-home-root .grid.cards ul { grid-template-columns: 1fr !important; }
}

#zynk-home-root .grid.cards ul li {
    background-color: #262626 !important;
    border: 1px solid #404040 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 200px !important;
    position: relative !important;
    transition: translate 0.15s, border-color 0.15s !important;
    border-radius: 1rem;
    overflow: hidden !important;
}

#zynk-home-root .grid.cards ul li:hover {
    translate: 0 -4px;
    border-color: #525252 !important;
}

#zynk-home-root .grid.cards a {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

#zynk-home-root .grid.cards a::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
}

#zynk-home-root .card-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 15px auto;
    border-radius: 0.6rem;
    background: #404040;
    color: #f97316;
}

#zynk-home-root .card-icon svg {
    width: 28px;
    height: 28px;
}

#zynk-home-root .card-description {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #262626 !important;
    color: #a3a3a3;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    z-index: 5;
    pointer-events: none;
    text-align: center;
}

#zynk-home-root .grid.cards ul li:hover .card-description {
    opacity: 1 !important;
}

/* --- 6. CONNECTOR GRID (Integration cards, matching zynk.com/integrations) --- */
.zynk-custom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.md-typeset .zynk-card {
    display: grid;
    grid-template-columns: 56px 1fr;
    column-gap: 0.75rem;
    align-items: center;
    padding: 0.8rem;
    border: 1px solid #404040;
    border-radius: 1rem;
    background-color: #262626;
    color: #ffffff;
    text-decoration: none;
    transition: translate 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.md-typeset .zynk-card:hover {
    translate: 0 -4px;
    border-color: #f97316;
    box-shadow: 0 0 14px rgb(249 115 22 / 0.25);
    color: #ffffff;
}

.md-typeset .zynk-card .zynk-logo {
    grid-row: span 2;
    width: 56px;
    height: 56px;
    margin: 0;
    padding: 5px;
    border-radius: 0.6rem;
    background: #fafafa;
    object-fit: contain;
}

.md-typeset .zynk-card h4 {
    align-self: end;
    margin: 0;
    font-family: var(--md-text-font-family) !important;
    font-size: 1em;
    font-weight: 700 !important;
    line-height: 1.25;
}

.md-typeset .zynk-card p {
    align-self: start;
    margin: 0.2rem 0 0;
    font-size: 0.85em;
    line-height: 1.4;
    color: #a3a3a3;
}

/* --- 7. CLEANUP --- */
.md-main__inner { margin-top: 0; }
.md-content__article { padding-top: 0; }
.md-content__article h1 { margin-top: 0; }

/* Screenshots: images whose source path contains "/screenshots/" */
.md-typeset img[src*="/screenshots/"] {
    border: 1px solid rgb(249 115 22 / 0.5);
    border-radius: 0.75rem;
    box-shadow: 0 0 25px rgb(249 115 22 / 0.5);
    margin-top: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.md-typeset img[src*="/screenshots/"]:hover {
    box-shadow: 0 0 35px rgb(249 115 22 / 0.7);
}

/* Disable card hover descriptions when search is active */
body:has(#__search:checked) .card-description {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Ensure the search overlay has a higher priority than the grid */
.md-search__inner {
    z-index: 100;
}
