/* ============================================================
   DevKarim — "Blueprint Atelier"
   COMPONENTS: buttons, forms, reveal, cursor, cookie, dots,
   marquee, accordion, tags
   ============================================================ */

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 0.95rem 1.9rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 2px solid transparent;
    border-radius: 100px;
    cursor: pointer;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s, background 0.25s, color 0.25s, border-color 0.25s;
    text-align: center;
}

.btn-primary {
    background: var(--color-primary);
    color: #14161B;
    box-shadow: 0 6px 20px -6px rgba(255, 92, 26, 0.55);
}

.btn-primary:hover {
    background: var(--color-primary-soft);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -8px rgba(255, 92, 26, 0.65);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--color-text);
    border-color: currentColor;
}

.btn-outline:hover {
    background: var(--color-text);
    color: var(--color-bg);
    transform: translateY(-2px);
}

/* Outline variant on dark surfaces */
.on-dark .btn-outline,
.btn-outline.btn-light {
    color: var(--color-text-light);
}

.on-dark .btn-outline:hover,
.btn-outline.btn-light:hover {
    background: var(--color-text-light);
    color: var(--color-bg-dark);
}

.btn-white {
    background: #FFFDF8;
    color: #14161B;
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.4);
}

.btn-dark {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
}

.btn-dark:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -10px rgba(17, 19, 24, 0.5);
}

.btn-lg {
    padding: 1.15rem 2.4rem;
    font-size: 1.02rem;
}

.btn-sm {
    padding: 0.55rem 1.2rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 26px;
    height: 26px;
    background: rgba(20, 22, 27, 0.15);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: transform 0.25s;
}

.btn:hover .btn-icon {
    transform: translateX(3px);
}

[dir="rtl"] .btn-icon i {
    transform: scaleX(-1);
}

[dir="rtl"] .btn:hover .btn-icon {
    transform: translateX(-3px);
}

/* ============================================
   SECTION TAG (mono index chip)
   ============================================ */
.portfolio-tag,
.about-tag,
.contact-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    padding: 0.45rem 1.1rem;
    margin-bottom: 1.4rem;
    background: var(--color-surface);
}

.on-dark .portfolio-tag,
.on-dark .about-tag,
.on-dark .contact-tag {
    color: rgba(244, 241, 234, 0.75);
    border-color: var(--color-border-dark);
    background: rgba(244, 241, 234, 0.04);
}

.portfolio-tag-index {
    color: var(--color-primary);
    font-weight: 700;
}

/* ============================================
   REVEAL ANIMATIONS
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
    will-change: opacity, transform;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* ============================================
   CUSTOM CURSOR — two switchable styles (motion.js)
   data-cursor="crosshair" | "ink" on <body>
   ============================================ */
