/* Japanese Minimalist Design - Inspired by Kamon Family Crests */

:root {
    --sumi-black: #1a1a1a;
    --sumi-black-light: #2a2a2a;
    --washi-white: #faf9f6;
    --washi-cream: #f5f4f1;
    --ink-gray: #4a4a4a;
    --ink-gray-light: #6a6a6a;
    
    /* Seasonal accent colors - extremely muted and restrained */
    /* Spring: Sakura pink, Autumn: Muted rust, Winter: Indigo */
    /* Set via JavaScript based on current month */
    --seasonal-accent: rgba(140, 150, 170, 0.25);
}


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

html {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 300;
    background-color: var(--washi-white);
    color: var(--sumi-black);
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.8;
    letter-spacing: 0.02em;
    position: relative;
}

/* Washi Paper Texture - Extremely low contrast */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(0,0,0,0.005) 1px, transparent 0);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* Top Navigation Banner */
/* Top Navigation Banner */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: rgba(250, 249, 246, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.top-nav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: var(--sumi-black);
    opacity: 0.12;
}

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

.nav-home {
    font-family: 'Noto Serif JP', serif;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--sumi-black);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.nav-home:hover {
    opacity: 0.6;
}

.top-nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.top-nav-link {
    font-size: 14px;
    font-weight: 300;
    color: var(--ink-gray);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: opacity 0.3s ease, color 0.3s ease;
    position: relative;
    padding: 4px 0;
}

.top-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--seasonal-accent), transparent);
    transition: width 0.3s ease;
    opacity: 0.5;
}

.top-nav-link:hover {
    opacity: 0.7;
    color: var(--sumi-black);
}

.top-nav-link:hover::after {
    width: 100%;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 650px;
    margin: 0 auto;
    padding: 140px 24px 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Main Content */
.content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Welcome Section - Editorial spacing with organic rhythm */
.welcome-section {
    margin-bottom: 72px;
    width: 100%;
}

.site-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 48px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--sumi-black);
    margin-bottom: 20px;
    line-height: 1.25;
}

.site-subtitle {
    font-size: 18px;
    font-weight: 400;
    color: var(--ink-gray);
    margin-bottom: 16px;
    letter-spacing: 0.03em;
}

.site-description {
    font-size: 16px;
    font-weight: 300;
    color: var(--ink-gray-light);
    letter-spacing: 0.02em;
    line-height: 1.75;
}

/* Navigation - Refined hover interactions */
.navigation {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-bottom: 72px;
}

.nav-link {
    text-decoration: none;
    color: var(--sumi-black);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: relative;
    transform: translateY(0);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--seasonal-accent), transparent);
    transition: width 0.3s ease;
    opacity: 0.5;
}

.nav-link:hover {
    opacity: 0.65;
    transform: translateY(-2px);
}

.nav-link:hover::after {
    width: 100px;
}

.nav-label {
    font-family: 'Noto Serif JP', serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--sumi-black);
}

.nav-desc {
    font-size: 14px;
    font-weight: 300;
    color: var(--ink-gray-light);
    letter-spacing: 0.02em;
}

/* Featured Section - Framed with thin border */
.featured-section {
    width: 100%;
    margin-top: 32px;
    padding: 32px 0;
    border: 1px solid var(--sumi-black);
    border-width: 1px 0;
    border-color: rgba(26, 26, 26, 0.12);
}

.section-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--sumi-black);
    margin-bottom: 36px;
    text-align: center;
}

.featured-content {
    width: 100%;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-text {
    font-size: 14px;
    font-weight: 300;
    color: var(--ink-gray-light);
    letter-spacing: 0.02em;
}

/* Error/Empty state styling */
.featured-content > div[style*="color"] {
    font-size: 14px;
    font-weight: 300;
    color: var(--ink-gray-light) !important;
    letter-spacing: 0.02em;
    text-align: center;
}

/* Project Card Styles (for dynamic content) */
.project-card {
    width: 100%;
    text-align: center;
    padding: 24px 0;
}

.project-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--sumi-black);
    margin-bottom: 12px;
}

.project-title a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.project-title a:hover {
    opacity: 0.6;
}

.project-description {
    font-size: 15px;
    font-weight: 300;
    color: var(--sumi-black);
    line-height: 1.7;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
    opacity: 0.9;
}

.project-tags {
    display: inline-block;
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    font-weight: 300;
    color: var(--ink-gray);
    letter-spacing: 0.03em;
    line-height: 1.6;
    opacity: 0.85;
}

.tag {
    display: inline;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    letter-spacing: inherit;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.tag:hover {
    opacity: 0.8;
    color: var(--seasonal-accent);
}

/* Chat Section - Matching featured section style */
.chat-section {
    width: 100%;
    margin-top: 32px;
    padding: 32px 0;
    border: 1px solid var(--sumi-black);
    border-width: 1px 0 0 0;
    border-color: rgba(26, 26, 26, 0.12);
    position: relative;
    overflow-x: hidden;
}

/* HTMX Swap Transitions - Fade out on swap */
#chat-content.htmx-swapping {
    opacity: 0;
    min-height: 220px; /* Keep height during fade out */
    transition: opacity 1.5s ease-out, min-height 1.5s ease-out;
}

/* HTMX Settle Transitions - Fade in on addition */
#chat-content.htmx-added {
    opacity: 0;
    min-height: 220px;
}

