/* Paleta herdada do README do perfil (github.com/Vinii225) */

@font-face {
    font-family: "Geist";
    src: url("../assets/fonts/geist-latin.woff2") format("woff2");
    font-weight: 400 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("../assets/fonts/geist-mono-latin.woff2") format("woff2");
    font-weight: 400 500;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0d1117;
    --bg-raised: #161b22;
    --line: #30363d;
    --text: #c9d1d9;
    --text-strong: #ffffff;
    --muted: #8b949e;
    --accent: #b794f6;
    --accent-soft: #e9d8fd;
    --accent-wash: rgba(183, 148, 246, 0.08);

    --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

    --measure: 68ch;
    --gutter: clamp(20px, 5vw, 48px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--accent-soft);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip {
    position: absolute;
    left: 16px;
    top: -48px;
    padding: 8px 12px;
    background: var(--accent);
    color: var(--bg);
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    z-index: 20;
}

.skip:focus {
    top: 16px;
}

/* ---------- Topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1040px;
    margin: 0 auto;
    padding: 18px var(--gutter);
    background: rgba(13, 17, 23, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color 200ms ease;
}

.topbar.is-scrolled {
    border-bottom-color: var(--line);
}

.mark {
    display: inline-flex;
    align-items: baseline;
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-strong);
    text-decoration: none;
}

.mark-prompt {
    color: var(--accent);
}

/* Digita o nome uma vez ao carregar (13 caracteres, um passo por letra).
   O recorte só existe durante a animação: no fim a largura volta a ser a do texto,
   sem cortar a última letra, e o nome não encolhe quando o menu aperta o topo. */
.mark {
    flex-shrink: 0;
}

.mark-text {
    display: inline-block;
    flex-shrink: 0;
    white-space: nowrap;
    animation: type 780ms steps(13, end) 250ms backwards;
}

@keyframes type {
    from { width: 0; overflow: hidden; }
    to { width: 13ch; overflow: hidden; }
}

.caret {
    color: var(--accent);
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.topbar nav {
    display: flex;
    gap: clamp(16px, 3vw, 28px);
    font-family: var(--font-mono);
    font-size: 13px;
}

.topbar nav a {
    color: var(--muted);
    text-decoration: none;
    transition: color 150ms ease;
}

.topbar nav a.is-active {
    color: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
    .topbar nav a:hover {
        color: var(--text-strong);
    }
}

/* ---------- Layout ---------- */

main {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.section {
    padding: clamp(72px, 12vw, 128px) 0 0;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 24px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

h1,
h2,
h3,
h4 {
    color: var(--text-strong);
    font-weight: 600;
    margin: 0;
}

h2 {
    font-size: clamp(24px, 3vw, 30px);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.section-note {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

/* ---------- Hero ---------- */

.hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 48px;
    align-items: start;
    padding-top: clamp(64px, 14vh, 140px);
}

.prompt {
    margin: 0 0 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--muted);
}

.prompt-user {
    color: var(--accent);
}

.prompt-path {
    color: var(--accent-soft);
}

.hero h1 {
    font-size: clamp(44px, 9vw, 96px);
    line-height: 0.98;
    letter-spacing: -0.045em;
    text-wrap: balance;
}

.lede {
    max-width: 46ch;
    margin: 28px 0 0;
    font-size: clamp(17px, 1.6vw, 19px);
    text-wrap: pretty;
}

.lede strong {
    color: var(--text-strong);
    font-weight: 500;
}

.avatar {
    margin: 0;
    width: clamp(140px, 16vw, 184px);
    margin-top: 6px;
    aspect-ratio: 1;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--line), 0 0 0 7px var(--bg), 0 0 0 8px rgba(183, 148, 246, 0.35);
}

.avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-block {
    margin-top: 32px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-ghost {
    border: 1px solid var(--line);
    color: var(--text-strong);
}

@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover {
        background: var(--accent-soft);
    }

    .btn-ghost:hover {
        border-color: var(--muted);
    }
}

.facts {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 16px 40px;
    margin: 56px 0 0;
    font-family: var(--font-mono);
    font-size: 13px;
}

.facts div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
    color: var(--text-strong);
}

/* ---------- Grupos de projetos ---------- */

.group + .group {
    margin-top: 72px;
}

.group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 24px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.group-head h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: -0.005em;
}

.group-head p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

/* ---------- Destaques ---------- */

.feature {
    padding: 32px 0;
    border-bottom: 1px solid var(--line);
}

.feature-visual {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-raised);
}

