/* ==========================================================================
   Laser Engraving Atelier — page styling
   Layers a "year 3020" holographic look on top of the shared enchanted theme
   (theme.css). Reuses --violet / --pink / --cyan / --gold tokens.
   ========================================================================== */

:root {
    --panel: rgba(20, 12, 48, 0.55);
    --panel-border: rgba(34, 211, 238, 0.28);
    --neon-cyan: #22d3ee;
    --neon-line: rgba(34, 211, 238, 0.35);
    --mono: 'JetBrains Mono', 'Courier New', monospace;
    --tech: 'Orbitron', var(--font-display);
}

/* Holographic scanline overlay -------------------------------------------- */
.scanlines {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: repeating-linear-gradient(0deg,
            rgba(34, 211, 238, 0.035) 0px,
            rgba(34, 211, 238, 0.035) 1px,
            transparent 2px,
            transparent 4px);
    mix-blend-mode: screen;
    opacity: 0.6;
}

/* Header ------------------------------------------------------------------- */
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.stardate {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    padding: 6px 14px;
    border: 1px solid var(--neon-line);
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.06);
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
    white-space: nowrap;
}

/* Hero --------------------------------------------------------------------- */
.hero {
    text-align: center;
    padding: 56px 0 30px;
}

.eyebrow {
    font-family: var(--mono);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.eyebrow span { color: var(--gold); }

.hero-title {
    font-family: var(--tech);
    font-weight: 900;
    font-size: clamp(2.2rem, 6.5vw, 4.2rem);
    line-height: 1.04;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.glow {
    background: var(--spell);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmer 8s linear infinite;
    filter: drop-shadow(0 0 22px rgba(168, 85, 247, 0.45));
}

.hero-sub {
    max-width: 660px;
    margin: 20px auto 0;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.hero-sub strong { color: var(--text); }

/* Toolbar ------------------------------------------------------------------ */
.toolbar {
    margin-bottom: 22px;
    display: grid;
    gap: 14px;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    font-size: 0.95rem;
    opacity: 0.7;
    pointer-events: none;
}

.filter-input {
    width: 100%;
    padding: 14px 44px;
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--text);
    background: rgba(6, 3, 15, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input::placeholder { color: var(--text-muted); }

.filter-input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.filter-clear {
    position: absolute;
    right: 12px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
}

.filter-clear:hover { background: var(--pink); }

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

/* Chips -------------------------------------------------------------------- */
.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 15px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.chip:hover {
    color: var(--text);
    border-color: var(--cyan);
}

.chip[aria-pressed="true"] {
    color: var(--night-0);
    font-weight: 600;
    background: var(--spell);
    background-size: 200% auto;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.4);
}

.chip-count { opacity: 0.7; }

/* View toggle -------------------------------------------------------------- */
.view-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-count {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.icon-btn:hover {
    border-color: var(--cyan);
    box-shadow: 0 8px 22px rgba(34, 211, 238, 0.2);
}

/* Gallery / single viewer -------------------------------------------------- */
.gallery {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 26px;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--shadow), inset 0 0 40px rgba(34, 211, 238, 0.04);
    margin-bottom: 18px;
    position: relative;
}

.gallery::before,
.gallery::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid var(--neon-cyan);
    opacity: 0.7;
    pointer-events: none;
}

.gallery::before { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.gallery::after { bottom: 12px; right: 12px; border-left: none; border-top: none; }

.image-container {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: pan-y;
}

/* The light "engraving plate" so black line-art stays visible on dark bg */
.plate {
    position: relative;
    width: 100%;
    max-width: 520px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(circle at 50% 30%, #ffffff, #eee 70%, #dcdce6 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 0 2px rgba(34, 211, 238, 0.15);
    overflow: hidden;
}

#mainImage {
    max-width: 100%;
    max-height: 460px;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.25s ease;
}

#mainImage.loading { opacity: 0; }

.plate-loader {
    position: absolute;
    width: 44px;
    height: 44px;
    border: 3px solid rgba(34, 211, 238, 0.25);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.plate-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    padding: 3px 10px;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--violet), var(--cyan));
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.4);
}

