/* CINE Game World — /makemusic page styles
   Dark, restrained, content-first.  No frameworks. */

:root {
    --cgw-bg:        #0c0d10;
    --cgw-bg-card:   #15171c;
    --cgw-bg-card-2: #1c2027;
    --cgw-fg:        #e6e8ec;
    --cgw-fg-dim:    #97a0ac;
    --cgw-fg-mute:   #5a6370;
    --cgw-accent:    #d8a64f;        /* warm gold, like lantern light */
    --cgw-accent-dim:#8a6a32;
    --cgw-line:      #262a32;
    --cgw-err:       #d97757;
    --cgw-radius:    8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

.cgw-mm-body {
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--cgw-fg);
    background: var(--cgw-bg);
    min-height: 100vh;
}

a { color: var(--cgw-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.cgw-mm {
    /* Honors whatever container width the host page provides — the
       WP block template's `.is-layout-constrained` wrapper, an
       Elementor section, a custom theme template, etc.  Block-level
       default width fills the parent; padding gives readable margins
       on narrow screens without overriding the parent's max-width. */
    padding: 48px clamp(16px, 3vw, 40px) 96px;
    box-sizing: border-box;
    /* Sit ABOVE the bg video + overlay so content is visible. */
    position: relative;
    z-index: 1;
}

/* ─── Full-page background video ────────────────────────────────────
   Fixed-position so it covers the whole viewport regardless of where
   the shortcode is rendered in the DOM.  Negative z-index pushes it
   behind everything; the theme's containers are made transparent
   (below) so it actually shows through.  AWB and similar plugins
   fail at this because they place the video inside a SECTION block
   bounded by its parent's height — fixed positioning escapes that. */

.cgw-mm-bg-video {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;     /* fill viewport, crop edges if aspect differs */
    z-index: -99;
    pointer-events: none;
    user-select: none;
}

/* Slight dark wash so titles + body copy stay readable over busy
   video content.  Tune the alpha if the video is darker/lighter. */
.cgw-mm-bg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 13, 16, 0.55);
    z-index: -9;
    pointer-events: none;
}

/* When the bg video is present, the WP page chrome (body + the
   theme's content wrappers) must be transparent so the video shows
   through.  `:has()` is supported in every modern browser; the
   selectors target the most common FSE / classic-theme wrapper
   classes.  The site header (.site-header) is left alone — it
   already has its own opaque background from the header mu-plugin. */
body:has(.cgw-mm-bg-video) {
    background: transparent !important;
}
body:has(.cgw-mm-bg-video) main,
body:has(.cgw-mm-bg-video) article,
body:has(.cgw-mm-bg-video) .wp-block-post-content,
body:has(.cgw-mm-bg-video) .entry-content,
body:has(.cgw-mm-bg-video) .is-layout-constrained,
body:has(.cgw-mm-bg-video) .wp-site-blocks {
    background: transparent !important;
}

/* Translucent cards over the video — preserves the page's existing
   dark/gold aesthetic but lets the garden bleed through with a soft
   backdrop blur for readability.  Falls back to opaque on browsers
   without backdrop-filter (older Firefox), which is fine. */
body:has(.cgw-mm-bg-video) .cgw-mm__auth,
body:has(.cgw-mm-bg-video) .cgw-mm__list {
    background: rgba(21, 23, 28, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
body:has(.cgw-mm-bg-video) .cgw-mm__list li:hover {
    background: rgba(28, 32, 39, 0.85);
}

/* ─── Description-builder modal ─────────────────────────────────── */

.cgw-mm-desc-modal__card {
    width: min(900px, 100%);
}
.cgw-mm-desc-modal__hint {
    color: var(--cgw-fg-dim); font-size: 13px; margin: 0 0 16px;
}
.cgw-mm-desc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.cgw-mm-desc-group {
    background: var(--cgw-bg);
    border: 1px solid var(--cgw-line);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 6px;
}
.cgw-mm-desc-group label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--cgw-accent); font-weight: 600;
}
.cgw-mm-desc-group select {
    background: var(--cgw-bg-card-2);
    color: var(--cgw-fg);
    border: 1px solid var(--cgw-line);
    border-radius: 4px;
    padding: 6px 8px;
    font: inherit; font-size: 12px;
    height: 160px;
}
.cgw-mm-desc-group select:focus {
    outline: none; border-color: var(--cgw-accent);
}
.cgw-mm-desc-group select option:checked {
    background: var(--cgw-accent);
    color: #1a1305;
}
.cgw-mm-desc-modal__actions {
    margin-top: 18px;
    display: flex; justify-content: flex-end; gap: 8px;
    border-top: 1px solid var(--cgw-line);
    padding-top: 14px;
}

