/**
 * SENSY HARMONY STACK SYSTEM v2.0
 * Atomic Orchestration Architecture
 *
 * @package SENSY_Premium
 * @description Гнучка система верстки z data-sensy-field інтеграцією
 */

/* ============================================
   0. ZERO-GAP PROTOCOL - Full-Screen Reset
   ============================================ */

html, body {
    margin: 0 ;
    padding: 0 ;
    width: 100vw ;
    overflow-x: hidden ;
    background: #000 ; /* Dark base */
}

/* Видалення відступу адмін-панелі для ідеального Hero */
#wpadminbar {
    display: none ;
}

.sensy-article-container {
    margin: 0 ;
    padding: 0 ;
}

.hero-section {
    margin-top: 0 !important;
    top: 0 !important;
}

/* ============================================
   1. ФУНДАМЕНТАЛЬНІ КОНСТАНТИ (CSS Variables)
   ============================================ */

:root {
    /* Геометричний закон (1100px standard) */
    --sensy-max-width: 1100px;
    --sensy-min-width: 320px;

    /* Vertical Rhythm Protocol */
    --spacing-major: 8rem;          /* 128px - Major blocks */
    --spacing-transition: 6rem;     /* 96px - Text ↔ Widget */
    --spacing-text: 2.5rem;         /* 40px - Paragraphs */

    /* Mobile compression */
    --spacing-major-mobile: 6rem;
    --spacing-transition-mobile: 6rem;
    --spacing-text-mobile: 1.5rem;

    /* Colors - SENSY DNA */
    --sensy-bg: #0a0a0a;
    --sensy-surface: #111111;
    --dark: #0f111a;
    --surface: #161925;
    --primary-purple: #8B5CF6;
    --secondary-pink: #EC4899;
    --accent-cyan: #06B6D4;
    --text-white: #f9fafb;
    --text-gray: #d1d5db;
}

/* ============================================
   1.5. ATOMIC MASTER STACK CONTAINER v3.0
   ============================================ */

#sensy-master-stack {
    /* FULL-WIDTH FREEDOM - No limits */
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;

    /* Atomic gap - 32px між блоками */
    display: flex !important;
    flex-direction: column !important;
    gap: 32px !important;            /* ← FORCE 32px */

    /* Фон - примусово чорний */
    background: #0a0a0a !important;

    /* Типографіка - Montserrat/Manrope */
    font-family: 'Montserrat', 'Manrope', -apple-system, sans-serif !important;
    color: var(--text-white);
}

/* Ensure atomic blocks inherit proper spacing */
#sensy-master-stack > div {
    width: 100%;
    max-width: 100%;
}

/* Remove all margins from atomic wrappers */
.sensy-atomic-wrapper {
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove all margins from sensy-blocks */
.sensy-block {
    margin: 0 !important;
    padding: 0 !important;
}

/* Hero block specific zero-margin */
.sensy-block.hero_v3 {
    margin-top: 0 !important;
}

/* ============================================
   2. HERO SECTION (Premium Glass DNA)
   ============================================ */

.hero-area {
    position: relative;
    height: 75vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--sensy-bg);
    overflow: hidden;
    box-shadow: inset 0 0 150px rgba(0,0,0,0.9);
}

/* Gradient bridge: digital smoke */
.hero-area::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35vh;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(10, 10, 10, 0) 20%,
        rgba(10, 10, 10, 0.1) 40%,
        rgba(10, 10, 10, 0.4) 65%,
        rgba(10, 10, 10, 0.8) 85%,
        var(--sensy-bg) 100%
    );
    z-index: 7;
    pointer-events: none;
}

.hero-bg-image-wrapper {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
    transition: opacity 0.5s ease;
}

#matrix-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* Glass Panel Wrapper - Flexbox centering */
.hero-glass-panel-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* Glass Panel - TRUE GLASSMORPHISM */
.hero-glass-panel {
    width: 90% !important; /* Гнучка ширина */
    max-width: var(--sensy-max-width) !important; /* ← 1100px = контентний блок */
    margin: 0 auto; /* Центрування */
    padding: clamp(2rem, 5vw, 5rem) clamp(1rem, 3vw, 4rem) !important; /* Адаптивні відступи */
    height: auto !important; /* Панель має рости за контентом */
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(25px) saturate(160%);
    -webkit-backdrop-filter: blur(25px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0,0,0,0.6);
    animation: fadeIn 1s ease-out 0.5s forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Hero Content Container - ГУМОВИЙ КОНТЕЙНЕР */
.hero-content-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    z-index: 100;
}

/* Hero Typography */
.hero-glass-panel h1,
.hero-title {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: clamp(2rem, 8vw, 4.5rem) !important; /* Гнучкий шрифт */
    font-weight: 900;
    line-height: 1.1 !important;
    word-break: break-word !important;
    max-width: 100% !important; /* Займає всю доступну ширину */
    margin: 0;
    color: var(--text-white);
}

