/*
Theme Name: Pluvid Monochrome
Theme URI: https://pluvid.com
Author: Pluvid Dev
Description: A monochrome, tool-like minimal theme inspired by isodung.pluvid.com.
Version: 1.0
Text Domain: pluvid-monochrome
*/

/* =========================================
   1. Variables & Reset
   ========================================= */
:root {
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-border: #000000;
    --color-hover-bg: #000000;
    --color-hover-text: #ffffff;
    
    --font-body: "Courier New", Courier, monospace;
    --font-heading: "IM Fell English", serif;
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 50px;
    --spacing-unit: 1rem;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 400;
    margin-top: 0;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 { font-size: 4.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }

a {
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

a:hover {
    border-bottom-color: var(--color-text);
}

p {
    margin-bottom: 1.5rem;
    max-width: 70ch;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =========================================
   2. Layout Structure
   ========================================= */
#page-wrapper {
    display: flex;
    min-height: 100vh;
    transition: padding-left 0.3s ease;
}

/* Sidebar */
#sidebar-primary {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--sidebar-width);
    background: var(--color-bg);
    border-right: 3px solid var(--color-border);
    padding: 20px;
    overflow-y: auto;
    z-index: 100;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Main Content */
#content-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    width: 100%;
    transition: margin-left 0.3s ease;
}

/* Collapsed State (Desktop) */
body.sidebar-collapsed #sidebar-primary {
    width: var(--sidebar-collapsed-width);
    padding: 20px 0;
    align-items: center;
}

body.sidebar-collapsed #content-area {
    margin-left: var(--sidebar-collapsed-width);
}

/* Collapsed: Logo & Title */
.site-logo-collapsed {
    display: none;
    width: 40px;
    height: auto;
    margin-bottom: 20px;
}

body.sidebar-collapsed .site-title {
    display: none;
}

body.sidebar-collapsed .site-logo-collapsed {
    display: block;
}

body.sidebar-collapsed .sidebar-footer {
    display: none;
}

/* Collapsed: Menu */
body.sidebar-collapsed .main-navigation ul li a .menu-label,
body.sidebar-collapsed .main-navigation ul li a .menu-description {
    display: none;
}

body.sidebar-collapsed .main-navigation ul li a {
    text-align: center;
    padding: 10px 0;
    font-size: 0; /* Hide other text/whitespace */
}

body.sidebar-collapsed .main-navigation ul li a::before {
    content: attr(data-initial);
    font-weight: 700;
    font-size: 1.5rem;
    display: block;
}

/* =========================================
   3. Navigation
   ========================================= */
.site-header {
    margin-bottom: 2rem;
}

.site-title {
    font-family: var(--font-heading);
    font-size: 3rem; /* Reduced to 3rem */
    margin: 0 0 20px;
    line-height: 0.9;
}

.site-title a {
    border: none;
}

.main-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.main-navigation ul li {
    margin-bottom: 0;
}

.main-navigation ul li a {
    display: block;
    padding: 5px 0 5px 2px;
    border-bottom: 2px solid #000;
    font-size: 1.6rem;
    font-weight: 700; /* Thicker text */
}

.main-navigation ul li a .menu-label {
    display: block;
}

.main-navigation ul li a .menu-description {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    font-style: italic;
    text-transform: none;
    font-variant: normal;
    color: #666;
    line-height: 1.2;
    margin-top: 3px; /* Add spacing between title and desc */
    padding-bottom: 2px;
}

.main-navigation ul li a:hover {
    background: #f5f5f5;
    border-bottom-color: #000;
}

/* Submenus (Apps) */
.main-navigation ul ul {
    padding-left: 15px;
    display: none;
}

.main-navigation ul li:hover > ul,
.main-navigation ul li.current-menu-item > ul,
.main-navigation ul li.current-menu-parent > ul {
    display: block;
}

