/* ==========================================================================
   Design System & Styling for Craft Analysis Web - Washi White Theme
   ========================================================================== */

/* 1. Global Reset & Variables */
:root {
    /* Warm natural washi paper white as base */
    --bg-color: #faf8f5;
    --text-primary: #1f2937;    /* Deep ink black */
    --text-secondary: #4b5563;  /* Charcoal */
    --text-muted: #6b7280;      /* Slate gray */
    
    /* Elegant Traditional Indigo Blue (藍色 - Ai-iro) */
    --accent-primary: #1e3a8a;
    --accent-secondary: #2563eb;
    --accent-glow: rgba(30, 58, 138, 0.1);
    
    /* Urushi Lacquer Red (朱赤 - Shu-aka) for warnings & callouts */
    --red-primary: #b91c1c;
    --red-secondary: #dc2626;
    
    /* Highlight Emerald Accent (Forest green) representing craft forest */
    --highlight-primary: #059669;
    --highlight-secondary: #10b981;
    --highlight-glow: rgba(5, 150, 105, 0.08);
    
    /* Light Glassmorphism settings for white background */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-shadow: rgba(0, 0, 0, 0.04);
    
    --font-heading: 'Outfit', 'Noto Sans JP', sans-serif;
    --font-body: 'Noto Sans JP', sans-serif;
    
    --border-radius: 12px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.8;
    font-size: 16px;
    letter-spacing: 0.03em;
    overflow-x: hidden;
}

/* Lang Toggle Visibility Control */
body.lang-ja .lang-en { display: none !important; }
body.lang-en .lang-ja { display: none !important; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 2. Global Navigation Bar */
.global-nav {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(250, 248, 245, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.nav-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
}

.lang-switch-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.lang-btn:hover {
    color: var(--accent-primary);
}

.lang-btn.active {
    color: var(--accent-primary);
    font-weight: 700;
}

.lang-divider {
    color: rgba(0, 0, 0, 0.15);
    font-size: 0.8rem;
    pointer-events: none;
}

/* 3. Hero Section (Header) */
.hero-section {
    padding: 80px 0 40px 0;
    text-align: center;
    position: relative;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(circle, rgba(30, 58, 138, 0.03) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 24px;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.hero-title .sub-heading {
    display: block;
    font-size: 1rem;
    color: var(--red-primary); /* Urushi Red for top line */
    font-weight: 600;
    letter-spacing: 0.18em;
    margin-bottom: 16px;
}

.hero-lead {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 760px;
    margin: 0 auto;
    font-weight: 400;
}

.download-container {
    margin-top: 32px;
}

.btn-download {
    display: inline-block;
    background: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.btn-download:hover {
    background: var(--accent-primary);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
}

/* 4. Helper Text Gradients */
.text-gradient {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--red-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 5. Glassmorphism Card Style (Light version) */
.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--glass-shadow);
}

/* 6. Statistics Dashboard */
.stats-dashboard {
    padding: 40px 0 20px 0;
}

.stats-header {
    text-align: center;
    margin-bottom: 32px;
}

.stats-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.03em;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.stats-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 50%;
    height: 2px;
    background: rgba(0, 0, 0, 0.08);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.stat-card {
    padding: 32px 24px;
    text-align: center;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(30, 58, 138, 0.15);
    box-shadow: 0 10px 30px rgba(30, 58, 138, 0.08);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 12px;
}

.stat-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.stat-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    font-weight: 400;
}

/* 7. Main Content Layout */
.main-content {
    padding: 40px 24px 80px 24px;
}

.content-section {
    margin-bottom: 80px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    padding-bottom: 18px;
    color: var(--text-primary);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), transparent);
}

.section-title span.chap-num {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--red-primary); /* Urushi Red accents */
    text-transform: uppercase;
    margin-bottom: 2px;
}

.content-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-weight: 400;
    font-size: 1rem;
    text-align: justify;
}

