/* ============================================
   ELIWA - Assistants en Langues Autochtones
   Design inspiré des traditions visuelles autochtones
   ============================================ */

/* Variables de couleurs sacrées */
:root {
    /* Couleurs de la roue médicinale */
    --sacred-red: #C41E3A;
    --sacred-black: #1A1A1A;
    --sacred-yellow: #F4C430;
    --sacred-white: #F5F5F5;
    
    /* Couleurs naturelles */
    --earth-brown: #5D4037;
    --forest-green: #2C5530;
    --sky-blue: #4A90A4;
    --sunset-orange: #D4652F;
    --copper: #B87333;
    --gold: #D4AF37;
    --turquoise: #40E0D0;
    
    /* Couleurs de fond */
    --bg-deep: #0A0A0C;
    --bg-medium: #121216;
    --bg-light: #1E1E24;
    --bg-card: rgba(255, 255, 255, 0.02);
    
    /* Texte */
    --text-primary: #E8E8E8;
    --text-secondary: #9A9AA0;
    --text-accent: #D4AF37;
    --text-muted: #606068;
    
    /* Timing */
    --ease-sacred: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-flow: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset et base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Crimson Pro', Georgia, serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.7;
}

/* Polices pour syllabiques */
.syllabic {
    font-family: 'Noto Sans Canadian Aboriginal', sans-serif;
}

/* Canvas de fond */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.7;
}

/* ============================================
   SYSTÈME D'ÉCRANS
   ============================================ */

.screen {
    display: none;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: block;
}

#chat-screen.active {
    display: flex;
    flex-direction: column;
}

/* ============================================
   BORDURES DÉCORATIVES
   ============================================ */

.pattern-border {
    position: fixed;
    width: 120px;
    height: 120px;
    z-index: 2;
    opacity: 0;
    animation: fadeInCorner 2s var(--ease-flow) forwards;
    pointer-events: none;
}

.pattern-border::before,
.pattern-border::after {
    content: '';
    position: absolute;
    background: linear-gradient(90deg, var(--gold), var(--copper));
}

.top-left {
    top: 20px;
    left: 20px;
    animation-delay: 0.2s;
}

.top-left::before {
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
}

.top-left::after {
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
}

.top-right {
    top: 20px;
    right: 20px;
    animation-delay: 0.4s;
}

.top-right::before {
    top: 0;
    right: 0;
    width: 100%;
    height: 2px;
}

.top-right::after {
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
}

.bottom-left {
    bottom: 20px;
    left: 20px;
    animation-delay: 0.6s;
}

.bottom-left::before {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
}

.bottom-left::after {
    bottom: 0;
    left: 0;
    width: 2px;
    height: 100%;
}

.bottom-right {
    bottom: 20px;
    right: 20px;
    animation-delay: 0.8s;
}

.bottom-right::before {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 2px;
}

.bottom-right::after {
    bottom: 0;
    right: 0;
    width: 2px;
    height: 100%;
}

@keyframes fadeInCorner {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   CONTENEUR SACRÉ
   ============================================ */

.sacred-container {
    position: relative;
    z-index: 1;
    padding: 3rem 2rem 6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   ROUE MÉDICINALE
   ============================================ */

.medicine-wheel {
    width: min(200px, 50vw);
    height: min(200px, 50vw);
    position: relative;
    animation: wheelReveal 2s var(--ease-sacred) forwards;
    opacity: 0;
}

.wheel-svg {
    width: 100%;
    height: 100%;
    color: var(--gold);
    filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.3));
    animation: wheelSpin 180s linear infinite;
}

.outer-ring {
    stroke-dasharray: 1230;
    stroke-dashoffset: 1230;
    animation: drawCircle 2s var(--ease-flow) 0.5s forwards;
}

