/*
Theme Name: MurO
Theme URI: https://example.com/muro
Author: ai.gnrtd.m
Author URI: https://example.com
Description: Thème WordPress pour galeries d'art. Mur d'œuvres en disposition justifiée (Justified Layout), proportions réelles conservées, marqueur "collection privée", tiroir de navigation permanent.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: muro
*/

:root{
    --bg:#FAFAFA;
    --text:#111111;
    --muted:#666666;
    --accent:#FF4C00;
    --border:#E6E6E6;
    --wall-width:94%;
    --gap-horizontal:32px;
    --gap-vertical:32px;
    --radius:0px;
    --transition:.25s ease;

    /* General typography -- overridden inline from the Customizer
       (see inc/customizer.php + functions.php:muro_output_typography_vars). */
    --font-family:"Inter",sans-serif;
    --heading-weight:300;
    --body-weight:400;
    --heading-size:2rem;

    /* Site title -- independent from the general heading style so it
       can carry its own identity (e.g. a decorative serif) without
       forcing that choice onto every other heading in the theme. */
    --title-font-family:var(--font-family);
    --title-weight:300;
    --title-size:2rem;
    --title-color:var(--text);
    --title-align:center;

    /* Footer */
    --footer-font-family:var(--font-family);
    --footer-weight:400;
    --footer-color:var(--text);
    --footer-align:center;
    --slogan-font-family:var(--font-family);
    --slogan-weight:400;
    --slogan-size:14px;
    --slogan-color:#666666;
    --social-icon-size:20px;
    --social-icon-color:#666666;

    /* Logo */
    --logo-size:60px;

    /* Title shelf line -- same mechanic as the wall's shelf line
       (see below), anchored under the header instead. */
    --title-shelf-gap:18px;
    --title-shelf-size:1px;
    --title-shelf-color:#E6E6E6;
    --title-shelf-opacity:1;
    --title-shelf-shadow-size:0px;
    --title-shelf-shadow-position:4px;
    --title-shelf-shadow-color:rgba(0,0,0,0);

    /* Nav drawer */
    --nav-font-family:var(--font-family);
    --nav-weight:400;
    --nav-size:1.1rem;
    --nav-color:var(--muted);
    --nav-shadow-size:20px;
    --nav-shadow-color:rgba(0,0,0,.08);

    /* Single œuvre info zone */
    --info-font-family:var(--font-family);
    --info-weight:400;
    --info-size:14px;
    --info-color:#666666;

    /* Wall layout -- read directly by MurEngine (assets/js/app.js) at
       layout time, not consumed by any CSS rule here. --gap is the
       exception: it's also used by the .wall flex gap below. */
    --wall-base-size:160px;
    --wall-proportion:1;

    /* "Shelf" grounding effect under each thumbnail: a discrete line
       at a gap below, plus a soft blurred drop shadow. */
    --shelf-gap:8px;
    --shelf-size:1px;
    --shelf-color:#E6E6E6;
    --shelf-opacity:0.5;
    --shelf-shadow-size:16px;
    --shelf-shadow-position:4px;
    --shelf-shadow-color:rgba(0,0,0,.15);
}

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

html{
    scroll-behavior:smooth;
}

body{
    background:var(--bg);
    color:var(--text);
    font-family:var(--font-family);
    font-weight:var(--body-weight);
    font-size:16px;
    line-height:1.5;
}

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

a{
    color:inherit;
}

/* ---------------- HEADER ---------------- */

.site-header{
    position:relative;
    width:var(--wall-width);
    margin:50px auto;
}

/* Line under the title -- same mechanic as the wall's shelf line
   (full page width via the left:50%/100vw breakout, soft box-shadow
   for the gradient falloff), just anchored under the header instead
   of under a row of thumbnails. This replaces the previous plain
   1px border-bottom entirely. No JS needed here (unlike the wall
   version): the header's height doesn't depend on dynamic content,
   so there's no "row" to detect -- a single ::after is enough. */
.site-header::after{
    content:"";
    position:absolute;
    left:50%;
    width:100vw;
    transform:translateX(-50%);
    top:calc(100% + var(--title-shelf-gap));
    height:var(--title-shelf-size);
    background:var(--title-shelf-color);
    opacity:var(--title-shelf-opacity);
    box-shadow:0 var(--title-shelf-shadow-position) var(--title-shelf-shadow-size) 0 var(--title-shelf-shadow-color);
    pointer-events:none;
}

