/*
 * Página inicial (HelloFunction no template.yaml). Fica aqui, e não inline,
 * porque a CSP do CloudFront aceita folhas de estilo da mesma origem
 * (style-src 'self'), mas não <style>. Tema claro por padrão; o escuro vem de
 * data-theme="dark" (js/theme-init.js e js/home.js, mesma chave 'theme' do dashboard).
 */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/dashboard/fonts/inter-latin-wght.woff2') format('woff2');
}

:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --card: #ffffff;
    --card-hover: #f3f5fa;
    --line: #e3e6ee;
    --line-strong: #cfd4e0;
    --text: #161a23;
    --muted: #596074;
    --dim: #7b8296;
    --green: #22c55e;
    --green-deep: #16a34a;
    --green-text: #15803d;
    --blue: #2563eb;
    --pink: #db2777;
    --yellow: #ca8a04;
    --ov: rgba(16, 24, 40, 0.05);
    --ov-strong: rgba(16, 24, 40, 0.08);
    --nav-bg: rgba(246, 247, 251, 0.8);
    --stats-bg: rgba(255, 255, 255, 0.8);
    --chip-text: #3b4256;
    --status-text: #166534;
    --grid: rgba(16, 24, 40, 0.04);
    --h1-from: #161a23;
    --h1-to: #5b6478;
    --stat-from: #d97706;
    --stat-to: #b45309;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0d12;
    --card: #12151c;
    --card-hover: #171b24;
    --line: #232834;
    --line-strong: #323846;
    --text: #e8eaf0;
    --muted: #9aa0ae;
    --dim: #6b7183;
    --green: #4ade80;
    --green-deep: #22c55e;
    --green-text: #4ade80;
    --blue: #60a5fa;
    --pink: #f472b6;
    --yellow: #facc15;
    --ov: rgba(255, 255, 255, 0.05);
    --ov-strong: rgba(255, 255, 255, 0.06);
    --nav-bg: rgba(11, 13, 18, 0.72);
    --stats-bg: rgba(18, 21, 28, 0.7);
    --chip-text: #c9cdd8;
    --status-text: #bbf7d0;
    --grid: var(--grid);
    --h1-from: #ffffff;
    --h1-to: #a8b0c2;
    --stat-from: #fde68a;
    --stat-to: #f59e0b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body.home {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv11', 'ss03';
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: -0.006em;
    color: var(--text);
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(74, 222, 128, 0.10), transparent 60%),
        radial-gradient(700px 450px at -10% 20%, rgba(96, 165, 250, 0.08), transparent 60%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* Grade sutil no fundo, sumindo para baixo */
body.home::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, #000, transparent 70%);
    pointer-events: none;
}

::selection { background: rgba(74, 222, 128, 0.3); }
a { color: inherit; }
h1, h2, h3 { letter-spacing: -0.02em; }
code { font-family: var(--mono); }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--dim); font-weight: 500; }

/* ---------- Navegação ---------- */
.topnav {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--ov);
    background: var(--nav-bg);
    backdrop-filter: saturate(1.4) blur(14px);
}

.topnav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 15px; font-weight: 600; text-decoration: none; }
.logo-dim { color: var(--dim); }
.logo-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--card);
    color: var(--green-text);
    font-size: 12px;
    font-weight: 700;
}

.topnav-links { display: flex; align-items: center; gap: 4px; }
.topnav-links a:not(.btn) {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.topnav-links a:not(.btn):hover { color: var(--text); background: var(--ov); }
.topnav-links .btn { margin-left: 8px; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.2s, transform 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .lab:focus-visible, summary:focus-visible, .topnav-links a:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 3px;
}

.btn-primary {
    background: var(--green);
    color: #052e14;
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.4), 0 8px 24px -8px rgba(74, 222, 128, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { background: #6ee7a0; box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.6), 0 12px 32px -8px rgba(74, 222, 128, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

.btn-ghost { border-color: var(--line-strong); background: var(--ov); color: var(--text); }
.btn-ghost:hover { border-color: var(--dim); background: var(--ov-strong); }

.btn-sm { padding: 8px 14px; border-radius: 9px; font-size: 13.5px; }

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: center;
    gap: 48px;
    padding: 72px 0 56px;
}

.hero-id { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }

.avatar {
    display: block;
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--green);
    box-shadow: 0 0 0 5px var(--bg), 0 0 0 6px var(--line-strong), 0 12px 32px -6px rgba(74, 222, 128, 0.4);
}

.hello { margin: 0 0 6px; color: var(--green-text); font-family: var(--mono); font-size: 15px; }

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 10px;
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.08);
    color: var(--status-text);
    font-size: 13px;
    font-weight: 500;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: ping 2s ease-out infinite; }

