/* ==========================================================================
   Editorial Motion & Kinetic Typography Stylesheet
   Exclusively scoped to Photomosaic.work editorial & blog pages.
   Zero impact on core creation applications.
   ========================================================================== */

/* --- 1. Typography Motion Primitives --- */
.motion-hero-title {
    opacity: 0;
    visibility: hidden;
}

.motion-hero-title.is-ready {
    opacity: 1;
    visibility: visible;
}

.motion-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    margin-right: 0.28em;
}

.motion-word-inner {
    display: inline-block;
    will-change: transform, opacity, filter;
}

/* --- 2. Typewriter Subheading Reveal --- */
.typewriter-text {
    position: relative;
    display: inline;
    font-weight: 400;
}

.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.15em;
    background-color: var(--primary, #d4af37);
    margin-left: 3px;
    vertical-align: -0.15em;
    animation: editorialCursorBlink 0.9s infinite ease-in-out;
}

@keyframes editorialCursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- 3. Cypher Scramble Metric Badges --- */
.cypher-badge {
    font-family: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: rgba(212, 175, 55, 0.08);
    color: #937318;
    border: 1px solid rgba(212, 175, 55, 0.25);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    display: inline-block;
}

/* --- 4. Editorial Calligraphic Underline Accents --- */
.accent-underline-wrap {
    position: relative;
    display: inline-block;
    white-space: nowrap;
}

.accent-underline-svg {
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 8px;
    pointer-events: none;
    overflow: visible;
}

.accent-underline-svg path {
    stroke: var(--primary, #d4af37);
    stroke-width: 2.2;
    stroke-linecap: round;
    fill: none;
}

/* --- 5. Interactive Before/After Split Comparison Slider --- */
.editorial-compare-container {
    position: relative;
    width: 100%;
    max-width: 820px;
    margin: 2.5rem auto;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f1f1f1;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

.editorial-compare-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

@media (max-width: 640px) {
    .editorial-compare-wrapper {
        aspect-ratio: 4 / 3;
    }
}

.editorial-compare-before,
.editorial-compare-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
}

.editorial-compare-before img,
.editorial-compare-after img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.editorial-compare-after {
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
    will-change: clip-path;
}

.editorial-compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background-color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
    will-change: left;
}

.editorial-compare-handle-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid #d4af37;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
}

.editorial-compare-label {
    position: absolute;
    bottom: 14px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 4px;
    backdrop-filter: blur(8px);
    z-index: 5;
    pointer-events: none;
}

.editorial-compare-label-left {
    left: 14px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
}

.editorial-compare-label-right {
    right: 14px;
    background: rgba(212, 175, 55, 0.9);
    color: #1a1a1a;
}

.editorial-figure-caption {
    padding: 0.9rem 1.2rem;
    font-size: 0.88rem;
    color: #64748b;
    background: #fafafa;
    border-top: 1px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- 6. Explanatory SVG Diagram Containers --- */
.editorial-diagram-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem auto;
    max-width: 820px;
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.04);
}

.editorial-diagram-header {
    margin-bottom: 1.25rem;
}

.editorial-diagram-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.35rem 0;
}

.editorial-diagram-subtitle {
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0;
}

.editorial-diagram-svg-wrap {
    width: 100%;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

/* --- 7. Editorial Media Figure Cards --- */
.editorial-media-figure {
    margin: 2.5rem 0;
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 24px -6px rgba(0, 0, 0, 0.05);
}

.editorial-media-figure img {
    width: 100%;
    height: auto;
    display: block;
}

.editorial-media-figure figcaption {
    padding: 0.9rem 1.4rem;
    font-size: 0.85rem;
    color: #64748b;
    background: #fafafa;
    border-top: 1px solid #eaeaea;
    line-height: 1.5;
}

.editorial-media-figure figcaption strong {
    color: #1e293b;
}

/* --- 8. Accessibility: Respect prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
    .motion-hero-title,
    .motion-word-inner {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        filter: none !important;
    }
    .typewriter-cursor {
        animation: none !important;
        opacity: 0 !important;
    }
    .accent-underline-svg path {
        stroke-dashoffset: 0 !important;
    }
}
