/* Portfolio Theme - Modern Illustrator Portfolio */

/* ========================================
   CSS Custom Properties
   ======================================== */
:root {
    --color-white: #ffffff;
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-border: #e8e8e8;
    --color-border-light: #f0f0f0;

    --color-text-primary: #2a2a2a;
    --color-text-secondary: #666666;
    --color-text-tertiary: #999999;

    --color-accent: var(--theme-accent-color, #555555);

    --font-display: 'Cormorant Garamond', 'Noto Serif JP', serif;
    --font-body: 'DM Sans', 'Noto Sans JP', sans-serif;

    --sidebar-width: 320px;
    --content-gap: 16px;
    --thumbnail-size: 220px;

    --transition-fast: 0.2s ease;
    --transition-medium: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.7;
    color: var(--color-text-primary);
    background-color: var(--color-bg);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.3;
    margin: 0 0 0.5em 0;
}

h1 {
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

h2 {
    font-size: 1.75rem;
    font-weight: 500;
}

h3 {
    font-size: 1.25rem;
    font-weight: 500;
}

p {
    margin: 0 0 1em 0;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   Layout - Index Page (Split View)
   ======================================== */
.portfolio-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.portfolio-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2.5rem;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;

}

.sidebar-inner {
    text-align: center;
}

.author-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.5rem;
    border: 3px solid var(--color-border-light);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.author-avatar:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.author-name {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
    color: var(--color-text-primary);
}

.author-tagline {
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
}

.author-bio {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.social-links a,
.social-links .p-sns-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-bg);
    color: var(--color-text-secondary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.social-links a:hover,
.social-links .p-sns-icon:hover {
    background-color: var(--color-text-primary);
    color: var(--color-white);
    transform: translateY(-2px);
}

/* Navigation */
.sidebar-nav {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border-light);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin: 0.75rem 0;
}

.sidebar-nav a {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 2px;
}

.sidebar-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 1px;
    background-color: var(--color-accent);
    transition: all var(--transition-fast);
    transform: translateX(-50%);
}

.p-home-menu-item-current {
    border: initial;
}

.sidebar-nav a:hover::after,
.sidebar-nav .p-home-menu-item-current a::after {
    width: 100%;
}

.sidebar-nav .p-home-menu-item-current a {
    color: var(--color-text-primary);
}

/* Main Content Area */
.portfolio-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    min-height: 100vh;
}

/* ========================================
   Gallery Grid
   ======================================== */
.gallery-intro {
    max-width: 600px;
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.gallery-intro p {
    font-size: 1rem;
    color: var(--color-text-secondary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--thumbnail-size), 1fr));
    gap: var(--content-gap);
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: var(--color-surface);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-medium);
}

.gallery-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-title {
    color: var(--color-white);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-item-icons {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.4rem;
}

.gallery-item-icons span {
    display: block;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.85;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Text-only thumbnail */
.gallery-item.text-only {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: var(--color-bg);
}

.gallery-item.text-only .gallery-text-title {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-text-secondary);
    text-align: center;
    word-break: break-word;
}

/* Tag Cloud */
.tag-cloud {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--color-surface);
    border-radius: 6px;
}

.tag-cloud a {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    margin: 0.2rem;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    background-color: var(--color-bg);
    border-radius: 20px;
    transition: all var(--transition-fast);
}

.tag-cloud a:hover {
    background-color: var(--color-text-primary);
    color: var(--color-white);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border-light);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
}

.pagination .pagination_current {
    background-color: var(--color-text-primary);
    color: var(--color-white);
    font-weight: 500;
}

/* ========================================
   Article Page
   ======================================== */
.article-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem 2rem;
    min-height: 100vh;
    background-color: var(--color-surface);
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
    margin-bottom: 2rem;
    transition: color var(--transition-fast);
}

.article-back:hover {
    color: var(--color-text-primary);
}

.article-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border-light);
}

.article-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--color-text-tertiary);
}

.article-tags {
    margin-top: 1rem;
}

.article-tags a {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    margin-right: 0.4rem;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    background-color: var(--color-bg);
    border-radius: 3px;
    transition: all var(--transition-fast);
}

.article-tags a:hover {
    background-color: var(--color-text-primary);
    color: var(--color-white);
}

.article-content {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--color-text-primary);
}

.article-content img {
    margin: 1.5rem 0;
    border-radius: 4px;
}

.article-content p {
    margin-bottom: 1.5rem;
}

/* Article Controls */
.article-controls {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border-light);
    text-align: center;
}

.article-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin: 2rem 0;
}

