/* =========================================
   1. FONTS & THEME VARIABLES
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* Default Theme: Grayscale (Dark) */
:root {
    --bg-color: #242424;
    --sidebar-bg: #242424; 
    --text-color: #e0e0e0;
    --border-color: #333333;
    --link-color: #ffffff;
    --link-hover: #aaaaaa;
}

/* Theme: OLED Black */
:root[data-theme="black"] {
    --bg-color: #000000;
    --sidebar-bg: #000000; 
    --text-color: #cccccc;
    --border-color: #222222;
    --link-color: #ffffff;
    --link-hover: #888888;
}

/* Theme: E-ink White */
:root[data-theme="white"] {
    --bg-color: #ffffff;
    --sidebar-bg: #ffffff; 
    --text-color: #111111;
    --border-color: #dddddd;
    --link-color: #000000;
    --link-hover: #555555;
}


/* =========================================
   2. GLOBAL STYLES & RESETS
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Atkinson Hyperlegible', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
}

/* =========================================
   2.1 TEST RESPONSIVE FLUID TYPOGRAPHY
   ========================================= */

/* Applies fluid scaling to writing/blog content, single views, and product text */
.blog-content,
.item-description,
.product-layout {
    /* 
      1. Minimum: 1.1rem (prevents it from getting too small)
      2. Fluid preferred: 1rem + 0.3vw (scales up slowly as the screen gets wider)
      3. Maximum: 1.35rem (stops scaling on ultra-wide / 4K displays)
    */
    font-size: clamp(1.1rem, 1rem + 0.3vw, 1.35rem);
    
    /* Slightly increase line-height proportionally for larger screens */
    line-height: clamp(1.4, 1.4 + 0.1vw, 1.5); 
}


/* =========================================
   3. LAYOUT (SIDEBAR & MAIN CONTENT)
   ========================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px; 
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    background-color: var(--sidebar-bg);
    z-index: 100;
}

/* 1. Default Layout (Restores Home, About, Ref) */
.main-content {
    margin-left: 220px; 
    width: calc(100% - 220px); 
    flex: 1;
    padding: 4rem;
}

/* 2. Sub-Page True Centering with Flexible Right Side */
@media (min-width: 769px) {
    /* Keeps Writing and Single Views tight and perfectly centered */
    .main-content:has(.single-view),
    .main-content:has(.blog-view) {
        margin-left: 0;
        width: 100%;
        padding: 4rem 0; 
        display: grid;
        grid-template-columns: minmax(260px, 1fr) minmax(0, 80ch) minmax(2rem, 1fr);
    }

    /* Gives Products a wider center column (1000px) so they have room to sit side-by-side */
    .main-content:has(.product-layout) {
        margin-left: 0;
        width: 100%;
        padding: 4rem 0; 
        display: grid;
        grid-template-columns: minmax(260px, 1fr) minmax(0, 1000px) minmax(2rem, 1fr);
    }

    .main-content:has(.single-view) > *,
    .main-content:has(.blog-view) > *,
    .main-content:has(.product-layout) > * {
        grid-column: 2; 
        width: 100%;
    }
}


/* =========================================
   4. SIDEBAR COMPONENTS
   ========================================= */
/* Logo */
.logo {
    width: 100px;
    height: 100px;
    margin-bottom: 2rem;
    text-align: center;
}

.logo a {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    border-radius: 50%; 
}

/* Navigation Menu */
.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-link {
    font-size: 1rem;
    display: block;
    padding: 0.25rem 0;
}

.nav-link.active {
    font-weight: 700;
    font-size: 1.2rem;
}

/* Live Search & Filters */
.sub-nav {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
}

.search-box {
    width: 100%;
    padding: 0.25rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-family: inherit;
    margin-bottom: 0.5rem;
    border-radius: 0; 
}

.cat-filter {
    display: none; 
}

.filter-label {
    display: block;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    transition: all 0.2s ease;
}