@keyframes wheelReveal {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-90deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

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

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

/* ============================================
   EN-TÊTE PRINCIPAL
   ============================================ */

.main-header {
    text-align: center;
    max-width: 800px;
}

.title-sovereign {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.title-line {
    display: block;
    opacity: 0;
    animation: titleReveal 1.5s var(--ease-flow) forwards;
}

.title-line.primary {
    font-size: clamp(3rem, 12vw, 6rem);
    font-weight: 300;
    letter-spacing: 0.2em;
    color: var(--text-primary);
    animation-delay: 0.8s;
    text-shadow: 0 0 60px rgba(212, 175, 55, 0.4);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--gold) 50%, var(--text-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-line.subtitle {
    font-size: clamp(0.9rem, 3vw, 1.3rem);
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-weight: 400;
    animation-delay: 1.1s;
}

.intro-text {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    line-height: 1.8;
    opacity: 0;
    animation: fadeInUp 1s var(--ease-flow) 1.4s forwards;
}

@keyframes titleReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SÉLECTION DES LANGUES
   ============================================ */

.language-selection {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding: 2rem 0;
}

.section-title {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-weight: 400;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInUp 1s var(--ease-flow) 1.6s forwards;
}

.language-group {
    opacity: 0;
    animation: groupFadeIn 1s var(--ease-flow) forwards;
}

.language-group[data-family="algonquian"] { animation-delay: 1.8s; }
.language-group[data-family="inuit"] { animation-delay: 2s; }
.language-group[data-family="iroquoian"] { animation-delay: 2.2s; }
.language-group[data-family="athabaskan"] { animation-delay: 2.4s; }
.language-group[data-family="salishan"] { animation-delay: 2.6s; }
.language-group[data-family="wakashan"] { animation-delay: 2.8s; }
.language-group[data-family="isolates"] { animation-delay: 3s; }

@keyframes groupFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.family-title {
    font-size: 0.85rem;
    color: var(--gold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 400;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.family-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    justify-items: center;
}

/* ============================================
   CARTES DE LANGUE
   ============================================ */

.lang-card {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.75rem 1.5rem;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.03) 0%, 
        rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(212, 175, 55, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.4s var(--ease-sacred);
    position: relative;
    overflow: hidden;
    font-family: inherit;
    color: inherit;
}

.lang-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(212, 175, 55, 0.08), 
        transparent);
    transition: left 0.6s var(--ease-flow);
}

.lang-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), transparent 50%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s var(--ease-sacred);
}

.lang-card:hover {
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateY(-6px);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(212, 175, 55, 0.1);
}

.lang-card:hover::before {
    left: 100%;
}

.lang-card:hover::after {
    opacity: 1;
}

.lang-card:active {
    transform: translateY(-2px);
}

.lang-card .script {
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-align: center;
    line-height: 1.3;
    transition: color 0.3s var(--ease-sacred);
}

.lang-card .script.syllabic {
    font-size: 1.8rem;
    color: var(--gold);
}

.lang-card:hover .script {
    color: var(--gold);
}

.lang-card .lang-name {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.lang-card .lang-name-fr {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.lang-card .speakers {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 0.25rem;
}

/* ============================================
   PIED DE PAGE
   ============================================ */

.site-footer {
    position: relative;
    padding: 4rem 2rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    opacity: 0;
    animation: footerReveal 1s var(--ease-flow) 3.2s forwards;
}

.footer-logo {
    width: 70px;
    height: 70px;
    margin-bottom: 0.5rem;
}

.eliwa-logo {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.3));
}

.logo-tri {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo-tri.outer {
    stroke: var(--gold);
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: drawTri 1.5s var(--ease-flow) 3.4s forwards;
}

.logo-tri.middle {
    stroke: var(--copper);
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawTri 1.2s var(--ease-flow) 3.6s forwards;
}

.logo-tri.inner {
    stroke: var(--gold);
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: drawTri 1s var(--ease-flow) 3.8s forwards;
}

.logo-center {
    fill: var(--forest-green);
    opacity: 0;
    animation: fadeIn 0.5s var(--ease-flow) 4s forwards;
}

@keyframes drawTri {
    to { stroke-dashoffset: 0; }
}

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

.footer-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 0.4em;
    text-transform: uppercase;
    font-weight: 300;
}

.footer-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 400px;
    margin-top: 0.5rem;
}

/* Section partenaires */
.partners-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
    width: 100%;
    max-width: 600px;
}

.partners-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.6;
}

