/* =====================================================================
   Denki Timber & Hardware — Frontend theme
   Font: Bookman Old Style
   Colors: Royal Blue #1D4ED8 · Cyan #06B6D4 · White #FFFFFF · Pale Blue #EFF6FF
   Text-only UI. Only icons: hamburger (menu) + close.
   ===================================================================== */

:root {
    --royal:    #1D4ED8;
    --royal-dk: #16409F;
    --cyan:     #06B6D4;
    --cyan-dk:  #0891B2;
    --white:    #FFFFFF;
    --pale:     #EFF6FF;
    --ink:      #1E293B;
    --muted:    #64748B;
    --green:    #22A55B;
    --green-dk: #1B8A4A;
    --radius:   10px;
    --shadow:   0 10px 30px rgba(29, 78, 216, .10);
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* In-page sections stop below the floating navbar when scrolled to */
#top, #categories, #products, #footer { scroll-margin-top: 92px; }

body {
    font-family: 'Bookman Old Style', 'Bookman', Georgia, 'Times New Roman', serif;
    color: var(--ink);
    background: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

button, .nav-toggle, .nav-close { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

a { color: var(--royal); text-decoration: none; }
a:hover { color: var(--royal-dk); }

ul { list-style: none; }

.container { width: min(1180px, 92%); margin-inline: auto; }

/* ------------------------------------------------------------- Buttons --- */

.btn {
    display: inline-block;
    padding: .55rem 1.15rem;
    border-radius: 8px;
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary  { background: var(--royal); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--royal-dk); color: var(--white); }

.btn-accent   { background: var(--cyan); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-accent:hover { background: var(--cyan-dk); color: var(--white); }

.btn-ghost    { background: var(--white); color: var(--royal); border-color: var(--royal); }
.btn-ghost:hover { background: var(--pale); color: var(--royal-dk); }

.btn-white    { background: var(--white); color: var(--royal); }
.btn-white:hover { background: var(--pale); color: var(--royal-dk); }

.btn-outline-white { background: transparent; color: var(--white); border-color: var(--white); }
.btn-outline-white:hover { background: rgba(255,255,255,.14); color: var(--white); }

.btn-whatsapp { background: var(--green); color: var(--white); }
.btn-whatsapp:hover { background: var(--green-dk); color: var(--white); }

.btn-call { background: var(--green); color: var(--white); margin-left: .8rem; }
.btn-call:hover { background: var(--green-dk); color: var(--white); }

.btn-block { display: block; width: 100%; }

/* --------------------------------------------------------------- Icons --- */
/* Hamburger: three royal-blue bars */
.icon-menu { display: inline-block; width: 26px; }
.icon-menu span {
    display: block; height: 3px; width: 100%;
    background: var(--white); border-radius: 2px; margin: 5px 0;
}
/* Close: two bars crossed */
.icon-close { display: inline-block; width: 24px; height: 24px; position: relative; }
.icon-close span {
    position: absolute; top: 50%; left: 0;
    width: 100%; height: 3px; background: var(--white);
    border-radius: 2px; transform: rotate(45deg);
}
.icon-close span:last-child { transform: rotate(-45deg); }

/* ----------------------------------------------------------------- Nav --- */

.site-header {
    position: sticky; top: 0; z-index: 60;
    background: #0A1932;
    transition: background .3s ease;
}
/* Home + photo-nav pages: navbar floats transparently OVER the single
   hero/master photo, turning solid dark once the page is scrolled */
.home .site-header,
.photo-nav .site-header {
    position: fixed; left: 0; right: 0;
    background: transparent;
}
.home .site-header.scrolled,
.photo-nav .site-header.scrolled {
    background: rgba(5, 15, 35, .92);
}
.nav-wrap {
    display: flex; align-items: center; justify-content: space-between;
    padding: .7rem 0; gap: 1rem; position: relative;
}

.brand { display: flex; align-items: center; }
.brand-logo {
    height: 58px; width: auto; display: block;
    transition: transform .2s ease;
}
.brand:hover .brand-logo { transform: scale(1.03); }
@media (max-width: 400px) { .brand-logo { height: 46px; } }

.main-nav { display: flex; align-items: center; }
.nav-list { display: flex; align-items: center; gap: .35rem; }

.nav-link {
    display: block; padding: .5rem .9rem; border-radius: 8px;
    color: var(--white); font-weight: 700;
}
.nav-link:hover { background: rgba(255, 255, 255, .16); color: var(--white); }
.nav-link.active { background: var(--royal); color: var(--white); }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: .5rem; }
.nav-close  { display: none; background: var(--cyan); border: none; border-radius: 50%;
              width: 44px; height: 44px; cursor: pointer; align-self: flex-end; }

/* --------------------------------------------------------------- Mobile --- */

/* Drawer backdrop (shared with admin).
   NOTE: no z-index — it is appended as the LAST element of <body>, so it
   naturally paints above the page content; the drawers carry z-index: 1
   explicitly, which always keeps them (and their taps) above this layer.
   Longhand top/right/bottom/left — older mobile WebViews lack `inset`. */
.nav-overlay {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(15, 23, 42, .45);
}

@media (max-width: 920px) {
    /* Stronger scrim on small screens: text spans the full photo width */
    .home .hero,
    .page-band {
        background-image:
            linear-gradient(180deg, rgba(0,0,0,.76) 0%, rgba(0,0,0,.55) 42%, rgba(0,0,0,.72) 100%),
            linear-gradient(90deg, rgba(0,0,0,.52), rgba(0,0,0,.38)),
            url('../img/store-bg.jpg');
        background-position: center 55%;
        background-size: cover;
        background-repeat: no-repeat;
    }

    /* ---- Compact topbar ---- */
    .nav-wrap { padding: .55rem 0; }
    .brand-logo { height: 46px; }

    /* Hamburger — generous 46px tap target */
    .nav-toggle {
        display: inline-flex; flex-direction: column;
        align-items: center; justify-content: center;
        width: 46px; height: 46px; border-radius: 10px;
        background: rgba(255, 255, 255, .1);
        text-decoration: none;
    }
    .nav-toggle:hover { background: rgba(255, 255, 255, .2); }
    .icon-menu { width: 20px; }
    .icon-menu span { background: var(--white); height: 2px; margin: 4px 0; }

    /* ---- Drawer: fades in, always in its final position (no tap-miss) ---- */
    .main-nav {
        position: fixed; top: 0; right: 0; bottom: 0; left: auto;
        width: min(320px, 85vw);
        height: 100vh;
        height: 100dvh;
        background: linear-gradient(180deg, #0B1B38 0%, #07122B 100%);
        flex-direction: column; align-items: stretch;
        padding: .9rem 1.1rem 1.4rem;
        z-index: 1; overflow-y: auto;   /* explicit: always above the backdrop */
        opacity: 0; pointer-events: none;
        transform: translateX(20px);
        transition: opacity .18s ease, transform .18s ease;
    }
    .main-nav.open {
        opacity: 1; pointer-events: auto;
        transform: none;
    }

    .nav-close {
        display: inline-flex; align-items: center; justify-content: center;
        width: 42px; height: 42px; border-radius: 50%;
        background: rgba(255, 255, 255, .1);
        text-decoration: none; align-self: flex-end; margin-bottom: .8rem;
    }
    .nav-close:hover { background: rgba(255, 255, 255, .2); }
    .icon-close { width: 18px; height: 18px; }
    .icon-close span { height: 2px; }

    /* Menu list: clean, separated rows, no pills in the drawer */
    .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
    .nav-list li { border-bottom: 1px solid rgba(255, 255, 255, .1); }
    .nav-list li:first-child { border-top: 1px solid rgba(255, 255, 255, .1); }
    .nav-link {
        color: var(--white); padding: 1rem .4rem;
        border-radius: 0; font-size: 1.05rem;
    }
    .nav-link:hover, .nav-link.active {
        background: none; color: #7DE3F4;
    }

    /* Call/WhatsApp pinned at the drawer bottom for thumb reach */
    .btn-call {
        margin: auto 0 0;
        width: 100%;
        text-align: center;
    }

    /* Pure-CSS fallback: even if JavaScript is unavailable, tapping the
       hamburger anchor (#siteNav) shows the drawer via :target */
    #siteNav:target {
        opacity: 1; pointer-events: auto;
        transform: none;
    }
}

/* ---------------------------------------------------------------- Hero --- */

.hero {
    background: var(--royal-dk);
    color: var(--white);
    padding: 7.2rem 0 5.6rem;
    text-align: left;
}
/* Home: the ONE background image lives here — the navbar simply
   sits on top of it, so navbar and hero share a single seamless photo.
   Scrim: darker where the text sits (left) and at the top/bottom edges,
   lighter in the middle so the products read through. */
.home .hero {
    padding: 10.4rem 0 5.6rem;
    background:
        linear-gradient(180deg, rgba(0,0,0,.74) 0%, rgba(0,0,0,.42) 42%, rgba(0,0,0,.68) 100%),
        linear-gradient(90deg, rgba(0,0,0,.58) 0%, rgba(0,0,0,.12) 62%, rgba(0,0,0,.22) 100%),
        url('../img/store-bg.jpg') center 55% / cover no-repeat var(--royal-dk);
}
.hero-inner { max-width: 780px; }
.hero h1 {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    line-height: 1.15; margin-bottom: 1.2rem;
    text-shadow: 0 2px 16px rgba(0, 0, 0, .55);
}
.hero p { text-shadow: 0 2px 10px rgba(0, 0, 0, .55); }
.hero h1 .accent { color: #7DE3F4; }
.hero p {
    font-size: clamp(1.02rem, 2vw, 1.18rem);
    opacity: .96; margin-bottom: 2rem; max-width: 640px;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: flex-start; }

/* ------------------------------------------------------------- Section --- */

.section { padding: 4.2rem 0; }
.section.alt { background: var(--pale); }

.section-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1.5rem; margin-bottom: 2.2rem; flex-wrap: wrap;
}
.section-head h2, .portlet h2 {
    font-size: clamp(1.5rem, 3vw, 2rem); color: var(--ink);
}
.section-head h2 .underline {
    display: block; width: 64px; height: 4px; border-radius: 2px;
    background: linear-gradient(90deg, var(--royal), var(--cyan)); margin-top: .45rem;
}
.section-head p { color: var(--muted); max-width: 520px; }

/* ------------------------------------------------------------ Categories --- */

.cat-grid {
    display: grid; gap: 1.2rem;
    grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 760px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }

.cat-tile {
    background: var(--white);
    border: 1px solid #DBEAFE;
    border-radius: var(--radius);
    padding: 1.6rem 1.4rem;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    display: block; color: var(--ink);
}
.cat-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--cyan); color: var(--ink); }
.cat-tile h3 { color: var(--royal); font-size: 1.08rem; margin-bottom: .35rem; }
.cat-tile p { font-size: .88rem; color: var(--muted); }

/* -------------------------------------------------------------- Search --- */

.search-bar {
    display: flex; gap: .6rem; flex-wrap: wrap;
    background: var(--white); border: 1px solid #DBEAFE;
    padding: .8rem; border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.search-bar input[type="search"] {
    flex: 1 1 240px; padding: .75rem 1.1rem;
    font-family: inherit; font-size: 1rem;
    border: 1px solid #CBD5E1; border-radius: 8px; outline: none;
}
.search-bar input[type="search"]:focus { border-color: var(--royal); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }

/* -------------------------------------------------------------- Products --- */

.product-grid {
    display: grid; grid-template-columns: 1fr; gap: 1.3rem;
}
@media (min-width: 640px)  { .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

.product-card {
    background: var(--white);
    border: 1px solid #E2E8F0;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.product-media { display: block; background: var(--pale); aspect-ratio: 4 / 3; overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.product-card:hover .product-media img { transform: scale(1.05); }

.product-body { padding: 1.05rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.product-cat {
    font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--cyan-dk);
}
.product-name { font-size: 1.05rem; line-height: 1.35; }
.product-name a { color: var(--ink); }
.product-name a:hover { color: var(--royal); }
.product-price { font-size: 1.18rem; font-weight: 700; color: var(--royal); }
.product-body .btn { margin-top: auto; white-space: nowrap; }

/* Keep the WhatsApp button label on one line — shrink, never wrap */
@media (max-width: 640px) {
    .product-body .btn { font-size: .8rem; padding: .45rem .6rem; letter-spacing: -.01em; }
}
@media (min-width: 641px) and (max-width: 1023px) {
    .product-body .btn { font-size: .88rem; padding: .5rem .9rem; }
}

/* ----------------------------------------------------------- Pagination --- */

.pagination { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; margin-top: 2.4rem; }
.view-all { display: flex; justify-content: center; }
.view-all-btn { width: 100%; max-width: 460px; text-align: center; }
.page-link {
    min-width: 40px; padding: .45rem .8rem; text-align: center;
    border: 1px solid #DBEAFE; border-radius: 8px;
    font-weight: 700; color: var(--royal); background: var(--white);
}
.page-link:hover { background: var(--pale); }
.page-link.active { background: var(--royal); color: var(--white); border-color: var(--royal); }
.page-link.disabled { color: #94A3B8; pointer-events: none; background: var(--pale); }

/* ------------------------------------------------------------ Empty/Note --- */

.empty-note {
    background: var(--pale); border: 1px dashed #93B4F5;
    border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted);
}

/* ---------------------------------------------------------- Product page --- */

.product-detail { display: grid; gap: 2.2rem; }
@media (min-width: 900px) { .product-detail { grid-template-columns: 1.05fr 1fr; align-items: start; } }

.product-detail-media {
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid #DBEAFE; background: var(--pale); box-shadow: var(--shadow);
}
.product-detail-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.product-detail-info h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: .35rem 0 .6rem; }
.product-detail-info .product-price { font-size: 1.65rem; display: block; margin-bottom: 1.1rem; }
.product-detail-info .desc { color: var(--muted); margin-bottom: 1.6rem; white-space: pre-line; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: .8rem; }
.detail-actions { display: flex; gap: .8rem; flex-wrap: wrap; }

/* ------------------------------------------------------- About / Manager --- */

/* About banner: same ONE photo, professionally balanced scrim —
   same treatment as the home hero */
.page-band {
    background:
        linear-gradient(180deg, rgba(0,0,0,.74) 0%, rgba(0,0,0,.42) 42%, rgba(0,0,0,.68) 100%),
        linear-gradient(90deg, rgba(0,0,0,.58) 0%, rgba(0,0,0,.12) 62%, rgba(0,0,0,.22) 100%),
        url('../img/store-bg.jpg') center 55% / cover no-repeat var(--royal-dk);
    color: var(--white);
    padding: 3.8rem 0;
    text-align: left;
    text-shadow: 0 2px 12px rgba(0,0,0,.35);
}
/* Photo-nav pages: the photo extends BEHIND the transparent navbar —
   the navbar clears its own height via the band's top padding */
.photo-nav .page-band { padding-top: 9.2rem; }
.page-band h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .5rem; }
.page-band p { opacity: .92; font-size: 1.05rem; }
.page-band { text-shadow: 0 2px 12px rgba(0,0,0,.35); }

.about-columns { display: grid; gap: 2rem; }
.about-columns p { color: var(--muted); margin-bottom: 1rem; }
.mini-title { color: var(--royal); font-size: 1.1rem; margin-bottom: .7rem; }
.tick-list { margin-bottom: 1.6rem; }
.tick-list li { position: relative; padding: .45rem 0 .45rem 1.5rem; color: var(--ink); }
.tick-list li::before {
    content: ''; position: absolute; left: 0; top: .95rem;
    width: .55rem; height: .55rem; border-radius: 50%;
    background: var(--cyan);
}

.manager-note { display: grid; gap: 2rem; }
@media (min-width: 860px) { .manager-note { grid-template-columns: .75fr 1.25fr; align-items: start; } }

.manager-photo {
    background: linear-gradient(160deg, #EFF6FF 0%, #DBEAFE 100%);
    border: 1px solid #DBEAFE;
    border-radius: var(--radius);
    padding: 1.8rem 1.4rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.manager-photo img { width: 100%; max-width: 300px; margin-inline: auto; display: block; }
.manager-photo .m-name { display: block; font-weight: 700; color: var(--royal); font-size: 1.08rem; margin-top: 1rem; }
.manager-photo .m-role { display: block; font-size: .86rem; color: var(--muted); margin-top: .15rem; }

.manager-quote blockquote {
    background: var(--white);
    border-left: 5px solid var(--cyan);
    border-radius: var(--radius);
    padding: 1.6rem 1.8rem;
    box-shadow: var(--shadow-sm);
}
.manager-quote blockquote p { color: var(--ink); margin-bottom: 1rem; }
.manager-quote blockquote p:last-child { margin-bottom: 0; }
.manager-quote figcaption {
    margin-top: 1.2rem; color: var(--muted);
    padding-left: 1.8rem;
}
.manager-quote figcaption strong { color: var(--royal); }

.band-cta h2 { margin-bottom: .4rem; }
.band-cta p { color: var(--muted); }

/* --------------------------------------------------------------- Flash --- */

.flash {
    max-width: 1180px; margin: 1rem auto 0; padding: .8rem 1.2rem;
    border-radius: 10px; font-weight: 700;
}
.flash.success { background: #ECFDF5; color: #166534; border: 1px solid #A7F3D0; }
.flash.error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* --------------------------------------------------------------- Footer --- */

.site-footer {
    position: relative;
    margin-top: 4rem;
    color: var(--white);
    background:
        radial-gradient(900px 320px at 88% -12%, rgba(6, 182, 212, .14), transparent 60%),
        linear-gradient(180deg, #0B1B38 0%, #07122B 100%);
}
.site-footer::before {
    content: ''; display: block; height: 4px;
    background: linear-gradient(90deg, var(--royal) 0%, var(--cyan) 60%, #7DE3F4 100%);
}
.footer-grid {
    display: grid; gap: 2.6rem; padding: 3.6rem 0 2.8rem;
    grid-template-columns: 1fr;
}
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.35fr 1fr 1.25fr; } }

.footer-logo { height: 84px; width: auto; display: block; margin: 0 0 1rem; max-width: 100%; }
.footer-about { opacity: .88; font-size: .94rem; max-width: 42ch; }
.footer-about strong { color: #7DE3F4; }

.footer-col h4 {
    font-size: .8rem; letter-spacing: .18em; text-transform: uppercase;
    margin-bottom: .4rem; color: #7DE3F4;
}

.footer-links li { border-bottom: 1px solid rgba(255, 255, 255, .09); }
.footer-links li:last-child { border-bottom: 0; }
.footer-links a {
    display: block; padding: .6rem 0;
    color: rgba(255, 255, 255, .88);
    transition: color .2s ease, padding-left .2s ease;
}
.footer-links a:hover { color: #7DE3F4; padding-left: .4rem; }

.footer-contact li { padding: .6rem 0; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.footer-contact li:last-child { border-bottom: 0; }
.c-label {
    display: block; font-size: .7rem; letter-spacing: .16em;
    text-transform: uppercase; color: rgba(125, 227, 244, .78);
    margin-bottom: .2rem;
}
.footer-contact a {
    color: var(--white); font-size: 1.04rem;
    transition: color .2s ease;
}
.footer-contact a:hover { color: #7DE3F4; }
.c-value { color: rgba(255, 255, 255, .92); }

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .12);
    background: rgba(0, 0, 0, .22);
    padding: 1.15rem 0;
}
.footer-bottom p { opacity: .78; font-size: .85rem; text-align: center; }
