/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #475569;
    --text-faint: #94A3B8;
    --accent: #4F46E5;
    --accent-rgb: 79, 70, 229;
    --shadow: rgba(0, 0, 0, 0.1);
    
    /* Legacy variable mappings for compatibility */
    --bg-color: var(--bg);
    --text-color: var(--text-main);
    --text-secondary: var(--text-muted);
    --text-tertiary: var(--text-faint);
    --link-color: var(--accent);
    --border-color: var(--accent);
}

body.dark-mode {
    --bg: #0D0F12;
    --text-main: #E3E6EB;
    --text-muted: #9BA3AE;
    --text-faint: #6B7280;
    --accent: #A3BFFA;
    --accent-rgb: 163, 191, 250;
    --shadow: rgba(255, 255, 255, 0.1);
    
    /* Legacy variable mappings for compatibility */
    --bg-color: var(--bg);
    --text-color: var(--text-main);
    --text-secondary: var(--text-muted);
    --text-tertiary: var(--text-faint);
    --link-color: var(--accent);
    --border-color: var(--accent);
}

body {
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    margin-bottom: 60px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.site-name {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    text-decoration: none;
}

.site-name:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* Navigation */
nav {
    display: flex;
    gap: 24px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Courier New', Courier, monospace;
}

nav a {
    color: var(--link-color);
    text-decoration: underline;
    font-family: 'Courier New', Courier, monospace;
}

nav a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* Header Right - Symbol Box */
.header-right {
    display: flex;
    align-items: flex-start;
}

/* Theme Toggle / Symbol Box */
.theme-toggle.symbol-box {
    background: none;
    border: 1px solid var(--text-color);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    color: var(--text-color);
    line-height: 1;
}

.theme-toggle.symbol-box:hover {
    opacity: 0.7;
}

.theme-toggle .material-symbols-outlined {
    font-size: 20px;
    color: inherit;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Main Grid - Container for About section */
.main-grid {
    position: relative;
    margin-bottom: 80px;
}

/* Fade-in Animations */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

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


.social-links {
    font-size: 14px;
    margin-top: 40px;
    font-family: 'Courier New', Courier, monospace;
}

.social-links a {
    color: var(--link-color);
    text-decoration: underline;
    margin-right: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.social-links a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* Section Title */
.section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--accent);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
}

/* About Section */
.about-section {
    scroll-margin-top: 20px;
}

/* Intro paragraph */
.intro-paragraph {
    margin-bottom: 20px;
    line-height: 1.7;
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
}

/* Label styling for subsections */
.label {
    font-size: 14px;
    font-weight: 400;
    margin-top: 30px;
    margin-bottom: 12px;
    color: var(--text-color);
    display: block;
    font-family: 'Courier New', Courier, monospace;
}

.label:first-of-type {
    margin-top: 40px;
}

/* About section lists */
#about-sections ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 20px;
}

#about-sections li {
    margin-bottom: 10px;
    line-height: 1.7;
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
}

#about-sections li:before {
    content: "• ";
    color: var(--text-tertiary);
    margin-right: 8px;
}

/* Shelf Section / Bookshelf Section - Appears beneath main-grid */
.bookshelf-section {
    position: relative;
    width: 100%;
    scroll-margin-top: 20px;
    margin-top: 40px;
}

/* Shelf Controls Container */
.shelf-controls {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.shelf-selector-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selector-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-muted);
    font-weight: 400;
}

.shelf-tabs {
    display: flex;
    gap: 24px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Courier New', Courier, monospace;
}

.tab-button {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--link-color);
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tab-button:hover {
    color: var(--text-color);
    text-decoration: underline;
}

.tab-button.active {
    font-weight: 400;
    color: var(--text-color);
    text-decoration: underline;
}

/* Shelf Filter */
.shelf-filter {
    display: flex;
    gap: 24px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Courier New', Courier, monospace;
}

.filter-button {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--link-color);
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-button:hover {
    color: var(--text-color);
    text-decoration: underline;
}

.filter-button.active {
    font-weight: 400;
    color: var(--text-color);
    text-decoration: underline;
}

/* Filter Controls */
.filter-controls {
    margin-bottom: 30px;
    font-size: 14px;
    color: var(--text-color);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-family: 'Courier New', Courier, monospace;
}

.filter-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-controls select {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.filter-controls input[type="checkbox"] {
    cursor: pointer;
}

/* Shelf Content */
.shelf-content {
    display: none;
}

.shelf-content.active {
    display: block;
}

.items-list {
    margin-top: 20px;
}

.year-group {
    margin-bottom: 40px;
}

.year-header {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
}

.category-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-family: 'Courier New', Courier, monospace;
    font-style: italic;
}

.year-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
}

/* Item Card - Grid View */
.item {
    position: relative;
    cursor: pointer;
}

.item-cover {
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: box-shadow 0.3s ease, transform 0.2s ease, filter 0.3s ease;
}

.item-cover.podcast-cover {
    aspect-ratio: 1/1;
}

