/* ═══════════════════════════════════════════════════════════════════
   TNG Photo Gallery v1.0.0
   Parchment aesthetic — matched to Heritage Map / Brick Walls
   ═══════════════════════════════════════════════════════════════════ */

.tng-pg-wrap {
    font-family: "Georgia", "Cambria", "Times New Roman", serif;
    color: #2c2416;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(139,90,43,.018) 3px,
            rgba(139,90,43,.018) 4px
        ),
        radial-gradient(ellipse at 40% 30%, #fdfaf4 0%, #f5eed8 50%, #ede3c8 100%);
    background-color: #faf8f4;
    border: 1px solid #d9cfc0;
    border-radius: 8px;
    padding: 1.75rem 1.5rem;
    max-width: 100%;
    line-height: 1.55;
    box-shadow: 0 2px 12px rgba(28,18,10,.10);
    position: relative;
}
.tng-pg-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    pointer-events: none;
    background-image:
        radial-gradient(circle 1.5px at 10% 20%, rgba(107,76,30,.06) 50%, transparent 50%),
        radial-gradient(circle 2px   at 85% 40%, rgba(107,76,30,.05) 50%, transparent 50%),
        radial-gradient(circle 1px   at 48% 70%, rgba(107,76,30,.04) 50%, transparent 50%),
        radial-gradient(circle 1.8px at 65% 12%, rgba(107,76,30,.05) 50%, transparent 50%),
        radial-gradient(circle 1.2px at 25% 90%, rgba(107,76,30,.04) 50%, transparent 50%);
    z-index: 0;
}
.tng-pg-wrap > * { position: relative; z-index: 1; }

/* ── Header ───────────────────────────────────────────────────── */
.tng-pg-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #b8860b;
}
.tng-pg-title {
    font-family: "Georgia", serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #6b4c1e;
    margin: 0;
}
.tng-pg-subtitle {
    display: block;
    font-size: .84rem;
    font-style: italic;
    color: #7a6a58;
    margin-top: .2rem;
}
.tng-pg-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    font-family: "Georgia", serif;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .03em;
    border: 1px solid #c5b89a;
    border-radius: 6px;
    background: #fdfcf8;
    color: #2c2416;
    cursor: pointer;
    transition: all .2s ease;
}
.tng-pg-btn:hover {
    background: #f5ecd4;
    border-color: #b8860b;
    color: #6b4c1e;
}
.tng-pg-refresh-icon { transition: transform .3s ease; }
.tng-pg-btn:hover .tng-pg-refresh-icon { transform: rotate(180deg); }

/* ── Grid ─────────────────────────────────────────────────────── */
.tng-pg-grid {
    display: grid;
    gap: 1.25rem;
}
.tng-pg-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.tng-pg-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.tng-pg-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }

/* ── Card ─────────────────────────────────────────────────────── */
.tng-pg-card {
    background: #fdfcf8;
    border: 1px solid #d9cfc0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(28,18,10,.08);
    transition: all .25s ease;
    animation: tng-pg-fadein .5s ease both;
}
.tng-pg-card:hover {
    box-shadow: 0 4px 14px rgba(28,18,10,.14);
    transform: translateY(-2px);
}

/* Staggered entry */
@keyframes tng-pg-fadein {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tng-pg-card:nth-child(1) { animation-delay: .05s; }
.tng-pg-card:nth-child(2) { animation-delay: .1s; }
.tng-pg-card:nth-child(3) { animation-delay: .15s; }
.tng-pg-card:nth-child(4) { animation-delay: .2s; }
.tng-pg-card:nth-child(5) { animation-delay: .25s; }
.tng-pg-card:nth-child(6) { animation-delay: .3s; }
.tng-pg-card:nth-child(7) { animation-delay: .35s; }
.tng-pg-card:nth-child(8) { animation-delay: .4s; }
.tng-pg-card:nth-child(9) { animation-delay: .45s; }

/* ── Photo ────────────────────────────────────────────────────── */
.tng-pg-photo-wrap {
    position: relative;
    width: 100%;
    padding-top: 110%; /* portrait aspect ratio */
    overflow: hidden;
    background: #efe8da;
}
.tng-pg-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform .35s ease;
    filter: sepia(8%) saturate(90%);
}
.tng-pg-card:hover .tng-pg-photo {
    transform: scale(1.03);
}
/* Vignette overlay */
.tng-pg-photo-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 60%,
        rgba(28,18,10,.15) 100%
    );
    pointer-events: none;
}

/* ── Info panel ───────────────────────────────────────────────── */
.tng-pg-info {
    padding: .85rem .9rem .75rem;
}
.tng-pg-name {
    font-family: "Georgia", serif;
    font-size: .95rem;
    font-weight: 700;
    color: #2c2416;
    margin: 0 0 .35rem 0;
    line-height: 1.25;
}
.tng-pg-name-last {
    text-transform: uppercase;
    letter-spacing: .02em;
}
.tng-pg-details {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .72rem;
    color: #7a6a58;
    line-height: 1.55;
    margin: 0 0 .5rem 0;
}
.tng-pg-detail-row {
    display: flex;
    align-items: baseline;
    gap: .3rem;
    margin-bottom: .15rem;
}
.tng-pg-detail-label {
    font-weight: 700;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #a09480;
    min-width: 20px;
}
.tng-pg-detail-born  .tng-pg-detail-label { color: #1d7a73; }
.tng-pg-detail-died  .tng-pg-detail-label { color: #c0392b; }
.tng-pg-detail-place .tng-pg-detail-label { color: #8a6d1b; }

.tng-pg-profile-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .7rem;
    font-weight: 600;
    color: #3d5a80;
    text-decoration: none;
    transition: color .2s ease;
}
.tng-pg-profile-link:hover { color: #2a4060; text-decoration: underline; }

/* ── Loading ──────────────────────────────────────────────────── */
.tng-pg-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 1rem;
    color: #7a6a58;
    font-style: italic;
    font-size: .88rem;
}
.tng-pg-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid #d9cfc0;
    border-top-color: #b8860b;
    border-radius: 50%;
    animation: tng-pg-spin .7s linear infinite;
    margin-right: .5rem;
    vertical-align: middle;
}
@keyframes tng-pg-spin { to { transform: rotate(360deg); } }

/* Empty */
.tng-pg-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem 1rem;
    color: #7a6a58;
    font-style: italic;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .tng-pg-grid[data-columns="4"] { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
    .tng-pg-wrap { padding: 1.25rem 1rem; }
    .tng-pg-header { flex-direction: column; }
    .tng-pg-grid[data-columns="3"],
    .tng-pg-grid[data-columns="4"] { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .tng-pg-grid[data-columns="2"],
    .tng-pg-grid[data-columns="3"],
    .tng-pg-grid[data-columns="4"] { grid-template-columns: 1fr; }
}
