/* ============================================
   An-Gallery — Public Pages CSS
   ============================================ */

:root {
    --bg: #08080a;
    --surface: #111114;
    --card: #161619;
    --card-h: #1c1c20;
    --border: #1e1e24;
    --border-h: #2a2a33;
    --text: #e8e6e3;
    --dim: #888;
    --muted: #555;
    --accent: #e87461;
    --accent-h: #f08574;
    --accent-s: rgba(232, 116, 97, .1);
    --r: 8px;
    --r-lg: 12px;
    --font-d: 'Zen Kaku Gothic New', sans-serif;
    --font-b: 'Noto Sans JP', sans-serif;
}

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

body {
    font-family: var(--font-b);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ---- HEADER ---- */
.hdr {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 8, 10, .88);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.hdr-in {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-d);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.03em;
}
.logo span:first-child { color: var(--accent); font-size: 1.25rem; }

.hdr-nav { display: flex; gap: 2px; }
.hdr-nav a {
    padding: 6px 12px;
    font-size: .78rem;
    color: var(--dim);
    border-radius: 6px;
    transition: .2s;
}
.hdr-nav a:hover { color: var(--text); background: var(--surface); }
.hdr-nav a.on { color: var(--accent); }
.hdr-nav .adm { color: var(--accent) !important; }

/* ---- HERO (index) ---- */
.hero {
    max-width: 1600px;
    margin: 0 auto;
    padding: 36px 20px 12px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.hero-left h1 {
    font-family: var(--font-d);
    font-size: 1.6rem;
    font-weight: 300;
    letter-spacing: -.04em;
}
.hero-left h1 b { font-weight: 700; color: var(--accent); }
.hero-left .sub { color: var(--dim); font-size: .8rem; margin-top: 4px; }

/* ---- SOCIAL LINKS ---- */
.socials { display: flex; gap: 6px; }
.soc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--dim);
    font-size: .8rem;
    font-weight: 500;
    transition: .25s;
}
.soc:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-s);
    transform: translateY(-2px);
}
.soc svg { width: 18px; height: 18px; fill: currentColor; }

