/* 
 * PikaLab Reading Room - Sidebar Edition + Visual Polish (App Store Style)
 */

body {
    background-color: #fdfcfa;
    /* ふんわりとしたパステルメッシュグラデーション */
    background-image: 
        radial-gradient(circle at 15% 10%, rgba(191, 239, 255, 0.7) 0%, transparent 50%),
        radial-gradient(circle at 85% 20%, rgba(209, 250, 229, 0.6) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(254, 240, 138, 0.5) 0%, transparent 60%),
        radial-gradient(circle at 80% 90%, rgba(251, 207, 232, 0.6) 0%, transparent 50%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Subtle dot overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* --- Dark Mode Overrides --- */
body.dark-mode {
    background-color: #0f172a;
    background-image: 
        radial-gradient(circle at 15% 10%, rgba(56, 189, 248, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(245, 158, 11, 0.1) 0%, transparent 60%),
        radial-gradient(circle at 80% 90%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
    color: #f8fafc;
}
body.dark-mode::before {
    background-image: radial-gradient(#334155 1px, transparent 1px);
    opacity: 0.3;
}
body.dark-mode .premium-header {
    background: rgba(15, 23, 42, 0.85);
    border-bottom-color: #1e293b;
}
body.dark-mode .dynamic-bg {
    background-color: rgba(30, 41, 59, 0.75);
    border-color: #334155;
}
body.dark-mode .dynamic-input {
    background-color: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
body.dark-mode .dynamic-text { color: #f1f5f9; }
body.dark-mode .dynamic-text-sub { color: #cbd5e1; }
body.dark-mode .dynamic-meta { color: #94a3b8; }
body.dark-mode .dark-border { border-color: #334155; }

body.dark-mode .worry-pill { 
    background: #1e293b; 
    border-color: #334155; 
    border-bottom-color: #0f172a; 
    color: #cbd5e1; 
}
body.dark-mode .worry-pill:hover, body.dark-mode .worry-pill.active-pill { 
    background: #0ea5e9; 
    border-color: #0284c7; 
    color: #fff; 
}

body.dark-mode .premium-article-card { background: #1e293b; border-color: #334155; }
body.dark-mode .premium-article-card:hover { background: #334155; border-color: #475569; }

body.dark-mode .sidebar-tool-link { background: #0f172a; border-color: #334155; }
body.dark-mode .sidebar-tool-link:hover { background: #1e293b; border-color: #0ea5e9; }

body.dark-mode .archive-link { color: #cbd5e1; }
body.dark-mode .archive-link:hover { background: #1e293b; color: #38bdf8; }
body.dark-mode .archive-count { background: #0f172a; color: #64748b; }
body.dark-mode .archive-link:hover .archive-count { color: #0ea5e9; }

body.dark-mode .scroll-top-btn { background: #1e293b; color: #38bdf8; border-color: #334155; }
body.dark-mode .scroll-top-btn:hover { background: #334155; }

body.dark-mode .bg-white { background-color: #1e293b; border-color: #334155; color: #f8fafc; }
body.dark-mode .bg-slate-100\/80 { background-color: rgba(30, 41, 59, 0.8); }

/* --- Font Size Overrides --- */
body.large-text .title { font-size: 1.65rem; line-height: 1.6; }
body.large-text .body { font-size: 1.15rem; line-height: 2; }
body.large-text .dynamic-text-sub { font-size: 1.1rem; line-height: 2.1; }


/* --- Idea 3: プロレベルの日本語タイポグラフィ（文字詰め） --- */
.text-palt {
    font-feature-settings: "palt", "chws";
}

/* --- Accessibility: Focus Visible --- */
a:focus-visible, button:focus-visible {
    outline: 3px solid #38bdf8;
    outline-offset: 4px;
    border-radius: inherit;
}

/* --- Dynamic Filtering & Load More Animations --- */
.hidden-article,
.article-hidden-by-limit {
    display: none !important;
}

.article-fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Scroll To Top Button --- */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #ffffff;
    color: #0ea5e9;
    border: 2px solid #e0f2fe;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
}
.scroll-top-btn .material-symbols-rounded {
    font-size: 28px;
    font-weight: 900;
}
.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.scroll-top-btn:hover {
    background: #f0f9ff;
    border-color: #38bdf8;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(56, 189, 248, 0.2);
}

/* --- ワクワクする予告バッジ --- */
.coming-soon-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1.5rem;
    border-radius: 9999px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    overflow: hidden;
    font-weight: 900;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.8), 0 4px 6px -1px rgba(0,0,0,0.02);
}
body.dark-mode .coming-soon-badge {
    background: #1e293b; border-color: #334155; box-shadow: none; color: #94a3b8;
}

.coming-soon-badge .stripe-bg {
    position: absolute;
    inset: -50%;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(0, 0, 0, 0.03) 10px,
        rgba(0, 0, 0, 0.03) 20px
    );
    animation: move-stripes 2s linear infinite;
}
body.dark-mode .coming-soon-badge .stripe-bg {
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.03) 10px,
        rgba(255, 255, 255, 0.03) 20px
    );
}

@keyframes move-stripes {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(28px) translateY(-28px); } 
}

/* --- Premium Header --- */
.premium-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 20px -10px rgba(0,0,0,0.05);
}

/* --- Breadcrumb Nav --- */
.breadcrumb-nav {
    transition: color 0.3s ease;
}
body.dark-mode .breadcrumb-nav {
    color: #64748b;
}
body.dark-mode .breadcrumb-nav .breadcrumb-current {
    color: #cbd5e1;
}

/* --- Worry Pills (悩みから探す - 3D Button Style) --- */
.worry-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1.25rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-bottom: 3px solid #cbd5e1; /* 3D edge */
    border-radius: 9999px;
    font-weight: 800;
    font-size: 0.9rem;
    color: #475569;
    text-decoration: none;
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.worry-pill:hover {
    border-color: #38bdf8;
    border-bottom-color: #0ea5e9;
    color: #0284c7;
    background: #f0f9ff;
    transform: translateY(-2px);
}
.worry-pill.active-pill {
    border-bottom-width: 1px;
    transform: translateY(2px);
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* --- Sidebar Widgets --- */
.sidebar-widget {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 1);
    border-top: 4px solid #bae6fd; /* Subtle visual highlight */
    border-radius: 28px;
    padding: 1.8rem;
    box-shadow: 0 4px 20px -5px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.widget-title {
    font-size: 1rem;
    font-weight: 900;
    color: #334155;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px dashed #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}
.widget-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 18px;
    background: #38bdf8;
    border-radius: 99px;
}

/* Sidebar Tools */
.sidebar-tool-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
}
.sidebar-tool-link:hover {
    border-color: #bae6fd;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.1);
    transform: translateY(-2px);
}
.sidebar-tool-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Archive Links */
.archive-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.5rem;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 12px;
}
.archive-link:hover {
    color: #0ea5e9;
    background: #f0f9ff;
    padding-left: 0.8rem;
}
.archive-count {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 900;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}
.archive-link:hover .archive-count {
    color: #0ea5e9;
}

/* --- Premium Horizontal Article Cards (App Store Style) --- */
.premium-article-card {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 4px 20px -5px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02);
    border: 1px solid rgba(255, 255, 255, 1);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.premium-article-card:hover {
    background: #ffffff;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
    border-color: #f1f5f9;
    transform: translateY(-4px);
}

/* Floating App Icon Cover */
.card-cover {
    width: 140px;
    margin: 1.5rem 0 1.5rem 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.1), 0 8px 16px -4px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 100%);
}
.card-cover .material-symbols-rounded {
    font-size: 3.5rem;
    color: white;
    opacity: 0.95;
    transition: transform 0.4s ease;
}
.premium-article-card:hover .card-cover {
    transform: scale(1.05) rotate(-2deg);
}
.premium-article-card:hover .card-cover .material-symbols-rounded {
    transform: scale(1.1);
}

.card-content {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tag {
    display: inline-flex;
    align-self: flex-start;
    padding: 0.3rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.title {
    font-size: 1.45rem;
    font-weight: 900;
    color: #1e293b;
    line-height: 1.5;
    margin-bottom: 0.8rem;
    transition: color 0.2s, font-size 0.3s;
    text-wrap: balance;
    letter-spacing: 0.01em;
}

.body {
    font-size: 1.05rem;
    line-height: 1.9;
    font-weight: 500;
    color: #334155;
    letter-spacing: 0.02em;
    transition: font-size 0.3s, line-height 0.3s;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 900;
    opacity: 0.6;
    transition: all 0.2s ease;
}
.premium-article-card:hover .read-more {
    opacity: 1;
}
.premium-article-card:hover .read-more .material-symbols-rounded {
    transform: translateX(4px);
}

/* --- Theme Colors (パステル調に柔らかく) --- */
.bg-gradient-indigo { background: linear-gradient(135deg, #a5b4fc, #6366f1); }
.text-indigo { color: #6366f1 !important; }
.bg-indigo-light { background: #e0e7ff; color: #4338ca; }
body.dark-mode .bg-indigo-light { background: rgba(99, 102, 241, 0.2); color: #818cf8; }

.bg-gradient-emerald { background: linear-gradient(135deg, #6ee7b7, #10b981); }
.text-emerald { color: #10b981 !important; }
.bg-emerald-light { background: #d1fae5; color: #047857; }
body.dark-mode .bg-emerald-light { background: rgba(16, 185, 129, 0.2); color: #34d399; }

.bg-gradient-cyan { background: linear-gradient(135deg, #67e8f9, #06b6d4); }
.text-cyan { color: #06b6d4 !important; }
.bg-cyan-light { background: #cffafe; color: #0e7490; }
body.dark-mode .bg-cyan-light { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }

.bg-gradient-sky { background: linear-gradient(135deg, #7dd3fc, #0ea5e9); }
.text-sky { color: #0ea5e9 !important; }
.bg-sky-light { background: #e0f2fe; color: #0369a1; }
body.dark-mode .bg-sky-light { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }

.bg-gradient-amber { background: linear-gradient(135deg, #fde047, #f59e0b); }
.text-amber { color: #f59e0b !important; }
.bg-amber-light { background: #fef3c7; color: #b45309; }
body.dark-mode .bg-amber-light { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.bg-gradient-rose { background: linear-gradient(135deg, #fda4af, #f43f5e); }
.text-rose { color: #f43f5e !important; }
.bg-rose-light { background: #ffe4e6; color: #be123c; }
body.dark-mode .bg-rose-light { background: rgba(244, 63, 94, 0.2); color: #fb7185; }

.bg-gradient-violet { background: linear-gradient(135deg, #d8b4fe, #8b5cf6); }
.text-violet { color: #8b5cf6 !important; }
.bg-violet-light { background: #ede9fe; color: #6d28d9; }
body.dark-mode .bg-violet-light { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }

.bg-gradient-fuchsia { background: linear-gradient(135deg, #f5d0fe, #d946ef); }
.text-fuchsia { color: #d946ef !important; }
.bg-fuchsia-light { background: #fae8ff; color: #a21caf; }
body.dark-mode .bg-fuchsia-light { background: rgba(217, 70, 239, 0.2); color: #e879f9; }

.bg-gradient-teal { background: linear-gradient(135deg, #99f6e4, #14b8a6); }
.text-teal { color: #14b8a6 !important; }
.bg-teal-light { background: #ccfbf1; color: #0f766e; }
body.dark-mode .bg-teal-light { background: rgba(20, 184, 166, 0.2); color: #2dd4bf; }

.bg-gradient-orange { background: linear-gradient(135deg, #fdba74, #f97316); }
.text-orange { color: #f97316 !important; }
.bg-orange-light { background: #ffedd5; color: #c2410c; }
body.dark-mode .bg-orange-light { background: rgba(249, 115, 22, 0.2); color: #fb923c; }


/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .premium-article-card {
        flex-direction: column;
        border-radius: 28px;
    }
    .card-cover {
        width: 80px;
        height: 80px;
        margin: 1.5rem 0 0 1.5rem;
        border-radius: 20px;
    }
    .card-cover .material-symbols-rounded {
        font-size: 2.5rem;
    }
    .card-content {
        padding: 1.25rem 1.5rem 1.5rem 1.5rem;
    }
    .title {
        font-size: 1.25rem;
    }
    .body {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    .scroll-top-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 48px;
        height: 48px;
    }
    .scroll-top-btn .material-symbols-rounded {
        font-size: 24px;
    }
    body.large-text .title { font-size: 1.4rem; }
    body.large-text .body { font-size: 1.1rem; }
}
/* --- Article Body Typography & Polish --- */
.article-body { font-family: 'Zen Maru Gothic', 'M PLUS Rounded 1c', sans-serif; font-weight: 500; }
.article-body h2 { font-weight: 900; font-size: 1.6rem; color: #0f172a; margin-top: 3.5rem; margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 3px solid #e0f2fe; letter-spacing: 0.02em; }
.article-body p { margin-bottom: 2rem; font-size: 1.05rem; line-height: 1.9; color: #1e293b; letter-spacing: 0.04em; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 2rem; color: #1e293b; line-height: 1.9; font-size: 1.05rem; letter-spacing: 0.04em; }
.article-body ul { list-style-type: disc; }
.article-body ol { list-style-type: decimal; }
.article-body ul li, .article-body ol li { margin-bottom: 0.75rem; }
.article-body strong { font-weight: 700; background: linear-gradient(transparent 60%, #fef08a 60%); padding: 0 0.2em; color: #0f172a; }
.article-body b { font-weight: 700; color: #0f172a; }
.article-body blockquote { margin: 2rem 0; padding: 1.5rem; background-color: #f8fafc; border-left: 4px solid #bae6fd; border-radius: 0 16px 16px 0; color: #334155; font-size: 1.05rem; line-height: 1.9; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body .reference { margin-top: 4rem; padding: 1.8rem; background-color: #f8fafc; border-radius: 20px; border: 1px solid #f1f5f9; }
.article-body .reference h3 { font-weight: 700; color: #475569; margin-bottom: 1rem; font-size: 1rem; }
.article-body .reference p { margin-bottom: 0.75rem; color: #64748b; font-size: 0.85rem; line-height: 1.7; letter-spacing: 0.02em; }
.article-body .speech-bubble { background-color: #f1f5f9; border-radius: 16px; padding: 1rem 1.5rem; margin-bottom: 1rem; display: inline-block; font-weight: 700; color: #334155; position: relative; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.article-body .speech-bubble::before { content: ''; position: absolute; bottom: -8px; left: 24px; border-width: 8px 8px 0; border-style: solid; border-color: #f1f5f9 transparent transparent transparent; }
body.dark-mode .article-body .speech-bubble { background-color: #1e293b; color: #e2e8f0; }
body.dark-mode .article-body .speech-bubble::before { border-top-color: #1e293b; }
body.dark-mode .article-body h2 { color: #f8fafc; border-bottom-color: #334155; }
body.dark-mode .article-body p, body.dark-mode .article-body ul, body.dark-mode .article-body ol { color: #cbd5e1; }
body.dark-mode .article-body strong { color: #fff; background: linear-gradient(transparent 60%, rgba(202, 138, 4, 0.4) 60%); }
body.dark-mode .article-body blockquote { background-color: #1e293b; border-left-color: #0ea5e9; color: #cbd5e1; }
body.dark-mode .article-body .reference { background-color: #0f172a; border-color: #334155; }
body.dark-mode .article-body .reference h3 { color: #94a3b8; }
body.dark-mode .article-body .reference p { color: #64748b; }