.cgw-mm__header {
    margin-bottom: 32px;
    border-bottom: 1px solid var(--cgw-line);
    padding-bottom: 20px;
}
.cgw-mm__title {
    font-size: 32px; font-weight: 600; margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.cgw-mm__tagline {
    margin: 0; color: var(--cgw-fg-dim); font-style: italic;
}

.cgw-mm__notice {
    padding: 12px 16px; border-radius: var(--cgw-radius);
    margin-bottom: 24px; font-size: 14px;
}
.cgw-mm__notice--err {
    background: rgba(217, 119, 87, 0.15);
    border: 1px solid var(--cgw-err);
    color: var(--cgw-err);
}

.cgw-mm__auth {
    background: var(--cgw-bg-card);
    border: 1px solid var(--cgw-line);
    border-radius: var(--cgw-radius);
    padding: 24px;
    margin-bottom: 32px;
}
.cgw-mm__lead { font-size: 17px; margin: 0 0 16px; color: var(--cgw-fg); }
.cgw-mm__lead-sm { font-size: 14px; margin: 0 0 16px; color: var(--cgw-fg-dim); }

.cgw-mm__btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid var(--cgw-line);
    background: var(--cgw-bg-card-2);
    color: var(--cgw-fg);
    font: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.cgw-mm__btn:hover { border-color: var(--cgw-accent-dim); }
.cgw-mm__btn:disabled { opacity: 0.5; cursor: default; }
.cgw-mm__btn--primary {
    background: var(--cgw-accent);
    color: #1a1305;
    border-color: var(--cgw-accent);
    font-weight: 600;
}
.cgw-mm__btn--primary:hover { background: #e6b865; border-color: #e6b865; }
.cgw-mm__link { font-size: 14px; color: var(--cgw-fg-dim); }
.cgw-mm__link:hover { color: var(--cgw-fg); }

/* Compose form */
.cgw-mm__compose { display: block; }
.cgw-mm__label {
    display: block;
    margin-bottom: 14px;
}
.cgw-mm__label > span {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--cgw-fg-dim);
    margin-bottom: 6px;
}

/* Title / Description label rows that carry an inline action button
   on the right ("Generate Title", "Build Description"). */
.cgw-mm__label-row {
    display: flex !important;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.cgw-mm__link-action {
    background: none; border: none; padding: 0;
    color: var(--cgw-accent);
    font: inherit; font-size: 12px; font-weight: 500;
    cursor: pointer; text-decoration: underline;
    text-underline-offset: 2px;
}
.cgw-mm__link-action:hover { color: #f1c780; }
.cgw-mm__link-action:disabled { opacity: 0.5; cursor: default; }
.cgw-mm__label input,
.cgw-mm__label textarea {
    display: block; width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cgw-line);
    border-radius: 6px;
    background: var(--cgw-bg);
    color: var(--cgw-fg);
    font: inherit;
    resize: vertical;
}
.cgw-mm__label input:focus,
.cgw-mm__label textarea:focus {
    border-color: var(--cgw-accent);
    outline: none;
}
.cgw-mm__hint {
    font-size: 13px; color: var(--cgw-fg-dim);
    background: var(--cgw-bg);
    border-left: 3px solid var(--cgw-accent-dim);
    padding: 10px 12px;
    margin: 0 0 16px;
}
.cgw-mm__compose-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.cgw-mm__quota { color: var(--cgw-fg-dim); font-size: 13px; }
.cgw-mm__status { font-size: 14px; margin: 12px 0 0; }
.cgw-mm__status--ok  { color: var(--cgw-accent); }
.cgw-mm__status--err { color: var(--cgw-err); }

/* Library list */
.cgw-mm__h2 { font-size: 22px; font-weight: 600; margin: 0 0 8px; }
.cgw-mm__list {
    list-style: none; padding: 0; margin: 0 0 24px;
    border: 1px solid var(--cgw-line);
    border-radius: var(--cgw-radius);
    overflow: hidden;
}
.cgw-mm__list li {
    padding: 14px 18px;
    border-bottom: 1px solid var(--cgw-line);
    cursor: pointer;
    display: flex; gap: 14px; align-items: baseline;
    transition: background 0.1s ease;
}
.cgw-mm__list li:last-child { border-bottom: none; }
.cgw-mm__list li:hover { background: var(--cgw-bg-card-2); }
.cgw-mm__list .cgw-mm__t-title  { flex: 1; color: var(--cgw-fg); font-weight: 500; }
.cgw-mm__list .cgw-mm__t-credit {
    color: var(--cgw-fg-dim); font-size: 13px; font-style: italic;
    flex: 0 0 auto;
}
.cgw-mm__list .cgw-mm__t-credit a { color: var(--cgw-fg); }
.cgw-mm__list .cgw-mm__t-credit a:hover { color: var(--cgw-accent); }
.cgw-mm__list .cgw-mm__t-date   { color: var(--cgw-fg-mute); font-size: 13px; font-variant-numeric: tabular-nums; }
.cgw-mm__list .cgw-mm__loading { color: var(--cgw-fg-dim); cursor: default; }
.cgw-mm__list .cgw-mm__loading:hover { background: transparent; }

/* Pagination */
.cgw-mm__pagination {
    display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
    font-size: 14px;
}
.cgw-mm__pagination button,
.cgw-mm__pagination input {
    border: 1px solid var(--cgw-line);
    background: var(--cgw-bg-card-2);
    color: var(--cgw-fg);
    border-radius: 4px;
    padding: 6px 10px;
    font: inherit; font-size: 13px;
    cursor: pointer;
    min-width: 36px; text-align: center;
}
.cgw-mm__pagination button:hover { border-color: var(--cgw-accent-dim); }
.cgw-mm__pagination button[aria-current="page"] {
    background: var(--cgw-accent);
    color: #1a1305;
    border-color: var(--cgw-accent);
    font-weight: 600;
    cursor: default;
}
.cgw-mm__pagination button:disabled { opacity: 0.4; cursor: default; }
.cgw-mm__pagination input {
    width: 56px; cursor: text;
}
.cgw-mm__pagination .cgw-mm__pg-sep {
    color: var(--cgw-fg-mute); padding: 0 4px; user-select: none;
}

/* Footer */
.cgw-mm__footer {
    margin-top: 64px; padding-top: 16px;
    border-top: 1px solid var(--cgw-line);
    color: var(--cgw-fg-mute); font-size: 13px;
}

/* Modal */
.cgw-mm-modal {
    position: fixed; inset: 0; z-index: 99;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.cgw-mm-modal[hidden] { display: none; }
.cgw-mm-modal__overlay {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
}
.cgw-mm-modal__card {
    position: relative;
    background: var(--cgw-bg-card);
    /* Explicit text color — the modal is portaled to <body> so it
       can't inherit from .cgw-mm-body (the shortcode's wrapper).
       Without this declaration text picks up the theme's default
       body color, which is dark on most light themes / the FSE
       hostinger-ai-theme. */
    color: var(--cgw-fg);
    border: 1px solid var(--cgw-line);
    border-radius: var(--cgw-radius);
    padding: 24px;
    width: min(680px, 100%);
    max-height: 90vh; overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.cgw-mm-modal__close {
    position: absolute; top: 8px; right: 12px;
    background: none; border: none;
    color: var(--cgw-fg-dim);
    font-size: 28px; line-height: 1;
    cursor: pointer; padding: 4px 10px;
}
.cgw-mm-modal__close:hover { color: var(--cgw-fg); }
/* Heading colors inside the modal — !important because FSE themes
   ship per-heading color rules from theme.json (`wp-elements-*`,
   `.has-text-color`, etc.) that win on specificity over our class
   selector and would otherwise leave the title rendered in the
   theme's default dark text color. */
.cgw-mm-modal h1,
.cgw-mm-modal h2,
.cgw-mm-modal h3,
.cgw-mm-modal h4,
.cgw-mm-modal h5,
.cgw-mm-modal h6,
.cgw-mm-modal__title {
    color: var(--cgw-fg) !important;
}
.cgw-mm-modal__title { margin: 0 0 12px; font-size: 22px; }
.cgw-mm-modal__canvas {
    display: block; width: 100%; height: 160px;
    background: var(--cgw-bg);
    border-radius: 6px;
    border: 1px solid var(--cgw-line);
    margin-bottom: 16px;
}
.cgw-mm-modal__info {
    background: var(--cgw-bg);
    border: 1px solid var(--cgw-line);
    border-radius: 6px;
    padding: 12px 14px;
    color: var(--cgw-fg-dim);
    font: 13px/1.5 ui-monospace, "Consolas", monospace;
    white-space: pre-wrap; word-wrap: break-word;
    margin: 0 0 16px;
    /* Cap at 6 lines (line-height 1.5 × 13px = 19.5px per line)
       plus padding (12+12).  Anything over 6 lines scrolls. */
    max-height: calc(1.5em * 6 + 24px);
    overflow-y: auto;
}
/* Custom scrollbar so it doesn't clash with the dark theme. */
.cgw-mm-modal__info::-webkit-scrollbar           { width: 8px; }
.cgw-mm-modal__info::-webkit-scrollbar-track     { background: var(--cgw-bg-card-2); }
.cgw-mm-modal__info::-webkit-scrollbar-thumb     { background: var(--cgw-accent-dim); border-radius: 4px; }
.cgw-mm-modal__info::-webkit-scrollbar-thumb:hover { background: var(--cgw-accent); }

.cgw-mm-modal__controls {
    display: flex; flex-direction: column; gap: 10px;
}
.cgw-mm-modal__row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.cgw-mm-modal__row--bottom {
    justify-content: space-between;   /* time on left, buttons pushed right */
    border-top: 1px solid var(--cgw-line);
    padding-top: 10px;
}
.cgw-mm-modal__time {
    font: 13px ui-monospace, "Consolas", monospace;
    color: var(--cgw-fg-dim);
    font-variant-numeric: tabular-nums;
    /* Prevent the time pill from being squeezed onto a second line by
       very wide button rows on narrow viewports — let it shrink the
       buttons below it instead. */
    flex: 0 0 auto;
}
.cgw-mm-modal__buttons {
    display: flex; gap: 8px;
    margin-left: auto;
}
.cgw-mm-modal__vol-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--cgw-fg-dim);
    flex: 1; min-width: 220px;
}
.cgw-mm-modal__vol-label input[type="range"] {
    flex: 1; min-width: 100px; accent-color: var(--cgw-accent);
}
#cgw-mm-volume-pct {
    color: var(--cgw-fg); font-variant-numeric: tabular-nums;
    min-width: 38px; text-align: right;
}
.cgw-mm-modal__viz-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--cgw-fg-dim);
}
.cgw-mm-modal__viz-label select {
    background: var(--cgw-bg);
    color: var(--cgw-fg);
    border: 1px solid var(--cgw-line);
    border-radius: 4px;
    padding: 4px 8px;
    font: inherit; font-size: 13px;
}
