/* CSS Variables for colors */
:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --dark-grey: #1a1a1a;
    --light-grey: #f9f9f9;
    --text-color: #333;
    --light-text-color: #f0f0f0;
    --positive-color: #28a745;
    --negative-color: #dc3545;
    --user-message-bg: #e1e1e1;
    --model-message-bg: #e9f1ff;
    --editor-header-bg: #2d2d2d;
    --editor-body-bg: #1e1e1e;
    --editor-text-color: #d4d4d4;
    --editor-cursor-color: #d4d4d4;
    --editor-border-color: #444;
}

/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--light-grey);
    color: var(--text-color);
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

html {
    overflow-x: hidden; /* Prevent horizontal scrolling */
}


/* Layout Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}


/* --- CHAT MESSAGE STYLES --- */
.message {
    padding: 12px 18px;
    border-radius: 18px;
    margin-bottom: 12px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
}

.user-message {
    background-color: var(--user-message-bg);
    color: var(--text-color);
    align-self: flex-end;
    text-align: left;
    border-bottom-right-radius: 4px;
}

.model-message {
    background-color: var(--model-message-bg);
    color: var(--text-color);
    align-self: flex-start;
    text-align: left;
    border-bottom-left-radius: 4px;
}


/* Header and Navigation */
header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

header a {
    text-decoration: none;
    color: var(--text-color);
}

/* Animated Gradient Logo */
.logo {
    font-size: 2.2em;
    font-weight: 800;
    background: linear-gradient(-45deg, var(--primary-color), var(--secondary-color), #23a6d5, #23d5ab);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientBG 8s ease infinite;
}


header nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

header nav ul li {
    margin-left: 20px;
}

header nav ul li a {
    font-weight: bold;
    background: linear-gradient(-45deg, var(--primary-color), var(--secondary-color), #23a6d5, #23d5ab);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientBG 8s ease infinite;
}

/* Main Content Sections */
main {
    padding-top: 0;
}

section {
    text-align: center;
    padding: 2rem 0;
}

section h2 {
    margin-top: 0;
    font-size: 2.5em;
    margin-bottom: 2rem;
}

/* Animated Gradient Hero Section */
.hero {
    color: var(--light-text-color);
    padding: 6rem 0;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


.hero .main-title {
    font-size: 3.5em;
    margin: 0;
    font-weight: 800;
    white-space: nowrap;
}

.hero .sub-title {
    font-size: 1.2em;
    opacity: 0.9;
}


.service-cards, .advantage-cards {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Glitch Effect */
.glitch {
    position: relative;
    display: inline-block;
}
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}
.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00c1;
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}
@keyframes glitch-anim-1 {
    0% { clip-path: inset(10% 0 80% 0); }
    10% { clip-path: inset(40% 0 40% 0); }
    20% { clip-path: inset(90% 0 2% 0); }
    30% { clip-path: inset(20% 0 70% 0); }
    40% { clip-path: inset(55% 0 25% 0); }
    50% { clip-path: inset(10% 0 85% 0); }
    60% { clip-path: inset(70% 0 10% 0); }
    70% { clip-path: inset(30% 0 50% 0); }
    80% { clip-path: inset(90% 0 5% 0); }
    90% { clip-path: inset(45% 0 35% 0); }
    100% { clip-path: inset(5% 0 90% 0); }
}
@keyframes glitch-anim-2 {
    0% { clip-path: inset(80% 0 10% 0); }
    10% { clip-path: inset(20% 0 60% 0); }
    20% { clip-path: inset(70% 0 5% 0); }
    30% { clip-path: inset(40% 0 45% 0); }
    40% { clip-path: inset(65% 0 20% 0); }
    50% { clip-path: inset(5% 0 80% 0); }
    60% { clip-path: inset(50% 0 30% 0); }
    70% { clip-path: inset(85% 0 5% 0); }
    80% { clip-path: inset(25% 0 70% 0); }
    90% { clip-path: inset(60% 0 15% 0); }
    100% { clip-path: inset(10% 0 75% 0); }
}


/* Interactive Card Styles */
.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    flex-basis: 300px;
    flex-grow: 1;
    max-width: 400px;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.card ion-icon {
    font-size: 3em;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
    transition: transform 0.3s ease;
}

.card:hover ion-icon {
    transform: scale(1.1) rotate(-5deg);
}


.card h3 {
    margin-top: 0;
    font-size: 1.4em;
}

.why-us {
    background: #ffffff;
}

/* Call to Action Section */
.cta {
    background: linear-gradient(-45deg, var(--primary-color), var(--secondary-color), #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--light-text-color);
    padding: 4rem 0;
}

.cta-button {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    padding: 1rem 2.5rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(106, 17, 203, 0.4);
    border: none;
    font-size: 1.1em;
    cursor: pointer;
}

.cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(106, 17, 203, 0.5);
}

.cta-button:disabled {
    background-color: #ccc;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#rewrite-rules-button {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: translateY(20px);
    display: none; /* Initially hidden */
}

#rewrite-rules-button.visible {
    display: inline-block;
    opacity: 1;
    transform: translateY(0);
}

#rewrite-rules-button:hover {
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.4);
}


