/*
 * 六曜カレンダー固有のスタイル。
 * 共通部分（ヘッダー・フッター・パンくず・.month-table・.holiday-list など）は /calendar/style.css を使う。
 */
:root {
    --rk-taian-bg: #fff3cd;
    --rk-taian-text: #8a5300;
    --rk-tomobiki-text: #23784a;
    --rk-butsumetsu-text: #8c8c8c;
    --rk-shakko-text: #7a5230;
    --rk-accent: #2b6cb0;
}

.rk-main {
    max-width: 1200px;
    margin: 0 auto;
}

/* 画面には出さず、読み上げには使う */
.rk-sr,
.rk-caption {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- 六曜の名前 ---------- */
.rk-name {
    display: block;
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--color-text);
}

.rk-short {
    display: none;
}

.rk-taian .rk-name {
    color: var(--rk-taian-text);
    font-weight: bold;
}

.rk-tomobiki .rk-name {
    color: var(--rk-tomobiki-text);
    font-weight: bold;
}

.rk-butsumetsu .rk-name {
    color: var(--rk-butsumetsu-text);
}

.rk-shakko .rk-name {
    color: var(--rk-shakko-text);
}

/* 大安は背景色（祝日の背景より優先） */
.month-table td.day.rk-taian {
    background: var(--rk-taian-bg);
}

.rk-lunar {
    display: block;
    font-size: 0.62rem;
    line-height: 1.2;
    color: var(--color-muted);
}

.rk-hide-lunar .rk-lunar {
    display: none;
}

.rk-hmark {
    display: none;
}

/* ---------- 月のカレンダー（月別・入口ページ） ---------- */
.rk-layout {
    display: grid;
    gap: 1.25rem;
}

.rk-layout .month-table th,
.rk-layout .month-table td {
    font-size: 0.9rem;
}

.rk-layout .month-table thead th {
    padding: 0.4rem 0;
}

.rk-layout .month-table td.day {
    height: 5.6rem;
    padding: 0.35rem 0.4rem;
    text-align: left;
}

.rk-layout .date-num {
    font-size: 1.05rem;
}

.rk-layout .rk-name {
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

.rk-layout .holiday-name {
    font-size: 0.7rem;
    margin-top: 0.1rem;
}

.rk-layout .rk-lunar {
    font-size: 0.7rem;
    margin-top: 0.15rem;
}

/* ---------- 年間ページ ---------- */
.rk-yeargrid .month h2 a {
    color: inherit;
}

.rk-yeargrid .month-table td.day {
    height: auto;
    padding: 0.2rem 0.1rem 0.25rem;
}

.rk-yeargrid .rk-name {
    font-size: 0.68rem;
}

/* ---------- 凡例・絞り込み ---------- */
.rk-side-heading {
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
}

.rk-controls {
    display: grid;
    gap: 1.25rem;
}

.rk-legend-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

.rk-legend-item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
}

.rk-legend-item.rk-taian {
    background: var(--rk-taian-bg);
}

.rk-legend-item .rk-name {
    display: inline;
    font-size: 0.85rem;
}

.rk-legend-desc {
    font-size: 0.75rem;
    color: #555;
}

.rk-legend-note {
    margin: 0.6rem 0 0;
    font-size: 0.75rem;
    line-height: 1.7;
    color: #555;
}

.rk-legend-mark {
    display: inline-block;
    margin-right: 0.25rem;
    padding: 0 0.25rem;
    border-radius: 3px;
    background: var(--color-holiday-bg);
    color: var(--color-holiday-text);
    font-weight: bold;
}

