/* ==========================================================================
   AI Script Generator — "Screenwriter's Studio" theme
   Scoped custom properties + asg-* prefixed classes.
   Only ever linked from ai-tools/ai-script-generator/index.html.
   ========================================================================== */

:root {
    --asg-bg: #050403;
    --asg-card: #0c0a07;
    --asg-card-raised: #100d09;
    --asg-border: #2a241a;
    --asg-border-soft: #1c1712;

    --asg-paper: #f3e8cd;
    --asg-paper-dark: #e7d8ac;
    --asg-paper-line: rgba(33, 24, 10, 0.1);
    --asg-ink: #241a0d;
    --asg-ink-soft: #5b4c30;

    --asg-red: #dc2626;
    --asg-red-dark: #9f1b1b;
    --asg-red-soft: rgba(220, 38, 38, 0.14);

    --asg-amber: #c98a3c;
    --asg-amber-bright: #e0a857;
    --asg-amber-soft: rgba(201, 138, 60, 0.14);

    --asg-font-slug: 'Special Elite', 'Courier New', monospace;
    --asg-font-mono: 'Courier Prime', 'Courier New', monospace;
}

/* ---------- global manuscript scope (inside <main> only) ---------- */

.asg-main {
    font-family: var(--asg-font-mono);
}

.asg-main h1,
.asg-main h2,
.asg-main h3 {
    font-family: inherit;
}

.asg-eyebrow {
    font-family: var(--asg-font-slug);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.68rem;
    color: var(--asg-amber-bright);
}

/* ---------- hero slate badge ---------- */

.asg-slate-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: var(--asg-red-soft);
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    font-family: var(--asg-font-slug);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: #ffb4a8;
}

.asg-rec-dot {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    background: var(--asg-red);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.65);
    animation: asg-pulse 1.8s ease-out infinite;
}

@keyframes asg-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.asg-title {
    letter-spacing: -0.01em;
}

.asg-title .asg-title-underline {
    position: relative;
    white-space: nowrap;
    color: var(--asg-amber-bright);
}

.asg-title .asg-title-underline::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.05em;
    height: 3px;
    background: var(--asg-red);
    opacity: 0.75;
}

/* ---------- scene slate chips (hero specs) ---------- */

.asg-chip-row {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .asg-chip-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.asg-chip {
    position: relative;
    border: 1px solid var(--asg-border);
    background: var(--asg-card);
    border-radius: 1.25rem;
    padding: 1.1rem 1.2rem 1rem;
    overflow: hidden;
}

.asg-chip::before {
    content: attr(data-scene);
    position: absolute;
    top: 0.7rem;
    right: 0.9rem;
    font-family: var(--asg-font-slug);
    font-size: 1.4rem;
    color: rgba(220, 38, 38, 0.18);
    line-height: 1;
}

.asg-chip-label {
    font-family: var(--asg-font-slug);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.66rem;
    color: var(--asg-amber-bright);
    margin-bottom: 0.6rem;
}

.asg-chip-body {
    color: #f4ecd8;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ---------- typewriter demo frame ---------- */

.asg-typewriter-frame {
    position: relative;
    border: 1px solid var(--asg-border);
    background: var(--asg-card-raised);
    border-radius: 2rem;
    padding: 1.9rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.asg-slate-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.4rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px dashed var(--asg-border);
}

.asg-slate-title {
    font-family: var(--asg-font-slug);
    font-size: 1.35rem;
    color: #fbf3e2;
    letter-spacing: 0.01em;
}

.asg-live-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    background: var(--asg-red-soft);
    color: #ffb4a8;
    font-family: var(--asg-font-slug);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    white-space: nowrap;
}

.asg-field {
    margin-bottom: 0.9rem;
}

.asg-label {
    display: block;
    font-family: var(--asg-font-slug);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.68rem;
    color: var(--asg-amber-bright);
    margin-bottom: 0.5rem;
}

.asg-input,
.asg-select {
    width: 100%;
    border-radius: 0.85rem;
    border: 1px solid var(--asg-border);
    background: var(--asg-bg);
    color: #f4ecd8;
    font-family: var(--asg-font-mono);
    font-size: 0.9rem;
    padding: 0.8rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.asg-input::placeholder {
    color: #6b6152;
}

.asg-input:focus,
.asg-select:focus {
    outline: none;
    border-color: var(--asg-amber);
    box-shadow: 0 0 0 3px var(--asg-amber-soft);
}

.asg-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.1rem;
}

/* ---------- the script page (output) ---------- */

.asg-script-page {
    position: relative;
    min-height: 320px;
    max-height: 420px;
    overflow-y: auto;
    border-radius: 0.9rem;
    padding: 1.9rem 1.4rem 1.5rem 3.4rem;
    background-color: var(--asg-paper);
    background-image: repeating-linear-gradient(
        var(--asg-paper) 0px,
        var(--asg-paper) 27px,
        var(--asg-paper-line) 28px
    );
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 18px 40px rgba(0, 0, 0, 0.45);
    color: var(--asg-ink);
    font-family: var(--asg-font-mono);
    font-size: 0.92rem;
    line-height: 1.75;
}

.asg-script-page::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2.3rem;
    width: 2px;
    background: rgba(159, 27, 27, 0.3);
}