.telegram-button {
    background: #0088cc; /* Telegram's brand color */
    box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.telegram-button ion-icon {
    font-size: 1.2em;
}

.telegram-button:hover {
    box-shadow: 0 8px 25px rgba(0, 136, 204, 0.5);
}


/* Article Styles */
.article-container {
    max-width: 800px;
    margin: 2rem auto;
    background: #fff;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,a,0.05);
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.article-title {
    font-size: 1.5em;
    margin-top: 0;
    line-height: 1.2;
}
.article-container h2 {
    font-size: 1.3em;
    margin-top: 2.5rem;
}
.article-container h3 {
    font-size: 1.1em;
    margin-top: 2rem;
}
.article-container ul {
    padding-left: 20px;
}
.article-container ul li {
    margin-bottom: 0.5rem;
}
a.article-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    margin-bottom: 2rem;
}
.article-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
    display: flex;
    align-items: center;
    padding: 2rem;
}
.article-card-link:hover .article-card {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.article-card .icon {
    font-size: 3em;
    color: var(--primary-color);
    margin-right: 2rem;
}
.article-card-content h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.0em;
    transition: color 0.3s ease;
}
.article-card-content p {
    font-size: 0.8em;
    margin: 0;
    color: #666;
}
.article-card-link:hover .article-card-content h2 {
    color: var(--primary-color);
}


/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    background: var(--dark-grey);
    color: #aaa;
}

footer a {
    color: #fff;
    text-decoration: none;
}

/* AI Brief Section */
.ai-brief {
    background-color: #fff;
}

.ai-brief h2 {
    font-size: 1.3em;
}

.ai-chat-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 1.5rem;
    background-color: var(--light-grey);
    border-radius: 12px;
    min-height: 100px;
    border: 1px solid #e0e0e0;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
}

.mic-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin-bottom: 2rem; /* Added margin */
}

.mic-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 2.5em;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.3s ease, opacity 0.3s ease, background 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: mic-pulse 2s infinite;
    position: relative;
}

@keyframes mic-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 117, 252, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(37, 117, 252, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 117, 252, 0);
    }
}


.mic-button:hover {
    transform: scale(1.1);
    animation-play-state: paused;
}

.mic-button.recording {
    background: var(--negative-color);
    animation: recording-pulse 1.5s infinite;
}

@keyframes recording-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.mic-button.loading {
    opacity: 0.7;
    cursor: wait;
    animation: none;
}

.mic-button.loading ion-icon {
    display: none;
}

.mic-button .spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


#contact-form-container {
    max-width: 500px;
    margin: 2rem auto;
    text-align: left;
}

.summary-display {
    background-color: #f0f8ff;
    border-left: 5px solid var(--secondary-color);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    font-style: italic;
    color: #333;
}

