/* Film Photography Design System - Pure CSS */

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

:root {
    /* Core film photography palette - Adjusted for a.jpg & b.jpg contrast and warmth */
    --background: hsl(42, 15%, 95%); /* Aged paper white */
    --foreground: hsl(25, 15%, 12%); /* Deep, rich black-brown */
    --card: hsl(42, 25%, 93%); /* Darker, clearly defined card */
    --card-foreground: hsl(25, 15%, 12%);
    --primary: hsl(25, 30%, 20%); /* Rich focus color */
    --primary-foreground: hsl(42, 20%, 95%);
    --secondary: hsl(35, 12%, 85%);
    --secondary-foreground: hsl(25, 15%, 12%);
    --muted: hsl(35, 8%, 88%);
    --muted-foreground: hsl(25, 10%, 40%); /* Slightly darker muted text */
    --accent: hsl(28, 15%, 82%);
    --accent-foreground: hsl(25, 15%, 12%);
    --border: hsl(35, 10%, 88%);
    --hover-overlay: hsla(25, 15%, 12%, 0.75); /* Darker hover effect */
    --modal-backdrop: hsla(25, 10%, 8%, 0.98); /* Deep, cinematic backdrop */
    
    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Spacing & Sizes */
    --radius: 16px;
    --header-height: 4rem;
}

/* --- Base Styles --- */

body {
    font-family: var(--font-body);
    color: var(--foreground);
    background-color: var(--background);
    line-height: 1.6;
    min-height: 100vh;
}

/* --- Grain Overlay (Crucial for the film look) --- */
.grain-overlay {
    position: relative;
}

.grain-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTggMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjE4IiBoZWlnaHQ9IjE4IiBmaWxsPSJyZ2JhKDAsMCwwLDApIi8+PGNpcmNsZSBjeD0iNSIgY3k9IjUiIHI9IjAuNSIgZmlsbD0icmdiYSgwLDAsMCwwLjE1KSIvPjxjaXJjbGUgY3g9IjEwIiBjeT0iMTIiIHI9IjAuNSIgZmlsbD0icmdiYSgwLDAsMCwwLjE1KSIvPjwvc3ZnPg==");
    background-size: 10px;
    opacity: 0.2; /* Subtle grain effect */
    pointer-events: none;
    z-index: 10;
}

/* --- Header --- */

.header {
    height: var(--header-height);
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center; /* Center logo horizontally */
    position: relative; /* Needed for menu button absolute */
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--foreground);
}

.logo i {
    width: 28px;
    height: 28px;
}

.logo-text {
    line-height: 1.1;
}

/* --- UPDATED Logo Title: ± ÷ × = Handwritten & Centered --- */
.logo-title {
    font-family: 'Patrick Hand', cursive; /* Handwritten font */
    font-size: 2rem; /* Default desktop size */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    margin: 0;
    height: var(--header-height);
    line-height: var(--header-height);
}

.symbol {
    display: inline-block;
    transition: transform 0.3s ease;
}

.symbol:hover {
    transform: scale(1.2) rotate(5deg);
}

/* Menu button on left */
.menu-btn {
    position: absolute;
    left: 2rem;
    background: none;
    border: none;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.2s;
}

.menu-btn:hover {
    color: var(--primary-foreground);
    background-color: var(--primary);
    border-radius: var(--radius);
}

/* Spacer for right-side items */
.spacer {
    position: absolute;
    right: 2rem;
}

/* --- Sidebar (Pinterest Categories) --- */

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background: var(--modal-backdrop); */
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100%;
    background-color: var(--card);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    border-right: 1px solid var(--border);
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2rem 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-title h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
}

.close-btn {
    background: none;
    border: none;
    color: var(--muted-foreground);
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--foreground);
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

.category-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    color: var(--foreground);
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background-color 0.2s, color 0.2s;
}

.category-btn:hover {
    background-color: var(--secondary);
}

.category-btn.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
}

.category-btn.active i {
    color: var(--primary-foreground);
}

