.tagrid-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--wp--preset--spacing--20, 0.5rem);
    max-width: 900px;
    margin-inline: auto;
}

.tagrid-grid__item {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background-color: #f8fafc;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    text-decoration: none;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.2s, transform 0.2s;
}

.tagrid-grid__item:hover {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    transform: scale(1.03);
}

.tagrid-grid__item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.1) 50%, transparent 100%);
    z-index: 1;
}

.tagrid-grid__label {
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: var(--wp--preset--font-size--medium, 1rem);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    padding: var(--wp--preset--spacing--20, 0.5rem);
    text-align: center;
    width: 100%;
}

.tagrid-grid__label a {
    color: #fff;
    text-decoration: none;
}

@media (prefers-color-scheme: dark) {
    .tagrid-single__card {
        background: #1d1f21;
        border-color: #334155;
        box-shadow: none;
    }
    .tagrid-single__card:hover {
        box-shadow: none;
    }
    .tagrid-single__header {
        background: #1d1f21;
        border-color: #334155;
        box-shadow: none;
    }
    .tagrid-grid__item {
        background-color: #1d1f21;
        border-color: #334155;
        box-shadow: none;
    }
    .tagrid-grid__item:hover {
        box-shadow: none;
    }
}

[data-theme="dark"] .tagrid-single__card {
    background: #1d1f21;
    border-color: #334155;
    color: #e2e8f0;
    box-shadow: none;
}
[data-theme="dark"] .tagrid-single__card:hover {
    box-shadow: none;
}
[data-theme="dark"] .tagrid-single__card a {
    color: #3b82f6;
}
[data-theme="dark"] .tagrid-single__header {
    background: #1d1f21;
    border-color: #334155;
    box-shadow: none;
}
[data-theme="dark"] .tagrid-grid__item {
    background-color: #1d1f21;
    border-color: #334155;
    box-shadow: none;
}
[data-theme="dark"] .tagrid-grid__item:hover {
    box-shadow: none;
}

@media (min-width: 600px) {
    .tagrid-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tagrid-single {
    max-width: 900px;
    margin-inline: auto;
}

.tagrid-single__header {
    text-align: center;
    margin-bottom: var(--wp--preset--spacing--40, 2rem);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.tagrid-single__title {
    margin-block-start: 10px;
    margin-block-end: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.tagrid-single__image {
    max-width: 200px;
    max-height: 200px;
    margin-bottom: var(--wp--preset--spacing--30, 1rem);
    object-fit: cover;
}

.tagrid-single__posts {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: var(--wp--preset--spacing--30, 1rem);
}

.tagrid-single__post {
    margin: 0;
}

.tagrid-single__card {
    display: flex;
    gap: var(--wp--preset--spacing--30, 1rem);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    padding: var(--wp--preset--spacing--30, 1rem);
    transition: box-shadow 0.2s;
}

.tagrid-single__card:hover {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.tagrid-single__thumb-link {
    flex-shrink: 0;
    line-height: 0;
}

.tagrid-single__thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.tagrid-single__post-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.tagrid-single__date {
    font-size: 0.875rem;
}

.tagrid-single__excerpt {
    margin: 0;
    font-size: var(--wp--preset--font-size--small, 0.875rem);
}

@media (max-width: 480px) {
    .tagrid-single__card {
        flex-direction: column;
    }
    .tagrid-single__thumb {
        width: 100%;
        height: 180px;
    }
}

#tagrid-theme-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 999;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    line-height: 1;
}

#tagrid-theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.tagrid-single__pagination {
    margin-block-start: var(--wp--preset--spacing--40, 2rem);
    text-align: center;
}

body {
    max-width: 900px;
    margin-inline: auto;
}

#headerimg > h1 {
    font-size: 18px;
    font-weight: bold;
}
#headerimg > .description {
    font-size: 14px;
    color: #6b7280;
}

#footer {
    font-size: 14px;
    color: #6b7280;
}

[data-theme="dark"] body {
    background-color: #151617;
    color: #e2e8f0;
}

[data-theme="dark"] body a {
    color: #3b82f6;
}

[data-theme="dark"] body .tagrid-single__excerpt {
    color: #94a3b8;
}

[data-theme="dark"] body .tagrid-single__date {
    color: #94a3b8;
}

[data-theme="dark"] body #tagrid-theme-toggle {
    background: #e2e8f0;
    color: #0f172a;
}
