/* =============================================
   HOMEPAGE STYLES (your original – unchanged)
   ============================================= */

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

body{
    font-family:Arial, Helvetica, sans-serif;
    background:#f4f4f4;
    color:#222;
}

/* Header */
header{
    background:#000;
    height:70px;
    display:flex;
    justify-content:center;
    align-items:center;
    box-shadow:0 2px 8px rgba(0,0,0,.2);
    position:sticky;
    top:0;
    z-index:1000;
}

header h2{
    color:#fff;
    font-size:32px;
    font-weight:bold;
}

/* Hero / Banner */
.hero{
    width:95%;
    max-width:1200px;
    height:420px;
    margin:30px auto;
    border:1px solid #d9d9d9;
    border-radius:12px;
    overflow:hidden;
    background:#fff;
}

.hero img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}

/* Library Section */
.library{
    width:95%;
    max-width:1200px;
    margin:50px auto;
}

.library h2{
    font-size:30px;
    font-weight:bold;
    margin-bottom:25px;
}

/* Library Cards */
.library-card{
    width:100%;
    max-width:520px;
    display:flex;
    align-items:center;
    text-decoration:none;
    color:#000;
    background:#fff;
    border:1px solid #d9d9d9;
    border-radius:12px;
    overflow:hidden;
    margin-bottom:20px;
    transition:.25s;
}

.library-card:hover{
    transform:translateY(-5px);
    box-shadow:0 8px 20px rgba(0,0,0,.12);
}

.library-card img{
    width:180px;
    height:120px;
    object-fit:cover;
    border-right:1px solid #d9d9d9;
}

.library-info{
    padding:20px;
}

.library-info h3{
    font-size:24px;
    font-weight:bold;
}

.library-subtitle{
    display:block;
    margin-top:8px;
    color:#666;
    font-size:16px;
}

/* =============================================
   GALLERY & IMAGE DETAIL STYLES (from prototype)
   ============================================= */

/* Main container for gallery and image pages */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* Back button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    padding: 8px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d9d9d9;
    text-decoration: none;
    margin-bottom: 20px;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.back-btn:hover {
    background: #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateX(-3px);
}

/* Page header (title area) */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #111;
}

.page-subtitle {
    font-size: 1rem;
    color: #777;
    margin-top: 4px;
}

/* Gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Gallery card */
.gallery-card {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Image wrapper – 3:2 aspect ratio */
.card-img-wrap {
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #e8e8e8;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-card:hover .card-img {
    transform: scale(1.04);
}

.card-body {
    padding: 14px 16px 16px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-sub {
    font-size: 0.85rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Image detail page */
.image-detail {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 40px;
}

.detail-img-wrap {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #e8e8e8;
    margin-bottom: 20px;
}

.detail-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 560px;
    background: #fafafa;
}

.detail-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 10px;
}

.detail-desc {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.7;
    margin-bottom: 20px;
    max-width: 720px;
}

/* Metadata table */
.meta-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.meta-table tbody tr {
    border-bottom: 1px solid #ececec;
}

.meta-table tbody tr:last-child {
    border-bottom: none;
}

.meta-table th {
    text-align: left;
    font-weight: 600;
    color: #333;
    padding: 10px 16px 10px 0;
    width: 140px;
    white-space: nowrap;
    vertical-align: top;
}

.meta-table td {
    padding: 10px 0;
    color: #555;
}

/* Action buttons */
.action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-dark {
    background: #000;
    color: #fff;
    border-color: #000;
}

.btn-dark:hover {
    background: #1a1a1a;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.btn-outline {
    background: #fff;
    color: #222;
    border-color: #bbb;
}

.btn-outline:hover {
    background: #f4f4f4;
    border-color: #888;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Previous / Next navigation */
.prev-next-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.prev-next-nav .btn {
    min-width: 130px;
}

/* Related images heading */
.related-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 18px;
}

/* =============================================
   RESPONSIVE – TABLET (2 columns)
   ============================================= */
@media (max-width: 1024px) and (min-width: 601px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .page-title {
        font-size: 1.7rem;
    }

    .detail-title {
        font-size: 1.4rem;
    }

    .detail-img {
        max-height: 420px;
    }

    .meta-table th {
        width: 110px;
    }
}

/* =============================================
   RESPONSIVE – MOBILE (1 column)
   ============================================= */
@media (max-width: 600px) {
    .main-container {
        padding: 16px 14px 36px;
    }

    header {
        height: 60px;
    }

    header h2 {
        font-size: 26px;
    }

    .back-btn {
        font-size: 0.85rem;
        padding: 7px 12px;
        margin-bottom: 14px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .page-subtitle {
        font-size: 0.85rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .image-detail {
        padding: 16px;
        border-radius: 10px;
    }

    .detail-img {
        max-height: 300px;
    }

    .detail-title {
        font-size: 1.2rem;
    }

    .detail-desc {
        font-size: 0.88rem;
    }

    /* Stack metadata table rows */
    .meta-table, .meta-table tbody, .meta-table tr, .meta-table th, .meta-table td {
        display: block;
        width: 100%;
    }

    .meta-table tr {
        margin-bottom: 10px;
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 8px;
    }

    .meta-table tr:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .meta-table th {
        padding: 0 0 2px 0;
        font-size: 0.78rem;
        color: #777;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        width: auto;
    }

    .meta-table td {
        padding: 0 0 4px 0;
        font-size: 0.9rem;
        color: #222;
    }

    .action-btns {
        flex-direction: column;
        gap: 10px;
    }

    .action-btns .btn {
        width: 100%;
    }

    .prev-next-nav {
        flex-direction: column;
        gap: 10px;
    }

    .prev-next-nav .btn {
        width: 100%;
        min-width: auto;
    }

    .related-heading {
        font-size: 1.1rem;
    }

    /* Existing mobile styles for home page (keep) */
    .hero {
        height: 220px;
        margin: 20px auto;
    }

    .library {
        margin-top: 30px;
    }

    .library h2 {
        font-size: 26px;
    }

    .library-card {
        flex-direction: column;
        align-items: flex-start;
        max-width: 100%;
    }

    .library-card img {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #d9d9d9;
    }

    .library-info {
        width: 100%;
        padding: 18px;
    }

    .library-info h3 {
        font-size: 22px;
    }

    .library-subtitle {
        font-size: 15px;
    }
}

/* Large screens */
@media (min-width: 1600px) {
    .hero {
        max-width: 1400px;
        height: 480px;
    }

    .library {
        max-width: 1400px;
    }
}