.item-cover.app-cover {
    aspect-ratio: 1/1;
    /* iOS squircle shape using clip-path (16-part Bézier curve approximation) */
    clip-path: url(#squircle);
    /* Fallback border-radius approximation (22.5% effective radius) */
    -webkit-clip-path: url(#squircle);
    border-radius: 22.5%;
    /* Use filter for glow since clip-path clips box-shadow */
    filter: drop-shadow(0 2px 8px var(--shadow));
    transition: filter 0.3s ease, transform 0.2s ease;
}

.item:hover .item-cover,
.item:hover .item-cover.podcast-cover {
    box-shadow: 0 2px 8px var(--shadow), 0 0 0 2px rgba(var(--accent-rgb), 0.15), 0 0 20px rgba(var(--accent-rgb), 0.2);
}

.item:hover .item-cover.app-cover {
    filter: drop-shadow(0 2px 8px var(--shadow)) drop-shadow(0 0 0 2px rgba(var(--accent-rgb), 0.15)) drop-shadow(0 0 20px rgba(var(--accent-rgb), 0.2));
}

.item:active .item-cover,
.item:active .item-cover.podcast-cover {
    box-shadow: 0 2px 8px var(--shadow), 0 0 0 3px rgba(var(--accent-rgb), 0.25), 0 0 25px rgba(var(--accent-rgb), 0.3);
    transform: scale(0.98);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.item:active .item-cover.app-cover {
    filter: drop-shadow(0 2px 8px var(--shadow)) drop-shadow(0 0 0 3px rgba(var(--accent-rgb), 0.25)) drop-shadow(0 0 25px rgba(var(--accent-rgb), 0.3));
    transform: scale(0.98);
    transition: filter 0.15s ease, transform 0.15s ease;
}

.item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-badges {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    z-index: 2;
}

.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    background-color: var(--bg);
    padding: 2px 4px;
    line-height: 1;
    z-index: 2;
}

.badge.heart {
    color: var(--accent);
}

.item-info {
    margin-top: 8px;
    display: block;
}

.item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 3px;
    line-height: 1.3;
}

.item-meta {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Skeleton Loading Styles */
.item-skeleton {
    position: relative;
    cursor: default;
}

.item-skeleton .item-cover {
    background: var(--text-faint);
    background: linear-gradient(90deg, var(--text-faint) 25%, rgba(255, 255, 255, 0.1) 50%, var(--text-faint) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .item-skeleton .item-cover {
    background: var(--text-faint);
    background: linear-gradient(90deg, var(--text-faint) 25%, rgba(255, 255, 255, 0.05) 50%, var(--text-faint) 75%);
    background-size: 200% 100%;
}

.item-skeleton .item-cover img {
    display: none;
}

.item-skeleton .item-title {
    background: var(--text-faint);
    background: linear-gradient(90deg, var(--text-faint) 25%, rgba(255, 255, 255, 0.1) 50%, var(--text-faint) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    height: 14px;
    border-radius: 2px;
    margin-bottom: 6px;
    width: 80%;
}

body.dark-mode .item-skeleton .item-title {
    background: var(--text-faint);
    background: linear-gradient(90deg, var(--text-faint) 25%, rgba(255, 255, 255, 0.05) 50%, var(--text-faint) 75%);
    background-size: 200% 100%;
}

.item-skeleton .item-meta {
    background: var(--text-faint);
    background: linear-gradient(90deg, var(--text-faint) 25%, rgba(255, 255, 255, 0.1) 50%, var(--text-faint) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    height: 10px;
    border-radius: 2px;
    width: 60%;
}

body.dark-mode .item-skeleton .item-meta {
    background: var(--text-faint);
    background: linear-gradient(90deg, var(--text-faint) 25%, rgba(255, 255, 255, 0.05) 50%, var(--text-faint) 75%);
    background-size: 200% 100%;
}

.item-skeleton .item-badges {
    display: none;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Footer */
footer {
    margin-top: 80px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    position: relative;
}

/* Scroll to Top Button */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--text-color);
    color: var(--bg-color);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.scroll-top .material-symbols-outlined {
    font-size: 24px;
    color: inherit;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.scroll-top.visible {
    opacity: 0.7;
    visibility: visible;
}

.scroll-top:hover {
    opacity: 1;
    transform: translateY(-3px);
}

.scroll-top:active {
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px;
        font-size: 14px;
    }

    .sun {
        font-size: 20px;
    }

    nav a {
        margin-right: 12px;
    }

    .shelf-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .shelf-selector-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .section h2 {
        font-size: 20px;
    }

    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .items-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 15px;
    }

    .item-info {
        display: block;
    }

    .scroll-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    .scroll-top .material-symbols-outlined {
        font-size: 20px;
    }
}

@media (min-width: 769px) {
    .items-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Hidden class */
.hidden {
    display: none;
}

/* General link styles */
a {
    color: var(--link-color);
    text-decoration: underline;
    font-family: 'Courier New', Courier, monospace;
}

a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