.filter-label:has(input:checked) {
    font-weight: 700;
    font-size: 1.05rem;
}

/* Theme Selector */
.theme-selector {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    gap: 0.5rem;
}

.theme-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    border-radius: 0;
}

#theme-black { background-color: #000; }
#theme-white { background-color: #fff; }
#theme-gray { background-color: #242424; }
#theme-random { 
    background: conic-gradient(from 0deg, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
}

/* =========================================
   RAINBOW THEME CUSTOM CURSOR
   ========================================= */
[data-theme="random"],
[data-theme="random"] p,
[data-theme="random"] h1,
[data-theme="random"] h2 {
    /* Points to your image, with 'auto' as a safety fallback */
    cursor: crosshair;
    /* cursor: url('images/rainbow-cursor.png'), auto;  */
}

/* Optional: A different custom cursor when hovering over links and buttons */
/* [data-theme="random"] a,
[data-theme="random"] button {
    cursor: url('images/rainbow-pointer.png'), pointer;
} */


/* =========================================
   5. HOME PAGE & GENERAL TYPOGRAPHY
   ========================================= */
.hero-text {
    font-size: 1.2rem;
}

.hero-text a {
    text-decoration: underline;
}

.secondary-content {
    margin-top: 1.5rem; /* Adds space above equivalent to a standard line/paragraph break */
}

.disclaimer-text {
    font-size: 0.85rem;
    line-height: 1.5;
    opacity: 0.6;
    margin-top: 2rem;
    font-style: italic;
    max-width: 600px;
}


/* =========================================
   6. GRID LAYOUTS (PROJECTS & PHOTOS)
   ========================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem; 
    width: 100%;
}

.tile-wrapper {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-color);
    cursor: pointer;
}

.tile {
    width: 100%;
    aspect-ratio: 1 / 1; 
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile-label {
    opacity: 0;
    text-align: center;
    margin-top: 0.75rem;
    font-size: 1.1rem;
    font-weight: bold;
    transition: opacity 0.2s ease-in-out;
}

.tile-wrapper:hover .tile-label {
    opacity: 1;
}

.tile-wrapper .tile-title {
    display: none; 
}


/* =========================================
   7. SINGLE ITEM VIEWS (ARTICLES & PRODUCTS)
   ========================================= */
.single-view {
    display: flex;
    flex-direction: column;
    align-items: center; 
    text-align: center;
    max-width: 800px;
    margin: 0 auto; 
    /* Removed the broken transform rule here so it centers properly */
}

.item-title {
    font-size: 2rem;
    margin-top: 1.5rem; 
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.item-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
}

/* Fixes the jumping image by locking aspect ratio */
.large-photo {
    width: 100%;
    aspect-ratio: 1 / 1; /* Locks the frame size permanently */
    object-fit: cover; 
    border: 1px solid var(--border-color);
    border-radius: 0; 
    
    /* NEW: Tells the image to shrink back immediately when the mouse leaves */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: 1;
}

/* NEW: The hover effect */
.large-photo:hover {
    transform: scale(1.25); /* Makes the image 15% larger */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); /* Adds a shadow so it pops off the page */
    z-index: 150; /* Ensures the zoomed image overlaps the surrounding text/thumbnails */
    
    /* Waits exactly 1 second (1s) before starting the zoom */
    transition: transform 0.3s ease 0.75s, box-shadow 0.3s ease 1s;
    cursor: zoom-in;
}


/* =========================================
   8. PRODUCT SPECIFIC STYLES
   ========================================= */
.product-view {
    text-align: left; 
    align-items: flex-start;
    max-width: 1500px; /* Unlocks the 800px limit so it fills wide screens */
    margin: 0; 
}

.gallery-thumbs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
    margin-top: 1rem;
}

.thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.6;
    border: 1px solid var(--border-color);
    transition: opacity 0.2s ease;
    border-radius: 0;
}

.thumb:hover, .thumb.active {
    opacity: 1;
    border-color: var(--text-color);
}

.product-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 1rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
}

