/* css/style.css */

/* --- Base Variables (Light Theme Default) --- */
:root {
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --transition-speed: 0.3s;
    --border-radius: 12px;

    --bg-color: #f4f4f9;
    --section-bg-color: #ffffff;
    --card-bg-color: #ffffff;
    --text-color: #1a1a1a;
    --text-muted-color: #555;
    --border-color: #e0e0e0;
    --link-color: #2980b9;
    --link-hover-color: #3498db;
    --avatar-border-color: #2980b9;
    --avatar-glow-color: rgba(41, 128, 185, 0.3);
    --chat-bubble-color: #e9e9f0;
    --chat-text-color: #333;
    --accent-color-1: #2980b9;  /* Blue for New Friend */
    --accent-color-2: #d35400;  /* Orange for Question */
    --accent-color-3: #8e44ad;  /* Purple for Homie */
}

/* --- Dark Theme via Media Query --- */
@media (prefers-color-scheme: dark) {
    :root:not(.light-mode) {
        --bg-color: #1a1a1a;
        --section-bg-color: #242424;
        --card-bg-color: #2c2c2c;
        --text-color: #f0f0f0;
        --text-muted-color: #a0a0a0;
        --border-color: #444;
        --link-color: #3498db;
        --link-hover-color: #5dade2;
        --avatar-border-color: #3498db;
        --avatar-glow-color: rgba(52, 152, 219, 0.5);
        --chat-bubble-color: #3a3a3a;
        --chat-text-color: #d0d0d0;
        --accent-color-1: #3498db;
        --accent-color-2: #e67e22;
        --accent-color-3: #9b59b6;
    }
}

/* --- Manual Override Classes for JS Toggle --- */
body.dark-mode {
    --bg-color: #1a1a1a;
    --section-bg-color: #242424;
    --card-bg-color: #2c2c2c;
    --text-color: #f0f0f0;
    --text-muted-color: #a0a0a0;
    --border-color: #444;
    --link-color: #3498db;
    --link-hover-color: #5dade2;
    --avatar-border-color: #3498db;
    --avatar-glow-color: rgba(52, 152, 219, 0.5);
    --chat-bubble-color: #3a3a3a;
    --chat-text-color: #d0d0d0;
    --accent-color-1: #3498db;
    --accent-color-2: #e67e22;
    --accent-color-3: #9b59b6;
}

body.light-mode {
    --bg-color: #f4f4f9;
    --section-bg-color: #ffffff;
    --card-bg-color: #ffffff;
    --text-color: #1a1a1a;
    --text-muted-color: #555;
    --border-color: #e0e0e0;
    --link-color: #2980b9;
    --link-hover-color: #3498db;
    --avatar-border-color: #2980b9;
    --avatar-glow-color: rgba(41, 128, 185, 0.3);
    --chat-bubble-color: #e9e9f0;
    --chat-text-color: #333;
    --accent-color-1: #2980b9;
    --accent-color-2: #d35400;
    --accent-color-3: #8e44ad;
}

/* --- Base & Resets --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    text-align: center;
    overflow-x: hidden;
}
h1, h2, h3 { font-weight: 700; }
p { line-height: 1.7; }
a { color: var(--link-color); text-decoration: none; transition: color var(--transition-speed) ease; }
a:hover { color: var(--link-hover-color); text-decoration: underline; }

/* --- Theme Toggle --- */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: transform 0.2s ease, background-color var(--transition-speed) ease;
}
.theme-toggle:hover { transform: scale(1.1); }
.theme-toggle svg {
    width: 22px;
    height: 22px;
}
.sun-icon, .moon-icon { display: none; }

/* Default to dark mode icon, light mode class shows sun */
.moon-icon { display: block; }
body.light-mode .sun-icon { display: block; }
body.light-mode .moon-icon { display: none; }


/* --- Main content wrapper --- */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Hero Section --- */
.hero-link, .hero-link:hover {
    color: inherit;
    text-decoration: none;
}
.hero-section { min-height: auto; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 6rem 0 4rem 0; }
.hero-content { display: flex; align-items: center; justify-content: center; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; }
.avatar-container { flex-shrink: 0; }
.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--avatar-border-color);
    box-shadow: 0 0 20px var(--avatar-glow-color);
    animation: breathing-glow 5s infinite ease-in-out;
}
.hero-text { text-align: left; }
.hero-intro { font-size: 1.5rem; color: var(--text-muted-color); margin: 0; }
.hero-text h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 600;
    margin: 0;
    background-image: linear-gradient(to right, #8baaf5 40%, #a2d9f5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@keyframes breathing-glow {
    0%, 100% { box-shadow: 0 0 20px var(--avatar-glow-color); }
    50% { box-shadow: 0 0 35px var(--avatar-glow-color); }
}

/* --- Typewriter --- */
.typewriter-container .label { font-size: 1rem; color: var(--text-muted-color); margin-bottom: 0.5rem; }
.typewriter-text { font-size: clamp(1.8rem, 5vw, 2.5rem); font-weight: 700; color: var(--accent-color-1); min-height: 7rem; }
.cursor { display: inline-block; width: 4px; height: 2.5rem; background-color: var(--accent-color-1); margin-left: 5px; animation: blink 0.7s infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* --- Shared Two-Column Layout --- */
.two-column-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding: 2rem 0 6rem 0;
    text-align: left;
    align-items: start;
}
.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: left;
}
.two-column-section .column {
    /* The general column for this layout */
}
.two-column-section .column p,
.two-column-section .column ul { margin-bottom: 1em; color: var(--text-muted-color); font-size: 1.1rem; }
.two-column-section .column ul { padding-left: 20px; }
.two-column-section .column ul li { margin-bottom: 0.5em; }

/* --- Anti-Pattern Section Specifics --- */
.chat-bubble-container {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto; /* Center the chat box in its column */
    overflow: hidden; /* This is the fix */
}
.chat-bubble {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    margin-bottom: 0.8rem;
    max-width: 80%;
    clear: both;
}
.chat-bubble.left {
    background-color: var(--chat-bubble-color);
    color: var(--chat-text-color);
    border-bottom-left-radius: 4px;
    float: left;
}
.chat-bubble.right {
    background-color: var(--accent-color-1);
    color: white;
    border-bottom-right-radius: 4px;
    float: right;
}

/* --- Protocol Section --- */
.protocol-section { padding: 6rem 0; text-align: center; }
.protocol-section .section-title { text-align: center; margin-bottom: 4rem; }
.sub-section { margin-bottom: 5rem; }
.sub-section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: left;
}
.protocol-section .two-column-section {
    padding: 0; /* Remove padding from the inner two-column layout */
    gap: 2rem;
}
#friend-title { color: var(--accent-color-1); }
#question-title { color: var(--accent-color-2); }
#homie-title { color: var(--accent-color-3); }


/* --- Footer --- */
.footer {
    padding: 3rem 0;
    font-size: 0.9rem;
    color: var(--text-muted-color);
    border-top: 1px solid var(--border-color);
}
.footer p {
    margin-bottom: 0.5rem;
}

/* --- Animations --- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* --- Responsive Media Queries --- */
@media (max-width: 768px) {
    .two-column-section { grid-template-columns: 1fr; gap: 2rem; }
    .hero-content { gap: 1rem; }
    .hero-text { text-align: center; }
    .section-title { text-align: center; }
}