.partners-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.partner-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    transition: all 0.3s var(--ease-sacred);
    padding: 0.5rem 0.75rem;
    border-radius: 3px;
}

.partner-link:hover {
    color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

.partner-link:hover .partner-icon {
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
}

.partner-icon {
    width: 24px;
    height: 24px;
    transition: all 0.3s var(--ease-sacred);
}

.partner-icon polygon {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linejoin: round;
}

.partner-separator {
    width: 1px;
    height: 16px;
    background: rgba(212, 175, 55, 0.2);
}

@keyframes footerReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ÉCRAN DE CHAT
   ============================================ */

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, var(--bg-medium) 0%, transparent 100%);
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.back-button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s var(--ease-sacred);
    color: var(--text-secondary);
}

.back-button svg {
    width: 20px;
    height: 20px;
}

.back-button:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateX(-3px);
}

.chat-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.chat-lang-script {
    font-size: 1.3rem;
    color: var(--gold);
    font-family: 'Noto Sans Canadian Aboriginal', 'Crimson Pro', serif;
}

.chat-lang-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--forest-green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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

.status-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   MESSAGES DE CHAT
   ============================================ */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    max-width: 80%;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    animation: messageSlide 0.4s var(--ease-flow) forwards;
    opacity: 0;
    line-height: 1.7;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--forest-green) 0%, #1a3a20 100%);
    border: 1px solid rgba(44, 85, 48, 0.5);
    border-bottom-right-radius: 4px;
    color: var(--text-primary);
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-light);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-bottom-left-radius: 4px;
}

.message.assistant .indigenous-text {
    display: block;
    font-size: 1.1rem;
    color: var(--gold);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    font-family: 'Noto Sans Canadian Aboriginal', 'Crimson Pro', serif;
}

.message.system {
    align-self: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    max-width: 90%;
}

.message.error {
    background: rgba(196, 30, 58, 0.1);
    border: 1px solid rgba(196, 30, 58, 0.3);
    color: #ff6b6b;
}

/* Indicateur de frappe */
.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 1rem 1.5rem;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============================================
   ZONE DE SAISIE
   ============================================ */

.chat-input-container {
    padding: 1rem 1.5rem 1.5rem;
    background: linear-gradient(0deg, var(--bg-medium) 0%, transparent 100%);
    border-top: 1px solid rgba(212, 175, 55, 0.08);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--bg-light);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 24px;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    transition: all 0.3s var(--ease-sacred);
}

.chat-input-wrapper:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.1);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    padding: 0.5rem 0;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

#chat-input:focus {
    outline: none;
}

.send-button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gold) 0%, var(--copper) 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s var(--ease-sacred);
    color: var(--bg-deep);
    flex-shrink: 0;
}

.send-button svg {
    width: 20px;
    height: 20px;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.4);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    opacity: 0.7;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sacred-container {
        padding: 2rem 1rem 4rem;
        gap: 2rem;
    }
    
    .medicine-wheel {
        width: min(150px, 40vw);
        height: min(150px, 40vw);
    }
    
    .pattern-border {
        width: 60px;
        height: 60px;
    }
    
    .languages-grid {
        grid-template-columns: 1fr;
    }
    
    .lang-card {
        max-width: 100%;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-input-container {
        padding: 0.75rem 1rem 1rem;
    }
    
    .partners-links {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .partner-separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .title-line.primary {
        letter-spacing: 0.1em;
    }
    
    .title-line.subtitle {
        letter-spacing: 0.15em;
    }
    
    .chat-header {
        padding: 0.75rem 1rem;
    }
    
    .chat-lang-script {
        font-size: 1.1rem;
    }
}

/* ============================================
   ANIMATIONS CONTINUES
   ============================================ */

.medicine-wheel {
    animation: wheelReveal 2s var(--ease-sacred) forwards,
               breathe 8s ease-in-out 2s infinite;
}

@keyframes breathe {
    0%, 100% {
        filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 50px rgba(212, 175, 55, 0.5));
    }
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-medium);
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

/* Sélection de texte */
::selection {
    background: rgba(212, 175, 55, 0.3);
    color: var(--text-primary);
}