.site-branding{
    width:100%;
    text-align:var(--title-align);
}

.site-title{
    display:inline-block;
    font-family:var(--title-font-family);
    font-size:var(--title-size, 2rem);
    font-weight:var(--title-weight);
    letter-spacing:.08em;
    text-decoration:none;
    color:var(--title-color);
}

/* ---------------- LOGO ---------------- */
/* Position (above / beside / replace the title text) is a body class
   set from the Customizer; default is "above". Using text-align on
   .site-branding (rather than flex alignment) to place both the logo
   and the title, since text-align accepts left/center/right directly
   -- flex's align-items does not, only justify-content does, and this
   needs to work identically whether the logo is stacked (block) or
   inline with the title. */

.site-logo{
    display:block;
    margin-bottom:12px;
}

.site-logo img{
    display:inline-block;
    max-height:var(--logo-size, 60px);
    width:auto;
    vertical-align:middle;
}

body.logo-beside .site-logo{
    display:inline-block;
    margin-bottom:0;
    margin-right:14px;
}

body.logo-beside .site-title{
    vertical-align:middle;
}

body.logo-replace .site-logo{
    display:block;
    margin-bottom:0;
}

body.logo-replace .site-title{
    /* Standard visually-hidden pattern: the logo takes the visual
       place of the title, but the site name stays in the DOM for
       screen readers and search engines. */
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0,0,0,0);
    white-space:nowrap;
    border:0;
}

/* ---------------- HAMBURGER ---------------- */
/* 18px, thin. Positioned absolutely so .site-title can span the
   header's full width and actually center on the page, independent
   of where the hamburger sits. Position (left/center/right) is a
   body class set from the Customizer -- default matches the
   original fixed top-right placement. */

.hamburger{
    width:18px;
    height:13px;
    position:absolute;
    top:4px;
    right:0;
    background:none;
    border:none;
    cursor:pointer;
    padding:0;
    z-index:110;
}

body.hamburger-left .hamburger{
    left:0;
    right:auto;
}

body.hamburger-center .hamburger{
    left:50%;
    right:auto;
    transform:translateX(-50%);
}

.hamburger span{
    position:absolute;
    left:0;
    width:100%;
    height:1px;
    background:var(--text);
    transition:var(--transition);
}

.hamburger span:nth-child(1){ top:0; }
.hamburger span:nth-child(2){ top:6px; }
.hamburger span:nth-child(3){ top:12px; }

.hamburger.open span:nth-child(1){
    top:6px;
    transform:rotate(45deg);
}

.hamburger.open span:nth-child(2){
    opacity:0;
}

.hamburger.open span:nth-child(3){
    top:6px;
    transform:rotate(-135deg);
}

/* ---------------- NAV DRAWER ---------------- */
/* Permanent drawer, no dark overlay -- sits on the same --bg as the
   page. Reveal method (slide from left/right, or fade) is a body
   class set from the Customizer; the rules below are the "left"
   default, the two variants follow. */

.site-nav{
    position:fixed;
    top:0;
    left:0;
    height:100vh;
    width:min(320px,80vw);
    background:var(--bg);
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:26px;
    padding:0 50px;
    transform:translateX(-100%);
    transition:transform .35s ease;
    border-right:1px solid var(--border);
    /* Ambient (non-directional) shadow rather than one offset toward
       a specific side -- looks correct regardless of which edge the
       drawer opens from, without needing per-reveal-method shadow
       geometry. */
    box-shadow:0 0 var(--nav-shadow-size) 0 var(--nav-shadow-color);
    z-index:100;
}

.site-nav.open{
    transform:translateX(0);
}

body.nav-reveal-right .site-nav{
    left:auto;
    right:0;
    border-right:none;
    border-left:1px solid var(--border);
    transform:translateX(100%);
}

body.nav-reveal-right .site-nav.open{
    transform:translateX(0);
}

body.nav-reveal-fade .site-nav{
    left:0;
    transform:none;
    opacity:0;
    visibility:hidden;
    transition:opacity .35s ease, visibility 0s linear .35s;
}

body.nav-reveal-fade .site-nav.open{
    opacity:1;
    visibility:visible;
    transition:opacity .35s ease;
}