.product-sku {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1.5rem;
}

.product-description p {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.product-details-block {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.product-details-block h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.ordering-notice {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.ordering-container {
    max-width: 700px;
    line-height: 1.7;
}

.ordering-container h1 {
    margin-bottom: 1.5rem;
}

.ordering-container p {
    margin-bottom: 1rem;
}

.product-thumb-price {
    font-weight: normal;
    font-size: 1rem;
    margin-top: 0.2rem;
    color: var(--text-color);
    opacity: 0.8;
}


/* =========================================
   9. WRITING & BLOG STYLES
   ========================================= */
.blog-view {
    text-align: left; 
    align-items: flex-start; 
}

.blog-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    width: 100%;
}

.blog-content p {
    margin-bottom: 1.5rem;
}

.blog-image {
    width: 100%;
    aspect-ratio: auto; 
    object-fit: cover;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    border-radius: 0;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.article-header h1 {
    margin-bottom: 0;
    font-size: 2rem;
}

.article-date {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.6; 
}

#content-list {
    display: flex;
    flex-direction: column;
    width: 100%; 
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 0; 
    border-bottom: 1px solid var(--border-color); 
    text-decoration: none;
    color: var(--text-color);
    transition: opacity 0.2s ease;
    width: 100%;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    opacity: 0.6;
}

.list-item span:first-child {
    font-size: 1.1rem;
    font-weight: bold;
}

.list-item span:last-child {
    font-size: 0.95rem;
    opacity: 0.7;
}

/* Wikipedia-Style Headings */
.blog-content h2 {
    /* Consider not using the line below */
    clear: left;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Wikipedia-Style Floating Figures */
.wiki-figure {
    border: 1px solid var(--border-color);
    padding: 6px;
    max-width: 300px;
    background-color: var(--bg-color); /* Ensures the background stays solid when zoomed */
    margin-bottom: 1rem;
    
    /* ADDED FOR HOVER EFFECT */
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ADD THIS NEW BLOCK FOR THE ZOOM */
.wiki-figure:hover {
    transform: scale(1.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); /* Adds a heavy drop shadow */
    z-index: 150; /* Forces it to the front so it overlaps surrounding text */
    
    /* Waits exactly 0.75s to start growing, 1s for the shadow */
    transition: transform 0.3s ease 0.75s, box-shadow 0.3s ease 1s;
    cursor: zoom-in;
}

.wiki-figure.float-right {
    float: right;
    margin-left: 1.5rem;
}

.wiki-figure.float-left {
    float: left;
    margin-right: 1.5rem;
}

.wiki-figure img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--border-color);
}

.wiki-caption {
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0.5rem 0.25rem 0.25rem;
    color: var(--text-color);
    opacity: 0.9;
}

/* Clearfix to ensure the container wraps around floating images */
.clearfix::after {
    content: "";
    clear: both;
    display: table;
}


/* =========================================
   10. REFERENCE PAGE STYLES
   ========================================= */
.ref-category {
    margin-bottom: 1.5rem;
}

.ref-header {
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    outline: none;
    list-style: none; /* Removes arrow in Firefox/Standard */
}

.ref-header::-webkit-details-marker {
    display: none; /* Removes arrow in Chrome/Safari */
}

.ref-content {
    padding: 0.75rem 0 0.75rem 1rem;
    line-height: 1.8;
}

.ref-item {
    display: block; 
    margin-bottom: 0.75rem;
}

.ref-item-row {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem; 
}

.ref-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 0; 
    vertical-align: middle;
}


/* =========================================
   11. ERROR PAGE (404)
   ========================================= */
.error-title {
    font-size: 10rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.error-img {
    width: 350px;
    height: 350px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    border-radius: 0;
}

/* =========================================
   12. LINK STYLES
   ========================================= */
/* Underline all links globally */
a {
    text-decoration: underline;
    text-underline-offset: 5px; /* Lowers the line slightly below descenders */
    text-decoration-thickness: 1px; /* Keeps the line crisp */
}

/* Remove underlines from UI elements so it remains clean and elegant */
.nav-link, 
.tile-wrapper, 
.list-item, 
.ref-header, 
.logo a,
.thumb,
.nav-arrow {
    text-decoration: none;
}

/* Add underline back on hover for navigation if desired 
.nav-link:hover, .list-item:hover {
    text-decoration: underline;
} */

/* =========================================
   13. SUBPAGE NAVIGATION ARROWS (DESKTOP)
   ========================================= */
/* Moved this ABOVE the media queries so mobile can properly override it */
.page-navigation {
    position: absolute;
    bottom: 4.2rem;
    left: 2rem;
    display: flex;
    justify-content: space-between; 
    width: 120px; 
}

.theme-selector {
    position: absolute;
    bottom: 2rem; 
    left: 2rem;
    display: flex;
    gap: 0.5rem;
}

.nav-arrow.right-only {
    margin-left: auto;
}

.nav-arrow {
    font-size: 1.5rem;
    color: var(--text-color);
    transition: opacity 0.2s;
    font-family: monospace; 
}

.nav-arrow:hover {
    opacity: 0.5;
}

/* =========================================
   14. DYNAMIC PRODUCT LAYOUT (RESPONSIVE WRAP)
   ========================================= */
.product-layout {
    display: flex;
    flex-wrap: wrap; /* Allows side-by-side on landscape, stacks on vertical monitors */
    justify-content: center; /* Keeps the entire block centered */
    gap: 3.5rem; /* Provides clean breathing room between photo and text */
    width: 100%;
    max-width: 1000px; /* Keeps the text from drifting too far away from the image */
    margin: 0 auto; 
    font-size: 1.1rem; 
}

.product-gallery-section {
    flex: 1 1 400px; /* Adjusted to 400px so it perfectly fits side-by-side with the 350px text */
    max-width: 550px; /* Lets the photo be large, but not screen-dominating */
    width: 100%;
}

.product-info-section {
    flex: 1 1 350px; /* Triggers the vertical stack if the screen is narrower than ~900px */
    text-align: left;
}

/* =========================================
   16 MOBILE RESPONSIVENESS (PHONES/TABLETS)
   ========================================= */
/* This MUST be the last section in your CSS file */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        position: relative;
        min-height: 100vh;
        padding-bottom: 8rem; 
    }

    .sidebar {
        position: static; 
        width: 100%;
        height: auto;
        padding:1.5rem 2rem 0.25rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
        border-bottom: none; 
    }

    .logo {
        width: 65px; 
        height: 65px;
        margin-bottom: 0;
    }

    .nav-menu {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1.25rem;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .sidebar .search-container,
    .sidebar .category-list,
    .sidebar input[type="text"] {
        display: none !important;
    }

    /* Properly stacks and centers the arrows directly above the theme boxes */
    .page-navigation {
        position: absolute;
        bottom: 4rem; 
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        justify-content: space-between; 
        width: 140px; /* Spaced out to perfectly frame the theme boxes below it */
        margin: 0;
    }

    /* Properly centers the theme boxes at the absolute bottom */
    .theme-selector {
        position: absolute;
        bottom: 1.5rem; 
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        width: max-content;
        margin: 0;
    }

    .main-content {
        margin-left: 0; 
        width: 100%;
        padding: 1.5rem; 
    }

    .product-layout {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        margin: 0 auto;
    }
    
    .product-gallery-section,
    .product-info-section {
        width: 100%;
        flex: none;
    }

    .article-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* Add inside the mobile media query! */
    .wiki-figure.float-right,
    .wiki-figure.float-left {
        float: none;
        margin: 1.5rem auto;
        max-width: 100%; /* Allows the image to span the mobile screen */
    }

    /* Disable all hover zoom effects on mobile */
    .large-photo:hover,
    .wiki-figure:hover{
        transform: none;
        box-shadow: none;
        z-index: auto;
    }
}
