*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --color-accent: #cc0000;
}

body.theme-dark {
    --bg-page: #0f1419;
    --text-primary: #e7ecf1;
    --text-muted: #9aa7b5;
    --text-soft: #7a8a9a;
    --border: #2a3441;
    --border-hover: #4a5a6d;
    --surface: #1a222d;
    --surface-deep: #111820;
    --surface-gradient-a: #151b24;
    --surface-gradient-b: #1f2a38;
    --placeholder: #5c6b7a;
    --text-body: #c5d0dc;
    --error-bg: #3b1f24;
    --error-border: #7a2e3a;
    --error-text: #ffb4be;
    --shadow-card: rgba(0, 0, 0, 0.35);
    --title-hover: color-mix(in srgb, var(--color-accent) 75%, white);
}

body.theme-light {
    --bg-page: #f4f6f8;
    --text-primary: #1a222d;
    --text-muted: #5c6b7a;
    --text-soft: #6b7c8f;
    --border: #d8dee6;
    --border-hover: #b8c4d0;
    --surface: #ffffff;
    --surface-deep: #eef1f5;
    --surface-gradient-a: #e8ecf1;
    --surface-gradient-b: #f0f3f7;
    --placeholder: #8a97a8;
    --text-body: #3d4a59;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --error-text: #991b1b;
    --shadow-card: rgba(26, 34, 45, 0.12);
    --title-hover: var(--color-accent);
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

header.site-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.25rem;
}

.site-logo {
    display: block;
    max-height: 48px;
    width: auto;
    margin-bottom: 0.75rem;
}

header.site-header h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-subtitle {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

header.site-header .site-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    padding: 1rem 1.25rem;
    border-radius: 10px;
}

.grid {
    display: grid;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr !important;
    }
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.card--clickable {
    cursor: pointer;
}

.card:hover,
.card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--color-accent);
    box-shadow: 0 12px 32px var(--shadow-card);
    outline: none;
}

.card__image-wrap {
    aspect-ratio: 16 / 9;
    background: var(--surface-deep);
    overflow: hidden;
}

.card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.card__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--placeholder);
    font-size: 0.85rem;
    background: linear-gradient(135deg, var(--surface-gradient-a), var(--surface-gradient-b));
}

.card--no-image .card__body {
    padding-top: 1.15rem;
}

.card--no-summary .card__hint,
.card--no-summary .card__link {
    margin-top: 0.25rem;
}

.card__body {
    padding: 1rem 1.1rem 1.15rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.card__date,
.detail__date {
    display: block;
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-soft);
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.detail__date {
    margin: -0.5rem 0 1rem;
    font-size: 0.9rem;
}

.card__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.35;
    font-weight: 650;
}

.card__title a {
    color: inherit;
    text-decoration: none;
}

.card__title a:hover {
    color: var(--title-hover);
}

.card__desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    flex: 1;
}

.card__link,
.card__hint {
    margin: 0;
    margin-top: auto;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-accent);
    text-decoration: none;
}

.card__link:hover {
    text-decoration: underline;
}

.detail {
    max-width: none;
    margin: 0;
}

.detail-page {
    max-width: 1200px;
    margin: 0 auto;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    gap: 1.5rem;
    align-items: start;
}

.detail-layout--solo {
    grid-template-columns: minmax(0, 1fr);
}

.detail-layout__main {
    min-width: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.92rem;
}

.back-link:hover {
    color: var(--text-primary);
}

.detail__panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.detail__image-wrap {
    aspect-ratio: 16 / 9;
    background: var(--surface-deep);
}

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

.detail__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: var(--placeholder);
    background: linear-gradient(135deg, var(--surface-gradient-a), var(--surface-gradient-b));
}

.detail__body {
    padding: 1.5rem 1.6rem 1.75rem;
}

.detail__title {
    margin: 0 0 1rem;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    line-height: 1.3;
    font-weight: 700;
}

.detail__text {
    margin: 0 0 1.5rem;
    color: var(--text-body);
    font-size: 1.05rem;
    line-height: 1.65;
}

.detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

.btn--primary {
    background: var(--color-accent);
    color: #fff;
}

.btn--primary:hover {
    filter: brightness(1.12);
}

.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn--ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.related {
    position: sticky;
    top: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1rem 1.1rem;
}

.related__title {
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
}

.related__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.related__item {
    margin: 0;
}

.related__link {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    padding: 0.55rem;
    margin: -0.55rem;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.related__link:hover {
    background: var(--surface-deep);
}

.related__link:hover .related__item-title {
    color: var(--color-accent);
}

.related__thumb-wrap {
    flex: 0 0 64px;
    width: 64px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-deep);
}

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

.related__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.related__item-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.35;
    transition: color 0.15s ease;
}

.related__date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-soft);
    text-transform: lowercase;
}

@media (max-width: 900px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .related {
        position: static;
    }
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.pagination__link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}

.pagination__link:hover {
    color: var(--color-accent);
}

.pagination__link--disabled {
    color: var(--placeholder);
    cursor: default;
}

.pagination__pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.pagination__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.4rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.pagination__num:hover {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--surface);
}

.pagination__num--current {
    color: #fff;
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.pagination__ellipsis {
    color: var(--placeholder);
    padding: 0 0.25rem;
}
