/* =============================================================================
   GRAJEVSTORE — MAIN THEME STYLESHEET
   =============================================================================

   TABLE OF CONTENTS
   ─────────────────
   1.  CSS Variables
   2.  Global Reset & Base
   3.  Typography
   4.  Global Layout
   5.  Header & Navigation
       5a. Header
       5b. Nav Dropdown (Gaminiai)
   6.  Footer
   7.  WooCommerce — Global
   8.  WooCommerce — Product Single
       8a. Product Gallery
       8b. Product Tabs
   9.  WooCommerce — Cart
   10. WooCommerce — Account
   ============================================================================= */

/* =============================================================================
   1. CSS VARIABLES
   ============================================================================= */

:root {
    --text-primary: #241a11;
    --text-secondary: #5f3826;
    --accent: #e7e7e6;
    --accent-dark: #dbdbda;
    --text-muted: #866752;
    --accent-rgb: 231, 231, 230;
}

/* =============================================================================
   2. GLOBAL RESET & BASE
   ============================================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media screen and (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    font-family: 'Inter', sans-serif;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    background-color: var(--accent);
}

/* =============================================================================
   3. TYPOGRAPHY
   ============================================================================= */

h1 {
    font-size: clamp(48px, 4vw + 1rem, 72px);
    color: var(--text-primary);
    line-height: 1;
    margin: 0;
}

h2 {
    font-size: 48px !important;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 24px 0 !important;
    line-height: 1 !important;
}

h3 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.43;
    color: var(--text-primary);
    margin: 0;
}

h4 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary);
    margin: 0;
}

h2.wp-block-heading {
    text-align: center;
}

p {
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.43;
}

a {
    color: var(--text-primary);
    text-decoration: none !important;
    font-size: 16px;
    line-height: 1.43;
}

span,
td {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.43;
    font-weight: 500;
}

ul {
    padding-inline-start: 25px;
}