.image-info {
    margin-top: 18px;
    text-align: center;
    width: 100%;
}

#imageName {
    font-family: var(--tech);
    font-size: 1.15rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    word-wrap: break-word;
}

.counter {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

.nav-btn {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    font-size: 28px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.nav-btn:hover:not(:disabled) {
    color: var(--night-0);
    background: var(--cyan);
    border-color: var(--cyan);
    transform: scale(1.08);
    box-shadow: 0 10px 26px rgba(34, 211, 238, 0.35);
}

.nav-btn:active:not(:disabled) { transform: scale(0.96); }

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Download controls -------------------------------------------------------- */
.controls {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-bottom: 14px;
}

.download-btn {
    flex: 1;
    max-width: 280px;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.download-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.viewer-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 26px;
}

.viewer-hint strong { color: var(--text); }

kbd {
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 2px 7px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-bottom-width: 2px;
    border-radius: 6px;
}

/* Grid view ---------------------------------------------------------------- */
.grid-view {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}

.grid-view.active { display: grid; }

.grid-item {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    background: radial-gradient(circle at 50% 30%, #ffffff, #e6e6ee 100%);
    transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.grid-item:hover,
.grid-item:focus-visible {
    outline: none;
    border-color: var(--cyan);
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(34, 211, 238, 0.25);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 14px;
}

.grid-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-family: var(--mono);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--violet), var(--cyan));
    box-shadow: 0 3px 10px rgba(34, 211, 238, 0.4);
}

.grid-item-name {
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(to top, rgba(6, 3, 15, 0.95), rgba(6, 3, 15, 0));
    color: #fff;
    padding: 18px 10px 8px;
    font-family: var(--mono);
    font-size: 0.68rem;
    text-align: center;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grid-item:hover .grid-item-name,
.grid-item:focus-visible .grid-item-name { opacity: 1; }

/* Empty state -------------------------------------------------------------- */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 50px 0;
    font-size: 1rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--cyan);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.link-btn:hover { color: var(--gold); }

/* Lightbox ----------------------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    background: rgba(6, 3, 15, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.lightbox.show { opacity: 1; }

.lightbox[hidden] { display: none; }

.lightbox-figure {
    max-width: min(90vw, 720px);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.lightbox-figure img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    background: radial-gradient(circle at 50% 30%, #fff, #e6e6ee 100%);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}

.lightbox-figure figcaption {
    font-family: var(--tech);
    color: var(--text);
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.lightbox-close:hover { background: var(--pink); color: #fff; }

.lightbox-nav {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    font-size: 30px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.lightbox-nav:hover {
    color: var(--night-0);
    background: var(--cyan);
    border-color: var(--cyan);
}

/* Back-to-top -------------------------------------------------------------- */
.to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 900;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    color: var(--night-0);
    background: var(--spell);
    background-size: 200% auto;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(168, 85, 247, 0.45);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s;
}

.to-top.show { opacity: 1; transform: none; }

/* Toast -------------------------------------------------------------------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(20px);
    z-index: 1600;
    padding: 12px 22px;
    font-family: var(--mono);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--night-0);
    background: var(--cyan);
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(34, 211, 238, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.site-footer .footer-bottom a { color: var(--cyan); }
.site-footer .footer-bottom a:hover { color: var(--gold); }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 640px) {
    .toolbar-row { flex-direction: column; align-items: stretch; }
    .view-toggle { justify-content: space-between; }
    .gallery { padding: 18px 10px; gap: 8px; }
    .nav-btn { width: 44px; height: 44px; font-size: 24px; }
    #mainImage { max-height: 320px; }
    .controls { flex-direction: column; }
    .download-btn { max-width: none; }
    .stardate { font-size: 0.68rem; letter-spacing: 1px; }
    .grid-view { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
}

/* Reduced motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .plate-loader { animation: none; }
    .glow { animation: none; }
}
