/* ==========================================================================
   OsmoTools : générateur de slider et de carrousel ([osmova_slider])
   Plan de travail pointillé + pellicule de vignettes synchronisée avec l'aperçu.
   ========================================================================== */

.osg {
    --osg-ink: #15171C;
    --osg-muted: #5E6573;
    --osg-line: #E2E5EA;
    --osg-stage: #F1F3F6;
    --osg-dot: #CDD3DB;
    --osg-accent: #0064FF;
    --osg-accent-soft: #E8F0FF;
    --osg-ratio: 16 / 9;
    margin: 0 0 40px;
    padding: 28px;
    border: 1px solid var(--osg-line);
    border-radius: 16px;
    background: #fff;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--osg-ink);
}

.osg__badge {
    display: inline-block;
    margin: 0 0 12px;
    padding: 4px 10px;
    border-radius: 4px;
    background: var(--osg-accent-soft);
    color: var(--osg-accent);
    font: 700 11px/1.4 'JetBrains Mono', monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.osg .osg__title {
    margin: 0 0 6px;
    font-size: 1.5rem;
    line-height: 1.25;
}

.osg__intro {
    max-width: 68ch;
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--osg-muted);
}

/* ---------- Contrôles segmentés (boutons radio) ---------- */

.osg__pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--osg-stage);
}

.osg__pills label {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.osg__pills input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.osg__pills span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--osg-muted);
    white-space: nowrap;
}

.osg__pills input:checked + span {
    background: #fff;
    color: var(--osg-ink);
    box-shadow: 0 1px 2px rgba(21, 23, 28, .12), 0 0 0 1px rgba(21, 23, 28, .04);
}

.osg__pills input:focus-visible + span {
    outline: 2px solid var(--osg-accent);
    outline-offset: 1px;
}

.osg__pills--sm span {
    padding: 5px 10px;
    font-size: 13px;
}

.osg__shape {
    display: inline-block;
    border: 1.5px solid currentColor;
    border-radius: 2px;
}

.osg__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
}

.osg__device {
    margin-left: auto;
}

/* ---------- Plan de travail ---------- */

.osg__stage {
    display: flex;
    justify-content: center;
    padding: 28px;
    border-radius: 14px;
    background: var(--osg-stage) radial-gradient(circle, var(--osg-dot) 1px, transparent 1.3px) 0 0 / 16px 16px;
}

.osg__preview {
    display: block;
    width: 100%;
    max-width: 760px;
    height: 420px;
    border: 0;
    background: transparent;
    color-scheme: light;
    transition: max-width .3s ease;
}

.osg--mobile .osg__preview {
    max-width: 390px;
    border: 8px solid var(--osg-ink);
    border-radius: 28px;
    background: #fff;
}

/* ---------- Pellicule ---------- */

.osg__strip {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 14px 0 0;
}

.osg__thumbs {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 4px;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: thin;
}

.osg__thumbs li {
    margin: 0;
}

.osg__thumb {
    position: relative;
    display: block;
    height: 72px;
    aspect-ratio: var(--osg-ratio);
    max-width: 216px;
    min-width: 72px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(21, 23, 28, .08);
}

.osg__thumb[aria-pressed="true"] {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--osg-accent);
}

.osg__thumb:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--osg-accent);
}

.osg__thumb-n {
    position: absolute;
    top: 5px;
    left: 5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .92);
    color: var(--osg-ink);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.osg__thumb-t {
    position: absolute;
    inset: auto 0 0;
    padding: 14px 7px 5px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .6));
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.osg__add {
    flex: 0 0 auto;
    width: 72px;
    margin: 4px 0;
    border: 1.5px dashed #AEB6C2;
    border-radius: 8px;
    background: #fff;
    color: var(--osg-muted);
    font-size: 26px;
    font-weight: 300;
    cursor: pointer;
}

.osg__add:hover {
    border-color: var(--osg-accent);
    color: var(--osg-accent);
}

.osg__add:disabled {
    opacity: .4;
    cursor: default;
}

/* ---------- Édition + réglages ---------- */

.osg__work {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 28px;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--osg-line);
}

.osg__h {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
}

.osg__editor-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.osg__editor-actions {
    display: flex;
    gap: 4px;
}

.osg__ghost {
    padding: 5px 9px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--osg-muted);
    font: 600 13px/1.3 inherit;
    font-family: inherit;
    cursor: pointer;
}

.osg__ghost:hover:not(:disabled) {
    background: var(--osg-stage);
    color: var(--osg-ink);
}

.osg__ghost:disabled {
    opacity: .35;
    cursor: default;
}

.osg__editor-body {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    gap: 18px;
}

