* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; font-family: Arial, sans-serif; background: #f5f5f5; color: #222; }
.page { max-width: 1400px; margin: 40px auto; padding: 0 25px; }
h1 { margin: 0; font-weight: 400; }
.site-heading { margin-bottom: 25px; }
.site-heading p { margin: 4px 0 0; color: #777; font-size: 14px; }
.webmaster-mode { color: #777; font-size: 13px; letter-spacing: .03em; }

.site-toolbar { position: fixed; top: 18px; right: 22px; z-index: 1500; display: flex; align-items: center; gap: 4px; padding: 5px; background: rgba(255,255,255,.96); border: 1px solid #999; border-radius: 5px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.toolbar-form { display: flex; margin: 0; padding: 0; }
.toolbar-button { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: 0; padding: 7px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #333; font: inherit; font-size: 18px; line-height: 1; text-decoration: none; cursor: pointer; }
.toolbar-button:hover { background: #eee; border-color: #ccc; }

.toolbar-button:disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none;
}
.toolbar-button:disabled:hover {
    background: transparent;
    border-color: transparent;
}
.toolbar-button:focus-visible { outline: 2px solid #777; outline-offset: 1px; }
/* Bascule Public / Webmaster : la session reste ouverte. */
.toolbar-button.view-switch { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.toolbar-button.view-switch.is-webmaster-view { color: #8a5600; background: #fff5df; border-color: #e2c482; }
.toolbar-button.view-switch.is-webmaster-view:hover { color: #684000; background: #ffedc7; border-color: #d3ae5d; }
.toolbar-button.view-switch.is-public-view { color: #0b6c7c; background: #e8f7f8; border-color: #88c9cf; }
.toolbar-button.view-switch.is-public-view:hover { color: #07535f; background: #d7f0f2; border-color: #69b6be; }

.toolbar-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

.language-switch { display: flex; align-items: center; gap: 1px; margin-right: 3px; padding-right: 4px; border-right: 1px solid #d5d5d5; }
.language-button { width: 36px; padding: 5px; filter: grayscale(.65); }
.language-button.active { background: #eee; border-color: #bbb; filter: none; }
.language-button .language-flag { width: 25px; height: 17px; border: 1px solid rgba(0,0,0,.25); border-radius: 1px; stroke: none; }

.instagram-widget { position: fixed; right: 22px; bottom: 18px; z-index: 1400; display: flex; flex-direction: row; align-items: flex-end; gap: 7px; }
.instagram-link { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: #222; background: rgba(255,255,255,.96); border: 1px solid #999; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.instagram-link:hover { background: #eee; }
.instagram-link svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.instagram-qr-button { position: relative; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 4px; color: #222; background: rgba(255,255,255,.96); border: 1px solid #999; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.instagram-qr-button svg { width: 27px; height: 27px; margin-top: -6px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.instagram-qr-button strong { position: absolute; right: 0; bottom: 2px; left: 0; font: 900 9px/1 Arial,sans-serif; letter-spacing: .08em; text-align: center; text-shadow: 0 1px 0 #fff; }
.instagram-qr-overlay { position: fixed; inset: 0; z-index: 5100; display: none; align-items: center; justify-content: center; padding: 30px; background: rgba(0,0,0,.42); cursor: zoom-out; }
.instagram-qr-overlay.visible { display: flex; }
.instagram-qr-frame { padding: 8px; background: #fff; border: 1px solid #555; box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.instagram-qr-frame img { display: block; width: min(70vw,420px); max-height: calc(100vh - 80px); object-fit: contain; }

/* Seule l'image principale conserve un cadre visible dans les galeries. */
.public-caption,
.caption-editor { border-color: transparent !important; background: transparent !important; }

.dialog-overlay { position: fixed; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.35); }
.dialog-overlay.visible { display: flex; }
.dialog-box { width: min(560px,100%); max-height: calc(100vh - 40px); padding: 25px; overflow-y: auto; background: #fff; border-radius: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.dialog-title { margin-bottom: 25px; font-size: 16px; font-weight: 600; line-height: 1.5; }
.dialog-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
button { padding: 9px 16px; border: 1px solid #999; border-radius: 4px; background: #fff; color: #222; font: 14px Arial,sans-serif; cursor: pointer; }
button:hover { background: #eee; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #777; outline-offset: 1px; }
.login-dialog-box { width: min(420px,100%); }
.login-dialog-box form, .standalone-login-form { display: grid; gap: 9px; }
.login-dialog-box label, .standalone-login-form label { margin-top: 5px; color: #444; font-size: 14px; }
.login-dialog-box input, .standalone-login-form input { width: 100%; padding: 10px 11px; border: 1px solid #aaa; border-radius: 4px; background: #fff; color: #222; font: 16px Arial,sans-serif; }
.login-dialog-box .dialog-buttons { margin-top: 16px; }
.login-error { margin: 0 0 16px; padding: 10px 12px; color: #8b1e1e; font-size: 14px; line-height: 1.4; background: #fff0f0; border: 1px solid #d9a0a0; border-radius: 4px; }
.login-page { max-width: 440px; }
.login-page h1 { margin-bottom: 25px; }
.standalone-login-form button { margin-top: 12px; }
.help-dialog-box { width: min(820px,100%); }
.help-content { color: #444; font-size: 14px; line-height: 1.6; }
.help-sections { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.help-section-button { padding: 8px 14px; border: 1px solid #aaa; border-radius: 3px; background: #f5f5f5; cursor: pointer; }
.help-section-button.active { background: #333; border-color: #333; color: #fff; }
.help-section h2 { margin: 0 0 10px; font-size: 1.05rem; }
.help-section + .help-section { margin-top: 12px; }
.help-action { font-weight: 700; }
.help-tree { max-height: 52vh; overflow: auto; padding: 12px; border: 1px solid #ccc; background: #f7f7f7; font: 13px/1.45 Consolas, monospace; white-space: pre; }

.image-zoom-overlay { position: fixed; inset: 0; z-index: 5000; display: none; align-items: center; justify-content: center; padding: 30px; background: rgba(0,0,0,.35); cursor: zoom-out; }
.image-zoom-overlay.visible { display: flex; }
.image-zoom-frame { display: inline-flex; max-width: calc(100vw - 60px); max-height: calc(100vh - 60px); padding: 8px; background: #fff; border: 1px solid #555; box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.image-zoom-image { display: block; width: auto; height: auto; max-width: calc(100vw - 80px); max-height: calc(100vh - 80px); object-fit: contain; user-select: none; -webkit-user-drag: none; cursor: zoom-out; }
body.zoom-open { overflow: hidden; }

@media (max-width: 700px) {
    .site-toolbar { top: 10px; right: 10px; }
    .toolbar-button { width: 34px; height: 34px; }
    .language-button { width: 32px; padding: 3px; }
    .language-button .language-flag { width: 23px; height: 15px; }
    .instagram-widget { right: 10px; bottom: 10px; }
    .instagram-link { width: 40px; height: 40px; }
    .instagram-qr-button { width: 40px; height: 40px; }
    .page { margin-top: 65px; padding: 0 15px; }
    .dialog-overlay { padding: 12px; }
    .dialog-box { max-height: calc(100vh - 24px); padding: 20px; }
    .image-zoom-overlay { padding: 15px; }
    .image-zoom-frame { max-width: calc(100vw - 30px); max-height: calc(100vh - 30px); }
    .image-zoom-image { max-width: calc(100vw - 50px); max-height: calc(100vh - 50px); }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }

/* =========================================================
   NAVIGATION PRINCIPALE DU SITE
   ========================================================= */
.site-primary-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin: -8px 0 30px;
    padding: 0 0 9px;
    border-bottom: 1px solid #d7d7d7;
}

.site-primary-link {
    display: inline-block;
    padding: 5px 0 6px;
    border-bottom: 2px solid transparent;
    color: #666;
    font-size: 15px;
    line-height: 1.2;
    text-decoration: none;
    text-underline-offset: 4px;
}

.site-primary-link:hover {
    color: #222;
}

.site-primary-link.active {
    border-bottom-color: currentColor;
    color: #222;
    font-weight: 600;
}
.site-primary-link.studio-editor-selected {
    outline: 2px solid #777;
    outline-offset: 3px;
    cursor: text;
    user-select: text;
}

.page-placeholder {
    margin: 40px 0 0;
    color: #777;
    font-size: 15px;
}

@media (max-width: 700px) {
    .site-primary-nav {
        gap: 8px 18px;
        margin-top: -2px;
    }

    .site-primary-link {
        font-size: 14px;
    }
}
