@charset "utf-8";

/* =================================================================
   NagiWrite Common Styles
   Theme: Ivory & Paper
   Target Accessibility: WCAG 2.1 AA
   
   Copyright (c) 2026 Lichiphen
   ================================================================= */

:root {
    /* Background - Ivory / Warm Paper */
    --bg-body: #FDFBF7;       /* メイン背景 */
    --bg-card: #FFFFFF;       /* カード背景 */
    --bg-header: #FFFFFF;     /* ヘッダー背景 */
    --bg-footer: #F5F2EB;     /* フッター背景 */
    
    /* Text - Warm Charcoal */
    --text-main: #3E3A36;     /* 本文色 AA: 12.5:1 */
    --text-muted: #6F6860;    /* 補助色 AA: 4.8:1 */
    --text-light: #8F8780;    /* 薄い文字 */
    
    /* Primary - Elegant Brown */
    --primary-color: #6D5A46; /* プライマリブラウン AA: 5.6:1 */
    --primary-hover: #544436; /* ホバー時 */
    
    /* Accent - Soft Amber */
    --accent-color: #C08455;  /* アクセント */
    
    /* Border */
    --border-color: #EBE8E1;
    
    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(62, 58, 54, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(62, 58, 54, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(62, 58, 54, 0.08);
    
    /* Spacing & Radius */
    --spacing-sm: 8px;
    --spacing-md: 20px;
    --spacing-lg: 40px;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --header-height: 80px;
    --content-max-width: 1000px;
}

/* =================================================================
   Reset & Base
   ================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'LINE Seed JP', 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-main);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: bottom;
}

/* =================================================================
   Common Components
   ================================================================= */
/* Header */
.site-header {
    background-color: var(--bg-header);
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.maintitle {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.maintitle a {
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 0.05em;
}

.header-categories {
    display: flex;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-categories a {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.header-categories a::before {
    content: "chevron_right";
    font-family: "Material Symbols Rounded";
    font-variation-settings: "FILL" 0, "wght" 200, "GRAD" -25, "opsz" 24;
    font-size: 18px;
    line-height: 1;
    color: var(--text-light);
}

.header-categories a:hover {
    color: var(--primary-color);
    background-color: var(--bg-body);
    text-decoration: none;
}

@media (max-width: 768px) {
    .site-header {
        height: auto;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        height: auto;
        padding: 12px var(--spacing-md);
    }

    .maintitle {
        width: 100%;
    }

    .maintitle a {
        align-items: flex-start;
    }

    .header-nav {
        width: 100%;
    }

    .header-categories {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px 0;
        margin-top: 8px;
    }

    .header-categories ul {
        flex-wrap: nowrap;
        gap: 12px;
    }

    .header-categories li {
        flex: 0 0 auto;
    }

    .header-categories li ul {
        display: none !important;
    }
}

/* Category Tree Adjustment */
.header-categories ul {
    display: flex;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-categories li {
    margin: 0;
    position: relative;
}

.header-categories ul li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 8px;
    z-index: 1000;
    flex-direction: column;
    gap: 6px;
}

.header-categories li:hover > ul,
.header-categories li:focus-within > ul {
    display: flex;
}

.header-categories li ul a {
    padding: 6px 8px;
    font-size: 0.85rem;
}

/* Footer */
.site-footer {
    background-color: var(--bg-footer);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
    margin-top: auto;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

@media (max-width: 600px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }
}

.footer-section h3 {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 6px;
    display: inline-block;
}

.hashtag-list a {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 4px;
    color: var(--text-muted);
    background: #FFFFFF;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.hashtag-list a:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    text-decoration: none;
}

.copyright-area {
    margin-top: var(--spacing-lg);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.footer-credits {
    margin-top: 8px;
    text-align: right;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
    padding: 0 var(--spacing-md);
}

.credit-button {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 4px 0;
}

.credit-button:hover {
    color: var(--primary-color);
}

.credit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 3000;
}

.credit-modal[hidden] {
    display: none;
}

.credit-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    color: var(--text-main);
}

.credit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.credit-modal-header h3 {
    font-size: 0.9rem;
    margin: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.credit-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

.credit-modal-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.credit-modal-body a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Layout Wrapper */
.contents {
    max-width: var(--content-max-width);
    width: 100%;
    margin: var(--spacing-lg) auto;
    padding: 0 var(--spacing-md);
}

/* Pagination */
.pagenavi {
    margin: var(--spacing-lg) 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pagenavi a, .pagenavi span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.9rem;
}

.pagenavi a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagenavi b { /* Current Page */
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* =================================================================
   List Reset (Footer/Header nested lists)
   ================================================================= */
.site-footer ul,
.site-footer li,
.site-header ul,
.site-header li,
.footer-inner ul,
.footer-inner li,
.header-inner ul,
.header-inner li {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* =================================================================
   QuickPost Modal
   ================================================================= */
#post-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}
#post-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.postarea-wrapper {
    display: none;
}
.postarea-wrapper.loggedin-NO {
    display: none !important;
}

/* PC: Center Modal */
@media (min-width: 901px) {
    .postarea-wrapper.active {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        max-width: 650px;
        z-index: 1600;
        background: #fff;
        border-radius: 24px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        padding: 40px;
        display: block !important;
        animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}

/* Mobile: Bottom Sheet */
@media (max-width: 900px) {
    .postarea-wrapper.active {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        z-index: 1600;
        padding: 24px;
        border-radius: 24px 24px 0 0;
        display: block !important;
        box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
    }
}

@keyframes modalPop {
    from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* QuickPost Form */
.postarea form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.postarea textarea {
    width: 100%;
    min-height: 150px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    outline: none;
    background: var(--bg-body);
}

.postarea textarea:focus {
    border-color: var(--primary-color);
    background: #fff;
}

/* =================================================================
   Floating Post Button (✏書く)
   ================================================================= */
.floating-post-btn {
    position: fixed;
    right: 32px;
    bottom: 32px;
    width: 64px;
    height: 64px;
    background: var(--accent-color);
    color: #fff !important;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: 0 6px 20px rgba(192, 132, 85, 0.4);
    z-index: 2000;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: none;
    cursor: pointer;
}

.floating-post-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(192, 132, 85, 0.5);
    background: #a96d40;
}

.floating-post-btn .icon {
    font-size: 24px;
    margin-bottom: -2px;
}

.floating-post-btn .text {
    font-size: 11px;
    font-weight: 700;
}

/* Hide when not logged in */
.floating-post-btn.loggedin-NO {
    display: none !important;
}

/* PC: Scroll-linked visibility (Optional - remove pc-scroll-visible requirement for always-visible) */
@media (min-width: 901px) {
    .floating-post-btn {
        /* Default: visible on PC (no scroll required) */
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
}

/* Mobile: Always visible */
@media (max-width: 900px) {
    .floating-post-btn {
        right: 20px;
        bottom: 20px;
        width: 56px;
        height: 56px;
    }
    .floating-post-btn .icon { font-size: 22px; }
    .floating-post-btn .text { font-size: 10px; }
}


/* =================================================================
   Decoration Line (decoration2 deco-)
   ================================================================= */
.decoration2.deco- {
    display: block;
    width: 100%;
    height: 1px;
    margin: 1.6em 0;
    background: linear-gradient(90deg, rgba(140, 112, 88, 0) 0%, rgba(140, 112, 88, 0.35) 20%, rgba(140, 112, 88, 0.5) 50%, rgba(140, 112, 88, 0.35) 80%, rgba(140, 112, 88, 0) 100%);
    color: transparent;
    font-size: 0;
    line-height: 0;
}

.grid-hidden-br {
    display: none !important;
}


/* Copy Toast (positioned near click) */
.copy-toast {
    position: fixed;
    padding: 8px 16px;
    background: #10b981;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    pointer-events: none;
    animation: copyToastFade 1.5s ease forwards;
    transform: translate(-50%, -100%);
}

@keyframes copyToastFade {
    0% { opacity: 0; transform: translate(-50%, -80%); }
    15% { opacity: 1; transform: translate(-50%, -100%); }
    85% { opacity: 1; transform: translate(-50%, -100%); }
    100% { opacity: 0; transform: translate(-50%, -120%); }
}