.osg__media-col,
.osg__text-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.osg__drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    aspect-ratio: var(--osg-ratio);
    min-height: 110px;
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(21, 23, 28, .1);
}

.osg__drop::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(21, 23, 28, .32);
}

.osg__drop.is-over {
    box-shadow: inset 0 0 0 3px var(--osg-accent);
}

.osg__drop > * {
    position: relative;
}

.osg__file {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.osg__drop-label {
    padding: 7px 12px;
    border-radius: 8px;
    background: #fff;
    color: var(--osg-ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.osg__file:focus-visible + .osg__drop-label {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.osg__drop-msg {
    max-width: 100%;
    color: #fff;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.osg__drop .osg__ghost {
    color: #fff;
    font-size: 12px;
}

.osg__drop .osg__ghost:hover {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

.osg__err {
    margin: 0;
    font-size: 13px;
    color: #B42318;
}

.osg__err:empty {
    display: none;
}

.osg__f {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--osg-ink);
}

.osg__f input[type="text"],
.osg__f input[type="url"] {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--osg-line);
    border-radius: 8px;
    background: #fff;
    font: 500 14px/1.3 inherit;
    font-family: inherit;
    color: var(--osg-ink);
    box-sizing: border-box;
}

.osg__f input:focus {
    border-color: var(--osg-accent);
    outline: 0;
    box-shadow: 0 0 0 3px var(--osg-accent-soft);
}

.osg__f--inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    color: var(--osg-muted);
}

.osg input[type="color"] {
    width: 34px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--osg-line);
    border-radius: 6px;
    background: none;
    cursor: pointer;
}

.osg__duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Réglages */

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

.osg__settings .osg__h:not(:first-child) {
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--osg-line);
}

.osg__line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 10px;
    font-size: 14px;
}

.osg__line input[type="range"] {
    width: 140px;
    accent-color: var(--osg-accent);
}

.osg__val {
    color: var(--osg-muted);
    font-weight: 500;
}

.osg__swatches {
    display: flex;
    align-items: center;
    gap: 6px;
}

.osg__swatch {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.osg__swatch[aria-pressed="true"] {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--osg-ink);
}

.osg__switch {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    cursor: pointer;
}

.osg__switch input {
    appearance: none;
    flex: 0 0 auto;
    position: relative;
    width: 34px;
    height: 20px;
    margin: 0;
    border-radius: 10px;
    background: #CBD2DB;
    cursor: pointer;
    transition: background .15s;
}

.osg__switch input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform .15s;
}

.osg__switch input:checked {
    background: var(--osg-accent);
}

.osg__switch input:checked::after {
    transform: translateX(14px);
}

.osg__switch input:focus-visible {
    outline: 2px solid var(--osg-accent);
    outline-offset: 2px;
}

.osg:not(.osg--carrousel) .osg__only-carrousel,
.osg.osg--carrousel .osg__only-slider,
.osg:not(.osg--auto) .osg__only-auto {
    display: none;
}

/* ---------- Export ---------- */

.osg__export {
    margin-top: 24px;
    padding: 18px 20px;
    border-radius: 12px;
    background: var(--osg-stage);
}

.osg__export-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.osg__copy,
.osg__download {
    padding: 12px 20px;
    border-radius: 10px;
    font: 700 15px/1.2 inherit;
    font-family: inherit;
    cursor: pointer;
}

.osg__copy {
    border: 1px solid var(--osg-accent);
    background: var(--osg-accent);
    color: #fff;
}

.osg__copy:hover {
    background: #0050CC;
}

.osg__download {
    border: 1px solid var(--osg-line);
    background: #fff;
    color: var(--osg-ink);
}

.osg__export-info {
    font-size: 14px;
    font-weight: 600;
    color: #067647;
}

.osg__note {
    max-width: 80ch;
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--osg-muted);
}

.osg__details {
    margin-top: 12px;
}

.osg__details summary {
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.osg .osg__code {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 12px 14px;
    border: 0;
    border-radius: 10px;
    background: var(--osg-ink);
    color: #E2E8F0;
    font: 500 12.5px/1.55 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
    font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace !important;
    white-space: pre;
    box-sizing: border-box;
    resize: vertical;
}

.osg button:focus-visible,
.osg summary:focus-visible,
.osg .osg__drop-label:focus-visible {
    outline: 2px solid var(--osg-accent);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .osg__work {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .osg {
        padding: 18px;
    }

    .osg__stage {
        padding: 12px;
    }

    .osg__device {
        display: none;
    }

    .osg__editor-body,
    .osg__duo {
        grid-template-columns: 1fr;
    }

    .osg__drop {
        aspect-ratio: auto;
        min-height: 120px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .osg__preview,
    .osg__switch input,
    .osg__switch input::after {
        transition: none;
    }
}