.site-nav ul{
    list-style:none;
    display:flex;
    flex-direction:column;
    gap:26px;
}

.site-nav a{
    color:var(--nav-color);
    font-family:var(--nav-font-family);
    font-weight:var(--nav-weight);
    font-size:var(--nav-size);
    text-decoration:none;
    transition:var(--transition);
    position:relative;
}

.site-nav a:hover,
.site-nav .current-menu-item a,
.site-nav a.active{
    color:var(--text);
}

.site-nav .current-menu-item a::after,
.site-nav a.active::after{
    content:"";
    position:absolute;
    left:0;
    bottom:-8px;
    width:100%;
    height:2px;
    background:var(--accent);
}

/* ---------------- WALL ---------------- */

.wall{
    position:relative;
    width:var(--wall-width);
    margin:auto;
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    align-items:flex-end;
    column-gap:var(--gap-horizontal);
    row-gap:var(--gap-vertical);
    transition:opacity .2s ease;
}

.wall.wall-loading{
    opacity:.4;
    pointer-events:none;
}

/* ---------------- OEUVRES ---------------- */

.artwork{
    position:relative;
    cursor:pointer;
    background:#fff;
    flex:none;
    /* Reserves the card's TRUE shape (--art-ratio, set inline per card
       from the declared real-world width/height) from first paint --
       before MurEngine's JS runs, or if it fails to run at all. Once
       JS does run, its inline width/height win regardless (inline
       style always beats a stylesheet rule on the same property), so
       this only matters for that initial window, but it means the
       wall is never, even briefly, showing a box shaped by the raw
       photo instead of the artwork's real proportions. */
    height:220px;
    aspect-ratio:var(--art-ratio, 4/3);
    opacity:0;
    transform:translateY(20px);
    transition:
        opacity .45s ease,
        transform .45s ease;
    /* The "grounding" drop shadow -- a plain box-shadow's blur is
       already a soft gradient falloff, so no gradient background is
       needed. --shelf-shadow-color has the transparency setting baked
       into its alpha by inc/typography.php (and mirrored in
       customizer-preview.js for live preview). Deliberately NOT
       clipped by overflow, unlike the image -- see .artwork-link. */
    box-shadow:0 var(--shelf-shadow-position) var(--shelf-shadow-size) 0 var(--shelf-shadow-color);
}

.artwork.visible{
    opacity:1;
    transform:translateY(0);
}

.artwork img{
    width:100%;
    height:100%;
    object-fit:cover;
    transition:.35s;
}

.artwork:hover img{
    transform:scale(1.02);
}

.artwork-link{
    display:block;
    width:100%;
    height:100%;
    overflow:hidden;
}

/* Triangle Collection privée */

.artwork.sold::after{
    content:"";
    position:absolute;
    right:0;
    bottom:0;
    width:0;
    height:0;
    border-left:10px solid transparent;
    border-top:10px solid transparent;
    border-right:10px solid var(--accent);
    border-bottom:10px solid var(--accent);
}

/* The grounding shelf line -- a single continuous element per row,
   spanning the FULL PAGE WIDTH like a physical shelf (not just the
   wall's own 94%-width column). Appended as a child of .wall by
   MurEngine (assets/js/app.js:updateShelfLines) and positioned with
   `top` relative to .wall (via offsetTop -- ordinary document-flow
   measurement, no scroll math involved), so it naturally scrolls with
   the page exactly like everything else on it.

   The full-page WIDTH comes from a standard CSS "breakout" technique
   (left:50% + translateX(-50%) + width:100vw) rather than computing
   or tracking scroll position in JS at all -- deliberately, after an
   earlier version that positioned these via
   getBoundingClientRect()+window.scrollY worked on desktop but not on
   mobile: address-bar show/hide and momentum-scroll bounce make
   scrollY an unreliable value to bake into a one-time calculation on
   mobile browsers, particularly right after an orientation change.
   This version has no such dependency, so there's nothing for those
   mobile-specific behaviors to desynchronize. */
.wall-shelf-line{
    position:absolute;
    left:50%;
    width:100vw;
    transform:translateX(-50%);
    height:var(--shelf-size);
    background:var(--shelf-color);
    opacity:0;
    transition:opacity .45s ease;
    pointer-events:none;
}

.wall-shelf-line.visible{
    opacity:var(--shelf-opacity);
}