.feature-visual img {
    display: block;
    width: 100%;
    height: auto;
}

.feature-body {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(0, 2.2fr);
    grid-template-rows: auto 1fr;
    gap: 4px 40px;
    margin-top: 24px;
}

.feature-context,
.feature-body h4 {
    grid-column: 1;
}

.feature-body > :not(.feature-context):not(h4) {
    grid-column: 2;
}

.feature-body h4 {
    grid-row: 2;
    align-self: start;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.feature-body > p:nth-of-type(2) {
    grid-row: 1 / span 2;
    margin: 0;
    max-width: var(--measure);
    text-wrap: pretty;
}

.feature-context {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}

.feature-links {
    display: flex;
    gap: 20px;
    margin: 14px 0 0;
    font-family: var(--font-mono);
    font-size: 13px;
}

.feature-links a,
.p-extra a,
.more a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(183, 148, 246, 0.35);
    text-underline-offset: 4px;
    transition: text-decoration-color 150ms ease, color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .feature-links a:hover,
    .p-extra a:hover,
    .more a:hover {
        color: var(--accent-soft);
        text-decoration-color: currentColor;
    }
}

/* Diagrama do Hackbot: o destaque percorre os agentes na ordem do fluxo */

.feature-visual--diagram {
    padding: clamp(24px, 4vw, 40px);
    background:
        radial-gradient(circle at 1px 1px, rgba(139, 148, 158, 0.16) 1px, transparent 0) 0 0 / 20px 20px,
        var(--bg-raised);
}

.flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.flow-node {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    animation: step 6s var(--ease-out) infinite;
}

.flow-node:nth-child(2) { animation-delay: 1.2s; }
.flow-node:nth-child(3) { animation-delay: 2.4s; }
.flow-node:nth-child(4) { animation-delay: 3.6s; }
.flow-node:nth-child(5) { animation-delay: 4.8s; }

@keyframes step {
    0%, 22%, 100% { border-color: var(--line); }
    4%, 16% { border-color: var(--accent); }
}

/* Conector com seta entre um agente e o próximo */
.flow-node:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, var(--line), var(--accent));
}

.flow-node:not(:last-child)::before {
    content: "";
    position: absolute;
    top: calc(50% - 3px);
    left: calc(100% + 22px);
    border: 3px solid transparent;
    border-left: 5px solid var(--accent);
}

.flow-name {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-strong);
}

.flow-role {
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted);
}

.flow-node--coord .flow-name {
    color: var(--accent);
}

.flow-node--out {
    justify-content: center;
    border-style: dashed;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 12px;
}

.skills::before {
    content: "skills/";
    color: var(--muted);
    padding: 3px 0;
}

.skills li {
    padding: 3px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--accent-soft);
}

/* ---------- Lista de projetos ---------- */

.projects {
    list-style: none;
    margin: 0;
    padding: 0;
}

.project {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 32px;
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
    isolation: isolate;
}

/* Faixa de destaque que entra pela esquerda no hover */
.project::before {
    content: "";
    position: absolute;
    inset: 0 -16px;
    z-index: -1;
    border-radius: 10px;
    background: var(--accent-wash);
    clip-path: inset(0 100% 0 0 round 10px);
    transition: clip-path 260ms var(--ease-out);
}

.p-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.p-title {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.015em;
}

.p-link {
    text-decoration: none;
}

/* A linha inteira é clicável; links secundários ficam por cima */
.p-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.p-link:focus-visible {
    outline: none;
}

.p-arrow {
    display: inline-block;
    color: var(--accent);
    opacity: 0;
    transform: translate(-4px, 4px);
    transition: opacity 180ms ease, transform 220ms var(--ease-out);
}

.p-desc {
    margin: 0;
    max-width: var(--measure);
    text-wrap: pretty;
}

.p-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 4px 0 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
}

.p-tags span:not(:last-child)::after {
    content: "/";
    margin-left: 14px;
    color: var(--line);
}

.p-extra {
    position: relative;
    z-index: 1;
    margin: 2px 0 0;
    font-family: var(--font-mono);
    font-size: 13px;
}

.p-meta {
    margin: 0;
    padding-top: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    text-align: right;
}

.project:focus-within::before {
    clip-path: inset(0 0 0 0 round 10px);
}

