/* Manody stylesheet, part 08 — Page builder blocks (public page, preview and editor), selection and inspector.
   Loaded in order by core/templates/core/includes/stylesheets.html. */

/* ==========================================================================
   Builder blocks (public page, preview and editor)
   ========================================================================== */

.public-main-builder { max-width: 600px; }
.builder-page.public-main-builder { max-width: none; }

.bk {
    position: relative;
    margin-bottom: 18px;
    padding: var(--bk-pad, 0);
    border-radius: var(--bk-radius, 12px);
    color: var(--bk-color, inherit);
}

.bk-has-bg { background: var(--bk-bg); }
.bk-align-center { text-align: center; }
.bk-align-left { text-align: left; }
.bk-align-stretch { text-align: left; }

.bk-shadow-soft   { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10); }
.bk-shadow-strong { box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22); }
.bk-shadow-glow   { box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent); }

/* Visibility per device (public page only: the editor shows everything). */
@media (max-width: 640px) {
    .public-main .bk-hide-mobile { display: none; }
}
@media (min-width: 641px) {
    .public-main .bk-hide-desktop { display: none; }
}

/* Entrance animations */
.bk-anim-fade, .bk-anim-slide, .bk-anim-zoom {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.bk-anim-slide { transform: translateY(24px); }
.bk-anim-zoom  { transform: scale(0.94); }
.bk.is-visible { opacity: 1; transform: none; }

/* Header */
.bk-header { margin-bottom: 0; }
.bk-header h1 { color: inherit; }
.bk-avatar-s { width: 64px; height: 64px; font-size: 1.5rem; margin: 0 auto 12px; }
.bk-avatar-m { width: 96px; height: 96px; font-size: 2.2rem; margin: 0 auto 16px; }
.bk-avatar-l { width: 132px; height: 132px; font-size: 3rem; margin: 0 auto 18px; }
.bk-align-left .bk-header .avatar { margin-left: 0; }

/* Text */
.bk-text { margin: 0; line-height: 1.6; }
.bk-text-small { font-size: 0.85rem; color: var(--bk-color, var(--text-muted)); }
.bk-text-large { font-size: 1.15rem; }
.bk-text-heading { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; }

/* Link button */
.bk-button { gap: 10px; }
.bk-button .bk-icon { position: absolute; left: 18px; }
.bk-align-stretch .public-link,
.bk-align-center .public-link,
.bk-align-left .public-link { width: 100%; }

.bk-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Social networks */
.bk-socials {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bk-align-left .bk-socials { justify-content: flex-start; }

.bk-social {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--bk-color, var(--text));
    text-decoration: none;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

a.bk-social:hover { transform: translateY(-2px); border-color: var(--text-muted); }
.bk-socials-square .bk-social { border-radius: 12px; }
.bk-socials-plain .bk-social { background: transparent; border-color: transparent; }
.bk-socials-plain .bk-icon { width: 26px; height: 26px; }

/* Images and gallery */
.bk-figure { margin: 0; }
.bk-figure a { display: block; }

.bk-img {
    width: 100%;
    border-radius: var(--bk-radius, 12px);
    object-fit: cover;
}

.bk-ratio-square    { aspect-ratio: 1; }
.bk-ratio-landscape { aspect-ratio: 16 / 9; }
.bk-ratio-portrait  { aspect-ratio: 4 / 5; }

.bk-figure figcaption,
.bk-caption {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--bk-color, var(--text-muted));
}

.bk-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
    gap: 6px;
}

.bk-gallery-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.bk-gallery-carousel::-webkit-scrollbar { display: none; }

.bk-gallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
}

.bk-gallery-carousel img {
    flex: 0 0 78%;
    aspect-ratio: 4 / 3;
    scroll-snap-align: center;
}

/* Video and music */
.bk-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--bk-radius, 12px);
    background: #000;
}

.bk-embed-vertical { aspect-ratio: 9 / 16; max-width: 340px; margin-inline: auto; }

.bk-embed iframe,
.bk-music {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.bk-music { height: 166px; border-radius: var(--bk-radius, 12px); }

/* The editor must not start the players: click = block selection. */
.builder-stage:not(.is-preview) iframe { pointer-events: none; }

/* Forms */
.bk-form { margin-top: 0; text-align: center; }
.bk-form-text { margin: -6px 0 14px; color: var(--text-muted); font-size: 0.9rem; }
.bk-form form { text-align: left; }
.bk-form-demo { display: flex; gap: 8px; }
.bk-form-demo .public-submit { display: inline-flex; align-items: center; }
.bk-form-demo-stack { flex-direction: column; }
.bk-form-demo-stack .public-submit { justify-content: center; }
.bb-textarea { height: 80px; align-items: flex-start; padding-top: 10px; }

/* Product */
.bk-product {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 12px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--bk-radius, 16px);
}

.bk-product-img {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text-muted);
}

.bk-product h3 { font-size: 1rem; letter-spacing: -0.01em; }
.bk-price { margin: 2px 0 6px; font-weight: 700; color: var(--accent); }
.bk-product-text { margin-bottom: 10px; font-size: 0.85rem; color: var(--text-muted); }
.bk-product .bk-product-btn { min-height: 40px; padding: 6px 16px; font-size: 0.85rem; }

/* Countdown */
.bk-countdown-title { margin-bottom: 10px; font-weight: 600; }

