.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
}

.button--primary {
    background: var(--theme-color);
    color: #fff;
}

.button--primary:hover {
    background: var(--theme-color-hover);
}

.button--quiet {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button--primary:disabled:hover {
    background: var(--theme-color);
}

.page-heading {
    margin-bottom: 2rem;
    padding: 1.5rem 0 1.25rem 1.25rem;
    border-left: 0.4rem solid var(--theme-color);
    border-bottom: 1px solid var(--border);
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.25;
}

.page-heading p {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
}

.section-heading {
    margin-bottom: 1.25rem;
}

.section-heading__row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 2px solid var(--theme-color);
}

.section-heading__title {
    min-width: 0;
}

.section-heading__link {
    flex: 0 0 auto;
    margin: 0 0 0.6rem auto;
    color: var(--theme-color);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.section-heading__link:hover {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.section-heading p {
    margin: 0.55rem 0 0;
    color: var(--text-muted);
    text-align: left;
}

.section-heading h2,
.section-title {
    margin: 0;
    padding-bottom: 0.55rem;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

/* 見出し行の右側リンクと説明文を、狭い幅でも読みやすく積み重ねる。 */
@media (max-width: 42rem) {
    .section-heading__row {
        display: block;
    }

    .section-heading__link {
        display: block;
        width: max-content;
        max-width: 100%;
        margin: 0.35rem 0 0.6rem auto;
    }
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.article-card,
.series-card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.article-card {
    overflow: hidden;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.article-card__link {
    display: grid;
    grid-template-columns: minmax(9rem, 32%) minmax(0, 1fr);
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.article-card__media,
.series-card__media {
    min-width: 0;
    overflow: hidden;
    background: var(--surface-strong);
}

.article-card__media {
    align-self: stretch;
    min-height: 9rem;
    border-inline-end: 1px solid var(--border);
    background: #fff;
}

.article-card__media img,
.series-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card__media img {
    padding: 0.35rem;
    object-fit: contain;
    object-position: center;
    background: #fff;
}

.article-card__body {
    display: flex;
    height: 100%;
    min-width: 0;
    flex-direction: column;
    padding: 1.15rem;
}

.article-card h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.08rem;
    line-height: 1.45;
}

.article-card__description {
    display: -webkit-box;
    margin: 0.7rem 0 1rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.7;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.article-card__context {
    margin: 0 0 0.5rem;
    color: var(--theme-color);
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.5;
}

.article-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.article-card__action {
    margin-top: 0.85rem;
    color: var(--theme-color);
    font-size: 0.82rem;
    font-weight: 850;
}

.article-card__meta span {
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--theme-color-soft);
    color: var(--theme-color);
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.75rem 1.5rem;
    padding: 0.2rem 0.75rem 1.25rem 0;
    perspective: 75rem;
}

.series-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    isolation: isolate;
    overflow: visible;
    border-radius: 0.35rem 0.55rem 0.55rem 0.35rem;
    box-shadow:
        0.65rem 0.9rem 1.35rem -0.3rem rgb(15 23 42 / 24%),
        0 0 0.15rem rgb(15 23 42 / 22%);
    transform: translateZ(0);
}

.series-card::before {
    position: absolute;
    z-index: -1;
    top: 0.45rem;
    right: -0.55rem;
    bottom: -0.45rem;
    width: 0.75rem;
    border: 1px solid #cbd5e1;
    border-left: 0;
    border-radius: 0 0.35rem 0.35rem 0;
    background: repeating-linear-gradient(
        0deg,
        #fff 0,
        #fff 0.18rem,
        #e2e8f0 0.2rem,
        #f8fafc 0.23rem
    );
    box-shadow: 0.25rem 0.35rem 0.55rem rgb(15 23 42 / 16%);
    content: "";
    pointer-events: none;
}

.series-card:hover,
.series-card:focus-within {
    box-shadow:
        0.85rem 1.15rem 1.55rem -0.3rem rgb(15 23 42 / 30%),
        0 0 0.15rem rgb(15 23 42 / 22%);
    transform: translate3d(-0.12rem, -0.18rem, 0) rotateY(-1deg);
}

.series-card__link {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    border-radius: inherit;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

.series-card__media {
    aspect-ratio: 1200 / 630;
    border-bottom: 1px solid var(--border);
}

.series-card__link::before,
.series-card__link::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    content: "";
    pointer-events: none;
}

.series-card__link::before {
    right: auto;
    width: 0.55rem;
    background: linear-gradient(90deg, rgb(15 23 42 / 28%), rgb(255 255 255 / 8%));
}

.series-card__link::after {
    background: linear-gradient(
        -90deg,
        rgb(255 255 255 / 0%) 0%,
        rgb(255 255 255 / 8%) 80%,
        rgb(255 255 255 / 38%) 94%,
        rgb(255 255 255 / 50%) 96%,
        rgb(255 255 255 / 0%) 100%
    );
}

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

.series-card__eyebrow {
    margin: 0;
    color: var(--theme-color);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.series-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

.series-card__contents {
    flex: 1;
    min-width: 0;
}

.series-card__goal h4,
.series-card__contents h4 {
    margin: 0 0 0.25rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

.series-card__goal p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

.series-card__contents ul {
    display: grid;
    gap: 0.28rem;
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.8rem;
    line-height: 1.45;
}

.series-card__contents li {
    overflow-wrap: anywhere;
}

.series-card__progress {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
    align-items: center;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.series-card__progress progress {
    grid-column: 1 / -1;
    width: 100%;
    height: 0.55rem;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--surface-strong);
    accent-color: var(--theme-color);
}

.series-card__progress progress::-webkit-progress-bar {
    background: var(--surface-strong);
}

.series-card__progress progress::-webkit-progress-value {
    background: var(--theme-color);
}

.series-card__progress progress::-moz-progress-bar {
    background: var(--theme-color);
}

.series-card__count {
    color: var(--theme-color);
    font-size: 0.82rem;
    font-weight: 800;
}

.series-card__resume {
    position: relative;
    margin: 0 1.25rem 1.25rem;
}

.chip-list,
.article-header__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.42rem 0.75rem;
    border: 1px solid #bae6fd;
    border-radius: 999px;
    background: var(--theme-color-soft);
    color: var(--theme-color);
    font-weight: 800;
    text-decoration: none;
}

.chip:hover {
    border-color: var(--theme-color);
}

.chip--small {
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
}

.empty-state,
.loading-state,
.error-state {
    padding: 2.5rem 1.5rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    text-align: center;
    color: var(--text-muted);
}

.loading-state {
    width: min(var(--content-width), calc(100% - 2rem));
    margin: 3rem auto;
}

.error-state {
    width: min(44rem, calc(100% - 2rem));
    margin: 4rem auto;
}

.error-state h1 {
    margin-top: 0;
    color: var(--text);
}

.error-state .button {
    margin-top: 1rem;
}

.document-dialog {
    width: min(70rem, calc(100% - 2rem));
    height: min(52rem, calc(100% - 2rem));
    max-width: none;
    max-height: none;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-md);
}

.document-dialog::backdrop {
    background: rgb(15 23 42 / 65%);
    backdrop-filter: blur(2px);
}

.document-dialog__panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
}

.document-dialog__header {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
}

.document-dialog__header h2 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.document-dialog__actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.65rem;
    align-items: center;
}

.document-dialog__actions a,
.document-dialog__actions button {
    min-height: 2.5rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--theme-color);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.45;
    text-decoration: none;
}

.document-dialog__actions button {
    border-color: var(--theme-color);
    background: var(--theme-color);
    color: #fff;
}

.document-dialog__frame {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    background: var(--surface);
}

@media (max-width: 52rem) {
    .article-grid,
    .series-grid {
        grid-template-columns: 1fr;
    }

    .article-card__link {
        display: flex;
        flex-direction: column;
    }

    .article-card__media {
        height: auto;
        min-height: 0;
        aspect-ratio: 1200 / 630;
        border-inline-end: 0;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 34rem) {
    .document-dialog {
        width: calc(100% - 0.75rem);
        height: calc(100% - 0.75rem);
        border-radius: var(--radius-md);
    }

    .document-dialog__header {
        align-items: flex-start;
        padding: 0.65rem 0.75rem;
    }

    .document-dialog__actions {
        gap: 0.4rem;
    }

    .document-dialog__actions a,
    .document-dialog__actions button {
        min-height: 2.25rem;
        padding: 0.35rem 0.55rem;
        font-size: 0.75rem;
    }

    .article-card__body {
        padding: 1rem;
    }
}