.project:has(.p-link:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 8px;
}

.project:focus-within .p-arrow {
    opacity: 1;
    transform: translate(0, 0);
}

@media (hover: hover) and (pointer: fine) {
    .project:hover::before {
        clip-path: inset(0 0 0 0 round 10px);
    }

    .project:hover .p-arrow {
        opacity: 1;
        transform: translate(0, 0);
    }
}

.more {
    margin: 32px 0 0;
    padding-bottom: clamp(80px, 12vw, 128px);
    color: var(--muted);
    font-size: 15px;
}

/* ---------- Contato ---------- */

.email {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.email-address {
    font-size: clamp(19px, 2.2vw, 24px);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-strong);
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-decoration-thickness: 1px;
    text-underline-offset: 6px;
    transition: text-decoration-color 150ms ease;
    overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
    .email-address:hover {
        text-decoration-color: var(--accent);
    }
}

/* Os dois rótulos ocupam a mesma célula: o botão não muda de largura */
.copy {
    display: inline-grid;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text-strong);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: transform 160ms var(--ease-out), border-color 150ms ease;
}

.copy:active {
    transform: scale(0.97);
}

.copy-label {
    grid-area: 1 / 1;
    align-self: center;
    transition: opacity 200ms ease, filter 200ms ease, transform 200ms var(--ease-out);
}

.copy-done {
    color: var(--accent);
    opacity: 0;
    filter: blur(2px);
    transform: translateY(4px);
}

.copy.is-copied {
    border-color: var(--accent);
}

.copy.is-copied .copy-idle {
    opacity: 0;
    filter: blur(2px);
    transform: translateY(-4px);
}

.copy.is-copied .copy-done {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

@media (hover: hover) and (pointer: fine) {
    .copy:hover {
        border-color: var(--muted);
    }
}

/* ---------- Motion: entrada e reveal ----------
   Só são escondidos quando o JS confirmou que vai animar (.js-motion),
   então sem JS a página aparece completa. */

.js-motion [data-enter] {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(4px);
    animation: enter 700ms var(--ease-out) forwards;
}

.js-motion [data-enter="1"] { animation-delay: 60ms; }
.js-motion [data-enter="2"] { animation-delay: 140ms; }
.js-motion [data-enter="3"] { animation-delay: 210ms; }
.js-motion [data-enter="4"] { animation-delay: 280ms; }

@keyframes enter {
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.js-motion .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
    transition-delay: var(--stagger, 0ms);
}

.js-motion .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Responsivo ---------- */

@media (max-width: 860px) {
    .flow {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .flow-node {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
    }

    .flow-node--out {
        justify-content: flex-start;
    }

    .flow-node:not(:last-child)::after {
        top: 100%;
        left: 24px;
        width: 1px;
        height: 20px;
        background: linear-gradient(180deg, var(--line), var(--accent));
    }

    .flow-node:not(:last-child)::before {
        top: calc(100% + 14px);
        left: 21px;
        border: 3px solid transparent;
        border-top: 5px solid var(--accent);
    }

    .flow-role {
        text-align: right;
    }
}

@media (max-width: 760px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .avatar {
        margin-top: 0;
    }

    .avatar {
        grid-row: 1;
        width: 96px;
        border-radius: 22px;
        margin-bottom: 28px;
    }

    .feature-body {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }

    /* Prévia larga demais para o celular: mostra os primeiros widgets em tamanho legível */
    .feature-visual img {
        height: 220px;
        object-fit: cover;
        object-position: left center;
    }

    .feature-body > :not(.feature-context):not(h4),
    .feature-body > p:nth-of-type(2) {
        grid-column: 1;
        grid-row: auto;
    }

    .feature-body > p:nth-of-type(2) {
        margin-top: 10px;
    }

    .project {
        grid-template-columns: 1fr;
    }

    .p-meta {
        grid-row: 1;
        padding-top: 0;
        text-align: left;
    }

}

/* Movimento reduzido: mantém fades e cor, remove deslocamento e loops */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .caret,
    .flow-node,
    .mark-text {
        animation: none;
    }

    .js-motion [data-enter] {
        transform: none;
        filter: none;
        animation-duration: 200ms;
    }

    .js-motion .reveal {
        transform: none;
        transition-duration: 200ms;
    }

    .p-arrow,
    .copy-label {
        transform: none !important;
    }
}