.cursor,
.cursor-follower {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    body.has-custom-cursor,
    body.has-custom-cursor a,
    body.has-custom-cursor button,
    body.has-custom-cursor [role="button"],
    body.has-custom-cursor .testimonials-track,
    body.has-custom-cursor .dock-item,
    body.has-custom-cursor input,
    body.has-custom-cursor textarea,
    body.has-custom-cursor select {
        cursor: none;
    }

    .cursor {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 10000;
        pointer-events: none;
        transform: translate3d(-100px, -100px, 0);
    }

    .cursor-follower {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9999;
        pointer-events: none;
        transform: translate3d(-100px, -100px, 0);
    }

    .cursor-label {
        font-family: var(--font-mono);
        font-size: 0.58rem;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: #14161B;
        opacity: 0;
        transform: scale(0.6);
        transition: opacity 0.2s, transform 0.2s var(--ease-spring);
        white-space: nowrap;
    }

    body.cursor-on-interactive .cursor-label {
        opacity: 1;
        transform: scale(1);
    }

    /* ---------- CROSSHAIR (blueprint) ---------- */
    body[data-cursor="crosshair"] .cursor {
        width: 22px;
        height: 22px;
        margin: -11px 0 0 -11px;
    }

    body[data-cursor="crosshair"] .cursor::before,
    body[data-cursor="crosshair"] .cursor::after {
        content: '';
        position: absolute;
        background: var(--color-primary);
    }

    body[data-cursor="crosshair"] .cursor::before {
        left: 50%;
        top: 0;
        width: 1.5px;
        height: 100%;
        transform: translateX(-50%);
    }

    body[data-cursor="crosshair"] .cursor::after {
        top: 50%;
        left: 0;
        height: 1.5px;
        width: 100%;
        transform: translateY(-50%);
    }

    body[data-cursor="crosshair"] .cursor-follower {
        width: 40px;
        height: 40px;
        margin: -20px 0 0 -20px;
        border: 1.5px solid rgba(255, 92, 26, 0.55);
        border-radius: 4px;
        transition: width 0.25s var(--ease-out-expo), height 0.25s var(--ease-out-expo),
                    margin 0.25s var(--ease-out-expo), background 0.25s, border-radius 0.25s;
    }

    body[data-cursor="crosshair"].cursor-on-interactive .cursor-follower {
        width: 84px;
        height: 84px;
        margin: -42px 0 0 -42px;
        background: var(--color-primary);
        border-color: var(--color-primary);
        border-radius: 100px;
    }

    /* ---------- INK DOT ---------- */
    body[data-cursor="ink"] .cursor {
        width: 9px;
        height: 9px;
        margin: -4.5px 0 0 -4.5px;
        background: var(--color-primary);
        border-radius: 50%;
    }

    body[data-cursor="ink"] .cursor-follower {
        width: 38px;
        height: 38px;
        margin: -19px 0 0 -19px;
        border: 1.5px solid rgba(255, 92, 26, 0.5);
        border-radius: 50%;
        transition: width 0.3s, height 0.3s, margin 0.3s, background 0.3s;
    }

    body[data-cursor="ink"].cursor-on-interactive .cursor-follower {
        width: 76px;
        height: 76px;
        margin: -38px 0 0 -38px;
        background: var(--color-primary);
        border-color: var(--color-primary);
    }

    /* ---------- BLEND (difference disc — the awwwards classic) ---------- */
    body[data-cursor="blend"] .cursor { display: none; }
    body[data-cursor="blend"] .cursor-label { display: none; }
    body[data-cursor="blend"] .cursor-follower {
        width: 30px;
        height: 30px;
        margin: -15px 0 0 -15px;
        border-radius: 50%;
        background: #F4F1EA;
        mix-blend-mode: difference;
        transition: width 0.28s var(--ease-out-expo), height 0.28s var(--ease-out-expo), margin 0.28s var(--ease-out-expo);
    }
    body[data-cursor="blend"].cursor-on-interactive .cursor-follower {
        width: 76px;
        height: 76px;
        margin: -38px 0 0 -38px;
    }

    /* ---------- RING (minimal hollow ring, no dot) ---------- */
    body[data-cursor="ring"] .cursor { display: none; }
    body[data-cursor="ring"] .cursor-follower {
        width: 26px;
        height: 26px;
        margin: -13px 0 0 -13px;
        border: 1.5px solid var(--color-primary);
        border-radius: 50%;
        background: transparent;
        transition: width 0.28s var(--ease-out-expo), height 0.28s var(--ease-out-expo), margin 0.28s var(--ease-out-expo), background 0.25s;
    }
    body[data-cursor="ring"] .cursor-label { color: var(--color-primary-deep); }
    body[data-cursor="ring"].cursor-on-interactive .cursor-follower {
        width: 70px;
        height: 70px;
        margin: -35px 0 0 -35px;
        background: rgba(255, 92, 26, 0.12);
    }

    /* ---------- COMET (dot + fading trail, ring on hover) ---------- */
    body[data-cursor="comet"] .cursor {
        width: 11px;
        height: 11px;
        margin: -5.5px 0 0 -5.5px;
        background: var(--color-primary);
        border-radius: 50%;
        transition: width 0.2s, height 0.2s, margin 0.2s;
    }
    body[data-cursor="comet"].cursor-on-interactive .cursor {
        width: 7px;
        height: 7px;
        margin: -3.5px 0 0 -3.5px;
    }
    body[data-cursor="comet"] .cursor-follower {
        width: 0;
        height: 0;
        margin: 0;
        border: 1.5px solid var(--color-primary);
        border-radius: 50%;
        background: transparent;
        opacity: 0;
        transition: width 0.3s var(--ease-out-expo), height 0.3s var(--ease-out-expo),
                    margin 0.3s var(--ease-out-expo), opacity 0.3s;
    }
    body[data-cursor="comet"].cursor-on-interactive .cursor-follower {
        width: 56px;
        height: 56px;
        margin: -28px 0 0 -28px;
        opacity: 1;
        background: rgba(255, 92, 26, 0.1);
    }
    body[data-cursor="comet"] .cursor-label { color: var(--color-primary-deep); }
    .cursor-trail {
        position: fixed;
        top: 0;
        left: 0;
        width: 9px;
        height: 9px;
        margin: -4.5px 0 0 -4.5px;
        border-radius: 50%;
        background: var(--color-primary);
        pointer-events: none;
        z-index: 9998;
        opacity: 0;
        transform: translate3d(-100px, -100px, 0);
    }
}

