/*
 * Home Page Styles
 * Ported from design_preview/index.html <style> section.
 * Footer styles excluded (handled by layout).
 */

/* === Hero Section (Branding Image) === */
.hero-section {
    text-align: center;
}

.hero-section img {
    width: 100%;
    height: auto;
    aspect-ratio: 1371 / 457;
    display: block;
}

.hero-text {
    padding: 0.75rem 1rem;
    text-align: center;
}

.hero-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.hero-sub {
    font-size: 0.9rem;
    margin: 0;
    color: #666;
}

/* === Hero USP (Unique Selling Points) === */
.hero-usp {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.5rem 1rem 0.75rem;
    flex-wrap: wrap;
}

.hero-usp-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
    white-space: nowrap;
}

.hero-usp-item i {
    color: var(--accent, #4c9aff);
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .hero-text h1 { font-size: 1.1rem; }
    .hero-sub { font-size: 0.8rem; }
    .hero-usp {
        gap: 0.5rem 1rem;
        padding: 0.25rem 0.75rem 0.5rem;
    }
    .hero-usp-item {
        font-size: 0.7rem;
    }
    .hero-usp-item i {
        font-size: 0.75rem;
    }
}

/* === Level Filter (Illustration Images from CloudFront) === */
.level-filter-bar {
    padding: 0.75rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.level-filter-wrapper {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.5rem 0;
}

.level-filter-wrapper::-webkit-scrollbar { display: none; }

.level-filter-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 15%;
    min-width: 60px;
    text-decoration: none;
    color: inherit;
}

.level-filter-btn:hover {
    transform: scale(1.05);
}

.level-filter-btn img {
    width: 100%;
    max-width: 150px;
    height: auto;
    display: block;
}

/* Hide inactive image, show active image when .active or :hover */
.level-filter-btn .level-img-active { display: none; }
.level-filter-btn .level-img-inactive { display: block; }

/* Desktop: show on .active or :hover */
@media (hover: hover) and (pointer: fine) {
  .level-filter-btn.active .level-img-active,
  .level-filter-btn:hover .level-img-active { display: block; }
  .level-filter-btn.active .level-img-inactive,
  .level-filter-btn:hover .level-img-inactive { display: none; }
}

/* Mobile: show on .active only */
@media (max-width: 768px) {
  .level-filter-btn.active .level-img-active { display: block; }
  .level-filter-btn.active .level-img-inactive { display: none; }
}

/* === Content Sections === */
.content-section {
    padding: 1.75rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.content-section + .content-section {
    border-top: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.section-header__main {
    flex: 1 1 auto;
    min-width: 0;
}

/* === Section Eyebrow (Tag + Label above title) === */
.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 0.5rem;
    border-radius: 4px;
    font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
    max-width: 6.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-tag--kids {
    background: var(--tag-kids-bg);
    color: var(--tag-kids-fg);
}

.section-tag--popular {
    background: var(--tag-hot-bg);
    color: var(--tag-hot-fg);
}

.section-tag--new {
    background: var(--tag-new-bg);
    color: var(--tag-new-fg);
}

.section-eyebrow__text {
    font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
}

/* === Full-width "More" Button (featured_typing_videos 等で使用) === */
.section-more-btn {
    display: block;
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.section-more-btn:hover {
    background: var(--hover-bg, rgba(128,128,128,0.06));
    border-color: var(--accent);
    color: var(--accent);
}

.section-more-btn:active {
    transform: scale(0.99);
}

/* === Inline "More" Link (section-header 右側に配置する派生形) === */
.section-more-btn--inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    margin-top: 0;
    padding: 0.35rem 0.1rem;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    align-self: flex-end;
    flex-shrink: 0;
}

.section-more-btn--inline:hover {
    background: transparent;
    border-color: transparent;
    color: var(--accent);
}

.section-more-btn--inline .section-more-btn__arrow {
    transition: transform 0.2s ease;
}

.section-more-btn--inline:hover .section-more-btn__arrow {
    transform: translateX(3px);
}

/* === Stats Section（大型数値 + CTA カード並置） === */
.stats-section {
    padding: 2.5rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    border-top: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 2rem 3rem;
    max-width: 1100px;
    margin: 0 auto;
}

/* ログイン時（CTAなし）: 2カラム中央寄せ */
.stats-grid.stats-grid--no-cta {
    grid-template-columns: 1fr 1fr;
    max-width: 640px;
}

.stats-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.stats-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    font-feature-settings: normal;
    display: inline-flex;
    align-items: baseline;
}

.stats-unit {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 0.2rem;
    letter-spacing: 0;
}

.stats-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

/* === Stats CTA カード（未ログイン時のみ、右側に並置） === */
.stats-cta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.75rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    justify-self: end;
    max-width: 480px;
}

.stats-cta__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.5;
}

.stats-cta__body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.65;
}

.stats-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 1.5rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--text-on-accent, #fff);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: filter 0.15s, transform 0.1s, box-shadow 0.2s;
    margin-top: 0.5rem;
}

.stats-cta__button i {
    font-size: 0.95rem;
    line-height: 1;
}

.stats-cta__button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(var(--accent-rgb), 0.4);
}

.stats-cta__button:active {
    transform: translateY(0);
}