/* 8. Interdependency visual */
.interdep-box {
    padding: 32px;
    margin: 32px 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
}

.box-subtitle {
    font-size: 1rem;
    margin-bottom: 24px;
    color: var(--text-primary);
    font-weight: 700;
}

.eco-network {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.eco-node.root {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #1d4ed8 100%);
    color: #ffffff;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.25);
    font-size: 1rem;
}

.eco-connector {
    width: 2px;
    height: 30px;
    background: linear-gradient(180deg, var(--accent-primary), transparent);
}

.eco-leaves {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.eco-leaf {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

/* 9. Accordions */
.accordion-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.accordion-item {
    overflow: hidden;
    transition: var(--transition-smooth);
    border: 1px solid var(--glass-border);
    background: #ffffff;
}

.accordion-item:hover {
    border-color: rgba(30, 58, 138, 0.15);
}

.accordion-trigger {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 20px 24px;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition-smooth);
}

.accordion-trigger:hover {
    background: rgba(30, 58, 138, 0.02);
}

.trigger-text {
    flex: 1;
}

.arrow-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    margin-left: 12px;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
    padding: 0 24px;
}

.accordion-item.active .accordion-content {
    max-height: 2000px;
    transition: max-height 0.4s cubic-bezier(1, 0, 1, 0);
    padding-bottom: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.accordion-item.active .arrow-icon {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.accordion-content p {
    margin-top: 16px;
    margin-bottom: 16px;
}

.accordion-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.accordion-content li {
    margin-bottom: 8px;
}

/* 10. Solutions Grid & Solution Cards */
.solutions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.solution-card {
    padding: 30px 24px;
    position: relative;
    transition: var(--transition-smooth);
    background: #ffffff;
}

.solution-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.sol-num {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-primary);
    display: block;
    margin-bottom: 12px;
    opacity: 0.7;
}

.solution-card h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
}

.solution-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.6;
}

/* Highlight Card (Craft Forest) */
.solution-card.highlight {
    grid-column: span 1;
    border-color: rgba(5, 150, 105, 0.25);
    background: rgba(240, 253, 250, 0.9);
}

@media (min-width: 768px) {
    .solution-card.highlight {
        grid-column: span 2;
    }
}

.solution-card.highlight .sol-num {
    color: var(--highlight-primary);
    opacity: 0.95;
}

.solution-card.highlight::after {
    content: 'PICK UP';
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--highlight-primary);
    border: 1px solid var(--highlight-primary);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.solution-card.highlight strong {
    color: var(--highlight-primary);
    font-weight: 700;
}

/* 11. Feedback Forum & Form */
.feedback-forum {
    padding: 48px;
    margin-top: 100px;
    border-color: rgba(30, 58, 138, 0.1);
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

.feedback-forum::after {
    content: '';
    position: absolute;
    bottom: -150px;
    right: -150px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(30, 58, 138, 0.02) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
}

.forum-title {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 700;
}

.forum-lead {
    color: var(--text-secondary);
    margin-bottom: 32px !important;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 700;
}

select, textarea, input[type="text"], input[type="number"] {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
    box-sizing: border-box; /* パディングを含めたサイズ算出 */
}

/* テキスト入力欄とセレクトボックスの高さをしっかり48pxで固定 */
select, input[type="text"], input[type="number"] {
    height: 48px;
}

select:focus, textarea:focus, input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(30, 58, 138, 0.08);
}

.btn-submit {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.15);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(30, 58, 138, 0.3);
}

/* Comments Display list */
.comments-display {
    margin-top: 48px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 36px;
}