@keyframes ping {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
    80%, 100% { box-shadow: 0 0 0 8px transparent; }
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(2.6rem, 7vw, 4.2rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.04em;
    background: linear-gradient(180deg, var(--h1-from) 30%, var(--h1-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.role { margin: 0 0 18px; color: var(--text); font-size: 1.1rem; font-weight: 500; }
.role span { color: var(--dim); }
.lead { max-width: 560px; margin: 0 0 30px; color: var(--muted); font-size: 1.02rem; line-height: 1.7; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-art { position: relative; }
.hero-art::before {
    content: '';
    position: absolute;
    inset: 10% 5%;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(74, 222, 128, 0.22), transparent);
    filter: blur(30px);
}
.terminal {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--ov);
    transform: perspective(1200px) rotateY(-6deg) rotateX(2deg);
    transition: transform 0.4s ease;
}
.hero-art:hover .terminal { transform: none; }

/* ---------- Métricas ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0 0 88px;
    padding: 0;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--stats-bg);
    overflow: hidden;
}
.stat { display: flex; flex-direction: column; gap: 4px; padding: 22px 22px 20px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--stat-from), var(--yellow) 60%, var(--stat-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat span { color: var(--muted); font-size: 0.86rem; line-height: 1.4; }

/* ---------- Seções ---------- */
.section { margin: 0 0 88px; }
.section-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 10px; margin: 0 0 24px; font-size: 1.6rem; font-weight: 700; }
.section-title code { color: var(--muted); font-size: 1rem; font-weight: 500; letter-spacing: 0; }
.section-title .hash { color: var(--green-text); font-family: var(--mono); font-weight: 500; }

/* ---------- Laboratórios ---------- */
.labs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }

.lab {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.lab h3 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 700; }
.lab p { flex: 1; margin: 0 0 20px; color: var(--muted); font-size: 0.95rem; line-height: 1.6; }

.lab-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.lab-emoji {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--ov);
    font-size: 1.5rem;
}
.lab-cta { font-weight: 600; font-size: 0.95rem; }
.lab-cta span { display: inline-block; transition: transform 0.2s; }

.lab-live {
    border-color: rgba(74, 222, 128, 0.45);
    background: linear-gradient(180deg, rgba(74, 222, 128, 0.07), transparent 55%), var(--card);
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.08), 0 20px 40px -24px rgba(74, 222, 128, 0.5);
}
.lab-live .lab-cta { color: var(--green-text); }
.lab-live:hover { transform: translateY(-4px); border-color: var(--green); box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.3), 0 28px 50px -24px rgba(74, 222, 128, 0.65); }
.lab-live:hover .lab-cta span { transform: translateX(4px); }

.lab-locked { cursor: not-allowed; }
.lab-locked h3, .lab-locked .lab-emoji { opacity: 0.6; filter: grayscale(1); }
.lab-locked p, .lab-locked .lab-cta { color: var(--dim); }

.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; }
.tag-live { background: rgba(74, 222, 128, 0.14); color: var(--green-text); box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.35); }
.tag-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: ping 2s ease-out infinite; }
.tag-soon { border: 1px dashed var(--line-strong); color: var(--dim); font-weight: 600; letter-spacing: 0; }

/* ---------- Stack ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li {
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--chip-text);
    font-size: 0.88rem;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.chips li:hover { border-color: rgba(96, 165, 250, 0.5); background: rgba(96, 165, 250, 0.08); color: var(--text); }

/* ---------- Carreira ---------- */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ''; position: absolute; top: 8px; bottom: 8px; left: 5px; width: 2px; background: linear-gradient(var(--pink), var(--line) 40%); }
.timeline li { position: relative; padding: 0 0 28px 36px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 0;
    width: 12px;
    height: 12px;
    border: 2px solid var(--pink);
    border-radius: 50%;
    background: var(--bg);
}
.timeline li:first-child::before { background: var(--pink); box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.18); }
.timeline .when { display: block; color: var(--pink); font-family: var(--mono); font-size: 0.82rem; }
.timeline strong { display: block; margin: 2px 0 4px; font-size: 1.05rem; }
.timeline p { max-width: 680px; margin: 0; color: var(--muted); line-height: 1.6; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--card); transition: border-color 0.15s, background 0.15s; }
.faq details:hover { border-color: var(--line-strong); }
.faq details[open] { border-color: var(--line-strong); background: var(--card-hover); }
.faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex-shrink: 0; color: var(--green-text); font-family: var(--mono); font-size: 1.2rem; font-weight: 400; transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0; padding: 0 20px 18px; color: var(--muted); line-height: 1.6; }

/* ---------- Chamada final ---------- */
.cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 56px;
    padding: 32px;
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 20px;
    background:
        radial-gradient(600px 200px at 100% 0%, rgba(74, 222, 128, 0.14), transparent 70%),
        var(--card);
}
.cta h2 { margin: 0 0 4px; font-size: 1.5rem; }
.cta p { margin: 0; color: var(--muted); }

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding-top: 24px;
    padding-bottom: 40px;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 0.88rem;
}

/* ---------- Telas menores ---------- */
@media (max-width: 860px) {
    .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding: 48px 0 40px; }
    .terminal { transform: none; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat + .stat { border-left: 0; }
    .stat { border-top: 1px solid var(--line); }
    .stat:nth-child(-n + 2) { border-top: 0; }
    .stat:nth-child(even) { border-left: 1px solid var(--line); }
    .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .topnav-links a:not(.btn) { display: none; }
    .hero-id { gap: 14px; }
    .avatar { width: 72px; height: 72px; }
    .section, .stats { margin-bottom: 64px; }
    .section-title { font-size: 1.35rem; }
    .actions .btn { flex: 1 1 auto; }
    .cta { padding: 24px; }
    .cta .btn { width: 100%; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}

/* ---------- Botão de tema ---------- */
.theme-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-left: 4px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--ov);
    color: var(--text);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}
.theme-btn:hover { background: var(--ov-strong); }
.theme-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