.hero-meta {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 1.5rem;
    color: rgba(255,255,255,0.6);
}

.meta-badge {
    color: var(--accent-cyan);
    font-weight: 700;
}

.meta-separator {
    margin: 0 0.5rem;
}

/* ============================================
   3. КОНТЕЙНЕРНА СИСТЕМА (1100px Standard)
   ============================================ */

.content-stream {
    position: relative;
    z-index: 40;
    background: linear-gradient(180deg, #111420 0%, var(--dark) 100%);
    padding: 4rem 2rem 6rem;
}

.content-wrapper {
    width: 100%;
    max-width: var(--sensy-max-width); /* ← 1100px LIMIT */
    margin-left: auto;
    margin-right: auto;
    min-width: var(--sensy-min-width);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-major); /* 8rem gap */
}

/* ============================================
   4. ОСНОВНІ БЛОКИ
   ============================================ */

.entry-content,
.widget-slot {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

@media (min-width: 1151px) {
    .entry-content,
    .widget-slot {
        max-width: var(--sensy-max-width);
    }
}

@media (max-width: 1150px) {
    .content-wrapper {
        gap: var(--spacing-major-mobile);
    }

    .entry-content,
    .widget-slot {
        width: 94%;
        max-width: 100%;
        min-width: var(--sensy-min-width);
    }
}

/* ============================================
   5. ТИПОГРАФІКА
   ============================================ */

body {
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--text-white);
    line-height: 1.7;
    background: var(--sensy-bg);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.entry-content p,
.entry-content li {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.15rem;
    line-height: 1.75;
    margin-bottom: var(--spacing-text);
    text-align: center;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #a5f3fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.entry-content h2 {
    font-size: clamp(2rem, 3.5vw, 3rem);
    text-align: center;
    margin-top: 5rem;
    margin-bottom: 2rem;
}

.entry-content h3 {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    text-align: left;
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.entry-content ul {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
    text-align: center;
}

.entry-content ul li {
    position: relative;
    margin: 1rem 0;
}

.entry-content ul li::before {
    content: "—";
    color: #8B5CF6;
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.entry-content blockquote {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    margin: 3rem auto;
    max-width: 600px;
}

/* ============================================
   6. SHIMMER PLACEHOLDER EFFECTS
   ============================================ */

.sensy-shimmer {
    position: relative;
    overflow: hidden;
}

.sensy-shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.sensy-placeholder-text {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

.sensy-placeholder-block {
    padding: 1rem 0;
}

.shimmer-line {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    border-radius: 4px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}

/* Remove shimmer when data is injected */
[data-sensy-injected="true"] {
    animation: none !important;
}

[data-sensy-injected="true"]::before {
    display: none !important;
}

[data-sensy-injected="true"] .sensy-placeholder-text,
[data-sensy-injected="true"] .sensy-placeholder-block {
    display: none !important;
}

/* ============================================
   7. MOBILE RESCUE
   ============================================ */

@media (max-width: 768px) {
    .hero-area {
        height: 65vh;
    }

    /* .hero-glass-panel та .hero-title тепер використовують clamp() - універсальна гнучкість */

    .content-stream {
        padding: 4rem 1rem 6rem;
    }

    .entry-content h2,
    .entry-content h3 {
        font-size: 2.2rem;
    }

    .entry-content p,
    .entry-content li {
        font-size: 1.15rem;
        margin-bottom: var(--spacing-text-mobile);
    }
}

@media (max-width: 640px) {
    .content-wrapper {
        gap: var(--spacing-major-mobile);
    }
}

/* ============================================
   8. DNA PROTECTION (Overflow prevention)
   ============================================ */

[data-sensy-field] {
    overflow: visible;
    white-space: normal;
    max-width: 100%;
}

[data-sensy-field].hero-title {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: visible !important;
}

[data-sensy-field].hero-date {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: visible !important;
    text-overflow: clip !important;
}

.sensy-content-slot {
    min-height: 200px;
}

/* ============================================
   9. WIDGET SLOTS
   ============================================ */

.widget-slot {
    min-height: 400px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-slot::after {
    content: 'Widget Slot: ' attr(data-sensy-slot);
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.widget-slot[data-sensy-injected="true"] {
    border: none;
    background: transparent;
}

.widget-slot[data-sensy-injected="true"]::after {
    display: none;
}

/* ============================================
   10. DIAGNOSTIC MARKERS (Optional)
   ============================================ */

/* Uncomment for debugging:
.content-wrapper {
    border: 2px dashed lime;
}

.entry-content,
.widget-slot {
    border: 1px solid cyan;
}
*/