.asg-script-page::after {
    content: '';
    position: absolute;
    top: 1.1rem;
    left: 0.85rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--asg-bg);
    box-shadow:
        0 34px 0 var(--asg-bg),
        0 68px 0 var(--asg-bg),
        inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.asg-script-page::-webkit-scrollbar {
    width: 10px;
}

.asg-script-page::-webkit-scrollbar-thumb {
    background: rgba(36, 26, 13, 0.25);
    border-radius: 999px;
}

.asg-script-placeholder {
    font-style: italic;
    color: var(--asg-ink-soft);
}

.asg-script-line {
    margin-bottom: 1rem;
}

.asg-script-line:last-child {
    margin-bottom: 0;
}

.asg-slug {
    font-family: var(--asg-font-slug);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--asg-red-dark);
}

/* ---------- action row ---------- */

.asg-action-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.3rem;
}

@media (min-width: 640px) {
    .asg-action-row {
        flex-direction: row;
    }
}

.asg-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border-radius: 999px;
    padding: 1rem 1.5rem;
    font-family: var(--asg-font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    border: 1px solid transparent;
}

.asg-btn:active {
    transform: translateY(1px) scale(0.99);
}

.asg-btn-primary {
    background: var(--asg-red);
    color: #fff;
}

.asg-btn-primary:hover {
    background: var(--asg-red-dark);
}

.asg-btn-secondary {
    background: var(--asg-card);
    border-color: var(--asg-border);
    color: #e7dcc4;
}

.asg-btn-secondary:hover {
    border-color: var(--asg-amber);
    color: #fff;
}

/* ---------- toast override ---------- */

.asg-toast {
    font-family: var(--asg-font-mono);
    letter-spacing: 0.01em;
}

/* ---------- content cards ---------- */

.asg-panel {
    border: 1px solid var(--asg-border);
    background: var(--asg-card);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.asg-panel-heading {
    font-size: 1.7rem;
    font-weight: 700;
    color: #fbf3e2;
    margin-bottom: 1.3rem;
}

.asg-slug-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.asg-slug-list li {
    position: relative;
    padding-left: 1.6rem;
    color: #cfc4a9;
}

.asg-slug-list li::before {
    content: '\2014';
    position: absolute;
    left: 0;
    color: var(--asg-amber);
}

/* ---------- voice / tone cards ---------- */

.asg-voice-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .asg-voice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.asg-voice-card {
    border: 1px solid var(--asg-border-soft);
    background: rgba(0, 0, 0, 0.35);
    border-radius: 1.25rem;
    padding: 1.4rem;
    position: relative;
}

.asg-voice-card::before {
    content: '\201C';
    font-family: Georgia, serif;
    font-size: 2.2rem;
    color: var(--asg-amber);
    opacity: 0.5;
    line-height: 1;
    display: block;
    margin-bottom: 0.25rem;
}

.asg-voice-name {
    font-family: var(--asg-font-slug);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.68rem;
    color: var(--asg-amber-bright);
    margin-bottom: 0.5rem;
}

.asg-voice-desc {
    color: #e7dcc4;
    font-size: 0.95rem;
}

/* ---------- script-page trio (how it works / what you get / best for) ---------- */

.asg-page-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .asg-page-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.asg-page-card {
    position: relative;
    border: 1px solid var(--asg-border);
    background: linear-gradient(180deg, var(--asg-card) 0%, var(--asg-card-raised) 100%);
    border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
    padding: 1.9rem;
    clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
}

.asg-page-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background: var(--asg-bg);
    border-bottom-left-radius: 0.4rem;
    box-shadow: -1px 1px 0 var(--asg-border);
}

.asg-page-number {
    font-family: var(--asg-font-slug);
    color: var(--asg-red);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    margin-bottom: 0.75rem;
    display: block;
}

.asg-page-card h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fbf3e2;
    margin-bottom: 1rem;
}

.asg-page-card ol,
.asg-page-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
    counter-reset: asg-step;
}

.asg-page-card ol li {
    position: relative;
    padding-left: 2.1rem;
    color: #cfc4a9;
    counter-increment: asg-step;
}

.asg-page-card ol li::before {
    content: counter(asg-step);
    position: absolute;
    left: 0;
    top: -0.05rem;
    height: 1.4rem;
    width: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--asg-amber);
    color: var(--asg-amber-bright);
    font-family: var(--asg-font-slug);
    font-size: 0.7rem;
}

.asg-page-card ul li {
    position: relative;
    padding-left: 1.4rem;
    color: #cfc4a9;
}

.asg-page-card ul li::before {
    content: '\2726';
    position: absolute;
    left: 0;
    color: var(--asg-red);
    font-size: 0.7rem;
    top: 0.2rem;
}

.asg-page-card p {
    color: #cfc4a9;
}

/* ---------- film-strip divider ---------- */

.asg-strip {
    height: 10px;
    background-image: repeating-linear-gradient(
        90deg,
        var(--asg-border) 0,
        var(--asg-border) 10px,
        transparent 10px,
        transparent 20px
    );
    opacity: 0.6;
    border-radius: 999px;
    margin: 0 auto;
    max-width: 6rem;
}

@media (max-width: 640px) {
    .asg-typewriter-frame {
        padding: 1.4rem;
        border-radius: 1.5rem;
    }

    .asg-script-page {
        padding-left: 2.6rem;
    }

    .asg-script-page::before {
        left: 1.6rem;
    }

    .asg-script-page::after {
        left: 0.6rem;
    }
}