.main-navigation ul ul li a {
    font-size: 1.5rem;
    border-bottom: 1px solid transparent;
    color: #555;
    padding-top: 5px;
    padding-bottom: 5px;
}

.main-navigation ul ul li a:hover {
    color: #000;
}

/* =========================================
   4. Components
   ========================================= */
/* Buttons */
button,
input[type="submit"],
input[type="button"],
.button,
a.button,
.wp-block-button__link {
    display: inline-block;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 10px 20px;
    font-family: var(--font-body);
    text-transform: uppercase;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.2s;
    text-decoration: none;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.button:hover,
a.button:hover,
.wp-block-button__link:hover {
    background: var(--color-hover-bg);
    color: var(--color-hover-text);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 10px;
    font-family: var(--font-body);
    width: 100%;
    max-width: 100%;
    border-radius: 0;
}

input:focus, textarea:focus, select:focus {
    outline: 1px solid var(--color-text);
}

/* =========================================
   5. Blog & Posts
   ========================================= */
.post {
    margin-bottom: 4rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #000;
}

.entry-header {
    margin-bottom: 1.5rem;
}

.entry-title {
    font-size: 4.5rem;
}

.entry-meta {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

.entry-content {
    font-size: 1rem;
}

/* Index / Archive Layout (Flex Row) */
.blog .post, .archive .post, .search .post {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    align-items: flex-start;
}

.blog .post-thumbnail, .archive .post-thumbnail, .search .post-thumbnail {
    flex: 0 0 250px;
    margin-bottom: 0;
}

.blog .post-body, .archive .post-body, .search .post-body {
    flex: 1;
    min-width: 0; /* Fix flex overflow */
}

/* Single Post / Page Layout (Grid) */
.entry-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

.entry-content-wrapper {
    min-width: 0;
}

.entry-sidebar {
    position: sticky;
    top: 20px;
}

.entry-meta-sidebar {
    font-size: 0.85rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

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

.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
}

/* =========================================
   6. WooCommerce
   ========================================= */
/* Shop Loop Grid */
.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 0;
    margin-bottom: 4rem;
}

/* Fix: Remove pseudo-elements that act as empty grid items */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none;
    content: "";
}