.article-nav-prev,
.article-nav-next {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-nav-prev {
    text-align: left;
}

.article-nav-next {
    text-align: right;
}

.article-nav-sep {
    color: var(--color-border);
}

/* Like Button */
.like-section {
    margin-bottom: 1.5rem;
}

.like-count {
    font-size: 0.9rem;
    color: var(--color-text-tertiary);
    margin-bottom: 0.5rem;
}

.p-button-like-it {
    display: inline-block;
    padding: 0.6rem 2rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 30px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.p-button-like-it:hover {
    background-color: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* Return Button */
.p-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--color-text-secondary);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    height: initial;
}

.p-button:hover {
    background-color: var(--color-text-primary);
    border-color: var(--color-text-primary);
    color: var(--color-white);
}

/* ========================================
   Search Page
   ======================================== */
.search-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem 2rem;
    min-height: 100vh;
    background-color: var(--color-surface);
}

.search-header {
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.p-search-input {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 250px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0 1rem;
}

.p-search-input input {
    flex: 1;
    border: none;
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
    font-family: var(--font-body);
    background: transparent;
    outline: none;
}

.p-search-input button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--color-text-tertiary);
}

.sort-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.sort-control select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-body);
    background-color: var(--color-surface);
}

/* Search Results */
.search-results {
    margin-top: 2rem;
}

.search-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border-light);
    transition: background-color var(--transition-fast);
}

.search-item:hover {
    background-color: var(--color-bg);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.search-item-thumb {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
    background-color: var(--color-bg);
}

.search-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-item-info {
    flex: 1;
    min-width: 0;
}

.search-item-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.search-item-title a {
    color: var(--color-text-primary);
}

.search-item-title a:hover {
    color: var(--color-accent);
}

.search-item-date {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    margin-bottom: 0.5rem;
}

.search-item-caption {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   Entry / NSFW Pages
   ======================================== */
.gate-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: var(--color-bg);
}

.gate-box {
    max-width: 480px;
    padding: 3rem;
    background-color: var(--color-surface);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.gate-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.gate-content {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
}

.gate-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gate-btn {
    display: block;
    padding: 1rem 2rem;
    font-size: 0.95rem;
    font-family: var(--font-body);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.gate-btn-primary {
    background-color: var(--color-text-primary);
    color: var(--color-white);
}

.gate-btn-primary:hover {
    background-color: #444;
}

.gate-btn-secondary {
    background-color: var(--color-bg);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.gate-btn-secondary:hover {
    background-color: var(--color-surface);
    border-color: var(--color-text-secondary);
}

/* ========================================
   Footer
   ======================================== */
.portfolio-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    border-top: 1px solid var(--color-border-light);
}

.global-header-link {
    display: block;
    padding: 1rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    letter-spacing: 0.05em;
}

.global-header-link:hover {
    color: var(--color-text-primary);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
        --thumbnail-size: 180px;
    }

    .portfolio-sidebar {
        padding: 2rem;
    }

    .author-avatar {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 768px) {
    :root {
        --thumbnail-size: 160px;
    }

    .portfolio-container {
        flex-direction: column;
    }

    .portfolio-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 2.5rem 1.5rem 2rem;
        border-right: none;
        border-bottom: 1px solid var(--color-border-light);
    }

    .sidebar-inner {
        max-width: 400px;
        margin: 0 auto;
    }

    .author-avatar {
        width: 100px;
        height: 100px;
        margin-bottom: 1rem;
    }

    .author-name {
        font-size: 1.4rem;
    }

    .author-bio {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    .sidebar-nav {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .sidebar-nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1.5rem;
    }

    .sidebar-nav li {
        margin: 0;
    }

    .portfolio-main {
        margin-left: 0;
        padding: 1.5rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .gallery-item-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 70%);
    }

    .article-container,
    .search-container {
        padding: 1.5rem 1.5rem 3rem 1.5rem;
    }

    .article-title {
        font-size: 1.8rem;
    }

    .article-nav {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        text-align: center;
    }

    .article-nav-prev,
    .article-nav-next {
        text-align: center;
    }

    .article-nav-sep {
        display: none;
    }

    .search-item {
        gap: 1rem;
    }

    .search-item-thumb {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .pagination {
        gap: 0.3rem;
    }

    .pagination a,
    .pagination span {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.8rem;
    }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.gallery-item:nth-child(1) {
    animation-delay: 0.05s;
}

.gallery-item:nth-child(2) {
    animation-delay: 0.1s;
}

.gallery-item:nth-child(3) {
    animation-delay: 0.15s;
}

.gallery-item:nth-child(4) {
    animation-delay: 0.2s;
}

.gallery-item:nth-child(5) {
    animation-delay: 0.25s;
}

.gallery-item:nth-child(6) {
    animation-delay: 0.3s;
}

.gallery-item:nth-child(7) {
    animation-delay: 0.35s;
}

.gallery-item:nth-child(8) {
    animation-delay: 0.4s;
}

.gallery-item:nth-child(9) {
    animation-delay: 0.45s;
}

.gallery-item:nth-child(10) {
    animation-delay: 0.5s;
}

.gallery-item:nth-child(n+11) {
    animation-delay: 0.55s;
}

/* Sidebar fade-in */
.portfolio-sidebar {
    animation: fadeInUp 0.6s ease;
}

/* ========================================
   Utility Classes
   ======================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}