/**
 * Redact — Blackout & Erasure Poetry for Elementor
 * Styles for both the published frontend and the Elementor visual studio.
 */

/* 1. Base Containers */
.redact-elementor-wrapper {
    position: relative;
    width: 100%;
    margin: 0 0 1.5em;
    line-height: 1.9;
}

.redact-poem {
    display: block;
    width: 100%;
}

.redact-figure {
    margin: 0;
    padding: 0;
    border-radius: 4px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.redact-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0 0 0.85em;
    letter-spacing: -0.01em;
}

.redact-text {
    line-height: inherit;
}

.redact-stanza {
    margin: 0 0 1.4em;
}
.redact-stanza:last-child {
    margin-bottom: 0;
}

/* 2. Token & Run States */
.redact-token {
    position: relative;
    display: inline-block;
    padding: 0 0.08em;
    margin: 0;
    border-radius: 0.2em;
    transition: background-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.redact-kept {
    font-weight: inherit;
    color: inherit;
    display: inline;
    transition: color 0.25s ease, background-color 0.25s ease, text-shadow 0.25s ease, transform 0.2s ease, opacity 0.25s ease;
}

.redact-gone {
    user-select: none;
    -webkit-user-select: none;
    display: inline;
    cursor: pointer;
    transition: color 0.25s ease, background-color 0.25s ease, opacity 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease, text-decoration 0.2s ease;
}

/* Screen reader announcement */
.redact-sr {
    border: 0;
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Attribution & Source Details */
.redact-attribution {
    font-size: 0.88em;
    font-style: italic;
    opacity: 0.75;
    margin-top: 1.1em;
}

.redact-source {
    margin-top: 1.25em;
    font-size: 0.85em;
    border-top: 1px dashed rgba(0, 0, 0, 0.15);
    padding-top: 0.85em;
}

.redact-source summary {
    cursor: pointer;
    opacity: 0.7;
    font-weight: 500;
    transition: opacity 0.2s ease;
}
.redact-source summary:hover,
.redact-source summary:focus-visible {
    opacity: 1;
}

.redact-source-text {
    margin-top: 0.75em;
    padding: 0.8em 1em;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    opacity: 0.85;
    font-size: 0.95em;
    line-height: 1.6;
}

/* ==========================================================================
   THE 5 VISUAL LOOKS (ASPECTS)
   ========================================================================== */

/* 1. MARKER (Austin Kleon / Newspaper Blackout) */
.is-mode-marker .redact-figure {
    background-color: #f6f1e5;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.05'/></feComponentTransfer></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
    color: #191510;
    padding: 1.5em 1.75em;
}

.is-mode-marker .redact-gone {
    background-color: var(--redact-marker-bar-color, #131313);
    color: var(--redact-marker-text-color, transparent);
    padding: 0.04em 0.22em;
    margin: 0 -0.06em;
    border-radius: 0.35em 0.2em 0.32em 0.24em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    filter: var(--redact-rough, none);
}

/* 2. WHITE-OUT (Mary Ruefle / A Little White Shadow) */
.is-mode-whiteout .redact-figure {
    background-color: #fbfaf4;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.05'/></feComponentTransfer></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
    color: #24211c;
    padding: 1.5em 1.75em;
}

.is-mode-whiteout .redact-gone {
    background-color: var(--redact-whiteout-bar-color, #fffef9);
    color: var(--redact-whiteout-text-color, transparent);
    padding: 0.04em 0.18em;
    border-radius: 0.14em;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.07);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* 3. BLANKS (Ronald Johnson / Radi os) */
.is-mode-blanks .redact-figure {
    padding: 0.5em 0;
}

.is-mode-blanks .redact-gone {
    visibility: hidden;
    color: var(--redact-blanks-text-color, transparent);
}

/* 4. GHOST (Jenny Bervin / NETS) */
.is-mode-ghost .redact-figure {
    padding: 0.5em 0;
}

.is-mode-ghost .redact-gone {
    opacity: var(--redact-ghost-opacity, 0.16);
    color: var(--redact-ghost-text-color, inherit);
    transition: opacity 0.25s ease, color 0.25s ease;
}

.is-mode-ghost .redact-kept {
    font-weight: 700;
}

/* 5. BARS (Declassified Government / Typewriter) */
.is-mode-bars .redact-figure {
    font-family: "Courier Prime", "Courier New", Courier, monospace;
    padding: 1.5em 1.75em;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
}

.is-mode-bars .redact-gone {
    background-color: var(--redact-bars-bar-color, #000000);
    color: var(--redact-bars-text-color, transparent);
    padding: 0.02em 0.16em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    border-radius: 1px;
}

/* ==========================================================================
   HOVER OVER EFFECTS (EVERY 5 ASPECTS & GENERAL HOVER)
   ========================================================================== */

/* Universal blackout hover defaults */
.redact-gone:hover,
.redact-token.redact-gone:hover,
.redact-allow-reveal .redact-gone:hover {
    cursor: pointer;
    color: var(--redact-blackout-hover-color, #2b2b2b);
    background-color: var(--redact-blackout-hover-bg, rgba(0, 0, 0, 0.09));
}

/* 1. Marker Hover */
.is-mode-marker .redact-gone:hover,
.redact-allow-reveal.is-mode-marker .redact-gone:hover,
.elementor-editor-active.is-mode-marker .redact-gone:hover {
    background-color: var(--redact-marker-hover-bg, rgba(19, 19, 19, 0.18));
    color: var(--redact-marker-hover-color, #111111);
    filter: none;
}

/* 2. White-out Hover */
.is-mode-whiteout .redact-gone:hover,
.redact-allow-reveal.is-mode-whiteout .redact-gone:hover,
.elementor-editor-active.is-mode-whiteout .redact-gone:hover {
    background-color: var(--redact-whiteout-hover-bg, rgba(0, 0, 0, 0.08));
    color: var(--redact-whiteout-hover-color, #2b2b2b);
}

/* 3. Blanks Hover */
.is-mode-blanks .redact-gone:hover,
.redact-allow-reveal.is-mode-blanks .redact-gone:hover,
.elementor-editor-active.is-mode-blanks .redact-gone:hover {
    visibility: visible;
    opacity: var(--redact-blanks-hover-opacity, 0.88);
    color: var(--redact-blanks-hover-color, #1a1a1a);
    background-color: var(--redact-blanks-hover-bg, transparent);
}

/* 4. Ghost Hover */
.is-mode-ghost .redact-gone:hover,
.redact-allow-reveal.is-mode-ghost .redact-gone:hover,
.elementor-editor-active.is-mode-ghost .redact-gone:hover {
    opacity: var(--redact-ghost-hover-opacity, 0.95);
    color: var(--redact-ghost-hover-color, inherit);
}

/* 5. Bars (Declassified) Hover */
.is-mode-bars .redact-gone:hover,
.redact-allow-reveal.is-mode-bars .redact-gone:hover,
.elementor-editor-active.is-mode-bars .redact-gone:hover {
    background-color: var(--redact-bars-hover-bg, rgba(0, 0, 0, 0.18));
    color: var(--redact-bars-hover-color, #111111);
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

/* ==========================================================================
   ELEMENTOR LIVE EDITOR STUDIO STYLES
   ========================================================================== */

/* Studio floating action bar */
.redact-studio-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: #1e1e24;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    user-select: none;
}

.redact-studio-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.redact-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #2b2b36;
    color: #ffffff;
    border: 1px solid #444455;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.redact-btn:hover {
    background: #383848;
    border-color: #55556a;
    color: #ffffff;
}

.redact-btn-ink {
    background: #e63946;
    border-color: #e63946;
    color: #ffffff;
    font-weight: 600;
}
.redact-btn-ink:hover {
    background: #d62828;
    border-color: #d62828;
}

.redact-btn-ink:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #333333;
    border-color: #444444;
}

.redact-studio-badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 7px;
    border-radius: 3px;
}

/* Interactive word tokens in editor */
.elementor-editor-active .redact-token {
    cursor: pointer;
}

.elementor-editor-active .redact-token:hover:not(.redact-gone) {
    outline: 1.5px dashed #3858e9;
    outline-offset: 1px;
}

/* The authentic hand-drawn graphite pencil circle */
.elementor-editor-active .redact-token.is-pencilled {
    box-shadow: 0 0 0 1.5px rgba(50, 48, 44, 0.9), inset 0 0 0 1px rgba(220, 215, 200, 0.4);
    border-radius: 1em 0.7em 1.1em 0.8em / 0.8em 1.2em 0.7em 1em;
    background: rgba(60, 55, 45, 0.08);
}

/* The dramatic inking sweep animation */
.redact-just-inked .redact-gone {
    animation: redact-sweep 0.32s cubic-bezier(0.2, 0.8, 0.25, 1) both;
    transform-origin: left center;
}

@keyframes redact-sweep {
    from {
        transform: scaleX(0);
        opacity: 0.2;
    }
    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

/* In editor, blanks mode shows faint text with line-through so author can click to restore */
.elementor-editor-active .is-mode-blanks .redact-gone {
    visibility: visible !important;
    opacity: 0.25;
    text-decoration: line-through;
}

/* In editor, peeking on hover over gone tokens */
.elementor-editor-active.is-mode-marker .redact-gone:hover,
.elementor-editor-active.is-mode-bars .redact-gone:hover {
    color: var(--redact-blackout-hover-color, rgba(255, 255, 255, 0.85));
}

/* Print Styles */
@media print {
    .redact-gone {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}
