/* --- AI Query Box & Core Interactive Components --- */
/* AI Query Box Styles */
.ai-box-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 24px;
    box-sizing: border-box;
    justify-content: center;
}

.ai-box-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--color-grid);
    /* Muted Ocean Slate */
    margin-bottom: 6px;
    text-align: left;
    user-select: none;
}

.telemetry-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #38A169;
    box-shadow: 0 0 0 2px rgba(56, 161, 105, 0.22);
    flex-shrink: 0;
}

.ai-box-title {
    font-family: 'Young Serif', serif;
    font-size: 20px;
    /* Reduced from 20px to support longer vision statement */
    color: var(--color-text);
    /* Primary text */
    margin-bottom: 10px;
    /* Reduced from 16px */
    line-height: 1.35;
    text-align: left;
}

/* Unified Content Box across all states */
.ai-content-box {
    width: 100%;
    height: 130px;
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    border-right: 1px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.45) 100%);
    box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.9), 0 4px 16px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
    position: relative;
    transition: all 0.25s ease;
    margin-bottom: 0px;
    border-radius: 14px;
}

.ai-content-box:focus-within {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.75) 100%);
    border-top-color: rgba(255, 255, 255, 1);
    border-left-color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(72, 123, 195, 0.2), inset 0 2px 6px rgba(255, 255, 255, 0.95);
}

/* In-place validation error state */
.ai-content-box.input-error {
    border-top-color: rgba(220, 75, 75, 0.9) !important;
    border-left-color: rgba(220, 75, 75, 0.9) !important;
    border-bottom-color: rgba(220, 75, 75, 0.5) !important;
    border-right-color: rgba(220, 75, 75, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(220, 75, 75, 0.22), inset 0 2px 6px rgba(255, 255, 255, 0.95) !important;
    background: linear-gradient(135deg, rgba(255, 245, 245, 0.92) 0%, rgba(255, 235, 235, 0.65) 100%) !important;
}

html[data-theme="dark-grey"] .ai-content-box.input-error {
    background: rgba(45, 25, 30, 0.75) !important;
    border-color: rgba(248, 113, 113, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

#ai-query-input {
    width: 100%;
    height: 100%;
    resize: none;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 14px;
    border: none;
    background-color: transparent;
    color: var(--color-text);
    outline: none;
    box-sizing: border-box;
    display: block;
}

#ai-query-input::placeholder {
    color: var(--color-placeholder);
    font-weight: 400;
    opacity: 0.8;
}

#ai-query-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Spacing between text and return key symbol */
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 11px 20px 11px 22px;
    background: var(--cta-gradient, var(--color-cta));
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 14px rgba(53, 101, 170, 0.24);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    border-radius: 10px;
}

#ai-query-submit:hover {
    background: var(--cta-hover-gradient, var(--color-cta-hover));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 6px 20px rgba(53, 101, 170, 0.32);
    transform: translateY(-1px);
}

#ai-query-submit:focus-visible {
    outline: 2px dashed var(--color-grid);
    outline-offset: 2px;
}

#ai-query-submit:active {
    transform: translateY(1px);
}

.return-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    opacity: 0.92;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    margin-top: -1px; /* Optical adjustment to vertically center unicode arrow */
}

.ai-actions-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 65px; /* matches Cloudflare Turnstile height */
    margin-top: 10px; /* Matched to meta spacing */
}

.ai-actions-row .ai-form-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    justify-content: flex-start; /* Aligned to the left */
    flex-grow: 1;
}

#turnstile-widget {
    transition: outline 0.2s ease, box-shadow 0.2s ease;
}

#turnstile-widget.input-error {
    outline: 2px solid rgba(220, 75, 75, 0.75);
    outline-offset: 3px;
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(220, 75, 75, 0.25);
}

.char-counter {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--color-placeholder);
    transition: color 0.2s ease;
    user-select: none;
    min-width: 65px;
    text-align: left; /* Align to the left to match left layout */
}

.char-counter.limit-reached {
    color: var(--color-cta);
    font-weight: 600;
}

.ai-box-meta {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11.5px;
    /* Matched to body-text size */
    font-weight: 500;
    line-height: 1.45;
    color: var(--color-text);
    text-align: left;
    letter-spacing: -0.015em;
    margin-top: 10px; /* Balanced spacing equal to margin-top of actions row */
}