li {
    line-height: 1.43;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

label {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.43;
    font-size: 20px;
}

input {
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.43;
    font-size: 16px;
}

textarea {
    color: var(--text-secondary);
    background-color: var(--accent-dark);
    font-weight: 500;
    line-height: 1.43;
    font-size: 16px;
    border-radius: 16px;
    padding: 10px;
    border: none;
}

button {
    height: 50px;
    background-color: var(--text-primary);
    color: var(--accent);
    width: 100%;
    border-radius: 50px;
    font-size: 16px;
    line-height: 1.43;
    font-weight: 500;
}

.button {
    height: 50px;
    border-radius: 30px;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.read-more-link {
    text-decoration: underline;
}

@media (max-width: 600px) {
    h1 {
        font-size: 46px !important;
    }

    h2 {
        font-size: 34px !important;
    }

    h3 {
        font-size: 18px;
        line-height: 1.55;
    }

    h4 {
        font-size: 16px;
        line-height: 1.55;
    }

    p,
    li,
    a,
    span,
    td,
    label,
    input {
        font-size: 14px;
        font-weight: 500;
        line-height: 1.35;
    }
}

/* =============================================================================
   4. GLOBAL LAYOUT
   ============================================================================= */

:root :where(.wp-block-post-content) {
    margin: 0 !important;
}

:where(.wp-site-blocks) > * {
    margin-block-start: 0;
}

.wp-site-blocks {
    position: relative;
}

section {
    margin: 0 !important;
    width: 100%;
    max-width: 100% !important;
}

.section-wrapper,
.privacy-policy .entry-content {
    max-width: min(1440px, calc(100% - 13%));
    margin: 0 auto !important;

    @media (max-width: 600px) {
        max-width: unset !important;
        padding: 0 24px;
    }
}

.privacy-policy .entry-content {
    padding: 60px 0 !important;
}

/* .is-layout-constrained
    > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: 100% !important;
} */

main {
    margin-top: 0;
    padding: 0 !important;
}

main[data-page='checkout'] {
    max-width: min(1440px, calc(100% - 13%)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 60px 0 !important;
}

main[data-page='cart'] .entry-content,
main[data-page='checkout'] .entry-content {
    max-width: 100%;
}

.wc-block-cart.wc-block-components-sidebar-layout {
    max-width: 100% !important;
    padding: 0 !important;
}

.wc-block-cart p {
    margin: 0;
}

.about-description p {
    margin: 0 0 1em 0;
}
/* =============================================================================
   5. HEADER & NAVIGATION
   ============================================================================= */

/* ── 5a. Header ────────────────────────────────────────────────────────────── */

header {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 10000;
    background-color: transparent;
}

header:has(.fixed) {
    background-color: var(--text-primary);
}

.logged-in header {
    margin-top: 32px;

    @media (max-width: 782px) {
        margin-top: 46px;
    }
}

/* Exclude admin bar links from global overrides */
#wpadminbar a,
#wpadminbar * a {
    color: inherit var(--accent);
    text-decoration: inherit !important;
}

/* ── 5b. Nav Dropdown (Gaminiai) ───────────────────────────────────────────── */

/* Hide native WP nav submenu to avoid conflict */
.wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container {
    display: none !important;
}

.wp-block-navigation-item.has-child {
    position: relative;
}

.grajev-nav-arrow {
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.grajev-subnav {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    border-radius: 0 0 16px 16px;
    padding: 8px 0 16px;
    min-width: 200px;
    list-style: none;
    margin: 0;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

header:not(:has(.fixed)) .grajev-subnav,
header:not(:has(.fixed)) .grajev-subnav__children {
    background: transparent;
    box-shadow: none;
}

.wp-block-navigation-item.has-child:hover > .grajev-subnav,
.wp-block-navigation-item.has-child:focus-within > .grajev-subnav {
    display: block;
}

.wp-block-navigation-item.has-child:hover
    > .wp-block-navigation-item__content
    .grajev-nav-arrow,
.wp-block-navigation-item.has-child:focus-within
    > .wp-block-navigation-item__content
    .grajev-nav-arrow {
    transform: rotate(180deg);
}

.grajev-subnav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    color: #fff !important;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.15s;
    text-decoration: none;
}

.grajev-subnav__link--parent {
    font-weight: 600;
}

.grajev-subnav__link:hover {
    opacity: 0.7;
}

/* Child submenu */
.grajev-subnav__item.has-child {
    position: relative;
}

.grajev-subnav__children {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--text-primary);
    border-radius: 0 16px 16px 0;
    padding: 8px 0 16px;
    min-width: 180px;
    list-style: none;
    margin: 0;
    box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.15);
}

.grajev-subnav__item.has-child:hover > .grajev-subnav__children,
.grajev-subnav__item.has-child:focus-within > .grajev-subnav__children {
    display: block;
}

.grajev-subnav__item.has-child:hover > .grajev-subnav__link .grajev-nav-arrow {
    transform: rotate(-90deg);
}

.grajev-subnav__children
    .grajev-subnav__item.has-child
    > .grajev-subnav__children {
    left: 100%;
    top: 0;
    border-radius: 0 16px 16px 0;
}

/* =============================================================================
   6. FOOTER
   ============================================================================= */

footer {
    margin: 0 !important;
    background-color: var(--text-primary);
    padding-bottom: 30px;

    @media (max-width: 768px) {
        padding-bottom: 20px;
    }
}

/* =============================================================================
   7. WOOCOMMERCE — GLOBAL
   ============================================================================= */

.woocommerce-page label {
    margin-bottom: 0;
}

.woocommerce-page select {
    font-size: 16px;
}

.wc-block-cart-item__wrap button,
.wc-block-cart-item__wrap input {
    color: var(--text-primary) !important;
}

.wp-block-woocommerce-cart-order-summary-block {
    color: var(--text-primary) !important;
}

/* =============================================================================
   8. WOOCOMMERCE — PRODUCT SINGLE
   ============================================================================= */

.single-product main {
    margin-block-start: 60px;
}

.single-product main p {
    margin: 0 0 1em 0;
}

.single-product main ul {
    margin: 0 0 1em 0;
}

.single-product main li {
    line-height: 1.43;
}

.single-product main .wp-block-columns {
    gap: 5%;
    max-width: min(1440px, calc(100% - 13%));
    margin: 0 auto 60px;
    align-items: flex-start;
}

@media (min-width: 782px) and (max-width: 1440px) {
    .single-product .wp-block-column[style*='flex-basis:512px'],
    .single-product .wp-block-column[style*='flex-basis: 512px'] {
        flex-basis: calc((100vw - 13% - 5%) * 512 / (512 + 526)) !important;
    }
}

/* Sticky column on desktop */
.single-product .wp-block-columns.is-layout-flex,
.single-product [class*='wp-container-core-columns'] {
    align-items: flex-start !important;
}

.single-product .woocommerce-product-gallery {
    position: static !important;
    max-height: none;
    overflow: visible !important;
}

@media (min-width: 782px) {
    .single-product .wp-block-column.is-layout-flow:first-child {
        position: sticky !important;
        top: 74px;
        align-self: flex-start !important;
    }

    .logged-in.single-product .wp-block-column.is-layout-flow:first-child {
        position: sticky !important;
        top: 106px;
        align-self: flex-start !important;
    }
}

/* ── 8a. Product Gallery ───────────────────────────────────────────────────── */

.woocommerce-product-gallery {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    position: relative;
}

.woocommerce-product-gallery__trigger {
    display: none !important;
}

.woocommerce-product-gallery__image:first-child,
.woocommerce-product-gallery .woocommerce-product-gallery__image {
    border-radius: 20px;
    overflow: hidden;
}

.woocommerce-product-gallery__image img {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
}

/* Thumbnail strip */
.flex-control-nav.flex-control-thumbs {
    display: flex !important;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
}

.flex-control-nav.flex-control-thumbs li {
    flex-shrink: 0;
    width: 89px !important;
    height: 94px !important;
    margin: 0 !important;
}

.flex-control-nav.flex-control-thumbs li img {
    width: 89px !important;
    height: 94px !important;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.flex-control-nav.flex-control-thumbs li img.flex-active {
    opacity: 1;
}

/* Flexslider arrows */
.woocommerce-product-gallery .flex-direction-nav {
    display: none;
}

.woocommerce-product-gallery--with-thumbs .flex-direction-nav {
    display: block;
}

.woocommerce-product-gallery .flex-prev,
.woocommerce-product-gallery .flex-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    text-indent: 0 !important;
    font-size: 0;
    padding: 0;
}

.woocommerce-product-gallery .flex-prev {
    left: 0;
}

.woocommerce-product-gallery .flex-next {
    right: 0;
    transform: translateY(-50%) rotate(180deg);
}

.woocommerce-product-gallery .flex-prev::after,
.woocommerce-product-gallery .flex-next::after {
    content: '';
    display: block;
    width: 13px;
    height: 23px;
    background-image: url("data:image/svg+xml,%3Csvg width='13' height='23' viewBox='0 0 13 23' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.9167 21.9167L0.916748 11.4167L11.9167 0.916748' stroke='%232A1A11' stroke-width='1.83333' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* ── 8b. Product Tabs ──────────────────────────────────────────────────────── */

.woocommerce-tabs .tabs {
    display: none !important;
}

.woocommerce-tabs h2 {
    text-align: center;
    margin: 0 0 36px 0;
}

.wp-block-woocommerce-product-details {
    max-width: min(1440px, calc(100% - 13%)) !important;
    margin: 0 auto 0 !important;
    padding: 60px 0 !important;
}

.woocommerce div.product .woocommerce-tabs .panel {
    margin: 0 !important;
}

body.woocommerce div.product .woocommerce-tabs ul.tabs li.active a,
html
    body
    .wp-block-woocommerce-product-details.is-style-minimal
    ul.tabs.wc-tabs
    li
    a {
    color: var(--text-primary);
}

/* =============================================================================
   9. WOOCOMMERCE — CART
   ============================================================================= */

.wc-block-cart-items__header {
    /* reserved for cart header overrides */
}

/* =============================================================================
   10. WOOCOMMERCE — ACCOUNT
   ============================================================================= */

.woocommerce .account-content .woocommerce-EditAccountForm,
.woocommerce-page .account-content .woocommerce-EditAccountForm {
    display: flex;
    flex-wrap: wrap;
}

.woocommerce .account-content .form-row-first,
.woocommerce-page .account-content .form-row-first {
    width: 48.5% !important;
    margin-right: 3% !important;
    float: none !important;
    display: flex !important;
    flex-direction: column;
    box-sizing: border-box;
}

.woocommerce .account-content .form-row-last,
.woocommerce-page .account-content .form-row-last {
    width: 48.5% !important;
    float: none !important;
    display: flex !important;
    flex-direction: column;
    box-sizing: border-box;
}

.woocommerce .account-content .form-row-wide,
.woocommerce-page .account-content .form-row-wide {
    width: 100% !important;
}

.account-content input:-webkit-autofill {
    -webkit-text-fill-color: var(--text-secondary) !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--accent-dark) inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

.account-content input {
    color: var(--text-secondary) !important;
    -webkit-text-fill-color: var(--text-secondary) !important;
}

/* logged out default */
body:not(.logged-in) .js-auth-login {
    display: block;
    padding: 60px 0;
}

body:not(.logged-in) .js-auth-register {
    display: none;
}

body:not(.logged-in) .js-account-shell {
    display: none !important;
}

/* switch to register */
body:not(.logged-in).is-register-view .js-auth-login {
    display: none;
}

body:not(.logged-in).is-register-view .js-auth-register {
    display: block;
    padding: 60px 0;
    margin-block-start: 0;
}

/* logged in */
body.logged-in .js-auth-login,
body.logged-in .js-auth-register {
    display: none !important;
}

body.logged-in .js-account-shell {
    display: block !important;
}

/* =============================================================================
   10. RESPONSIVE
   ============================================================================= */
