/**
 * Main stylesheet for Doujinshi Introduction Website
 * Simple, clean design optimized for Japanese content
 */

/* Page transition - Fade in on load */
html {
    opacity: 0;
}

html.is-render {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* CSS Variables for theme colors */
:root {
    --color-text: #333;
    --color-text-secondary: #666;
    --color-text-muted: #999;
    --color-bg: #f5f5f5;
    --color-bg-surface: #fff;
    --color-bg-hover: #f8f9fa;
    --color-bg-secondary: #fafafa;
    --color-border: #ddd;
    --color-border-light: #eee;
    --color-border-secondary: #f0f0f0;
    --color-primary: #0066cc;
    --color-primary-hover: #0052a3;
    --color-link: #0066cc;
    --color-accent: #ff6b6b;
    --color-accent-secondary: #d32f2f;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Dark theme colors */
html[data-theme="dark"] {
    --color-text: #e0e0e0;
    --color-text-secondary: #b0b0b0;
    --color-text-muted: #808080;
    --color-bg: #121212;
    --color-bg-surface: #1e1e1e;
    --color-bg-hover: #2a2a2a;
    --color-bg-secondary: #252525;
    --color-border: #404040;
    --color-border-light: #333;
    --color-border-secondary: #2a2a2a;
    --color-primary: #6bb6ff;
    --color-primary-hover: #4a9eff;
    --color-link: #6bb6ff;
    --color-accent: #ff8787;
    --color-accent-secondary: #ff5252;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 62.5%; /* 1rem = 10px (16px × 62.5% = 10px) */
    min-height: 100vh;
}

body {
    font-family: "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", Meiryo, メイリオ, sans-serif;
    font-size: 1.4rem; /* 14px */
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

a:hover {
    text-decoration: underline;
    opacity: 0.7;
}

/* Header */
.site-header {
    background-color: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.site-title a {
    color: var(--color-text);
    text-decoration: none;
}

.main-nav {
    margin-inline: auto 1rem;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.main-nav a {
    color: var(--color-text-secondary);
    text-decoration: none;
    position: relative;
    display: inline-block;
}

.main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--color-text-secondary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.main-nav a:hover::after {
    transform: scaleX(1);
}

/* Header Menu */
.header-menu {
    position: relative;
}

.menu-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.menu-button:hover {
    background-color: var(--color-bg-hover);
}

.menu-button svg {
    color: var(--color-text-secondary);
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s, background-color 0.3s ease, border-color 0.3s ease;
    z-index: 1000;
}

.menu-dropdown[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
}

.menu-dropdown li {
    margin: 0;
}

.menu-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 1.4rem;
    transition: background-color 0.2s, color 0.3s ease;
}

.menu-dropdown a:hover {
    background-color: var(--color-bg-hover);
    text-decoration: none;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 1.4rem;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s, color 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--color-bg-hover);
}

.theme-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.sun-icon,
.moon-icon {
    display: none;
}

html[data-theme="light"] .sun-icon {
    display: block;
}

html[data-theme="dark"] .moon-icon {
    display: block;
}

.cat-drop-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 1.4rem;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s, color 0.3s ease;
}

.cat-drop-button:hover {
    background-color: var(--color-bg-hover);
}

/* Breadcrumbs */
.breadcrumbs {
    background-color: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border-light);
    padding: 0.5rem 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.breadcrumbs ol {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.breadcrumbs li::after {
    content: "›";
    margin-left: 0.5rem;
    color: var(--color-text-muted);
}

.breadcrumbs li:last-child::after {
    content: "";
}

/* Breadcrumbs links with animated underline */
.breadcrumbs a {
    text-decoration: none;
    color: var(--color-primary);
}

.breadcrumbs a span {
    display: inline-block;
    position: relative;
}

.breadcrumbs a span::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--color-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.breadcrumbs a:hover {
    color: var(--color-primary-dark, #0056b3);
}

.breadcrumbs a:hover span::before {
    transform: scaleX(1);
}

/* Page content layout */
.page-content {
    display: grid;
    grid-template-rows: 1fr auto;
}

/* Container and two-column layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

/* Main content area */
.content-area {
    background-color: var(--color-bg-surface);
    padding: 2rem;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    background-color: var(--color-bg-surface);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-section h3 {
    font-size: 1.4rem;
    font-weight: normal;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-primary);
}

.sidebar-section ul {
    list-style: none;
}

.sidebar-section li {
    margin-bottom: 0.5rem;
}

/* Sidebar category links with animated underline */
#sidebar-categories a {
    text-decoration: none;
    color: var(--color-primary);
}

#sidebar-categories a span {
    display: inline-block;
    position: relative;
}

#sidebar-categories a span::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--color-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

#sidebar-categories a:hover {
    color: var(--color-primary-dark, #0056b3);
}

#sidebar-categories a:hover span::before {
    transform: scaleX(1);
}

/* Search form */
.simple-search-form {
    position: relative;
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.simple-search-form input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 1.4rem;
    background-color: var(--color-bg-surface);
    color: var(--color-text);
    transition: border-color 0.3s, background-color 0.3s ease, color 0.3s ease;
}

.simple-search-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.simple-search-form input::placeholder {
    color: var(--color-text-muted);
    font-weight: normal;
}

.simple-search-form button {
    padding: 0.5rem 0.75rem;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.simple-search-form button:hover {
    background-color: var(--color-primary-hover);
}

.simple-search-form button svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* Sidebar Recommendations Slider */
.recommendation-slider {
    position: relative;
}

.slider-items {
    position: relative;
    width: 100%;
}

.recommendation-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    transition: opacity 1s ease-in-out, visibility 1s ease-in-out;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.recommendation-item.active {
    position: relative;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background-color: var(--color-bg-surface);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s, box-shadow 0.3s ease, opacity 1s ease-in-out, visibility 1s ease-in-out;
}

.recommendation-item.active:hover {
    opacity: 0.7;
    text-decoration: none;
}

.recommendation-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: var(--color-bg-secondary);
}

.recommendation-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recommendation-item.active:hover .recommendation-image img {
    transform: scale(1.08);
}

.recommendation-info {
    padding: 1rem;
}

.recommendation-title {
    font-size: 1.4rem;
    font-weight: normal;
    margin: 0;
    line-height: 1.4;
    height: calc(1.4rem * 1.4 * 2); /* Fixed height for exactly 2 lines */
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Slider Navigation */
.slider-nav {
    position: absolute;
    top: calc(100px - 18px); /* Center on 200px image: (200px / 2) - (36px / 2) */
    width: 36px;
    height: 36px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    z-index: 10;
    padding: 0;
}

.slider-nav svg {
    width: 24px;
    height: 24px;
    display: block;
}

.slider-nav:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.slider-prev {
    left: 8px;
}

.slider-next {
    right: 8px;
}

/* For devices with hover capability: show buttons only on hover */
@media (hover: hover) {
    .slider-nav {
        opacity: 0;
        pointer-events: none;
    }

    .recommendation-slider:hover .slider-nav {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Slider Dots */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: var(--color-border);
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.slider-dot:hover {
    background-color: var(--color-text-muted);
    transform: scale(1.2);
}

.slider-dot.active {
    background-color: var(--color-primary);
    transform: scale(1.2);
}

/* Recommendations */
.recommended-works {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Footer */
.site-footer {
    background-color: var(--color-text);
    color: var(--color-bg);
    text-align: center;
    padding: 2rem 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.footer-nav {
    margin-bottom: 1.5rem;
}

.footer-nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.footer-nav li {
    margin: 0;
}

.footer-nav a {
    color: var(--color-bg);
    text-decoration: none;
    font-size: 1.2rem;
    transition: opacity 0.3s ease;
}

.footer-nav a:hover {
    opacity: 0.7;
}

.copyright {
    font-size: 1.2rem;
    margin: 0;
}

@media (max-width: 640px) {
    .footer-nav ul {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Block Styles for Content Editor */
.block {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--color-bg-secondary);
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.block-text {
    margin: 2rem 0;
}

.block-text h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.block-text .content {
    line-height: 1.8;
    color: var(--color-text-secondary);
}

.block-image {
    margin: 2rem 0;
    text-align: center;
}

.block-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow-md);
}

.block-image-text {
    margin: 2rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.block-image-text.image-right .image {
    order: 2;
}

.block-image-text .image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.block-image-text h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.block-image-text .content {
    line-height: 1.8;
}

.block-html {
    margin: 2rem 0;
    padding: 0;
    background: transparent;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .header-container {
        position: relative;
        flex-direction: column;
        gap: 1rem;
    }

    .main-nav {
        margin-inline: auto auto;
    }

    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-menu {
        position: absolute;
        top: -0.5rem;
        right: 0;
    }

    .block {
        padding: 1rem;
        margin: 1rem 0;
    }

    .block-image-text {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .block-image-text.image-right .image {
        order: 1;
    }
}

/* Work Info Block */
.block-work-info {
    margin: 2rem 0;
    background-color: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.work-info-table {
    width: 100%;
    border-collapse: collapse;
}

.work-info-table th,
.work-info-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border-secondary);
}

.work-info-table th {
    background-color: var(--color-bg-secondary);
    font-weight: 600;
    color: var(--color-text);
    width: 6em;
    transition: background-color 0.3s ease;
}

.work-info-table td {
    color: var(--color-text-secondary);
}

.work-info-table tr:last-child th,
.work-info-table tr:last-child td {
    border-bottom: none;
}

/* Purchase Button Block */
.block-purchase-button {
    margin: 2rem 0;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.block-purchase-button .price {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: #fff;
}

.block-purchase-button .btn {
    display: inline-block;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.block-purchase-button .btn-primary {
    background-color: #ff6b6b;
    color: white;
}

.block-purchase-button .btn-primary:hover {
    background-color: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.block-purchase-button .btn-secondary {
    background-color: #4ecdc4;
    color: white;
}

.block-purchase-button .btn-secondary:hover {
    background-color: #45b8b0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.block-purchase-button .btn-success {
    background-color: #51cf66;
    color: white;
}

.block-purchase-button .btn-success:hover {
    background-color: #40c057;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Feature List Block */
.block-feature-list {
    margin: 2rem 0;
}

.block-feature-list h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

.block-feature-list .feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.block-feature-list .feature-list li {
    position: relative;
    padding: 1rem 1rem 1rem 3rem;
    margin-bottom: 1rem;
    background-color: var(--color-bg-surface);
    border-left: 4px solid #667eea;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    line-height: 1.6;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.block-feature-list .feature-list li:before {
    content: "✓";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 1.5rem;
    font-weight: bold;
}

.block-feature-list .feature-list li:last-child {
    margin-bottom: 0;
}

/* Summary Block */
.block-summary {
    max-width: 600px;
    margin: 4rem auto;
    padding: 1.5rem;
    background-color: var(--color-bg-hover);
    border: 1px dashed var(--color-border);
    border-radius: 4px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.block-summary h2 {
    font-size: 1.4rem;
    margin-bottom: 5px;
}

.block-summary .content {
    line-height: 1.8;
    color: var(--color-text-secondary);
}

/* Quote Block */
.block-quote {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--color-bg-hover);
    border-radius: 4px;
}

.block-quote blockquote {
    margin: 0;
    padding: 2.5rem 2rem 2rem 2.5rem;
    font-style: italic;
    line-height: 1.8;
    color: var(--color-text-secondary);
    position: relative;
}

.block-quote blockquote::before {
    content: "\201c";
    position: absolute;
    top: -1rem;
    left: -1rem;
    font-size: 6rem;
    color: #999;
    font-family: serif;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.block-quote blockquote::after {
    content: "\201d";
    position: absolute;
    bottom: -2rem;
    right: 1rem;
    font-size: 6rem;
    color: #999;
    font-family: serif;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.block-quote cite {
    display: block;
    text-align: right;
    font-style: normal;
    color: var(--color-text-secondary);
}

/* Sample Image List Block */
.block-sample-image-list {
    margin: 2rem 0;
}

.block-sample-image-list .sample-image-item {
    margin-bottom: 1.5rem;
    text-align: center;
}

.block-sample-image-list .sample-image-item:last-child {
    margin-bottom: 0;
}

.block-sample-image-list img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: var(--shadow-md);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.block-sample-image-list a:hover img {
    opacity: 0.9;
}

/* Responsive adjustments for new blocks */
@media (max-width: 768px) {
    .work-info-table th,
    .work-info-table td {
        padding: 0.5rem;
    }

    .block-purchase-button {
        padding: 1.5rem 1rem;
    }

    .block-purchase-button .price {
        font-size: 1.5rem;
    }

    .block-purchase-button .btn {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }
}