/* Cursor-lab switcher (only shown with ?cursorlab=1) */
.cursor-lab {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    display: flex;
    gap: 0.4rem;
    background: var(--color-bg-dark);
    border: 1px solid var(--color-border-dark);
    border-radius: 100px;
    padding: 0.4rem;
    box-shadow: var(--shadow-pop);
}

.cursor-lab button {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-light);
    background: transparent;
    border: none;
    border-radius: 100px;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.cursor-lab button.active {
    background: var(--color-primary);
    color: #14161B;
}

/* ============================================
   FORMS
   ============================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 560px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.required {
    color: var(--color-primary);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.9rem 1.1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color 0.25s, box-shadow 0.25s;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(255, 92, 26, 0.12);
}

.form-input.error,
.form-textarea.error {
    border-color: #DC2626;
}

.form-input.valid,
.form-textarea.valid {
    border-color: #16A34A;
}

.form-textarea {
    resize: vertical;
    min-height: 110px;
}

.form-input-error {
    font-size: 0.8rem;
    color: #DC2626;
    min-height: 1em;
}

.form-required-note {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 1.25rem;
}

.form-required-note i {
    color: var(--color-primary);
}

/* Honeypot — visually removed, still in DOM for bots */
.form-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Checkbox */
.form-checkbox-group {
    margin: 0.25rem 0 1.25rem;
}

.form-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.form-checkbox-label a {
    color: var(--color-primary-deep);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.form-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    position: relative;
    transition: background 0.2s, border-color 0.2s;
    margin-top: 1px;
}

.form-checkbox-label input:checked + .checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.form-checkbox-label input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #14161B;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.form-checkbox-label input:focus-visible + .checkmark {
    box-shadow: var(--focus-ring);
}

/* File upload */
.form-file-label {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1.1rem;
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    transition: border-color 0.25s, background 0.25s, color 0.25s;
    background: var(--color-surface);
    position: relative;
}

.form-file-label:hover {
    border-color: var(--color-primary);
    color: var(--color-text);
    background: rgba(255, 92, 26, 0.04);
}

.form-file-label i {
    color: var(--color-primary);
}

