/* Glassmorphism CSS Generator — page styles.

   Chrome uses the site's theme tokens (--fg-rgb, --pure, --surface-*, --border)
   like the rest of style.css. The two deliberate exceptions are the preview
   backgrounds and the demo card itself: those are *content*, not chrome — the
   whole point of the tool is to show the effect against literal colours, and
   the card's own look is written from JS at runtime. */

.glass-main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 30px 40px 64px;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */

.glass-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 34px;
}

.glass-hero-copy {
    flex: 1 1 auto;
}

.glass-kicker,
.glass-panel-head > span,
.glass-control-group legend,
.glass-field label {
    margin: 0;
    color: rgba(var(--fg-rgb), 0.48);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: uppercase;
}

.glass-hero h1 {
    margin: 16px 0 18px;
    color: rgba(var(--fg-rgb), 0.92);
    font-family: "Geist", sans-serif;
    font-size: clamp(1.35rem, 5.2vw, 3.6rem);
    font-weight: 200;
    letter-spacing: -0.055em;
    line-height: 1;
    white-space: nowrap;
}

.glass-intro {
    max-width: 620px;
    margin: 0;
    color: rgba(var(--fg-rgb), 0.58);
    font-size: 0.875rem;
    font-weight: 200;
    letter-spacing: 0;
    text-transform: uppercase;
}

.glass-format-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.glass-format-pills span {
    padding: 8px 14px;
    border: 1px solid rgba(var(--fg-rgb), 0.08);
    border-radius: 999px;
    background: rgba(var(--fg-rgb), 0.04);
    color: rgba(var(--fg-rgb), 0.68);
    font-size: 0.72rem;
    letter-spacing: 0;
}

/* ── Workspace ──────────────────────────────────────────────────────────── */

.glass-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 456px);
    gap: 28px;
    align-items: start;
}

/* ── Preview stage ──────────────────────────────────────────────────────── */

.glass-stage {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* The single fixed ground. Served as an optimised WebP derivative of
   public/images/glassmorphism_background.jpg — the 5120x2880 source is ~56x the
   bytes for a frame that never renders wider than ~800 CSS px (§7). */
.glass-preview-frame {
    display: grid;
    place-items: center;
    min-height: 520px;
    padding: 40px;
    overflow: hidden;
    border-radius: 30px;
    background-color: #16161a;
    background-image: url("/public/images/glassmorphism-background.webp");
    background-position: center;
    background-size: cover;
}

/* The demo card. Every visual property is a custom property written by
   glass-generator.js, so the preview and the copied code cannot drift apart. */
.glass-preview-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    width: 240px;
    height: 360px;
    padding: 22px;
    color: #ffffff;
    background: var(--g-background, rgba(255, 255, 255, 0.15));
    -webkit-backdrop-filter: var(--g-backdrop, none);
    backdrop-filter: var(--g-backdrop, none);
    border: var(--g-border, 1px solid rgba(255, 255, 255, 0.3));
    border-radius: var(--g-radius, 20px);
    box-shadow: var(--g-shadow, none);
    filter: var(--g-filter, none);
}

.glass-preview-card[data-glow="on"]::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: var(--g-edge-width, 1px);
    border-radius: inherit;
    background: var(--g-edge);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.glass-preview-card[data-glow="on"]::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--g-sheen);
    pointer-events: none;
}

.glass-preview-tag,
.glass-preview-body,
.glass-preview-action {
    position: relative;
    z-index: 1;
}

.glass-preview-tag {
    align-self: flex-start;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.glass-preview-body strong {
    display: block;
    margin-bottom: 8px;
    font-family: "Geist", sans-serif;
    font-size: 1.25rem;
    font-weight: 300;
    letter-spacing: -0.02em;
}

.glass-preview-body p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.5;
    opacity: 0.82;
}

.glass-preview-action {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.6;
}

.glass-stage-note {
    margin: 0;
    color: rgba(var(--fg-rgb), 0.36);
    font-size: 0.72rem;
}