.comments-display h3 {
    font-size: 1.15rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    padding: 20px 24px;
    border-color: rgba(0, 0, 0, 0.06);
    background: #ffffff;
    animation: fadeIn 0.5s ease-out;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.comment-topic {
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.comment-stance {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.stance-agree {
    background: rgba(5, 150, 105, 0.08);
    color: var(--highlight-primary);
}

.stance-worry {
    background: rgba(185, 28, 28, 0.08);
    color: var(--red-primary);
}

.stance-idea {
    background: rgba(30, 58, 138, 0.08);
    color: var(--accent-primary);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-body {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0 !important;
}

/* 12. Footer */
.site-footer {
    text-align: center;
    padding: 60px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer p {
    margin-bottom: 8px;
}

.footer-note {
    font-style: italic;
    opacity: 0.8;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.8rem;
    }
    .hero-section {
        padding: 60px 0 30px 0;
    }
    .feedback-forum {
        padding: 24px;
    }
    .nav-container {
        padding: 12px 16px;
    }
}

/* 13. Metrics Details in Chapter 1 */
.metrics-details {
    padding: 32px;
    margin: 32px 0 0 0;
    background: #ffffff;
}

.metrics-details-title {
    font-size: 1.15rem;
    margin-bottom: 24px;
    color: var(--text-primary);
    font-weight: 700;
}

.metrics-category-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.metrics-category {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 16px;
}

.metrics-category h4 {
    font-size: 0.95rem;
    color: var(--accent-primary);
    margin-bottom: 16px;
    font-weight: 700;
    border-left: 3px solid var(--accent-primary);
    padding-left: 8px;
}

.metrics-category ul {
    list-style: none;
    padding: 0;
}

.metrics-category li {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    font-size: 0.82rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
    border-bottom: 1px dashed rgba(0, 0, 0, 0.04);
    padding-bottom: 10px;
}

.m-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 4px;
}

.m-label {
    flex: 1;
    padding-right: 8px;
    font-weight: 500;
}

.m-val {
    font-weight: 700;
    white-space: nowrap;
}

.m-val.red {
    color: var(--red-primary);
}

.m-bar-container {
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.m-bar {
    height: 100%;
    background: var(--accent-primary);
    opacity: 0.4;
    border-radius: 2px;
}

/* 14. Notice Section */
.notice-section {
    padding: 0 0 32px 0;
}

.notice-box {
    padding: 24px 32px;
    border-color: rgba(196, 65, 12, 0.15); /* Soft Urushi Red border */
    background: rgba(254, 243, 199, 0.25); /* Warm amber tint background */
    text-align: left;
}

.notice-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0;
}

.notice-text strong {
    color: var(--red-primary);
    font-weight: 700;
}

/* 15. Threaded Replies & URL Auto-linking */
.comment-replies-area {
    margin-top: 18px;
    padding-left: 20px;
    border-left: 3px solid rgba(30, 58, 138, 0.12); /* Soft deep blue indentation border */
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.reply-item {
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.01);
}

.reply-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.reply-nickname {
    font-weight: 700;
    color: var(--text-primary);
}

.reply-time {
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
}

.reply-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.reply-trigger-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.btn-reply-toggle {
    background: none;
    border: none;
    font-size: 0.82rem;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-reply-toggle:hover {
    background: var(--accent-glow);
    color: #1d4ed8;
}

.reply-form-container {
    margin-top: 14px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(30, 58, 138, 0.08);
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    animation: slideDown 0.25s ease-out;
}

.reply-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reply-form input[type="text"] {
    background: #ffffff;
    height: 40px; /* 少しコンパクトに */
    padding: 8px 12px;
    font-size: 0.9rem;
}

.reply-form textarea {
    background: #ffffff;
    padding: 10px 12px;
    font-size: 0.9rem;
}

/* 自動リンクURLのスタイル */
.comment-url {
    color: var(--accent-primary);
    text-decoration: none;
    word-break: break-all;
    border-bottom: 1px dashed rgba(30, 58, 138, 0.3);
    transition: var(--transition-smooth);
}

.comment-url:hover {
    color: #1d4ed8;
    border-bottom-style: solid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
