/**
 * トップページ（2026-11 リデザイン）
 * 百人一首.jp
 *
 * ヒーロー: かるたの写真を藍の重ねで沈め、白い明朝の見出し＋検索。PC は右に「今日の一首」を読み札として飾る。
 * 接頭辞: hh-（ヒーロー） / hn-（目的別の入口） / ht-（テーマのアイコン）
 * 色は style.css のトークン（藍 --color-accent-primary ほか）と、ヒーロー専用の金茶・和紙色だけを使う。
 */

.home {
    --hh-ai-deep: #12233F;     /* 藍の最も深い色（重ねの左端） */
    --hh-ai: #1A3463;
    --hh-kin: #D8BC84;         /* 金茶（藍の上で 8.6:1） */
    --hh-washi: #FBF8F0;       /* 読み札の面 */
    --hh-fuda-edge: #2F6B4F;   /* 取り札のふち（実物の緑） */
}

/* ============================
   ヒーロー
   ============================ */
.hh {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 0 0 var(--space-8);
    border-radius: 20px;
    background: var(--hh-ai-deep);
    color: #fff;
}
.hh-bg,
.hh-bg img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.hh-bg { z-index: -1; } /* 藍の重ね（::before）より下に敷く */
.hh-bg img {
    object-fit: cover;
    object-position: 62% 50%;
}
/* 藍の重ね: 文字側（左・上）を深く、札側（右・下）を浅くして写真の札を見せる */
.hh::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(18, 35, 63, .35) 0%, rgba(18, 35, 63, .82) 58%, rgba(18, 35, 63, .94) 100%);
}
/* 和紙の繊維のような細かい粒（SVG ノイズ、2KB 未満） */
.hh::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: .12;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    pointer-events: none;
}
.hh-inner {
    position: relative;
    z-index: 1;
    display: grid;
    gap: var(--space-6);
    padding: 36px 20px 18px;
}
.hh-copy { min-width: 0; }
.hh-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    color: var(--hh-kin);
    font-size: .8125rem;
    letter-spacing: .14em;
}
.hh-eyebrow::before {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
}
.hh-title {
    margin: 0;
    font-family: var(--font-mincho);
    font-weight: 600;
    font-size: clamp(1.875rem, 7.4vw, 3.25rem);
    line-height: 1.32;
    letter-spacing: .04em;
    color: #fff;
    text-wrap: balance;
}
.hh-lead {
    margin: 14px 0 0;
    max-width: 34em;
    color: rgba(255, 255, 255, .86);
    font-size: .9375rem;
    line-height: 1.85;
}
.hh-br { display: none; }

/* 検索 */
.hh-search {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 520px;
    margin: 24px 0 0;
    padding: 6px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(5, 12, 28, .35);
}
.hh-search svg {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0 4px 0 10px;
    color: var(--color-text-tertiary);
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}
.hh-search input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: var(--color-text-primary);
    font: inherit;
    font-size: 1rem; /* 16px 未満だと iOS が拡大する */
    outline: none;
}
.hh-search input::placeholder { color: var(--color-text-tertiary); }
.hh-search input::-webkit-search-cancel-button { display: none; }
.hh-search:focus-within { box-shadow: 0 0 0 3px var(--hh-kin), 0 10px 30px rgba(5, 12, 28, .35); }
.hh-search button {
    flex: none;
    height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: var(--color-accent-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.hh-search button:hover { background: var(--color-accent-hover); }
.hh-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* よく見られている言葉 */
.hh-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 16px 0 0;
    font-size: .8125rem;
}
.hh-tags span { color: rgba(255, 255, 255, .72); margin-right: 2px; }
.hh-tags a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    transition: background-color .15s, border-color .15s;
}
.hh-tags a:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .6); color: #fff; }