/* ---------------- SINGLE OEUVRE ---------------- */

.oeuvre-single{
    width:var(--wall-width);
    margin:60px auto;
    display:grid;
    grid-template-columns:1.4fr 1fr;
    gap:60px;
}

.oeuvre-single img{
    width:100%;
    height:auto;
}

.oeuvre-single h1{
    font-size:var(--heading-size);
    font-weight:var(--heading-weight);
    margin-bottom:20px;
}

.oeuvre-meta{
    color:var(--muted);
    display:flex;
    flex-direction:column;
    gap:8px;
    margin-bottom:24px;
}

.oeuvre-meta .sold-flag{
    color:var(--accent);
    font-weight:500;
}

.oeuvre-info-note{
    font-family:var(--info-font-family);
    font-weight:var(--info-weight);
    font-size:var(--info-size);
    color:var(--info-color);
    line-height:1.6;
    padding:16px;
    border:1px solid var(--border);
    margin-bottom:24px;
}

.back-link{
    display:inline-block;
    margin-top:20px;
    color:var(--muted);
    text-decoration:none;
    border-bottom:1px solid var(--border);
}

.back-link:hover{
    color:var(--text);
    border-color:var(--text);
}

/* ---------------- SHARE LINKS ---------------- */

.share-links{
    display:flex;
    align-items:center;
    gap:16px;
    margin-top:24px;
    flex-wrap:wrap;
}

.share-label{
    color:var(--muted);
    font-size:.85rem;
}

.share-link{
    background:none;
    border:none;
    padding:0;
    font:inherit;
    color:var(--muted);
    text-decoration:none;
    cursor:pointer;
    border-bottom:1px solid transparent;
    transition:var(--transition);
}

.share-link:hover{
    color:var(--text);
    border-color:var(--text);
}

/* ---------------- OEUVRE PREV/NEXT ---------------- */

.oeuvre-nav{
    width:var(--wall-width);
    margin:60px auto 0;
    display:flex;
    justify-content:space-between;
    gap:32px;
    border-top:1px solid var(--border);
    padding-top:24px;
}

.oeuvre-nav-link{
    display:flex;
    align-items:center;
    gap:10px;
    max-width:45%;
    color:var(--muted);
    text-decoration:none;
    transition:var(--transition);
}

.oeuvre-nav-link:hover{
    color:var(--text);
}

.oeuvre-nav-next{
    margin-left:auto;
    text-align:right;
}

.oeuvre-nav-arrow{
    font-size:1.3rem;
    line-height:1;
    flex:none;
}

.oeuvre-nav-title{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* ---------------- SIMILAR WORKS ---------------- */

.similar-works{
    width:var(--wall-width);
    margin:60px auto 0;
}

.similar-works-title{
    font-size:1rem;
    font-weight:var(--heading-weight);
    color:var(--muted);
    margin-bottom:24px;
}

.similar-works-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
    gap:24px;
}

.similar-work{
    display:flex;
    flex-direction:column;
    gap:10px;
    text-decoration:none;
    color:var(--text);
}

.similar-work img{
    width:100%;
    aspect-ratio:4/3;
    object-fit:cover;
    background:#fff;
    transition:.35s;
}

.similar-work:hover img{
    transform:scale(1.02);
}

.similar-work-title{
    font-size:.9rem;
    color:var(--muted);
}

/* ---------------- LIGHTBOX ---------------- */
/* No dark overlay, same as the nav drawer -- consistent with the
   site's white/editorial identity rather than a generic dark scrim. */

.lightbox{
    position:fixed;
    inset:0;
    z-index:200;
    background:var(--bg);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:60px;
    opacity:0;
    pointer-events:none;
    transition:opacity .3s ease;
}

.lightbox.open{
    opacity:1;
    pointer-events:auto;
}

.lightbox-inner{
    width:100%;
    max-width:1100px;
    max-height:100%;
    display:flex;
    flex-direction:column;
    gap:32px;
    overflow:auto;
}

/* "Sous l'image" is the default layout above. "À côté" (side-by-side)
   switches to the same two-column grid used on the single œuvre page. */
body.caption-side .lightbox-inner{
    flex-direction:row;
    align-items:flex-start;
    max-width:1400px;
}

.lightbox-image-wrap{
    flex:1;
    min-width:0;
    display:flex;
    align-items:center;
    justify-content:center;
}