.category-btn i {
    width: 16px;
    height: 16px;
    color: var(--muted-foreground);
}

.sidebar-footer {
    padding: 1.5rem 2rem 0 2rem;
    font-size: 0.8rem;
    color: var(--muted-foreground);
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

/* --- Main Content (Pinterest Grid) --- */

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 2rem;
}

.photo-grid {
    column-count: 4;
    column-gap: 0.5rem;
    padding: 0 2rem 4rem 2rem;
}

.photo-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 0.5rem;
    cursor: pointer;
    background-color: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, opacity 0.5s ease-out;
}

.photo-item:hover {
    transform: scale(1.01);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);
}

.photo-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s;
    filter: saturate(1.1) contrast(1.1); 
}

.photo-item img:hover {
    opacity: 0.95;
}

.photo-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    background: var(--hover-overlay);
    color: var(--primary-foreground);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.photo-item:hover .photo-title {
    opacity: 1;
}

/* --- Modal Styles --- */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-backdrop);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card);
    border-radius: var(--radius);
    max-width: 900px;
    width: 90%;
    max-height: 90%;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: var(--modal-backdrop);
    color: var(--background);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s;
}

.modal-close-btn:hover {
    background-color: var(--foreground);
}

.modal-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    max-height: 100%;
    overflow-y: auto;
}

.modal-image-container {
    background-color: var(--foreground);
    aspect-ratio: 4/5;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.modal-text {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-category {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.modal-description {
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.modal-meta {
    font-size: 0.8rem;
    color: var(--accent-foreground);
    display: flex;
    gap: 0.5rem;
}

/* --- Media Queries --- */

@media (max-width: 1024px) {
    .photo-grid { column-count: 4; column-gap: 0.5rem; padding: 0 1.5rem 3rem 1.5rem; }
    .modal-grid { grid-template-columns: 1fr 1fr; }
    .modal-text { padding: 2rem; }
    .logo-title { font-size: 1.75rem; gap: 0.5rem; }
}

@media (max-width: 768px) {
    .photo-grid { column-count: 4; column-gap: 0.5rem; padding: 1rem; }
    .modal-content { max-width: 95%; }
    .modal-grid { grid-template-columns: 1fr; }
    .modal-text { padding: 1.5rem; order: 2; }
    .modal-image-container { order: 1; aspect-ratio: 1; }
    .modal-title { font-size: 1.75rem; }
    .logo-title { font-size: 1.4rem; gap: 0.4rem; }
    .modal-description {
        font-size: 0.95rem;    /* Slightly smaller text prevents awkward line breaks */
        line-height: 1.6;       /* Slightly tighter line-height for small screens */
        text-align: left;       /* Ensures it stays clean and readable */
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.photo-item { animation: fadeIn 0.5s ease-out forwards; }

/* Quote Loader */
#loader {
  position: fixed;
  inset: 0;
  background: #fafafa;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 2000;
  padding: 2rem;
  color: #444;
  font-size: 1.2rem;
  font-family: 'Georgia', serif;
  line-height: 1.6;
}

/* Container for the quote to ensure centering and padding */
#loaderQuote {
    text-align: center;
    color: var(--foreground);
    line-height: 1.6;
    font-weight: 500;
    margin-top: 24px;
    padding: 0 20px; /* Prevents text from touching screen edges */
    max-width: 600px; /* Keeps line length readable on desktop */
    transition: opacity 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Mobile Specific Adjustments --- */
@media (max-width: 640px) {
    #loaderQuote {
        font-size: 0.9rem;  /* Slightly smaller text for mobile */
        line-height: 1.5;   /* Tighter spacing for vertical flow */
        max-width: 90%;     /* Use more of the screen width on mobile */
        margin-top: 16px;
    }
}

/* --- Tablet/Desktop Specific Adjustments --- */
@media (min-width: 641px) {
    #loaderQuote {
        font-size: 1.1rem;
        margin-top: 24px;
    }
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