.rk-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.rk-filter-buttons button {
    min-height: 2.25rem;
    padding: 0.3rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    color: var(--color-text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.rk-filter-buttons button[aria-pressed="true"] {
    border-color: var(--rk-accent);
    background: var(--rk-accent);
    color: #fff;
    font-weight: bold;
}

.rk-filter-buttons button:focus-visible {
    outline: 2px solid var(--rk-accent);
    outline-offset: 2px;
}

.rk-lunar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
}

/* 絞り込み：対象外の日は薄くする（六曜の名前は残るので、色だけに頼らない） */
[data-filter="taian"] td.day:not(.rk-taian),
[data-filter="tomobiki"] td.day:not(.rk-tomobiki),
[data-filter="off"] td.day:not(.is-off) {
    opacity: 0.22;
}

.rk-toolbar {
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

/* ---------- ヘッダー・ナビ ---------- */
.rk-monthnav a.year-nav-current {
    font-weight: bold;
}

.rk-nav-disabled {
    padding: 0.25rem 0.5rem;
    color: var(--color-muted);
}

.rk-promo {
    margin: 1rem auto 0;
    max-width: 640px;
}

.rk-promo a {
    display: block;
    padding: 0.75rem 1rem;
    border: 2px solid var(--rk-taian-text);
    border-radius: 6px;
    background: var(--rk-taian-bg);
    color: var(--color-text);
    text-decoration: none;
}

.rk-promo a:hover,
.rk-promo a:focus {
    text-decoration: underline;
}

.rk-section-heading {
    font-size: 1.2rem;
    margin: 0 0 0.75rem;
}

.rk-section-heading a,
.rk-subheading a {
    color: var(--color-saturday);
}

.rk-subheading {
    font-size: 1rem;
    margin: 1.25rem 0 0.5rem;
}

.rk-more {
    margin: 0.5rem 0 0;
    text-align: right;
    font-size: 0.9rem;
}

.rk-note {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--color-holiday-text);
    background: #fdf6f5;
    font-size: 0.85rem;
    line-height: 1.7;
}

.rk-lead {
    margin: 0 0 0.75rem;
}

.rk-empty {
    color: var(--color-muted);
}

.info-section a {
    color: var(--color-saturday);
}

.rk-list td.rk-taian,
.rk-byrokuyo tr.rk-taian th {
    background: var(--rk-taian-bg);
}

.rk-byrokuyo th {
    width: 6rem;
    white-space: nowrap;
}

.rk-byrokuyo th .rk-name {
    display: inline;
    font-size: 0.95rem;
}

.rk-list .rk-name {
    display: inline;
    font-size: inherit;
}

.rk-taian-year th[scope="row"] {
    white-space: nowrap;
}

.rk-about-table th[scope="row"] {
    white-space: nowrap;
}

.rk-about-table th .rk-name {
    font-size: 1rem;
}

.rk-related ul {
    margin: 0;
    padding-left: 1.25rem;
    line-height: 1.9;
}

/* 年・月から探す */
.rk-index-years {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rk-index-years > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.rk-index-year {
    min-width: 4.5rem;
    font-weight: bold;
}

.rk-index-months {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.6rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

.rk-index-years > li.is-current-year {
    background: #f7fafc;
}

/* タップで出す詳細（スマホ） */
.rk-detail-row td {
    padding: 0.6rem 0.75rem !important;
    height: auto !important;
    background: #f7fafc;
    text-align: left !important;
    font-size: 0.85rem !important;
    line-height: 1.6;
}

.rk-detail-row strong {
    margin-right: 0.5rem;
}

@media (min-width: 768px) {
    .rk-layout {
        grid-template-columns: minmax(0, 1fr) 250px;
        align-items: start;
    }

    .rk-toolbar .rk-controls {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }

    .rk-toolbar .rk-legend-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ---------- スマホ（幅768px未満） ---------- */
@media (max-width: 767.98px) {
    .rk .site-header h1 {
        font-size: 1.3rem;
    }

    .rk-layout .month-table td.day,
    .rk-yeargrid .month-table td.day {
        height: 3.3rem;
        padding: 0.25rem 0.1rem;
        text-align: center;
        cursor: pointer;
    }

    .rk-layout .date-num {
        font-size: 0.95rem;
    }

    /* 六曜は頭文字1字（正式名は読み上げ用に残す） */
    .rk-table .rk-full {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .rk-table .rk-short {
        display: inline;
        font-size: 0.85rem;
    }

    /* 祝日名は省いて印だけ（祝日名は読み上げ用に残す） */
    .rk-table .holiday-name {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .rk-table .rk-hmark {
        display: block;
        font-size: 0.6rem;
        line-height: 1.2;
        color: var(--color-holiday-text);
        font-weight: bold;
    }

    /* 旧暦はタップした詳細に出す */
    .rk-table .rk-lunar {
        display: none;
    }

    .rk-layout .month-table th,
    .rk-layout .month-table td {
        font-size: 0.85rem;
    }

    .rk-legend-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rk-legend-item {
        flex-direction: column;
        gap: 0;
    }

    .rk-legend-note {
        font-size: 0.7rem;
    }

    .holiday-list.rk-list th,
    .holiday-list.rk-list td {
        padding: 0.45rem 0.4rem;
    }

    .rk-index-years > li {
        display: block;
    }

    .rk-index-year {
        display: inline-block;
        margin-bottom: 0.25rem;
    }

    .rk-index-months {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 0.35rem;
    }
}

@media print {
    .rk-filter,
    .rk-lunar-toggle {
        display: none !important;
    }
}
