/* --- FONTS & VARIABLES --- */
@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
    --bg-vellum: #F9F7F1;
    --text-ink: #292524;
    --oss-red: #7f1d1d;
    --oss-gold: #d4af37;
    --stone-600: #57534e;
    
    --font-body: 'Libre Baskerville', Georgia, serif;
    --font-ui: 'Source Sans 3', sans-serif; 
}

/* --- GLOBAL LAYOUT --- */
body {
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image: url('https://img.freepik.com/premium-photo/beige-marble-texture_1375194-69172.jpg');
    background-repeat: repeat;
    background-size: auto;
    color: var(--text-ink);
    margin: 0;
}

.content-wrapper {
    flex-grow: 1;
    max-width: 70ch; 
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* --- LOGO / HEADER STYLE --- */
.site-title {
    font-family: var(--font-body);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--oss-red);
    text-align: center;
    margin-top: 3rem;
    margin-bottom: 2rem;
    text-transform: lowercase;
    letter-spacing: -0.02em;
}

/* --- ACT & SCENE HIERARCHY --- */
.act-heading {
    text-align: center;
    font-size: 2.25rem; 
    font-weight: 700;
    color: var(--oss-red);
    margin-top: 5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    display: block;
    border-bottom: 2px solid var(--oss-gold); 
}

h2 {
    font-size: 1.5rem; 
    font-weight: 700;
    color: var(--stone-600);
    padding-top: 1rem; 
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    border-bottom: 2px solid var(--oss-gold); 
}

.act-heading + h2 {
    padding-top: 0;
    margin-top: 0.5rem;
    border-bottom: none; 
}

/* --- SCRIPT FORMATTING --- */
.speaker {
    display: block;
    margin-top: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: #991b1b;
    margin-bottom: 0.25rem;
}

.stage-direction {
    font-style: italic;
    color: var(--stone-600);
    background-color: #f5f5f4;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    display: inline-block;
    margin-bottom: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.scene-summary {
    background-color: rgba(245, 245, 244, 0.5);
    border-left: 4px solid var(--oss-red);
    padding: 1.25rem;
    margin: 2rem 0; 
    color: #44403c;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.5;
    display: block;
    font-family: var(--font-ui);
}

/* --- LINE NUMBERING & FLEURONS --- */
.scene-container {
    counter-reset: line-counter; 
    margin-bottom: 5rem;
    position: relative;
}

.scene-container::after {
    content: "❦"; 
    display: block;
    text-align: center;
    color: var(--oss-gold);
    font-size: 2rem;
    margin-top: 4rem;
    opacity: 0.6;
}

.line {
    position: relative;
    counter-increment: line-counter;
    line-height: 1.6; 
    margin-bottom: 0;
    padding-right: 3rem; 
}

.line::after {
    content: counter(line-counter);
    position: absolute;
    right: 0;
    top: 0;
    width: 2rem;
    text-align: right;
    font-size: 0.75rem;
    color: #888888;
    font-family: var(--font-ui); 
    opacity: 0;
    user-select: none;
}

.line:nth-of-type(5n)::after {
    opacity: 1;
}

/* --- INTERACTIVE ANNOTATIONS --- */
.term, .analysis {
    border-bottom: 2px dotted var(--oss-gold);
    cursor: help;
    position: relative; 
    display: inline;
}

.analysis {
    border-bottom-style: solid;
}

.term:hover, .analysis:hover {
    background-color: rgba(212, 175, 55, 0.15); 
    color: var(--oss-red);
}

.term .definition, .analysis .commentary {
    visibility: hidden;
    position: absolute; 
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px; 
    width: 280px;
    background-color: #fafaf9;
    color: #1c1917;
    text-align: left;
    border-radius: 6px;
    padding: 14px;
    font-size: 0.95rem; 
    line-height: 1.4;
    font-family: var(--font-ui);
    border: 1px solid #e7e5e4;
    border-left: 4px solid var(--oss-red); 
    box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.15);
    bottom: 150%; 
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none; 
}

/* Distinct Label Logic */
.label {
    display: block;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem; 
    letter-spacing: 0.05em;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.label:first-of-type {
    color: var(--oss-red); 
    border-bottom: 2px solid var(--oss-gold); 
}

.label:not(:first-of-type) {
    color: var(--stone-600);
    border-bottom: 1px solid #e7e5e4;
    margin-top: 12px;
}

.term:hover .definition, .analysis:hover .commentary {
    visibility: visible;
    opacity: 1;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 600px) {
    .content-wrapper {
        padding: 1rem;
    }
    .act-heading { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
    .line { line-height: 1.75; padding-right: 0; }
    .line::after { display: none; }
    .term .definition, .analysis .commentary { width: 220px; }
    .label { font-size: 0.75rem; } 
}