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

:root {
  --black: #080808;
  --dark:#111111;
  --surface: #161616;
  --white: #f5f0e8;
  --border: #2a2a2a;
  --gold: #c9a84c;
  --gold-lt: #e2c97e;
  --muted: #6b6460;
  --text: #d8cf4c;
  --bg-hover: #c9a84c0d;
  --bg-select: #c9a84c14;
  --sidebar: 280px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    background: var(--black);
    color: var(--text);
    font-family: Georgia, serif;
    font-size: 18px;
    line-height: 1.6;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#sidebar {
    width: var(--sidebar);
    min-width: var(--sidebar);
    background-color: var(--dark);
    border-right: 1px solid var(--border);
    overflow-y:auto;
    flex-direction: column;
    display: flex;
}

#sidebar::-webkit-scrollbar { 
    width: 4px;
}
#sidebar::-webkit-scrollbar-track {
    background: transparent;
}
#sidebar::-webkit-scrollbar-thumb {
    background: var(--border); border-radius: 2px;
}

.sidebar-header {
    padding: 2.5rem 1.8rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-eyebrow{
    color: var(--gold);
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    margin-bottom: 0.5rem;
}

.sidebar-title{
    color: var(--white);
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}

.sidebar-subtitle{
    color: var(--muted);
    font-family: 'Playfair Display', serif;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.5rem;
}

.sidebar-label{
    padding: 1.4rem 1.8rem 0.6rem;
    color: var(--muted);
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.theme-list {
    list-style: none;
    padding: 0 0 1rem;
}

.theme-item{
    cursor: pointer;
    padding: 1rem 1.8rem;
    border-left: 3px solid transparent;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

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

.theme-item.active {
    border-left-color: var(--gold);
    background: var(--bg-select);
}

.theme-name {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.3rem;
    transition: color 0.2s;
}

.theme-item.active .theme-name {
    color: var(--gold);
}

.theme-desc {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
    }

.sidebar-footer {
    margin-top: auto;
    padding: 1.2rem 1.8rem;
    border-top: 1px solid var(--border);
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.7rem;
    color: var(--muted);
    line-height: 1.5;
}

.sidebar-footer a {
    color: var(--gold);
    text-decoration: none;
}

#main{
    flex: 1;
    flex-direction:column;
    display: flex;
    overflow: hidden;
}

#topbar {
    padding: 1.4rem 2.4rem;
    border-bottom: 1px solid var(--border);
    background-color: var(--dark);
    flex-shrink: 0;
    align-items: baseline;
    gap: 1rem;
    display: flex;
}

#exhibit-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
}

#exhibit-count {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--muted);
}

#gallery-wrap{
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2.4rem;
}

#gallery-wrap::-webkit-scrollbar { width: 5px; }
#gallery-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

#gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.5rem;
}

.art-card {
    cursor:pointer;
    background-color: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.3s var(--ease),
                box-shadow 0.3s var(--ease),
                border-color 0.3s;
    animation: fadeUp 0.5s var(--ease) both;
}

.art-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/*wave effect for the cards*/
.art-card:nth-child(1)  { animation-delay: 0.03s; }
.art-card:nth-child(2)  { animation-delay: 0.07s; }
.art-card:nth-child(3)  { animation-delay: 0.11s; }
.art-card:nth-child(4)  { animation-delay: 0.15s; }
.art-card:nth-child(5)  { animation-delay: 0.19s; }
.art-card:nth-child(6)  { animation-delay: 0.23s; }
.art-card:nth-child(7)  { animation-delay: 0.27s; }
.art-card:nth-child(8)  { animation-delay: 0.31s; }
.art-card:nth-child(9)  { animation-delay: 0.35s; }
.art-card:nth-child(10) { animation-delay: 0.38s; }
.art-card:nth-child(11) { animation-delay: 0.41s; }
.art-card:nth-child(12) { animation-delay: 0.44s; }
.art-card:nth-child(13) { animation-delay: 0.47s; }
.art-card:nth-child(14) { animation-delay: 0.50s; }
.art-card:nth-child(15) { animation-delay: 0.53s; }

.card-img-wrap {
    aspect-ratio: 4/5;
    overflow: hidden;
    background-color: var(--dark);
}

.card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s var(--ease);
}

.art-card:hover .card-img-wrap img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/*for artworks without images from API*/
.card-placeholder {
    width: 100%;
    height:100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.8rem;
}

.card-info {
    padding: 0.8rem 1rem;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.2rem;
}

.card-artist {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.7rem;
    color: var(--muted);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-year {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.7rem;
    color: var(--gold);
    margin-top: 0.15rem;
}

#status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
}

.spinner {
    width: 35px;
    height: 35px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-message {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--muted);
}

#modal {
    display: flex;
    width: 100%;
    transform: scale(0.97);
    transition: transform 0.35s var(--ease);
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--black);
    z-index: 100;         
    display: flex;
    align-items: stretch;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease);
    backdrop-filter: blur(8px);
}

#modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

#modal-img-panel {
    flex: 1.1;
    background: #0c0c0c;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

#modal-img-panel::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse at center, var(--bg-select) 0%, var(--black) 100%);
}

#modal-img {
    position: relative;
    max-width: 100%;
    max-height: calc(100vh - 5rem);
    object-fit: contain;
    box-shadow: 0 30px 90px rgba(0,0,0,0.85),
                0 0 0 1px rgba(201, 168, 76, 0.12);
    display: block;
    animation: imgReveal 0.5s var(--ease) both;
}

@keyframes imgReveal {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

#modal-info-panel {
    width: 380px;
    min-width: 340px;
    background: var(--dark);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 3rem 2.2rem 2rem;
    display: flex;
    flex-direction: column;
}

#modal-info-panel::-webkit-scrollbar {
    width: 4px;
}
#modal-info-panel::-webkit-scrollbar-thumb {
    background: var(--border);
}

.modal-eyebrow {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.7rem;
}

#modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

#modal-artist {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--gold-lt);
    margin-bottom: 0.25rem;
}

#modal-date {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.modal-divider {
    height: 1px;
    background: var(--border);
    margin: 1.2rem 0;
}

.detail-row {
    margin-bottom: 1rem;
}

.detail-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.detail-value {
    font-family: 'EB Garamond', serif;
    font-size: 0.9rem;
    color: var(--gold-lt);
    line-height: 1.5;
}

#modal-description {
    font-family: 'EB Garamond', serif;
    font-size: 0.9rem;
    color: var(--gold-lt);
    line-height: 1.7;
}

#modal-description p {
    margin-bottom: 0.6rem;
}

.modal-aic-link {
    margin-top: auto;
    padding-top: 2rem;
}

.modal-aic-link a {
    display: inline-block;
    padding: 0.65rem 1.3rem;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.modal-aic-link a:hover {
    background: var(--gold);
    color: var(--black);
}

#modal-close {
    position: absolute;
    top: 1.4rem;
    right: 1.4rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.2s, color 0.2s;
    z-index: 10;
}

#modal-close:hover {
    border-color: var(--gold);
    color: var(--gold);
}

#modal-prev, #modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    z-index: 10;
}

#modal-prev { left: 1.4rem; }
#modal-next { right: calc(380px + 1.4rem); }

#modal-prev:hover, #modal-next:hover {
    border-color: var(--gold);
    color: var(--gold);
}

#modal-prev:disabled, #modal-next:disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}