/* == 1. GLOBAL SETTINGS & VARIABLES ======================================== */
:root {
    --bg-main: #ffffff;
    --bg-panel: #ffffff;
    --text-main: #333333;
    --text-main-blue: #0000ff;
    --text-muted: #888888;
    --border-color: #dddddd;
    --accent-blue: #0000ff;
    --shadow: rgba(0, 0, 0, 0.05);
	
	
  --theme-main: hsl(240, 100%, 99%);
  --blue-main: hsl(240, 100%, 50%);
  --blue-secondary: hsl(240, 100%, 30%);
  --blue-lighter: hsl(240, 100%, 85%);
  
  --folder-blue: hsl(240, 100%, 50%);
  --files-blue: hsl(240, 80%, 50%);
  
  --blue-arrow-icon: hsl(240, 100%, 25%);
  
  
  --text-main-quartz: #4e4e4e
}

[data-theme="dark"] {
    --bg-main: #121212;
    --bg-panel: #1e1e1e;
    --text-main: #e0e0e0;
    --text-main-blue: #0055ff;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --accent-blue: #0055ff;
    --shadow: rgba(0, 0, 0, 0.3);
	
	
  --theme-main: hsl(240, 15%, 10%);
  --blue-main: hsl(220, 100%, 50%);
  --blue-secondary: hsl(220, 90%, 65%);
  --blue-lighter: hsl(220, 100%, 85%);
  
  --folder-blue: hsl(220, 100%, 50%);
  --files-blue: hsl(220, 80%, 50%);
  
  --blue-arrow-icon: hsl(220, 100%, 75%);
  
  
  --text-main-quartz: #d4d4d4
}

//The Quartz CSS Override, i hope lol
header.hero-section-heading,
header.hero-section-text {
    display: block !important; 
}

/* Styling for the links when they are at the top */
.top-nav {
    margin-top: 20px;
    text-align: center;
}

.top-nav .footer-content {
    margin-bottom: 15px; /* Space between links and the line */
}

.top-nav .separator {
    margin-top: 0;
    margin-bottom: 30px; /* Space before the gallery starts */
    max-width: 1200px; /* Matches your gallery width */
}

/* Adjust the footer links specifically for the top nav if needed */
.top-nav .footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 0;
}

* {
    box-sizing: border-box;
}

/* Container for the top links and separators */
.top-nav-container {
    width: 100%;
}

/* The actual link area between the lines */
.top-nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0; /* This equal padding creates the centered look */
}

/* Reset margins for separators inside this container to keep spacing consistent */
.top-nav-container .separator {
    margin: 0 auto; 
}

/* Ensure the links inside use the same style as your footer */
.top-nav-links .footer-links {
    margin-bottom: 0; /* Removes the footer's bottom margin */
    display: flex;
    gap: 30px; /* Space between the two links */
}

body {
    margin: 0;
    color: var(--text-main);
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden;
    background-color: #f8f9fa; 
}

/* This is your new "High Performance" background layer */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Stay behind everything */
    background-image:  
        radial-gradient(at 0% 0%, hsla(220,100%,90%,0.75) 0, transparent 20%),  
        radial-gradient(at 50% 0%, hsla(220,100%,90%,0.75) 0, transparent 20%),  
        radial-gradient(at 100% 0%, hsla(220,100%,90%,0.75) 0, transparent 20%);
    /* We don't need background-attachment: fixed anymore because the layer is fixed */
}

[data-theme="dark"] body { background-color: #0b0e14; }

[data-theme="dark"] body::before {
    background-image:  
        radial-gradient(at 0% 0%, hsla(220,100%,10%,1) 0, transparent 50%),  
        radial-gradient(at 50% 0%, hsla(220,100%,10%,1) 0, transparent 50%),  
        radial-gradient(at 100% 0%, hsla(220,100%,10%,1) 0, transparent 50%);
}

.infinite-hidden { display: none !important; }

/* == 2. FLOATING UI (Theme Toggle & Back to Top) =========================== */
.theme-toggle, .back-to-top {
    position: fixed;
    z-index: 10000;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--shadow);
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle { top: 30px; left: 30px; width: 42px; height: 42px; }
.back-to-top { bottom: 30px; right: 30px; width: 45px; height: 45px; color: var(--text-main); opacity: 0; visibility: hidden; }
.back-to-top.show { opacity: 1; visibility: visible; }

.theme-toggle:hover, .back-to-top:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

/* == 3. HERO SECTION ======================================================= */
.hero-section-heading { text-align: center; padding: 60px 20px 0; max-width: 900px; margin: 0 auto;  }
.site-title { font-weight: 300; font-size: clamp(2rem, 5vw, 3.5rem); margin: 0 0 10px 0; letter-spacing: -1px; color: var(--accent-blue); }
.site-description { font-weight: 300; font-size: 1.1rem; 
color: var(--text-main-quartz); 
margin: 0 auto 30px auto; max-width: 600px; line-height: 1.5; text-align: center; padding-right: 25px; padding-left: 25px; }
.separator { border: 0; height: 1px; background-image: linear-gradient(to right, transparent, var(--accent-blue), transparent); margin: 0 auto 30px auto; max-width: 80vw; }

/* == 4. CONTROL PANEL & SEARCH BAR ========================================= */
.control-panel { width: 100%; max-width: 900px; margin: 30px auto; padding: 0 15px; }
.control-bar { 
    display: flex; 
    align-items: stretch; 
    background: var(--bg-panel); 
    border: 1px solid var(--border-color); 
    border-radius: 4px; 
    box-shadow: 0 4px 12px var(--shadow);
    overflow: visible;
}

.control-bar:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-blue), transparent 90%);
}