/* ── Control panel ──────────────────────────────────────────────────────── */

.glass-panel {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 24px;
    border-radius: 30px;
    background: #1b1b1a;
}

.glass-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.glass-panel-actions {
    display: flex;
    gap: 8px;
}

.glass-ghost-button,
.glass-primary-button,
.glass-copy-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.74rem;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.glass-ghost-button,
.glass-copy-button {
    border: 1px solid rgba(var(--fg-rgb), 0.12);
    background: transparent;
    color: rgba(var(--fg-rgb), 0.68);
}

.glass-ghost-button:hover,
.glass-copy-button:hover {
    border-color: rgba(var(--fg-rgb), 0.28);
    color: var(--text);
}

.glass-primary-button {
    border: 1px solid transparent;
    background: var(--pure);
    color: var(--surface-0);
    font-weight: 500;
}

.glass-primary-button:hover {
    background: rgba(var(--fg-rgb), 0.86);
}

.glass-copy-button.is-copied {
    border-color: rgba(var(--fg-rgb), 0.34);
    background: rgba(var(--fg-rgb), 0.1);
    color: var(--text);
}

.glass-controls {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.glass-control-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
    padding: 18px 16px 16px;
    border: 1px solid rgba(var(--fg-rgb), 0.07);
    border-radius: 18px;
}

.glass-control-group legend {
    padding: 0 6px;
}

.glass-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 9px 10px;
}

.glass-field.is-disabled {
    opacity: 0.38;
}

.glass-field output {
    color: var(--text);
    font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

.glass-field-hint {
    grid-column: 1 / -1;
    margin: 0;
    color: rgba(var(--fg-rgb), 0.36);
    font-size: 0.7rem;
}

/* A lock pins a control against Randomize. It is deliberately NOT a disabled
   state — the slider stays draggable, so it must not read as greyed out. */
.glass-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: rgba(var(--fg-rgb), 0.28);
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.glass-lock:hover {
    border-color: rgba(var(--fg-rgb), 0.14);
    background: rgba(var(--fg-rgb), 0.06);
    color: rgba(var(--fg-rgb), 0.72);
}

.glass-lock[aria-pressed="true"] {
    background: var(--pure);
    border-color: transparent;
    color: var(--surface-0);
}

.glass-lock:focus-visible {
    outline: 2px solid rgba(var(--fg-rgb), 0.4);
    outline-offset: 1px;
}

.glass-lock .glass-lock-closed,
.glass-lock[aria-pressed="true"] .glass-lock-open {
    display: none;
}

.glass-lock[aria-pressed="true"] .glass-lock-closed {
    display: block;
}

/* A locked row keeps its readout bright, so you can see what is pinned. */
.glass-field.is-locked output {
    color: var(--pure);
}

.glass-controls-note {
    margin: 0 0 -6px;
    color: rgba(var(--fg-rgb), 0.36);
    font-size: 0.72rem;
}

.glass-field-hint code {
    color: rgba(var(--fg-rgb), 0.52);
    font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.94em;
}

/* ── Sliders ────────────────────────────────────────────────────────────── */

.glass-field input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
    height: 4px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px;
    background: rgba(var(--fg-rgb), 0.12);
    cursor: pointer;
}

.glass-field input[type="range"]:disabled {
    cursor: not-allowed;
}

.glass-field input[type="range"]::-webkit-slider-thumb {
    width: 15px;
    height: 15px;
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    border-radius: 50%;
    background: var(--pure);
    cursor: inherit;
}

.glass-field input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border: 0;
    border-radius: 50%;
    background: var(--pure);
    cursor: inherit;
}

.glass-field input[type="range"]:focus-visible {
    outline: none;
}

.glass-field input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(var(--fg-rgb), 0.2);
}

.glass-field input[type="range"]:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 4px rgba(var(--fg-rgb), 0.2);
}

/* ── Tint picker ────────────────────────────────────────────────────────── */