.woocommerce ul.products li.product {
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.woocommerce ul.products li.product a.woocommerce-loop-product__link {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.woocommerce ul.products li.product img {
    margin-bottom: 1rem;
    border: 2px solid #000;
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-family: var(--font-body);
    font-size: 1.1rem;
    padding: 0;
    margin-top: auto;
}

.woocommerce ul.products li.product .price {
    display: block;
    color: var(--color-text);
    margin-bottom: 1rem;
    font-weight: bold;
}

/* Buttons (Global WC) */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce .single_add_to_cart_button {
    display: inline-block;
    background-color: #000 !important;
    color: #fff !important;
    border: 1px solid #000;
    border-radius: 0 !important;
    padding: 12px 24px;
    text-transform: uppercase;
    font-family: var(--font-body);
    font-weight: 400;
    cursor: pointer;
    transition: all 0.1s ease;
    text-decoration: none;
    line-height: 1;
    margin-top: auto;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce .single_add_to_cart_button:hover {
    background-color: #000 !important;
    color: #fff !important;
    box-shadow: 5px 5px 0px 0px rgba(0,0,0,0.4);
    transform: translate(-1px, -1px);
}

.woocommerce ul.products li.product .button {
    width: 100%;
    text-align: center;
}

/* Single Product Layout */
.woocommerce div.product {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* Bigger images (60/40 split) */
    gap: 4rem;
    margin-bottom: 4rem;
}

.woocommerce div.product div.images img {
    border: 2px solid #000;
    width: 100%;
    height: auto;
}

.woocommerce div.product .product_title {
    font-family: var(--font-heading);
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
}

.woocommerce div.product .price {
    color: var(--color-text);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    display: block;
}

/* Add to Cart Form Layout */
.woocommerce div.product form.cart {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for variable product tables */
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

/* Handle Variable Product Table */
.woocommerce div.product form.cart .variations {
    width: 100%;
    margin-bottom: 1rem;
    border: none;
}

.woocommerce div.product form.cart .variations td,
.woocommerce div.product form.cart .variations th {
    display: block;
    padding: 0 0 5px 0;
    text-align: left;
}

.woocommerce div.product form.cart .variations select {
    width: 100%;
    margin-bottom: 1rem;
}

/* Wrapper for button+qty in variable products */
.woocommerce div.product form.cart .woocommerce-variation-add-to-cart {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

/* Quantity Input Styling */
.woocommerce .quantity .input-text {
    width: 60px;
    padding: 11px 0;
    text-align: center;
    border: 1px solid #000;
    border-radius: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    background: #fff;
    color: #000;
    height: 43px; /* Fixed height to match button padding calculation approximately */
    box-sizing: border-box;
}

/* Tabs & Description */
.woocommerce-tabs {
    clear: both;
    margin-top: 4rem;
}

.woocommerce-tabs ul.tabs {
    padding: 0;
    margin: 0 0 2rem;
    list-style: none;
    border: none;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.woocommerce-tabs ul.tabs li {
    border: none;
    margin: 0;
    background: transparent;
}

.woocommerce-tabs ul.tabs li a {
    display: inline-block;
    background-color: #000;
    color: #fff;
    border: 1px solid #000;
    border-radius: 0;
    padding: 12px 24px;
    text-transform: uppercase;
    font-family: var(--font-body);
    font-weight: 400;
    text-decoration: none;
    line-height: 1;
    transition: all 0.1s ease;
}

.woocommerce-tabs ul.tabs li a:hover,
.woocommerce-tabs ul.tabs li.active a {
    box-shadow: 5px 5px 0px 0px rgba(0,0,0,0.4);
    transform: translate(-1px, -1px);
    color: #fff; /* Ensure text stays white */
}

.woocommerce-Tabs-panel--description {
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 700px;
}

.woocommerce-Tabs-panel--description h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Messages */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    background: #fff;
    border: 1px solid #000;
    border-top: 4px solid #000;
    color: #000;
    padding: 1rem;
    margin-bottom: 2rem;
}

.woocommerce-message .button {
    float: right;
    margin-left: 1rem;
}

/* Mobile Adjustments for WC */
@media (max-width: 768px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr;
    }
    
    .woocommerce div.product {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* =========================================
   7. Mobile Responsive
   ========================================= */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    #sidebar-primary {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid var(--color-border);
    }

    body.mobile-menu-open #sidebar-primary {
        transform: translateX(0);
        width: 260px;
    }

    #content-area {
        margin-left: 0;
        padding: 20px;
        width: 100%;
    }
    
    /* Mobile Toggle Button (Visible on mobile only) */
    #mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 200;
        background: #fff;
        border: 1px solid #000;
        padding: 8px 12px;
    }

    /* Hide Desktop Toggle */
    #sidebar-toggle {
        display: none;
    }
    
    /* Adjust grid */
    .woocommerce ul.products {
        grid-template-columns: 1fr;
    }

    /* Stack Index Layout */
    .blog .post, .archive .post, .search .post {
        flex-direction: column;
    }
    
    .blog .post-thumbnail, .archive .post-thumbnail, .search .post-thumbnail {
        flex: 0 0 auto;
        width: 100%;
        margin-bottom: 1rem;
    }

    /* Stack Single Layout */
    .entry-container {
        grid-template-columns: 1fr;
    }

    .entry-sidebar {
        position: static;
        order: -1; /* Move sidebar (image) above content on mobile? Or keep below? User said "next to text", likely wants image visible. Let's keep normal order or move meta up. */
        margin-bottom: 2rem;
    }
}

@media (min-width: 769px) {
    #mobile-menu-toggle {
        display: none;
    }
}