.contact-form .contact-input {
    width: 100%;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1em;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.consent-container {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9em;
}
.consent-container input[type="checkbox"] {
    margin-right: 10px;
}
.gallery-section {
    padding: 5rem 0;
    background-color: #fff;
}

.gallery-container {
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.gallery {
    position: relative;
    width: 200px;
    height: 200px;
    transform-style: preserve-3d;
}

.gallery-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transform: rotateY(calc(var(--i) * 36deg)) translateZ(320px);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

@keyframes rotate {
    from {
        transform: rotateY(0deg);
    }
    to {
        transform: rotateY(360deg);
    }
}

.typing-intro-section {
    background: #000;
    padding: 4rem 1rem;
    overflow: hidden;
    transition: max-height 0.7s ease-in-out, padding 0.7s ease-in-out, transform 0.7s ease-in-out;
}

.typing-intro-section.collapsing {
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    margin: 0;
    transform: scaleY(0);
}


#typing-container {
    background: var(--editor-body-bg);
    border: 1px solid var(--editor-border-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

.editor-header {
    background: var(--editor-header-bg);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--editor-border-color);
}

.editor-button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}
.editor-button.red { background: #ff5f56; }
.editor-button.yellow { background: #ffbd2e; }
.editor-button.green { background: #27c93f; }

.editor-title {
    color: #9e9e9e;
    font-family: sans-serif;
    font-size: 0.9em;
}

.typing-content {
    padding: 1.5rem;
    color: var(--editor-text-color);
    font-family: 'Courier New', Courier, monospace;
    text-align: left;
    max-height: 120px; /* NEW: Start with a fixed max-height for ~4-5 lines */
    overflow: hidden;
    transition: max-height 0.5s ease-out; /* NEW: Animate max-height */
}

.typing-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5em;
    min-height: 1.6em; 
    display: none; /* Hide paragraphs completely */
}

.typing-content p.visible {
    display: block; /* Show them when they become active */
}


.typing-cursor {
    display: inline-block;
    background-color: var(--editor-cursor-color);
    width: 10px;
    height: 1rem;
    margin-left: 5px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    from, to { background-color: transparent }
    50% { background-color: var(--editor-cursor-color); }
}

/* Media Query for Mobile */
@media (max-width: 768px) {
    section h2 {
        font-size: 2em;
    }

    .cta h2, .ai-brief h2 {
        font-size: 1.8em;
    }

    .typing-intro-section {
        padding: 2rem 0.5rem;
    }
    .typing-content {
        padding: 1rem;
        max-height: 110px; /* Adjust initial height for mobile */
    }
    .typing-content p {
        font-size: 0.9rem;
    }
    .typing-cursor {
        height: 0.9rem;
    }
}

/* Glitch Effect for Buttons (Phase Shift) */
.glitch-button {
  overflow: visible;
  position: relative;
}

.glitch-button::before,
.glitch-button::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--primary-color);
  
  /* Make pseudo-elements invisible by default */
  opacity: 0;
}

.glitch-button {
  color: var(--primary-color) !important;
}

.glitch-button::before {
  left: 2px;
  text-shadow: -2px 0 #ff00c1;
  animation: glitch-shift 3s infinite linear;
}

.glitch-button::after {
  left: -2px;
  text-shadow: -2px 0 #00fff9, 2px 2px #ff00c1;
  animation: glitch-shift 3s infinite linear reverse;
}

@keyframes glitch-shift {
  0%, 85% {
    opacity: 0;
    transform: translate(0, 0);
    clip-path: inset(100% 0 0 0);
  }
  86% {
    opacity: 1;
    clip-path: inset(80% 0 10% 0);
  }
  88% {
    opacity: 1;
    clip-path: inset(20% 0 60% 0);
  }
  90% {
    opacity: 1;
    clip-path: inset(50% 0 30% 0);
  }
  92% {
    opacity: 1;
    clip-path: inset(70% 0 5% 0);
  }
  94% {
    opacity: 1;
    clip-path: inset(40% 0 45% 0);
  }
  96% {
    opacity: 1;
    clip-path: inset(65% 0 20% 0);
  }
  98% {
    opacity: 0;
    clip-path: inset(100% 0 0 0);
  }
  100% {
    opacity: 0;
  }
}