.bk-countdown-units {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.bk-countdown-units span {
    display: grid;
    gap: 2px;
    padding: 12px 4px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bk-countdown-units b {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--bk-color, var(--text));
    font-variant-numeric: tabular-nums;
    text-transform: none;
}

.bk-countdown-done { font-size: 1.2rem; font-weight: 700; }

/* Columns */
.bk-columns {
    display: grid;
    grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
    gap: 10px;
    text-align: left;
}

.bk-card {
    padding: 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.bk-card h3 { margin-bottom: 4px; font-size: 0.95rem; }
.bk-card p { font-size: 0.85rem; color: var(--text-muted); }
.bk-card a { display: inline-block; margin-top: 8px; font-size: 0.85rem; font-weight: 500; color: var(--accent); text-decoration: none; }

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

/* Divider and spacer */
.bk-divider {
    margin: 4px auto;
    border: 0;
    border-top: 2px solid var(--border);
}

.bk-divider-dashed { border-top-style: dashed; }
.bk-divider-dots { border-top: 4px dotted var(--text-muted); opacity: 0.6; }
.bk-align-left .bk-divider { margin-left: 0; }

/* Address */
.bk-place {
    display: flex;
    gap: 12px;
    padding: 16px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--bk-radius, 16px);
}

.bk-place-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
}

.bk-place h3 { font-size: 1rem; margin-bottom: 4px; }
.bk-place p { font-size: 0.88rem; color: var(--text-muted); }
.bk-place-hours { margin-top: 6px; }
.bk-place a { display: inline-block; margin-top: 8px; font-size: 0.88rem; font-weight: 500; color: var(--accent); text-decoration: none; }

/* Hints and empty slots (editor) */
.bk-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px;
    border: 1.5px dashed color-mix(in srgb, var(--text) 25%, transparent);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    list-style: none;
}

.bk-placeholder-media { min-height: 120px; }
.bk-hint { margin-top: 6px; font-size: 0.78rem; color: var(--text-muted); }

.bk-notice {
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: left;
}

.bk-empty {
    display: grid;
    gap: 6px;
    padding: 48px 20px;
    border: 2px dashed color-mix(in srgb, var(--text) 25%, transparent);
    border-radius: 16px;
    text-align: center;
    color: var(--text-muted);
}

.bk-empty strong { color: var(--text); }

/* ---------- Editor: selection, drag and drop, status ---------- */
.bb { margin-left: -8px; margin-right: -8px; }
.bb .bk-inner { position: relative; }

.drop-indicator {
    position: absolute;
    left: 16px;
    right: 16px;
    z-index: 5;
    height: 4px;
    border-radius: 999px;
    background: #6366f1;
    box-shadow: 0 0 0 3px color-mix(in srgb, #6366f1 25%, transparent);
    pointer-events: none;
}

button.bb-tool {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.builder-status[data-state="dirty"]  { color: #b45309; }
.builder-status[data-state="saved"],
.builder-status[data-state="published"] { color: #047857; }
.builder-status[data-state="error"]  { color: var(--danger); }
.builder-status a { color: inherit; font-weight: 600; }

.block-card {
    width: 100%;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text);
}

.block-grid li { list-style: none; }
.block-grid li[hidden] { display: none; }

.layer-list li {
    display: grid;
    gap: 0;
    line-height: 1.35;
}

.layer-list li strong { font-size: 0.85rem; font-weight: 500; }

/* ---------- Inspector ---------- */
.inspector-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 48px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.inspector-empty .bicon { width: 28px; height: 28px; }

.inspector-note {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.inspector-note.is-locked { background: #fef3c7; border-color: #fde68a; color: #92400e; }

.ifield textarea {
    min-height: 72px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    resize: vertical;
}

.ifield small { font-weight: 400; }

.irange { display: flex; align-items: center; gap: 10px; }
.irange output { min-width: 2.5em; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.icolor { display: flex; align-items: center; gap: 10px; }
.icolor input[type="color"] { flex: 1; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.icolor input[type="color"]:disabled { opacity: 0.4; }

.iimage { display: grid; gap: 8px; }
.iimage img { width: 100%; max-height: 160px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.iimage-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.ithumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ithumb { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); }
.ithumb img { width: 100%; height: 100%; object-fit: cover; }

.ithumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}

.iitems { gap: 10px; }

.iitem {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.iitem-head { display: flex; align-items: center; justify-content: space-between; }

/* In the editor, the selection frame surrounds the block without shifting its content. */
.bb.bk {
    margin: 0 -8px 10px;
    padding: calc(var(--bk-pad, 0px) + 8px);
}
.bb.bk-has-bg { background: var(--bk-bg); }

/* Two-click embeds: placeholder until the visitor accepts the third-party player. */
.bk-embed-consent {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    min-height: 140px;
    padding: 16px;
    border: 1px dashed currentColor;
    border-radius: var(--bk-radius, 12px);
    background: color-mix(in srgb, currentColor 6%, transparent);
    color: inherit;
    font: inherit;
    text-align: center;
    cursor: pointer;
}
.bk-embed-consent svg { width: 28px; height: 28px; }
.bk-embed-consent span { font-size: 0.8rem; opacity: 0.75; max-width: 320px; }
.bk-music-consent { height: auto; }