.search-section { position: relative; flex: 2; display: flex; align-items: center; border-right: 1px solid var(--border-color); min-width: 0; }
.sort-section { flex: 1; min-width: 140px; }

.modern-input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-main);
    outline: none;
    font-family: inherit;
}

/* Sort Specifics */
.sort-select { 
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
}
.sort-select option { background-color: var(--bg-panel); color: var(--text-main); }

/* == 5. SEARCH TOOLS (No-Wrap Minimalist) ================================== */
.search-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    white-space: nowrap;
    flex-shrink: 0;
}

.count-wrapper { position: relative; cursor: pointer; user-select: none; }
.inner-count { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.count-wrapper:hover .inner-count { color: var(--accent-blue); }

.tool-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; width: auto; height: auto; transition: all 0.2s;
}

.tool-btn:hover { color: var(--accent-blue); transform: scale(1.1); }
.search-submit { color: var(--accent-blue); opacity: 0.8; }
.clear-btn { font-size: 20px; display: none; }
#helpBtn { font-weight: 700; font-size: 15px; }

/* Tooltip */
.copy-tooltip {
    position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%);
    background: var(--text-main); color: var(--bg-main);
    padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: bold;
    opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.2s;
}
.copy-tooltip.show { opacity: 1; visibility: visible; }

/* Tag Dropdown */
.tag-dropdown {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--bg-panel); border: 1px solid var(--accent-blue);
    border-radius: 4px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-height: 250px; overflow-y: auto; z-index: 1000;
}
.tag-option { padding: 12px 18px; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.tag-option.active { background: color-mix(in srgb, var(--accent-blue), transparent 90%); color: var(--accent-blue); }

/* == 6. GALLERY & MASONRY ================================================== */
.masonry-container { display: flex; flex-wrap: wrap; justify-content: center; padding: 5px; max-width: 100vw; }
.gallery-wrapper { display: flex; flex-direction: column; 
align-items: center; justify-content: center; }

@media (min-width: 1200px) {
    .gallery-wrapper img { height: 45vmin; width: auto; border-radius: 4px; }
	.masonry-container { gap: 15px; }
}

@media (max-width: 1200px) {
    .gallery-wrapper { flex: 1 1 calc(50% - 20px); max-width: 48%; }
    .gallery-wrapper img { width: 100%; height: auto; border-radius: 4px; }
	.masonry-container { gap: 5px; }
}

.button-stack { display: flex; gap: 8px; margin-top: 10px; width: 100%; justify-content: center; }
.square-btn {
    /* 1. Reset everything to ensure a clean slate */
    display: inline-flex;  /* Using inline-flex keeps them side-by-side */
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;        /* CRITICAL: Prevents text from being pushed down */
    padding: 0 12px;       /* Horizontal padding only */
    
    /* 2. Sizing */
    width: 32px; height: 32px;     /* Consistent height is better than padding for centering */
    font-size: 16px;
    border-radius: 4px;
    
    /* 3. Visuals */
    background: color-mix(in srgb, var(--accent-blue), transparent 96%);
    color: var(--text-main-blue);
    text-decoration: none;
    border: 1px solid color-mix(in srgb, var(--accent-blue), transparent 80%);
    cursor: pointer;
    transition: all 0.1s;
}

.square-btn:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* == 7. FOOTER & SCROLLBAR ================================================= */
.site-footer { padding: 80px 20px 40px; text-align: center; }
.footer-links { display: flex; justify-content: center; gap: 25px; margin-bottom: 15px; }
.footer-links a { text-decoration: none; color: var(--text-muted); font-size: 14px; }
.footer-links a:hover { color: var(--accent-blue); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); }
::-webkit-scrollbar-thumb:hover { background-color: var(--accent-blue); }

/* == Search Loader Spinner ================================================ */
.search-loader {
    display: none; /* Hidden by default */
    width: 18px;
    height: 18px;
    margin-right: 15px; /* Space from the right edge of the input area */
    border: 2px solid color-mix(in srgb, var(--accent-blue), transparent 80%);
    border-top: 2px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Optional: Keep your searching-text but hide it on mobile to save space */
.searching-text {
    display: none;
    font-size: 11px;
    color: var(--accent-blue);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 10px;
}

@media (max-width: 600px) {
    .searching-text { display: none !important; } /* Only show spinner on mobile */
}