/* ===== 中小企業診断士1次試験 用語集 CSS ===== */
:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --bg-section: #f1f5f9;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --max-width: 960px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    line-height: 1.8;
    color: var(--text);
    background: var(--bg-alt);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; width: 100%; }

/* --- Header --- */
.header {
    background: var(--primary);
    color: #fff;
    padding: 14px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header .container { display: flex; align-items: center; justify-content: space-between; }
.site-title { color: #fff !important; font-size: 1.1rem; font-weight: 700; text-decoration: none !important; }
.header-sub { color: rgba(255,255,255,0.8); font-size: 0.8rem; }

/* --- Breadcrumb --- */
.breadcrumb {
    background: var(--bg);
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* --- Main --- */
.main { padding: 32px 0 64px; flex: 1; }

/* --- Hero (top page) --- */
.hero {
    text-align: center;
    padding: 48px 0 32px;
}
.hero h2 { font-size: 1.8rem; margin-bottom: 12px; }
.hero p { color: var(--text-secondary); font-size: 1.05rem; max-width: 600px; margin: 0 auto; }
.stats { display: flex; justify-content: center; gap: 32px; margin-top: 24px; }
.stat-item { text-align: center; }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); display: block; }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); }

/* --- Subject Cards (top page) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 32px;
}
.subject-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.subject-card a { text-decoration: none !important; color: inherit; display: block; }
.subject-card .subject-number { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; }
.subject-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.subject-card p { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.6; }
.subject-card .term-count {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.82rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 12px;
}

/* --- Subject Index --- */
.subject-header { margin-bottom: 8px; }
.subject-header h2 { font-size: 1.6rem; }
.subject-description { color: var(--text-secondary); margin: 8px 0 4px; }
.term-count-label { color: var(--primary); font-weight: 600; font-size: 0.95rem; margin-bottom: 16px; }

/* Search */
.search-box { position: relative; margin: 20px 0 16px; }
.search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-sans);
    background: var(--bg);
    transition: border-color 0.2s;
}
.search-input:focus { outline: none; border-color: var(--primary); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-size: 1.1rem; }

/* Category filter */
.category-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.category-tag {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
    color: var(--text);
}
.category-tag:hover, .category-tag.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Term list */
.term-list { list-style: none; }
.term-item {
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.term-item:hover { border-color: var(--border); box-shadow: var(--shadow); }
.term-item a {
    display: flex;
    align-items: baseline;
    padding: 10px 16px;
    text-decoration: none !important;
    color: var(--text);
    gap: 8px;
}
.term-number {
    width: 32px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-align: right;
    padding-right: 4px;
}
.term-name-link { font-weight: 600; color: var(--primary); white-space: nowrap; }
.term-overview-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Term Detail Page --- */
.term-detail { background: var(--bg); border-radius: var(--radius); padding: 36px 40px; box-shadow: var(--shadow); }
.term-header { margin-bottom: 28px; }
.term-category {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 10px;
}
.term-title { font-size: 1.8rem; line-height: 1.3; margin-bottom: 4px; }
.term-english { color: var(--text-secondary); font-size: 0.95rem; font-style: italic; }

/* Sections */
.section { margin-bottom: 28px; }
.section h3 {
    font-size: 1.15rem;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 6px;
    margin-bottom: 14px;
}
.section p { margin-bottom: 12px; }
.section ul, .section ol { margin: 8px 0 12px 24px; }
.section li { margin-bottom: 4px; }
.section table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.92rem; }
.section th, .section td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.section th { background: var(--bg-section); font-weight: 600; }

/* Overview box */
.overview-box {
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 18px 22px;
    font-size: 1rem;
    line-height: 1.9;
}

/* Example box */
.example-box {
    background: #fefce8;
    border-left: 4px solid #eab308;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 18px 22px;
    margin: 12px 0;
}
.example-box h4 { color: #854d0e; margin-bottom: 8px; font-size: 0.95rem; }
.example-box p { margin-bottom: 8px; }

/* Scholar box */
.scholar-box {
    background: #f5f3ff;
    border-left: 4px solid #7c3aed;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 18px 22px;
    margin: 12px 0;
}
.scholar-box h4 { color: #5b21b6; margin-bottom: 8px; font-size: 0.95rem; }
.scholar-box p { margin-bottom: 8px; }

/* Formula */
.formula {
    background: var(--bg-section);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    text-align: center;
    font-size: 1.05rem;
    overflow-x: auto;
}

/* Term navigation */
.term-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.term-nav a {
    color: var(--primary);
    text-decoration: none !important;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: background 0.2s;
}
.term-nav a:hover { background: var(--primary-light); }
.nav-prev::before { content: "\2190\00a0"; }
.nav-next::after { content: "\00a0\2192"; }
.nav-center { font-weight: 600; }

/* --- Footer --- */
.footer {
    background: #1e293b;
    color: #94a3b8;
    text-align: center;
    padding: 20px 0;
    font-size: 0.82rem;
    margin-top: auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .hero h2 { font-size: 1.4rem; }
    .stats { gap: 20px; }
    .stat-number { font-size: 1.5rem; }
    .card-grid { grid-template-columns: 1fr; }
    .term-detail { padding: 24px 20px; }
    .term-title { font-size: 1.4rem; }
    .term-nav { flex-direction: column; gap: 8px; }
    .term-item a { flex-wrap: wrap; }
    .term-overview-text { width: 100%; flex-basis: 100%; padding-left: 40px; }
}
@media (max-width: 480px) {
    .hero { padding: 32px 0 20px; }
    .stats { flex-direction: column; gap: 12px; }
}

/* Subject-specific accent colors (applied via inline style on header and elements) */