.ai-box-meta a {
    color: var(--color-cta);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.ai-box-meta a:hover {
    color: var(--color-cta-hover);
}

/* Responsive adjustments for mobile screen orientations */
@media (max-width: 767px) {
    .ai-actions-row {
        flex-direction: column-reverse; /* Stacks Turnstile CAPTCHA above button */
        align-items: flex-start;
        gap: 10px;
        min-height: auto;
        margin-top: 10px;
    }
    
    .ai-actions-row .ai-form-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    #turnstile-widget {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        margin: 0;
    }
}

.hidden {
    display: none !important;
}

#turnstile-widget {
    max-width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

#turnstile-widget iframe {
    max-width: 100%;
}

/* Loading State */
#ai-loading-state {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ai-content-box.loading-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bouncer-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.loader-cubes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.cube {
    width: 10px;
    height: 10px;
    background-color: var(--color-bg);
    border: 1px solid var(--color-grid);
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.15);
    border-radius: 3px;
    animation: cube-bounce 1.4s infinite ease-in-out both;
}

.cube-1 { animation-delay: -0.32s; }
.cube-2 { animation-delay: -0.16s; }
.cube-3 { animation-delay: 0s; }

.loader-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text);
}

.loader-dots {
    display: inline-block;
    width: 20px;
    text-align: left;
}

.loader-dots::after {
    content: '';
    animation: typing-dots 1.5s steps(4, end) infinite;
}

@keyframes typing-dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

@keyframes cube-bounce {
    0%, 80%, 100% { 
        transform: translateY(0) scaleY(1);
        background-color: var(--color-bg);
    }
    40% { 
        transform: translateY(-6px) scaleY(1.3);
        background-color: var(--color-cta);
    }
}

/* Response State */
#ai-response-state {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ai-content-box.response-box {
    height: auto;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    overflow: visible;
}

.user-query-preview {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    color: var(--color-grid);
    border-bottom: 1px solid rgba(var(--color-grid-rgb), 0.2);
    padding-bottom: 4px;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.query-preview-label {
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 4px;
}

#ai-query-preview-text {
    font-style: italic;
}

.response-body {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--color-text);
    overflow-y: visible;
    height: auto;
    max-height: none;
    flex-grow: 0;
    margin-bottom: 0;
    padding-right: 0;
    text-align: left;
}

/* Smooth glass scrollbar for response box */
.response-body::-webkit-scrollbar {
    width: 6px;
}

.response-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.response-body::-webkit-scrollbar-thumb {
    background: var(--color-grid);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

#ai-response-clear {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 24px;
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    color: var(--color-text);
    border: 1px solid rgba(139, 126, 200, 0.35);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    border-radius: 10px;
}

#ai-response-clear:hover {
    background-color: rgba(255, 255, 255, 0.85);
    border-color: var(--color-cta);
    color: var(--color-cta);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.15);
}

#ai-response-clear:active {
    transform: translateY(1px);
}

.ai-btn-disabled {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 24px;
    background-color: rgba(255, 255, 255, 0.3);
    color: var(--color-placeholder);
    border: 1px solid rgba(142, 137, 168, 0.3);
    cursor: not-allowed;
    box-sizing: border-box;
    border-radius: 10px;
}

.branding-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    user-select: none;
    cursor: pointer;
    /* Clickable */
    transition: left 0.3s cubic-bezier(0.05, 0.7, 0.1, 1), top 0.3s cubic-bezier(0.05, 0.7, 0.1, 1);
    outline: none;
}

.branding-container:focus-visible {
    outline: 2px dashed var(--color-grid);
    outline-offset: 4px;
}

.branding-container:hover .branding-text {
    color: var(--color-grid);
    /* Change logo to Muted Ocean Slate on hover */
}

.branding-text {
    font-family: 'Young Serif', serif;
    font-size: 24px;
    color: var(--color-text);
    /* Primary text */
    letter-spacing: -0.02em;
    line-height: 28px;
    min-height: 28px;
    white-space: nowrap;
    display: inline-block;
    transition: color 0.2s ease;
}

.branding-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13.5px;
    /* Increased from 12px so animated subtitle is crisp and legible */
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 18px;
    min-height: 18px;
    white-space: nowrap;
    color: var(--color-text);
    /* Primary text */
    margin-top: 4px;
    margin-left: 5px;
    /* Shifted right by 5px */
}