#chat-content {
    opacity: 1;
    transition: opacity 1.5s ease-out, min-height 1.5s ease-out;
    min-height: 220px; /* Match approximate height of placeholder */
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.chat-messages {
    width: 100%;
    min-height: 100px;
    max-height: 40vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
    gap: 24px;
    scroll-behavior: smooth;
    overflow-anchor: auto;
}

.chat-messages:empty {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.chat-message {
    width: 100%;
    max-width: 500px;
    text-align: left;
    padding: 16px 0;
    border-bottom: 1px solid var(--sumi-black);
    border-width: 0 0 1px 0;
    border-color: rgba(26, 26, 26, 0.15);
    animation: fadeIn 1.5s ease-out;
}

.chat-message:last-child {
    border-bottom: none;
}

.chat-message-label {
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-gray);
    letter-spacing: 0.03em;
    margin-bottom: 8px;
    text-transform: uppercase;
    opacity: 0.9;
}

.chat-message-text {
    font-size: 15px;
    font-weight: 300;
    color: var(--sumi-black);
    line-height: 1.7;
    letter-spacing: 0.02em;
    opacity: 0.95;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.chat-message.user .chat-message-label {
    color: var(--ink-gray);
    opacity: 0.9;
}

.chat-message.ai .chat-message-label {
    color: var(--ink-gray);
    opacity: 0.9;
}

.chat-message.system .chat-message-label {
    color: var(--ink-gray);
    opacity: 0.9;
}

.chat-message.error {
    border-bottom: none;
    padding: 12px 0;
}

.chat-message.error .chat-message-text {
    color: var(--ink-gray-light);
    font-size: 14px;
    font-style: italic;
}

.chat-form {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.chat-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 300;
    color: var(--sumi-black);
    background-color: transparent;
    border: 1px solid var(--sumi-black);
    border-width: 0 0 1px 0;
    border-color: rgba(26, 26, 26, 0.4);
    opacity: 0.9;
    outline: none;
    letter-spacing: 0.02em;
    transition: opacity 0.3s ease, border-color 0.3s ease;
}

.chat-input:focus {
    opacity: 1;
    border-color: rgba(26, 26, 26, 0.8);
}

.chat-input::placeholder {
    color: var(--ink-gray-light);
    opacity: 0.5;
}

.chat-submit {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 12px 8px;
    background-color: transparent;
    border: none;
    color: var(--sumi-black);
    opacity: 0.6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.chat-submit:hover {
    opacity: 1;
}

.chat-submit:active {
    opacity: 0.8;
}

.chat-submit svg {
    display: block;
}

/* Responsive Design - Maintaining editorial rhythm */
@media (max-width: 768px) {
    .top-nav-container {
        padding: 16px 20px;
    }

    .nav-home {
        font-size: 16px;
    }

    .top-nav-links {
        gap: 24px;
    }

    .top-nav-link {
        font-size: 13px;
    }

    .container {
        padding: 120px 20px 100px;
        max-width: 100%;
    }

    .welcome-section {
        margin-bottom: 64px;
    }

    .site-title {
        font-size: 36px;
        margin-bottom: 18px;
    }

    .site-subtitle {
        font-size: 16px;
        margin-bottom: 14px;
    }

    .site-description {
        font-size: 15px;
    }

    .nav-label {
        font-size: 18px;
    }

    .nav-desc {
        font-size: 13px;
    }

    .navigation {
        gap: 36px;
        margin-bottom: 64px;
    }

    .section-title {
        font-size: 20px;
        margin-bottom: 32px;
    }

    .featured-section {
        margin-top: 28px;
        padding: 28px 0;
    }

    .chat-section {
        margin-top: 28px;
        padding: 28px 0;
    }

    .chat-messages {
        gap: 20px;
        margin-bottom: 28px;
        max-height: 33.33vh;
    }

    .chat-message {
        padding: 14px 0;
    }

    .chat-message-text {
        font-size: 14px;
    }

    .chat-form {
        max-width: 100%;
    }

    .chat-input {
        font-size: 14px;
        padding: 10px 44px 10px 14px;
    }

    .chat-submit {
        padding: 10px 6px;
    }

    .chat-submit svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .top-nav-container {
        padding: 14px 16px;
    }

    .nav-home {
        font-size: 15px;
    }

    .top-nav-links {
        gap: 20px;
    }

    .top-nav-link {
        font-size: 12px;
    }

    .container {
        padding: 100px 16px 80px;
    }

    .welcome-section {
        margin-bottom: 56px;
    }

    .site-title {
        font-size: 32px;
        margin-bottom: 16px;
    }

    .navigation {
        gap: 32px;
        margin-bottom: 56px;
    }

    .chat-section {
        margin-top: 24px;
        padding: 24px 0;
    }

    .chat-messages {
        gap: 18px;
        margin-bottom: 24px;
        max-height: 26.67vh;
    }

    .chat-message {
        padding: 12px 0;
    }

    .chat-message-label {
        font-size: 11px;
    }

    .chat-message-text {
        font-size: 13px;
    }

    .chat-form {
        max-width: 100%;
    }

    .chat-input {
        width: 100%;
        font-size: 13px;
        padding: 10px 40px 10px 12px;
    }

    .chat-submit {
        padding: 10px 6px;
    }

    .chat-submit svg {
        width: 16px;
        height: 16px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --sumi-black: #000000;
        --ink-gray: #333333;
        --ink-gray-light: #555555;
    }
}