/* ---- MASONRY GRID (index) ---- */
.masonry {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 20px 48px;
    columns: 4;
    column-gap: 6px;
}
.masonry-item {
    break-inside: avoid;
    position: relative;
    line-height: 0;
    cursor: pointer;
    display: inline-block;
    width: 100%;
    margin-bottom: 6px;
}
.masonry-item-inner {
    border-radius: var(--r);
    overflow: hidden;
    position: relative;
}
.masonry-item img {
    width: 100%;
    display: block;
    transition: transform .5s, filter .3s;
}
.masonry-item:hover img {
    transform: scale(1.04);
    filter: brightness(.65);
}
.masonry-item .ov {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 32px 12px 10px;
    background: linear-gradient(transparent 40%, rgba(0, 0, 0, .75));
    opacity: 0;
    transition: .3s;
    line-height: 1.4;
}
.masonry-item:hover .ov { opacity: 1; }
.ov .ov-t { font-size: .78rem; font-weight: 500; color: #fff; }

/* ---- FIGURE CARD GRID (browse/collection) ---- */
.fig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.fig-card {
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: .3s;
}
.fig-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.fig-card-img {
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--surface);
    position: relative;
}
.fig-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}
.fig-card:hover .fig-card-img img { transform: scale(1.05); }
.fig-card-img .no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 2rem;
}
.fig-card-body { padding: 12px 14px 16px; }
.fig-card-chars {
    font-size: .72rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fig-card-name {
    font-family: var(--font-d);
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}
.fig-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.fig-card-tag {
    padding: 2px 7px;
    background: var(--surface);
    border-radius: 4px;
    font-size: .65rem;
    color: var(--dim);
}

/* Status badges */
.status {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-owned { background: #5cb985; color: #fff; }
.status-ordered { background: #e8b44e; color: #1a1a1a; }
.status-wished { background: #5b9bd5; color: #fff; }

/* ---- PAGE HEADER (browse) ---- */
.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}
.page h1 {
    font-family: var(--font-d);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.03em;
    margin-bottom: 6px;
}
.page .count { color: var(--dim); font-size: .85rem; margin-bottom: 20px; }

.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: var(--accent-s);
    border: 1px solid var(--accent);
    border-radius: 20px;
    font-size: .78rem;
    color: var(--accent);
}
.filter-tag .label { color: var(--dim); font-size: .7rem; text-transform: uppercase; }
.clear-link {
    color: var(--dim);
    font-size: .78rem;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: .2s;
}
.clear-link:hover { color: var(--text); border-color: var(--dim); }

/* ---- PHOTO DETAIL ---- */
.photo-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 44px;
    background: rgba(5, 5, 6, .7);
    backdrop-filter: blur(12px);
}
.photo-bar a { color: var(--dim); font-size: .8rem; transition: .2s; }
.photo-bar a:hover { color: var(--text); }
.photo-nav { display: flex; gap: 8px; }
.photo-nav a {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .75rem;
}
.photo-nav a:hover { border-color: var(--accent); color: var(--accent); }

.photo-wrap {
    position: fixed;
    inset: 44px 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.photo-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.info-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 60;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .25s;
}
.info-toggle:hover { background: var(--accent); border-color: var(--accent); }

.info-panel {
    position: fixed;
    top: 44px;
    right: 0;
    bottom: 0;
    width: 340px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 55;
    transform: translateX(100%);
    transition: transform .3s ease;
    overflow-y: auto;
    padding: 24px 20px;
}
.info-panel.open { transform: translateX(0); }
.info-panel h2 {
    font-family: var(--font-d);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 16px;
}

.info-section { margin-bottom: 20px; }
.info-section h3 {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: 8px;
}

.fig-link {
    display: flex;
    gap: 10px;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 6px;
    transition: .2s;
}
.fig-link:hover { border-color: var(--accent); }
.fig-link img {
    width: 44px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.fig-link .no-img {
    width: 44px;
    height: 56px;
    background: var(--surface);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--muted);
    font-size: .9rem;
}
.fig-link-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.fig-link-name {
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fig-link-meta { font-size: .68rem; color: var(--muted); margin-top: 1px; }

.exif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.exif-item .exif-l {
    font-size: .6rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.exif-item .exif-v { font-size: .78rem; color: var(--dim); margin-top: 1px; }

.edit-btn {
    display: inline-block;
    padding: 6px 14px;
    font-size: .72rem;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    transition: .2s;
    margin-top: 8px;
}
.edit-btn:hover { background: var(--accent); color: #fff; }

/* ---- EMPTY & FOOTER ---- */
.empty { text-align: center; padding: 100px 20px; color: var(--muted); }
.empty span { font-size: 3.5rem; display: block; margin-bottom: 12px; }

.ft {
    border-top: 1px solid var(--border);
    padding: 20px;
    text-align: center;
    color: var(--muted);
    font-size: .7rem;
}

/* ---- ANIMATION ---- */
.masonry-item { animation: up .4s ease both; }
@keyframes up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}
.masonry-item:nth-child(1) { animation-delay: .02s; }
.masonry-item:nth-child(2) { animation-delay: .04s; }
.masonry-item:nth-child(3) { animation-delay: .06s; }
.masonry-item:nth-child(4) { animation-delay: .08s; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1200px) {
    .masonry { columns: 3; }
}
@media (max-width: 768px) {
    .masonry { columns: 2; column-gap: 10px; padding: 10px 12px 32px; }
    .masonry-item { margin-bottom: 10px; }
    .hero { padding: 24px 12px 8px; }
    .hero-left h1 { font-size: 1.2rem; }
    .socials { gap: 4px; }
    .soc { padding: 6px 12px; font-size: .75rem; }
    .soc svg { width: 16px; height: 16px; }
    .hdr-in { padding: 0 12px; }
    .fig-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .page { padding: 20px 12px 32px; }
    .page h1 { font-size: 1.2rem; }
    .info-panel {
        width: 100%;
        top: auto;
        bottom: 0;
        max-height: 55vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    .info-panel.open { transform: translateY(0); }
    .info-panel::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 4px;
        margin: 0 auto 16px;
    }
}
@media (max-width: 480px) {
    .masonry { columns: 2; }
    .soc span:last-child { display: none; }
    .soc { padding: 8px; }
}