#qayam-block .body-text {
    font-size: 14px;
    /* Increased to 14px */
}

.email-link {
    text-decoration: none;
    color: var(--color-text);
    /* Explicitly set to match branding slogan */
    cursor: pointer;
    transition: color 0.2s ease;
    outline: none;
}

.email-link:hover {
    color: var(--color-grid);
    /* Hover changes to Muted Ocean Slate */
    text-decoration: underline;
}

.email-link:focus-visible {
    outline: 2px dashed var(--color-grid);
    outline-offset: 2px;
}

.linkedin-link {
    text-decoration: none;
    color: var(--color-text);
    cursor: pointer;
    transition: color 0.2s ease;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px; /* Space below email link */
}

.linkedin-link:hover {
    color: var(--color-grid);
    text-decoration: underline;
}

.linkedin-link:focus-visible {
    outline: 2px dashed var(--color-grid);
    outline-offset: 2px;
}

.linkedin-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    display: inline-block;
}

/* Partner Logos Layout */
/* Detail Block 3-Section Layout */
.detail-container {
    width: 100%;
    height: 100%;
    padding: 24px 32px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 16px;
}

.detail-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-section.summary-section {
    gap: 10px;
}

.detail-section.track-record-section {
    align-items: center;
    text-align: center;
    gap: 12px;
}

.detail-headline {
    font-size: 20px;
    text-align: left;
    margin: 0;
    font-family: 'Young Serif', serif;
    color: var(--color-text);
}

.detail-body-text {
    font-size: 14.5px;
    line-height: 1.6;
    text-align: left;
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--color-text);
    font-weight: 500;
}

.detail-divider {
    width: 100%;
    border-top: 1px solid var(--color-grid);
    opacity: 0.35;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-grid);
    /* Muted Ocean Slate */
    margin-top: 0;
    margin-bottom: 6px;
    text-align: left;
}

.track-record-section .section-title {
    text-align: center;
    width: 100%;
}

.logo-horizontal-row {
    display: flex;
    flex-direction: row;
    gap: 48px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.qualifications-columns {
    display: flex;
    flex-direction: row;
    gap: 40px;
    width: 100%;
}

.qual-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qual-list {
    margin: 0;
    padding-left: 16px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
    font-weight: 500;
    list-style-type: square;
}

.qual-list li {
    margin-bottom: 4px;
    text-align: left;
}

.qual-list li strong {
    font-weight: 700;
}

.partner-logo-item {
    display: flex;
    align-items: center;
    color: var(--color-text);
    /* Primary text */
    opacity: 0.85;
    /* Increased from 0.65 to ensure excellent legibility */
}

.partner-logo-svg {
    height: 22px;
    /* Enforces uniform baseline height across brand assets */
    width: auto;
    /* Scales width dynamically to preserve brand aspect ratios */
    fill: currentColor;
    display: block;
    overflow: visible;
    /* Prevents subpixel clipping of vector curves and end-caps */
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Optical sizing to balance distinct partner logo aspect ratios & cap-heights */
.partner-logo-svg.partner-logo-google { height: 28.5px; }
.partner-logo-svg.partner-logo-xero   { height: 18.5px; }
.partner-logo-svg.partner-logo-wpp    { height: 20px; }
.partner-logo-svg.partner-logo-vice   { height: 21px; }
.partner-logo-svg.partner-logo-omd    { height: 23.5px; }

@media (max-width: 768px) {
    .logo-horizontal-row {
        gap: 16px;
    }
    .partner-logo-svg.partner-logo-google { height: 22px; }
    .partner-logo-svg.partner-logo-xero   { height: 14px; }
    .partner-logo-svg.partner-logo-wpp    { height: 16px; }
    .partner-logo-svg.partner-logo-vice   { height: 17px; }
    .partner-logo-svg.partner-logo-omd    { height: 19px; }
}

/* Micro-animation: Subtle Horizontal Shake */
@keyframes shake-subtle {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-4px);
    }
    40%, 80% {
        transform: translateX(4px);
    }
}

.shake-subtle {
    animation: shake-subtle 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Reduced Motion (WCAG 2.3.3) — .visually-hidden lives in insights.css */
@media (prefers-reduced-motion: reduce) {
    .cube {
        animation: none !important;
    }
    .loader-dots::after {
        animation: none !important;
    }
    .shake-subtle,
    .input-error {
        animation: none !important;
    }
}
