:root {
    /* Dark Theme (Default) */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --border-primary: #2a2a2a;
    --border-secondary: #3a3a3a;

    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --text-tertiary: #c0c0c0;
    --text-muted: #a0a0a0;

    --accent-from: #5c5cff;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    --title-font: "Italianno", cursive;

}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e5e5e5;
    --border-primary: #e0e0e0;
    --border-secondary: #d0d0d0;

    --text-primary: #0a0a0a;
    --text-secondary: #1a1a1a;
    --text-tertiary: #404040;
    --text-muted: #666666;

    --accent-from: #1818ff;

}

::selection {
    background-color: var(--accent-from);
    color: white;
}

::-moz-selection {
    background-color: var(--accent-from);
    color: white;
}

/* 
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar {
    width: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-from);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-weight: 400;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: transparent;
    /* Make body transparent */
    color: var(--text-secondary);
    display: flex;
    margin-top: 4rem;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: color var(--transition-slow);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: -2;
    transition: background-color var(--transition-slow);
}

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
}

::view-transition-new(root) {
    z-index: 9999;
}

::view-transition-old(root) {
    z-index: 1;
}

.blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 9999;
    pointer-events: none;

    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);

    mask-image: linear-gradient(to bottom,
            black 0%,
            black 10%,
            transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom,
            black 0%,
            black 10%,
            transparent 100%);

    opacity: 0;
    transition: opacity 0.5s ease;
}

.blur-overlay.visible {
    opacity: 1;
}

.container {
    max-width: 40%;
    width: 100%;
    position: relative;
}

.container>* {
    opacity: 0;
    transform: translateY(10px);
    animation: itemFade 0.5s ease-out forwards;
    animation-delay: calc(var(--i) * 0.2s);
}

@keyframes itemFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-btn:focus-visible,
.social-btn:focus-visible {
    z-index: 2;
    outline: 2px solid var(--accent-from);
    outline-offset: 2px;
}

.filter-btn {
    outline: none;
}

.filter-btn:focus {
    outline: none;
}

.filter-btn:focus-visible {
    z-index: 2;
    box-shadow: inset 0 0 0 2px var(--accent-from);
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.right-buttons {
    display: flex;
    gap: 0;
    align-items: center;
}

.theme-toggle {
    display: flex;
}

.theme-home {
    border-radius: 25px;
}

.theme-sound {
    border-top-left-radius: 25px;
    border-bottom-left-radius: 25px;
}

.theme-theme {
    border-top-right-radius: 25px;
    border-bottom-right-radius: 25px;
}

.theme-btn {
    width: 35px;
    height: 35px;
    background-color: var(--bg-secondary);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.theme-btn svg {
    width: 15px;
    height: 15px;
}

.theme-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1321px) {
    body {
        padding: 1.5rem;
    }

    .container {
        max-width: 80%;
    }
}

@media (max-width: 996px) {
    body {
        padding: 1.5rem;
    }

    .container {
        max-width: 90%;
    }
}

.starfield-container {
    min-height: 100px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.footer-wrapper {
    overflow-x: hidden;
    position: relative;
}

.site-footer {
    position: relative;
    border-top: 1px solid var(--border-primary);
    padding: 15px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.site-footer::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 120px;
    /* length of the glowing bar */
    height: 1px;
    background: var(--text-primary);
    animation: footer-loading-bar 3.5s linear infinite;
}

@keyframes footer-loading-bar {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(calc(100vw + 120px));
    }
}

.footer-left img {
    height: 28px;
    width: auto;
    transition: opacity var(--transition-fast);
}

.footer-right {
    font-weight: 600;
    letter-spacing: 0.02em;
}

@media (max-width: 640px) {
    .site-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
}

.archive {
    text-align: center;
    margin-top: 2.5rem;
    font-family: 'Clash Display', sans-serif;
    letter-spacing: 0.25rem;
    text-transform: uppercase;
    font-weight: 500;
    font-size: 0.5rem;

}

.thoughts-section-title {
    font-family: "Italianno", cursive;
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.content {
    line-height: 1.8;
    font-size: 0.90rem;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
    margin-bottom: 1.5rem;
}

.thoughts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .thoughts-grid {
        grid-template-columns: 1fr;
    }
}

.thoughts-card {
    margin-top: 1rem;
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    border: 1px solid var(--border-secondary);
    background-color: var(--bg-secondary);
    transition: all var(--transition-slow);
}

.thoughts-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.thoughts-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Blend image bottom into card background */
.thoughts-image-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 55%;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-secondary) 100%);
    pointer-events: none;
}

/* Glassy tags on top of image */
.thoughts-tags {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    z-index: 2;
}

.thoughts-tag {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.thoughts-info {
    padding: 0 1.25rem 1.25rem;
    margin-top: -0.5rem;
    position: relative;
    z-index: 1;
}

.thoughts-title {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.thoughts-description {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thoughts-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.thoughts-dot {
    opacity: 0.6;
}

.thoughts-card:focus-visible {
    z-index: 3;
    outline: 2px solid var(--accent-from);
    outline-offset: 2px;
}

.filter-buttons {
    display: flex;
    gap: 0;
    border-radius: 25px;
    overflow: hidden;
}

.filter-btn {
    padding: 0.5rem 1.0rem;
    background-color: var(--bg-secondary);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: "Inter", sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-base);
    position: relative;
}

.filter-btn:first-child {
    border-top-left-radius: 25px;
    border-bottom-left-radius: 25px;
}

.filter-btn:last-child {
    border-top-right-radius: 25px;
    border-bottom-right-radius: 25px;
}

.filter-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.filter-btn.active {
    background: var(--border-primary);
    color: var(--text-primary);
}

.thoughts-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.5rem 0 1.25rem;
    flex-wrap: wrap;
}

.thoughts-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    border-radius: 25px;
    flex: 1;
    max-width: 220px;
    transition: background-color var(--transition-base);
}

.thoughts-search:focus-within {
    background-color: var(--bg-tertiary);
}

.thoughts-search svg {
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.thoughts-search-input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: "Inter", sans-serif;
    font-size: 0.85rem;
    width: 100%;
}

.thoughts-search-input::placeholder {
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .thoughts-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-buttons {
        width: 100%;
    }

    .thoughts-search {
        max-width: none;
    }
}

.thoughts-empty {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2.5rem 1rem;
    border: 1px dashed var(--border-primary);
    border-radius: var(--radius-lg);
}

.thoughts-empty.hidden {
    display: none;
}

.thoughts-card.hidden {
    display: none;
}

.archive.hidden {
    display: none;
}

/* Dim only the cards that are NOT being hovered */
.thoughts-grid:has(.thoughts-card:hover) .thoughts-card:not(:hover) {
    opacity: 0.4;
}

/* Hovered card */
.thoughts-card:hover {
    opacity: 1;
    transform: scale(1.01);
    box-shadow: var(--shadow-lg);
}