@import url('https://fonts.googleapis.com/css2?family=Lora:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #FAF7F2;
    --ink: #1B2A4A;
    --ink-soft: #4A5A78;
    --primary: #2C4770;
    --primary-dark: #1B2A4A;
    --accent: #E3A857;
    --accent-dark: #C98B33;
    --safe: #6B9080;
    --alert: #C1502E;
    --line: #DDD5C7;
    --card-bg: #FFFFFF;
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 18px;
    line-height: 1.6;
}

h1, h2, h3, .display {
    font-family: 'Lora', Georgia, serif;
    color: var(--primary-dark);
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 0.5em;
}

h1 { font-size: 2.75rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.4rem; }

p { color: var(--ink-soft); }

a { color: var(--primary); }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Navbar ---------- */
.navbar {
    background: var(--primary-dark);
    padding: 18px 0;
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-family: 'Lora', serif;
    font-size: 1.4rem;
    font-weight: 600;
    text-decoration: none;
}
.navbar-brand img {
    height: 40px;
}
.navbar-search {
    flex: 1;
    max-width: 360px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
}
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary {
    background: var(--accent);
    color: var(--primary-dark);
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-outline {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}
.btn-outline:hover { border-color: #fff; }

.btn-danger {
    background: transparent;
    color: var(--alert);
    border-color: var(--alert);
}
.btn-danger:hover { background: var(--alert); color: #fff; }

.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink-soft); }

.btn-block { width: 100%; }
.btn-sm { padding: 9px 18px; font-size: 0.95rem; }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Hero ---------- */
.hero {
    padding: 72px 0 56px;
}
.hero .eyebrow {
    color: var(--safe);
    font-weight: 600;
    margin-bottom: 10px;
}
.hero p.lead {
    font-size: 1.25rem;
    max-width: 560px;
}
.hero-actions {
    margin-top: 28px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---------- AI panel ---------- */
.ai-panel {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 720px;
    margin: 0 auto 64px;
    clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 0 100%);
}
.ai-panel-featured {
    max-width: 820px;
    padding: 36px;
    border: 2px solid var(--accent);
    box-shadow: 0 16px 40px rgba(227, 168, 87, 0.18);
}
.ai-panel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.ai-icon {
    font-size: 2.2rem;
    line-height: 1;
}
.ai-panel-header h3 { margin: 0; }
.ai-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--ink-soft);
}
.ai-status.ai-status-live {
    color: var(--safe);
    font-weight: 600;
}
.ai-status.ai-status-live::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--safe);
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.4); }
}
.ai-panel h3 { display: flex; align-items: center; gap: 10px; }
.aiChat {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    margin-top: 12px;
}
.btn-lg { padding: 16px 36px; font-size: 1.15rem; }

.ia-conversa {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    max-height: 420px;
    overflow-y: auto;
}
.ia-conversa:empty { display: none; }
.ia-bubble {
    padding: 14px 18px;
    border-radius: var(--radius);
    white-space: pre-wrap;
    line-height: 1.55;
    max-width: 90%;
}
.ia-bubble-user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
}
.ia-bubble-model {
    align-self: flex-start;
    background: var(--bg);
    border: 1px solid var(--line);
}
.ia-bubble-thinking {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
}
.ia-bubble-thinking span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.3;
    animation: thinking-bounce 1.2s ease-in-out infinite;
}
.ia-bubble-thinking span:nth-child(2) { animation-delay: 0.15s; }
.ia-bubble-thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes thinking-bounce {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* ---------- Sections ---------- */
.section {
    padding: 56px 0;
}
.section-primary {
    background: var(--primary);
    color: #fff;
}
.section-primary h1, .section-primary h2 { color: #fff; }
.section-primary p { color: rgba(255,255,255,0.85); }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

/* ---------- Pillar cards (compromissos) ---------- */
.pillars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.pillar {
    background: #fff;
    color: var(--ink);
    padding: 28px;
    border-top: 4px solid var(--accent);
}
.pillar:nth-child(2) { border-top-color: var(--safe); }
.pillar:nth-child(3) { border-top-color: var(--primary); }
.pillar svg { width: 44px; height: 44px; margin-bottom: 14px; color: var(--primary); }
.pillar h3 { margin-bottom: 10px; }

/* ---------- Course cards ---------- */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.course-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
}
.course-thumb {
    background: var(--primary);
    color: #fff;
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 600;
    padding: 32px 20px;
    min-height: 96px;
    display: flex;
    align-items: center;
}
.course-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}
.badge {
    display: inline-block;
    align-self: flex-start;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
}
.course-body .btn { margin-top: auto; }

