/* /volume1/web/StudioMarine/css/home.css */

.home-body {
    --home-top-height: 140px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

.home-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    margin: 0 auto;
    padding: 0 25px 6px;
    overflow: hidden;
}

.home-top-region {
    flex: 0 0 var(--home-top-height);
    width: 100%;
    height: var(--home-top-height);
    overflow: hidden;
}

.home-site-heading {
    display: flex;
    align-items: center;
    height: 94px;
    margin: 0;
}

.home-heading-copy { min-width: 0; }
.home-site-heading h1 { margin: 0; }
.home-subtitle { margin: 5px 0 0; color: #666; font-size: 15px; line-height: 1.25; }
.home-site-heading .webmaster-mode { margin: 5px 0 0; }

.home-logo-slot {
    position: relative;
    flex: 0 0 104px;
    width: 104px;
    height: 84px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-logo-slot[hidden] { display: none; }
.home-logo-image { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.home-logo-editable { border: 1px dashed #aaa; border-radius: 4px; cursor: pointer; background: rgba(255,255,255,.55); }
.home-logo-editable.dragover { outline: 2px solid #666; outline-offset: 2px; }
.home-logo-editable.selected { outline: 2px solid #555; outline-offset: 3px; }
.home-logo-editable.busy { opacity: .65; cursor: wait; }
.home-logo-placeholder { color: #999; font-size: 12px; pointer-events: none; }
.home-logo-slot.has-logo .home-logo-placeholder { display: none; }
.home-logo-remove { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; padding: 0; border-radius: 50%; line-height: 20px; background: #fff; font-size: 16px; }

.home-top-region .site-primary-nav {
    height: 56px;
    margin: 0;
    padding: 8px 0 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}
.home-top-region .site-primary-link { flex: 0 0 auto; }

/* Zone commune : barre d'édition + composition = largeur de l'en-tête. */
.home-workspace {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow: visible;
}

.home-canvas-stage {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    align-items: flex-start;
    justify-content: center;
}

.home-workspace-webmaster .home-canvas-stage {
    padding-left: 0;
}

/* Barre d'édition verticale, visuellement flottante, style palette. */
.home-editor-toolbar {
    position: absolute;
    z-index: 1450;
    left: 0;
    top: 6px;
    display: grid;
    grid-template-columns: repeat(2, 34px);
    align-content: start;
    justify-content: center;
    gap: 2px;
    width: 82px;
    max-height: calc(100% - 12px);
    padding: 5px 4px;
    overflow: visible;
    background: rgba(255,255,255,.98);
    border: 1px solid #a9a9a9;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0,0,0,.24);
    color: #1f1f1f;
}

.home-editor-toolbar.is-dragging { cursor: grabbing; }
.home-body.home-background-moving,
.home-body.home-background-moving * { cursor: move !important; }
.home-editor-button.active,
.home-editor-button.is-active { background: #dedede; border-color: #888; }
.home-editor-grip,
.home-editor-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 5px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: #222;
    font: 13px Arial,sans-serif;
    line-height: 1;
    cursor: pointer;
}
.home-editor-grip { grid-column: 1 / -1; width: 100%; height: 24px; cursor: grab; opacity: .72; }
.home-editor-grip:active { cursor: grabbing; }
.home-editor-grip svg,
.home-editor-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.home-editor-grip svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.home-editor-button:hover,
.home-editor-grip:hover { background: #eeeeee; border-color: #b8b8b8; }
.home-editor-button:disabled { opacity: .34; cursor: default; pointer-events: none; }
.home-editor-divider { grid-column: 1 / -1; width: 100%; height: 1px; margin: 2px 0; background: #d0d0d0; }
.home-editor-category { grid-column: 1 / -1; width: 100%; margin: 0; color: #555; font: 700 8px/1.15 Arial,sans-serif; letter-spacing: .035em; text-align: center; white-space: nowrap; }
.home-editor-text-icon { font-weight: 600; font-size: 13px; letter-spacing: -.04em; }
.home-editor-vertical-icon { flex-direction: column; gap: 0; font: 700 9px/.78 Arial,sans-serif; }
.home-editor-color-icon { position: relative; flex-direction: column; gap: 1px; font-weight: 700; font-size: 15px; }
.home-editor-color-swatch { display: block; width: 20px; height: 3px; background: #333; border: 1px solid #8d8d8d; }
.home-editor-tool { position: relative; width: 34px; }

[data-home-split-line="true"] { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; column-gap: 1em; box-sizing: border-box; width: 100%; max-width: 100%; overflow: hidden; }
[data-home-split-side="left"] { min-width: 0; overflow-wrap: anywhere; text-align: left; }
[data-home-split-side="right"] { min-width: 2ch; max-width: 50%; overflow: hidden; overflow-wrap: anywhere; white-space: nowrap; text-align: right; }

.home-editor-flyout {
    position: absolute;
    z-index: 1480;
    left: calc(100% + 8px);
    top: 0;
    width: 180px;
    padding: 10px;
    color: #222;
    background: rgba(255,255,255,.98);
    border: 1px solid #8c8c8c;
    border-radius: 4px;
    box-shadow: 0 5px 18px rgba(0,0,0,.22);
}
.home-editor-flyout[hidden] { display: none; }
.home-editor-flyout-small { width: 112px; }
.home-editor-flyout label { display: block; margin: 0 0 6px; color: #555; font-size: 11px; }
.home-editor-flyout select,
.home-editor-flyout input[type="number"] { width: 100%; height: 31px; padding: 3px 6px; border: 1px solid #aaa; border-radius: 3px; background: #fff; color: #222; font: 12px Arial,sans-serif; }
.home-editor-flyout input[type="color"] { width: 100%; height: 34px; padding: 2px; border: 1px solid #aaa; border-radius: 3px; background: #fff; }

.home-canvas {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    height: 100%;
    max-height: none;
    aspect-ratio: auto;
    overflow: hidden;
    background: transparent;
}
.home-webmaster .home-canvas {
    width: 100%;
    max-height: none;
}
.home-canvas-editable { background-color: rgba(255,255,255,.58); border: 1px solid #c6c6c6; }
.home-body.home-has-background .home-canvas-editable { background-color: rgba(255,255,255,.30); }
.home-canvas-editable.dragover { outline: 3px solid #777; outline-offset: -3px; }
.home-canvas-empty[hidden] { display: none; }
.home-canvas-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #888; font-size: 15px; pointer-events: none; }

.home-item {
    position: absolute;
    left: 0;
    top: 0;
    width: 20%;
    transform-origin: center center;
    user-select: none;
    touch-action: none;
}

.home-item-image {
    height: auto;
}

.home-item-image .home-item-content {
    width: 100%;
}

.home-item-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.home-item-caption {
    width: 100%;
    min-height: 1.25em;
    margin-top: 7px;
    color: #444;
    line-height: 1.35;
    text-align: center;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.home-item-caption:empty {
    display: none;
}

.home-canvas-editable .home-item-caption:empty {
    display: block;
    min-height: 1.45em;
}

.home-canvas-editable .home-item.selected .home-item-caption:empty {
    border: 1px dashed #c5c5c5;
}

.home-item-text {
    min-width: 70px;
    min-height: 36px;
}

.home-text-content {
    width: 100%;
    height: 100%;
    padding: 4px 5px;
    overflow: hidden;
    color: #333;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.home-canvas-editable .home-item {
    cursor: move;
}

.home-canvas-editable .home-item.selected {
    outline: 2px solid #555;
    outline-offset: 3px;
}

.home-canvas-editable .home-item.editing {
    cursor: text;
}

.home-canvas-editable .home-item.editing .home-text-content,
.home-canvas-editable .home-item.editing .home-item-caption {
    user-select: text;
    cursor: text;
}

.home-text-content[contenteditable="true"],
.home-item-caption[contenteditable="true"] {
    outline: 1px dashed #777;
    outline-offset: 2px;
    background: rgba(255,255,255,.82);
}

.home-text-content span,
.home-item-caption span {
    line-height: inherit;
}

/* =========================================================
   POIGNÉES DE TRANSFORMATION
   ========================================================= */
.home-resize-handle,
.home-rotate-handle,
.home-move-handle,
.home-rotate-stem {
    display: none;
    position: absolute;
    z-index: 10;
}

.home-canvas-editable .home-item.selected:not(.editing) .home-resize-handle,
.home-canvas-editable .home-item.selected:not(.editing) .home-rotate-handle,
.home-canvas-editable .home-item.selected:not(.editing) .home-move-handle,
.home-canvas-editable .home-item.selected:not(.editing) .home-rotate-stem {
    display: block;
}

.home-resize-handle {
    width: 10px;
    height: 10px;
    background: #fff;
    border: 1px solid #444;
    border-radius: 1px;
}

.home-resize-handle[data-handle="nw"] { left: -8px; top: -8px; cursor: nwse-resize; }
.home-resize-handle[data-handle="n"]  { left: calc(50% - 5px); top: -8px; cursor: ns-resize; }
.home-resize-handle[data-handle="ne"] { right: -8px; top: -8px; cursor: nesw-resize; }
.home-resize-handle[data-handle="e"]  { right: -8px; top: calc(50% - 5px); cursor: ew-resize; }
.home-resize-handle[data-handle="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.home-resize-handle[data-handle="s"]  { left: calc(50% - 5px); bottom: -8px; cursor: ns-resize; }
.home-resize-handle[data-handle="sw"] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.home-resize-handle[data-handle="w"]  { left: -8px; top: calc(50% - 5px); cursor: ew-resize; }

/* Les images conservent leurs proportions : seuls les coins servent. */
.home-item-image .home-resize-handle[data-handle="n"],
.home-item-image .home-resize-handle[data-handle="e"],
.home-item-image .home-resize-handle[data-handle="s"],
.home-item-image .home-resize-handle[data-handle="w"] {
    display: none !important;
}

.home-rotate-stem {
    left: calc(50% - .5px);
    top: -31px;
    width: 1px;
    height: 23px;
    background: #555;
    pointer-events: none;
}

.home-rotate-handle {
    left: calc(50% - 7px);
    top: -45px;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid #555;
    border-radius: 50%;
    cursor: grab;
}

.home-rotate-handle:active {
    cursor: grabbing;
}

.home-move-handle {
    left: 16px;
    top: -39px;
    width: 24px;
    height: 24px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font: 700 18px/22px Arial, sans-serif;
    text-align: center;
    cursor: move;
    user-select: none;
}

.home-item.busy {
    opacity: .65;
    cursor: wait;
}

@media (max-width: 700px) {
    .home-body { --home-top-height: 138px; }
    .home-page { padding-right: 15px; padding-left: 15px; }
    .home-site-heading { height: 86px; }
    .home-logo-slot { flex-basis: 76px; width: 76px; height: 68px; margin-right: 12px; }
    .home-top-region .site-primary-nav { height: 52px; gap: 8px 18px; }
    .home-workspace-webmaster .home-canvas-stage { padding-left: 0; }
    .home-editor-toolbar { grid-template-columns: repeat(2, 32px); width: 72px; padding-right: 2px; padding-left: 2px; }
    .home-editor-button { width: 32px; min-width: 32px; height: 32px; }
    .home-editor-tool { width: 32px; }
    .home-item-caption { margin-top: 4px; }
    .home-resize-handle { width: 12px; height: 12px; }
}

.home-editor-flyout.open-left {
    left: auto;
    right: calc(100% + 8px);
}

@media (max-height: 700px) {
    .home-editor-toolbar { gap: 1px; padding-top: 3px; padding-bottom: 3px; }
    .home-editor-grip { height: 20px; }
    .home-editor-button { width: 30px; min-width: 30px; height: 30px; padding: 4px; }
    .home-editor-divider { margin: 1px 0; }
}