.glass-field--color .glass-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.glass-field--color .glass-field-hint,
.glass-field--toggle .glass-field-hint {
    grid-column: 1 / -1;
}

.glass-field--color input[type="color"] {
    width: 34px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(var(--fg-rgb), 0.14);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.glass-field--color input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.glass-field--color input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 6px;
}

.glass-hex-input {
    width: 96px;
    padding: 6px 10px;
    border: 1px solid rgba(var(--fg-rgb), 0.12);
    border-radius: 8px;
    background: rgba(var(--fg-rgb), 0.04);
    color: var(--text);
    font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.76rem;
}

.glass-hex-input:focus-visible {
    outline: 1px solid rgba(var(--fg-rgb), 0.34);
    outline-offset: 1px;
}

.glass-hex-input[aria-invalid="true"] {
    border-color: #f87171;
}

/* ── Glow switch ────────────────────────────────────────────────────────── */

.glass-field--toggle .glass-switch {
    position: relative;
    width: 40px;
    height: 22px;
    padding: 0;
    justify-self: end;
    border: 1px solid rgba(var(--fg-rgb), 0.12);
    border-radius: 999px;
    background: rgba(var(--fg-rgb), 0.1);
    cursor: pointer;
    transition: background 0.18s ease;
}

.glass-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(var(--fg-rgb), 0.5);
    transition: left 0.18s ease, background 0.18s ease;
}

.glass-switch[aria-checked="true"] {
    background: var(--pure);
    border-color: transparent;
}

.glass-switch[aria-checked="true"] .glass-switch-thumb {
    left: 20px;
    background: var(--surface-0);
}

.glass-switch:focus-visible {
    outline: 2px solid rgba(var(--fg-rgb), 0.4);
    outline-offset: 2px;
}

/* ── Code output ────────────────────────────────────────────────────────── */

.glass-code {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.glass-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.glass-code-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(var(--fg-rgb), 0.05);
}

.glass-code-tabs button {
    padding: 6px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(var(--fg-rgb), 0.52);
    font-family: inherit;
    font-size: 0.74rem;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.glass-code-tabs button:hover {
    color: rgba(var(--fg-rgb), 0.84);
}

.glass-code-tabs button.is-active {
    background: rgba(var(--fg-rgb), 0.12);
    color: var(--text);
}

.glass-code-panel {
    max-height: 300px;
    overflow: auto;
    border: 1px solid rgba(var(--fg-rgb), 0.07);
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.28);
}

.glass-code-panel:focus-visible {
    outline: 1px solid rgba(var(--fg-rgb), 0.34);
    outline-offset: 2px;
}

.glass-code-panel pre {
    margin: 0;
    padding: 16px;
    color: rgba(var(--fg-rgb), 0.82);
    font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.74rem;
    line-height: 1.7;
    white-space: pre;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */

.glass-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    z-index: 60;
    padding: 10px 18px;
    transform: translateX(-50%);
    border: 1px solid rgba(var(--fg-rgb), 0.12);
    border-radius: 999px;
    background: var(--surface-4);
    color: var(--text);
    font-size: 0.76rem;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
    .glass-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .glass-stage {
        position: static;
    }

    .glass-preview-frame {
        min-height: 460px;
    }
}

@media (max-width: 720px) {
    .glass-main {
        padding: 24px 20px 48px;
    }

    .glass-hero {
        margin-bottom: 26px;
    }

    .glass-preview-frame {
        min-height: 420px;
        padding: 28px 20px;
        border-radius: 24px;
    }

    .glass-panel {
        padding: 20px 16px;
        border-radius: 24px;
    }
}

@media (max-width: 420px) {
    .glass-panel-head {
        flex-wrap: wrap;
    }

    .glass-code-head {
        flex-direction: column;
        align-items: stretch;
    }

    .glass-code-tabs {
        justify-content: space-between;
    }

    .glass-code-tabs button {
        flex: 1;
        padding: 6px 8px;
    }

    .glass-copy-button {
        justify-content: center;
    }

    .glass-hex-input {
        width: 82px;
    }
}