.form-file-label input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-file-name {
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

/* Submit button states */
.form-submit-btn {
    position: relative;
}

.form-submit-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.btn-icon-right {
    font-size: 0.85rem;
    transition: transform 0.25s;
}

.form-submit-btn:hover .btn-icon-right {
    transform: translateX(4px) translateY(-2px);
}

/* Success / error blocks */
.form-success,
.form-error {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
}

.form-success {
    background: rgba(22, 163, 74, 0.08);
    border: 1.5px solid rgba(22, 163, 74, 0.4);
    text-align: center;
}

.form-success-icon {
    font-size: 2.2rem;
    color: #16A34A;
    margin-bottom: 0.6rem;
}

.form-success-title {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
}

.form-error {
    background: rgba(220, 38, 38, 0.07);
    border: 1.5px solid rgba(220, 38, 38, 0.35);
}

.form-error-icon {
    color: #DC2626;
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
}

.form-error-text {
    font-weight: 600;
    color: #B91C1C;
}

.form-error-list {
    margin: 0.5rem 0 0 1.2rem;
    color: #B91C1C;
    font-size: 0.9rem;
}

/* ============================================
   MARQUEE TICKER
   ============================================ */
.marquee {
    background: var(--color-primary);
    color: #14161B;
    overflow: hidden;
    padding: 0.9rem 0;
    position: relative;
    transform: rotate(-0.6deg) scale(1.01);
    border-top: 2px solid #14161B;
    border-bottom: 2px solid #14161B;
    z-index: 5;
}

.marquee-track {
    display: flex;
    gap: 3rem;
    width: max-content;
    animation: marquee-scroll 36s linear infinite;
    will-change: transform;
}

.marquee:hover .marquee-track {
    animation-play-state: paused;
}

.marquee-item {
    display: flex;
    align-items: center;
    gap: 3rem;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.marquee-item i {
    font-size: 0.6rem;
    opacity: 0.7;
}

@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

[dir="rtl"] .marquee-track {
    animation-direction: reverse;
}

/* ============================================
   FAQ ACCORDION (native <details>)
   ============================================ */
.faq-item {
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    margin-bottom: 0.9rem;
    overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.faq-item:hover {
    border-color: rgba(255, 92, 26, 0.45);
}

.faq-item[open] {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-card);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.3rem 1.5rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--color-text);
    list-style: none;
    user-select: none;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::after {
    content: '+';
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--color-primary);
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s var(--ease-out-expo), background 0.25s, color 0.25s;
}

.faq-item[open] .faq-question::after {
    content: '−';
    transform: rotate(180deg);
    background: var(--color-primary);
    color: #14161B;
    border-color: var(--color-primary);
}

.faq-answer {
    padding: 0 1.5rem 1.4rem;
    color: var(--color-text-secondary);
    line-height: 1.75;
}

.faq-answer a {
    color: var(--color-primary-deep);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ============================================
   COOKIE CONSENT
   ============================================ */
.cookie-consent {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    max-width: 380px;
    background: var(--color-bg-dark-2);
    color: var(--color-text-light);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    z-index: 9000;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.4s, transform 0.4s var(--ease-out-expo);
    box-shadow: var(--shadow-pop);
}

[dir="rtl"] .cookie-consent {
    left: auto;
    right: 1.25rem;
}

.cookie-consent.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.cookie-content p {
    color: rgba(244, 241, 234, 0.8);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.55;
}

@media (max-width: 480px) {
    .cookie-consent {
        left: 0.75rem;
        right: 0.75rem;
        max-width: none;
    }
}

/* ============================================
   SECTION INDICATOR DOTS (desktop)
   ============================================ */
.section-indicator {
    position: fixed;
    right: 1.4rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    z-index: 90;
}

[dir="rtl"] .section-indicator {
    right: auto;
    left: 1.4rem;
}

.section-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(132, 135, 143, 0.4);
    cursor: pointer;
    padding: 0;
    transition: all 0.3s var(--ease-out-expo);
}

.section-dot:hover {
    background: var(--color-text-muted);
}

.section-dot.active {
    background: var(--color-primary);
    height: 24px;
    border-radius: 100px;
}

@media (max-width: 1100px) {
    .section-indicator {
        display: none;
    }
}

/* ============================================
   SCROLL PROGRESS BAR (injected by motion.js)
   ============================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--gradient-primary);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 102;
    pointer-events: none;
}

[dir="rtl"] .scroll-progress {
    transform-origin: right;
}

/* ============================================
   NOISE / GRAIN OVERLAY utility
   ============================================ */
.grain::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    z-index: 1;
}