/* ---------- Forms / auth cards ---------- */
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    padding: 44px;
    margin-top: 56px;
    clip-path: polygon(0 0, calc(100% - 32px) 0, 100% 32px, 100% 100%, 0 100%);
}
.auth-card h2 { text-align: left; }
.auth-card .subtitle { margin-bottom: 28px; }

.field { margin-bottom: 20px; }
.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--ink);
}
.field input, .field textarea, .field select {
    width: 100%;
    padding: 12px 14px;
    font-size: 1.05rem;
    font-family: 'Inter', sans-serif;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none;
    border-color: var(--primary);
}
.form-footer {
    text-align: center;
    margin-top: 16px;
    color: var(--ink-soft);
}

/* ---------- Alerts / states ---------- */
.state {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}
.state-info { background: #E8EEF6; color: var(--primary-dark); }
.state-error { background: #F7E4DD; color: var(--alert); }
.state-empty { background: #FBF0DD; color: var(--accent-dark); text-align: center; }

/* ---------- Footer ---------- */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.65);
    padding: 56px 0 24px;
    font-size: 0.95rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
}
.footer-brand img { height: 32px; }
.footer-tagline {
    max-width: 340px;
    line-height: 1.6;
}
.footer-heading {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-links a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: color 0.15s ease;
}
.footer-links a:hover { color: #fff; }
.footer-bottom {
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
}

/* ---------- Animações de entrada ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}
.fade-in-1 { animation-delay: 0.05s; }
.fade-in-2 { animation-delay: 0.15s; }
.fade-in-3 { animation-delay: 0.25s; }

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.pillar, .course-card, .news-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pillar:hover, .course-card:hover, .news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(27, 42, 74, 0.1);
}

@media (max-width: 820px) {
    .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- Curso detalhe / aulas ---------- */
.curso-header {
    background: var(--primary);
    color: #fff;
    padding: 48px 0;
}
.curso-header h1 { color: #fff; }
.curso-header p { color: rgba(255,255,255,0.85); }

.lesson-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
}
.lesson-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--card-bg);
}
.lesson-item:last-child { border-bottom: none; }
.lesson-number {
    font-family: 'Lora', serif;
    font-weight: 600;
    color: var(--accent-dark);
    font-size: 1.2rem;
    min-width: 28px;
}
.lesson-info { flex: 1; }
.lesson-info h3 { font-size: 1.1rem; margin-bottom: 4px; }
.lesson-info p { margin: 0; font-size: 0.95rem; }

/* ---------- Notícias ---------- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}
.news-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.news-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}
.news-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}
.news-date {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

/* ---------- Destaque de última notícia (home) ---------- */
.news-highlight {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0;
    background: var(--card-bg);
    border: 1px solid var(--line);
    overflow: hidden;
    clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 0 100%);
}
.news-highlight img {
    width: 100%;
    height: 100%;
    min-height: 220px;
    object-fit: cover;
}
.news-highlight-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}
.news-highlight-tag {
    color: var(--safe);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 820px) {
    .news-highlight { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .pillars { grid-template-columns: 1fr; }
    h1 { font-size: 2.1rem; }
    .navbar .container { flex-direction: column; align-items: stretch; }
    .navbar-search { max-width: none; }
}