/* 今日の一首（スマホ: 下の帯 / PC: 右の読み札） */
.hh-fuda {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #fff;
    text-decoration: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.hh-fuda:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.hh-fuda-label {
    color: var(--hh-kin);
    font-size: .75rem;
    letter-spacing: .1em;
    white-space: nowrap;
}
.hh-fuda-text {
    min-width: 0;
    overflow: hidden;
    font-family: var(--font-mincho);
    font-size: .9375rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.hh-fuda-text .hh-fuda-shimo,
.hh-fuda-meta { display: none; }
.hh-fuda-go { font-size: .8125rem; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.hh-fuda-go svg { width: 16px; height: 16px; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2; }

@media (min-width: 600px) {
    .hh-inner { padding: 64px 40px 32px; }
    .hh-br { display: inline; }
}

@media (min-width: 900px) {
    .hh { margin-top: calc(-1 * var(--space-6)); } /* .site-main の上余白 48px を 24px に詰める */
    .hh::before {
        background:
            linear-gradient(100deg, rgba(18, 35, 63, .9) 0%, rgba(18, 35, 63, .72) 38%, rgba(18, 35, 63, .18) 64%, rgba(18, 35, 63, 0) 100%);
    }
    .hh-inner {
        grid-template-columns: minmax(0, 1fr) 236px;
        align-items: center;
        gap: 48px;
        min-height: 440px;
        padding: 56px 56px 56px 56px;
    }
    .hh-title { font-size: clamp(2.5rem, 4.2vw, 3.25rem); }

    /* 読み札: 和紙の面・緑のふち・縦書き。少し傾けて写真の札の上に置く */
    .hh-fuda {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 14px;
        width: 236px;
        aspect-ratio: 53 / 74;
        padding: 22px 18px 18px;
        border: 0;
        border-radius: 8px;
        background: var(--hh-washi);
        color: var(--color-text-primary);
        box-shadow: inset 0 0 0 5px var(--hh-fuda-edge), inset 0 0 0 7px var(--hh-washi), inset 0 0 0 8px rgba(47, 107, 79, .35),
                    0 24px 48px rgba(5, 12, 28, .45);
        transform: rotate(-4deg);
        transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .hh-fuda:hover {
        background: var(--hh-washi);
        color: var(--color-text-primary);
        transform: rotate(-1.5deg) translateY(-4px);
    }
    .hh-fuda-label {
        color: var(--hh-fuda-edge);
        font-weight: 700;
    }
    /* 縦書きでは block の子が右から左へ列として並ぶ。句ごとに1列 */
    .hh-fuda-text {
        flex: 1;
        display: block;
        writing-mode: vertical-rl;
        white-space: normal;
        overflow: hidden;
        font-size: 1.0625rem;
        font-weight: 600;
        line-height: 1.6;
        letter-spacing: .1em;
    }
    .hh-fuda-text .hh-fuda-kami,
    .hh-fuda-text .hh-fuda-shimo { display: block; }
    .hh-fuda-text .hh-fuda-shimo { margin-right: 10px; color: var(--color-text-secondary); font-weight: 400; }
    .hh-fuda-text i { display: block; font-style: normal; white-space: nowrap; margin-left: 4px; }
    .hh-fuda-meta {
        display: block;
        font-size: .75rem;
        color: var(--color-text-secondary);
    }
    .hh-fuda-go { color: var(--color-accent-primary); font-weight: 700; }
}

/* ============================
   目的別の入口
   ============================ */
.hn { margin: 0 0 var(--space-12); }
.hn-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: var(--space-4);
}
.hn-title {
    margin: 0;
    font-family: var(--font-mincho);
    font-weight: 600;
    font-size: 1.375rem;
    color: var(--color-text-primary);
}
.hn-sub { margin: 0; font-size: .8125rem; color: var(--color-text-tertiary); }
.hn-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
@media (min-width: 900px) { .hn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
.hn-grid a {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
    height: 100%;
    min-height: 76px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.hn-grid a:hover { border-color: var(--color-accent-primary); box-shadow: var(--shadow-md); color: var(--color-text-primary); }
.hn-grid a:active { transform: scale(.985); }
.hn-ic {
    grid-row: 1 / 3;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--color-accent-soft);
    color: var(--color-accent-primary);
}
.hn-ic svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hn-grid a.is-main .hn-ic { background: var(--color-accent-primary); color: #fff; }
.hn-name { align-self: end; font-weight: 700; font-size: .9375rem; line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; } /* <wbr> の位置でだけ折り返す */
.hn-desc { align-self: start; font-size: .75rem; color: var(--color-text-tertiary); line-height: 1.5; }
/* 五色百人一首: 札の5色（青・桃・黄・緑・橙）を点で示す */
.hn-goshoku { display: flex; gap: 2px; }
.hn-goshoku i { width: 5px; height: 18px; border-radius: 2px; }
.hn-goshoku i:nth-child(1) { background: #2F6FB5; }
.hn-goshoku i:nth-child(2) { background: #E07A9B; }
.hn-goshoku i:nth-child(3) { background: #E3B92E; }
.hn-goshoku i:nth-child(4) { background: #3E9B5C; }
.hn-goshoku i:nth-child(5) { background: #E8833A; }
/* スマホ: アイコンを上、文字を下に積む（横並びだと名前が3行に折れるため） */
@media (max-width: 599px) {
    .hn-grid a {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        align-content: start;
        row-gap: 4px;
        padding: 14px 14px 16px;
    }
    .hn-ic { grid-row: auto; margin-bottom: 6px; width: 40px; height: 40px; }
    .hn-name, .hn-desc { align-self: auto; }
}

/* テーマカードの SVG アイコン（絵文字の置き換え） */
.ht-ic {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--color-accent-soft);
    color: var(--color-accent-primary);
}
.ht-ic svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) {
    .hh-fuda, .hn-grid a { transition: none; }
}