/* === SEO Text === */
.seo-section {
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    border-top: 1px solid var(--border-color);
}

/* About TypingTube 導入ブロック（ブランドランドマーク） */
.seo-intro {
    max-width: 720px;
    margin: 0 auto 3rem;
    text-align: center;
    padding: 0 1rem;
}

.seo-intro__eyebrow {
    display: inline-block;
    font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.seo-intro h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.seo-intro p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 0 auto;
    max-width: 640px;
}

/* SEO コンテンツ領域（グリッド ⇄ 詳細パネル切替の親） */
.seo-content {
    position: relative;
    margin-top: 2.5rem;
}

/* SEO 番号付きグリッド（4列 × 2行 = 8 項目、視覚ランドマーク化） */
.seo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2.5rem 2rem;
    transition: opacity 0.2s ease, visibility 0.2s;
}

.seo-content.is-detail-open .seo-grid {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.seo-item {
    position: relative;
    padding: 0.25rem 0 0.25rem 1rem;
    border-left: 2px solid var(--border-color);
    transition: border-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.seo-item:hover {
    border-left-color: var(--accent);
    transform: translateX(2px);
}

.seo-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 2px;
}

.seo-item__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.seo-item__icon {
    font-size: 1.1rem;
    color: var(--accent);
    line-height: 1;
}

.seo-item__num {
    font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.seo-item h3 {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    line-height: 1.45;
}

.seo-item__sub {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.seo-item p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0.5rem 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .seo-grid { grid-template-columns: repeat(2, 1fr); gap: 2rem 1.5rem; }
    .seo-intro h2 { font-size: 1.75rem; }
}

@media (max-width: 640px) {
    .seo-grid { grid-template-columns: 1fr; gap: 1.75rem; }
    .seo-intro { margin-bottom: 2rem; }
    .seo-intro h2 { font-size: 1.5rem; }
    .seo-intro__eyebrow { font-size: 0.6875rem; }
}

/* SEO 詳細パネル: クリックでグリッドを置き換える同サイズカード */
.seo-detail {
    position: absolute;
    inset: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem 3rem;
    box-shadow: var(--modal-panel-shadow);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.seo-detail__inner {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.seo-content.is-detail-open .seo-detail {
    opacity: 1;
    visibility: visible;
}

.seo-detail__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 0.5rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.seo-detail__close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.seo-detail__close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.seo-detail__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    padding-right: 2.5rem;
}

.seo-detail__icon {
    font-size: 1.6rem;
    color: var(--accent);
    line-height: 1;
}

.seo-detail__num {
    font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.seo-detail__sub {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    line-height: 1.3;
}

.seo-detail__sub:empty {
    display: none;
}

.seo-detail__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
    line-height: 1.4;
}

.seo-detail__body {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text-primary);
    margin: 0.5rem 0 0;
}

@media (max-width: 1024px) {
    .seo-detail { padding: 2rem 1.75rem; }
    .seo-detail__title { font-size: 1.5rem; }
}

@media (max-width: 640px) {
    .seo-detail {
        padding: 1.75rem 1.25rem;
        /* グリッド縦長（1カラム×8項目）時に詳細パネルが過大にならないよう制限 */
        max-height: 80vh;
        overflow-y: auto;
        /* position:absolute の親高さに追従すると空白が巨大化するため、
           固定高さを与えて上端に配置 */
        inset: 0 0 auto 0;
        min-height: 20rem;
    }
    .seo-detail__title { font-size: 1.25rem; }
    .seo-detail__body { font-size: 0.9rem; line-height: 1.75; }
    .seo-detail__head { padding-right: 2rem; }
}

.seo-internal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.seo-internal-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}

.seo-internal-links a:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* === Featured Typing Videos Section === */
.home-featured-tv {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.05), rgba(139, 92, 246, 0.08));
    border-radius: 12px;
}

.home-featured-tv-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.home-featured-tv-title i {
    color: #a855f7;
}

.home-featured-tv-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* === Pickup Events Scroll Container === */
.pickup-events-scroll-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .pickup-events-scroll-wrapper {
        position: relative;
    }
    .pickup-events-scroll-wrapper::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(to right, transparent, var(--body-bg));
        pointer-events: none;
        z-index: 1;
    }

    .pickup-events-scroll-container {
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
    }

    .pickup-event-card {
        scroll-snap-align: start;
        flex-shrink: 0;
    }
}

/* === Mobile === */
@media (max-width: 768px) {
    .content-section { padding: 1.25rem 1rem; }
    .section-title { font-size: 1.25rem; }
    .level-filter-bar { padding: 0.5rem 1rem; }
    .level-filter-wrapper { gap: 0.25rem; }
    .stats-section { padding: 1.75rem 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem 1.25rem; max-width: 100%; }
    .stats-grid .stats-cta { grid-column: 1 / -1; }
    .stats-value { font-size: 2rem; }
    .stats-unit { font-size: 0.8rem; }
    .stats-cta { width: 100%; max-width: none; padding: 1.25rem 1.25rem; justify-self: stretch; }
    .stats-cta__title { font-size: 0.95rem; }
    .section-header { margin-bottom: 1rem; gap: 0.5rem; }
    .section-more-btn--inline { align-self: flex-start; padding-left: 0; }
}