.lightbox-image-wrap img{
    max-width:100%;
    max-height:65vh;
    width:auto;
    height:auto;
    object-fit:contain;
    background:#fff;
}

body.caption-side .lightbox-image-wrap img{
    max-height:80vh;
}

.lightbox-caption{
    flex:none;
    width:100%;
    max-width:500px;
    margin:0 auto;
}

body.caption-side .lightbox-caption{
    flex:0 0 300px;
    max-width:300px;
    margin:0;
    padding-top:10px;
}

.lightbox-title{
    font-size:calc(var(--heading-size) * .75);
    font-weight:var(--heading-weight);
    margin-bottom:16px;
}

.lightbox-close,
.oeuvre-close,
.lightbox-prev,
.lightbox-next{
    position:fixed;
    background:none;
    border:none;
    cursor:pointer;
    color:var(--muted);
    transition:var(--transition);
    z-index:210;
}

.lightbox-close:hover,
.oeuvre-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover{
    color:var(--text);
}

.lightbox-close,
.oeuvre-close{
    top:30px;
    right:30px;
    width:18px;
    height:18px;
    display:block;
    text-decoration:none;
}

.lightbox-close span,
.oeuvre-close span{
    position:absolute;
    top:50%;
    left:0;
    width:100%;
    height:1px;
    background:currentColor;
}

.lightbox-close span:first-child,
.oeuvre-close span:first-child{
    transform:rotate(45deg);
}

.lightbox-close span:last-child,
.oeuvre-close span:last-child{
    transform:rotate(-45deg);
}

.lightbox-prev,
.lightbox-next{
    top:50%;
    transform:translateY(-50%);
    font-size:2rem;
    line-height:1;
    padding:10px;
}

.lightbox-prev{ left:12px; }
.lightbox-next{ right:12px; }

/* ---------------- FOOTER ---------------- */

.site-footer{
    width:var(--wall-width);
    max-width:600px;
    margin:120px auto 60px;
    padding-top:60px;
    display:flex;
    flex-direction:column;
    gap:40px;
    font-family:var(--footer-font-family);
    font-weight:var(--footer-weight);
    color:var(--footer-color);
    text-align:var(--footer-align);
}

.signature h2{
    margin-bottom:10px;
}

.signature p.footer-slogan{
    font-family:var(--slogan-font-family);
    font-weight:var(--slogan-weight);
    font-size:var(--slogan-size);
    color:var(--slogan-color);
    margin-bottom:14px;
}

.signature p{
    color:#999;
    font-size:.85rem;
}

.contact h3{
    margin-bottom:18px;
    font-size:1rem;
    font-weight:500;
}

.contact{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.contact a{
    color:inherit;
    text-decoration:none;
}

.contact a:hover{
    color:var(--accent);
}

.contact a.social-icon-link{
    display:inline-flex;
    align-items:center;
    justify-content:var(--footer-align);
    color:var(--social-icon-color);
}

.contact a.social-icon-link:hover{
    color:var(--accent);
}

.social-icon{
    width:var(--social-icon-size);
    height:var(--social-icon-size);
}

/* ---------------- EMPTY STATE ---------------- */

.wall-empty{
    width:var(--wall-width);
    margin:80px auto;
    color:var(--muted);
    text-align:center;
}

/* ---------------- RESPONSIVE ---------------- */

body.lightbox-open{
    overflow:hidden;
}

@media(max-width:900px){

    .wall{
        justify-content:center;
    }

    .site-footer{
        flex-direction:column;
    }

    .oeuvre-single{
        grid-template-columns:1fr;
    }

    .oeuvre-nav{
        flex-direction:column;
        gap:16px;
    }

    .oeuvre-nav-link,
    .oeuvre-nav-next{
        max-width:100%;
        margin-left:0;
        text-align:left;
    }

    /* Side-by-side caption doesn't work on narrow screens -- fall
       back to stacked regardless of the customizer setting. */
    body.caption-side .lightbox-inner{
        flex-direction:column;
    }

    body.caption-side .lightbox-caption{
        flex:none;
    }

    .lightbox{
        padding:24px;
    }

}

@media(prefers-reduced-motion:reduce){

    .artwork,
    .hamburger span,
    .site-nav,
    .wall,
    .wall-shelf-line,
    .lightbox{
        transition:none;
    }

}
