:root {
    --background: #fafaf8;
    --surface: #ffffff;
    --foreground: #111111;
    --muted-foreground: #6b6b6b;
    --border: #dcdcdc;
    --border-strong: #111111;

    --success: #2f6b3a;
    --error: #8c2a2a;

    --font: 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
    --gutter: clamp(16px, 5vw, 60px);
    --max-width: 1280px;
    --radius: 2px;
    --ease: cubic-bezier(.55, .8, .15, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: 1.25rem;
    line-height: 1.5;
    background: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

:focus-visible {
    outline: 1px solid var(--foreground);
    outline-offset: 3px;
}

::selection {
    background: var(--foreground);
    color: #ffffff;
}

/* Botões e links com aparência de botão: texto não selecionável */
button,
.button {
    -webkit-user-select: none;
    user-select: none;
}

.icon {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Botões ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-width: 280px;
    padding: 14px 28px;
    background: var(--foreground);
    color: var(--background);
    border: 1px solid var(--foreground);
    border-radius: var(--radius);
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: .02em;
    text-decoration: none;
    cursor: pointer;
    transition: background .25s, color .25s;

    &:hover {
        background: transparent;
        color: var(--foreground);
    }

    &:disabled {
        opacity: .35;
        cursor: not-allowed;
    }

    &:disabled:hover {
        background: var(--foreground);
        color: var(--background);
    }
}

.button-small {
    min-width: 0;
    padding: 10px 22px;
    font-size: 1.15rem;
}

.button-outline {
    background: transparent;
    color: var(--foreground);

    &:hover {
        background: var(--foreground);
        color: var(--background);
    }
}

/* ---------- Seções ---------- */

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

/* Evita exibir o português por um instante quando o idioma é inglês */
.i18n-pending body {
    visibility: hidden;
}

/* ---------- Idioma ---------- */

.lang-switch {
    position: absolute;
    top: 24px;
    right: var(--gutter);
    z-index: 3;
    display: flex;
    gap: 6px;

    & button {
        display: flex;
        padding: 3px;
        background: none;
        border: 1px solid transparent;
        border-radius: var(--radius);
        cursor: pointer;
        opacity: .45;
        transition: opacity .2s, border-color .2s;

        &:hover {
            opacity: 1;
        }

        &[aria-pressed="true"] {
            opacity: 1;
            border-color: var(--foreground);
        }
    }

    & .flag {
        width: 26px;
        height: 18px;
        display: block;
    }
}

.section {
    padding: clamp(64px, 10vw, 120px) 0;
    border-top: 1px solid var(--border);
}

.section-title {
    font-size: clamp(2.75rem, 7vw, 4.5rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -.01em;
    margin-bottom: clamp(32px, 5vw, 56px);
}

.muted {
    color: var(--muted-foreground);
}

/* ---------- Início ---------- */

.home {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: clamp(32px, 6vw, 80px);
    padding: 96px 0;
}

.home-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
}

.home-greeting {
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    font-style: italic;
    color: var(--muted-foreground);
}

.home-title {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 300;
    line-height: 1.05;

    & em {
        font-style: italic;
        font-weight: 500;
    }
}

.home-bio {
    max-width: 34ch;
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    line-height: 1.4;
    color: var(--muted-foreground);
    margin-bottom: 16px;
}

.home-image {
    overflow: hidden;
    border-radius: var(--radius);

    & img {
        width: 100%;
        aspect-ratio: 4 / 5;
        object-fit: cover;
    }
}

.reveal {
    animation: reveal .9s var(--ease) both;
}

.reveal-delay {
    animation-delay: .5s;
}

.reveal-delay-2 {
    animation-delay: 1s;
}

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

.arrow-down {
    position: absolute;
    bottom: 48px;
    left: 50%;
    translate: -50% 0;
    font-size: 2rem;
    animation: bounce 3s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* ---------- Projetos ---------- */

.carousel {
    position: relative;
}

.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--surface);
    border: 1px solid var(--foreground);
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background .2s, color .2s;
    z-index: 2;

    &:hover {
        background: var(--foreground);
        color: var(--background);
    }

    &[hidden] {
        display: none;
    }
}

.carousel > .carousel-nav {
    position: absolute;
    top: 50%;
    translate: 0 -50%;

    &.prev { left: -24px; }
    &.next { right: -24px; }
}

.project {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(24px, 4vw, 56px);
    min-height: 520px;
    padding: clamp(24px, 4vw, 48px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;

    &.slide-next { animation: slide-next .6s var(--ease); }
    &.slide-prev { animation: slide-prev .6s var(--ease); }
}

@keyframes slide-next {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-prev {
    from { opacity: 0; transform: translateX(-60px); }
    to { opacity: 1; transform: translateX(0); }
}

.project-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.project-counter {
    font-size: 1rem;
    letter-spacing: .15em;
    color: var(--muted-foreground);
}

.project-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 500;
    font-style: italic;
    line-height: 1.1;
}

.project-description {
    flex: 1;
    color: var(--muted-foreground);
}

.project-link[hidden] {
    display: none;
}

.project-image {
    display: block;
    min-height: 280px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    overflow: hidden;
    cursor: zoom-in;

    & img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: 0% 50%;
        animation: pan 10s cubic-bezier(.645, .045, .355, 1) infinite alternate;
        transition: opacity .2s, transform .3s;
    }

    & img.fade-out {
        opacity: .3;
    }

    &:hover img {
        transform: scale(.98);
        opacity: .6;
    }
}

@keyframes pan {
    from { object-position: 0% 50%; }
    to { object-position: 100% 50%; }
}

/* Galeria */

.gallery {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: clamp(56px, 8vw, 80px) clamp(16px, 4vw, 80px);
    border: none;
    background: transparent;
    color: var(--background);

    &[open] {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
    }

    &::backdrop {
        background: rgba(10, 10, 10, .92);
    }

    & .carousel-nav {
        flex-shrink: 0;
        background: transparent;
        border-color: var(--background);
        color: var(--background);

        &:hover {
            background: var(--background);
            color: var(--foreground);
        }

        &[hidden] {
            display: flex;
            visibility: hidden;
        }
    }
}

.gallery-image {
    min-width: 0;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
    user-select: none;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--background);
    cursor: pointer;
}

.gallery-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    translate: -50% 0;
    font-size: 1rem;
    letter-spacing: .15em;
}

/* ---------- Habilidades ---------- */

.skill-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.skill {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.4rem;
    font-weight: 500;
    transition: border-color .25s, transform .25s;

    & img {
        width: 40px;
        height: 40px;
    }

    &:hover {
        border-color: var(--border-strong);
        transform: translateY(-4px);
    }
}

/* ---------- Cards (Experiência / Formação) ---------- */

.card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);

    & h3 {
        font-size: 1.75rem;
        font-weight: 500;
        line-height: 1.2;
    }
}

.card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-body {
    flex: 1;
    padding: 16px 0;
    border-block: 1px solid var(--border);
    font-size: 1.15rem;
    color: var(--muted-foreground);
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.logo-monogram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--foreground);
    border-radius: 50%;
    font-size: 1.6rem;
    font-style: italic;
    font-weight: 600;
}

.period {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1.1rem;
    white-space: nowrap;

    & hr {
        flex: 1;
        border: none;
        border-top: 1px solid var(--border);
    }
}

.timeline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    position: relative;

    & .card.current {
        border-color: var(--border-strong);

        & .period span:last-child {
            font-style: italic;
            font-weight: 600;
        }
    }
}

.card-wide {
    flex-direction: row;
    align-items: center;
    gap: 40px;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}

.logo-large {
    max-height: 110px;
    width: auto;
}

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

.contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(32px, 6vw, 80px);
}

.lead {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--muted-foreground);
    line-height: 1.3;
}

.social {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 40px;

    & a {
        display: inline-flex;
        align-items: center;
        gap: 14px;
        padding: 6px 0;
        text-decoration: none;
        color: var(--muted-foreground);
        border-bottom: 1px solid transparent;
        transition: color .2s, border-color .2s;

        &:hover {
            color: var(--foreground);
            border-color: var(--foreground);
        }
    }
}

.contact-form-wrapper {
    position: relative;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: opacity .2s;

    & label {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    & label > span {
        font-size: 1rem;
        letter-spacing: .12em;
        text-transform: uppercase;
        color: var(--muted-foreground);
    }

    & input,
    & textarea {
        width: 100%;
        padding: 12px 14px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        font-size: 1.2rem;
        resize: vertical;
        transition: border-color .2s;

        &:focus {
            outline: none;
            border-color: var(--foreground);
        }
    }

    & .button {
        align-self: stretch;
    }

    &.loading {
        opacity: .4;
        pointer-events: none;
    }
}

.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.form-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 100%;
    padding: 48px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.4rem;
    text-align: center;

    &[hidden] {
        display: none;
    }

    &.success { color: var(--success); }
    &.error { color: var(--error); }

    & .icon {
        font-size: 2.5rem;
    }
}

/* ---------- Rodapé ---------- */

.site-footer {
    padding: 32px var(--gutter);
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 1rem;
    color: var(--muted-foreground);
}

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

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

@media (max-width: 768px) {
    .home,
    .contact,
    .project {
        grid-template-columns: 1fr;
    }

    .home {
        padding: 80px 0 64px;
    }

    .lang-switch {
        top: 16px;
    }

    .home-image {
        order: -1;
        max-width: 280px;
    }

    .arrow-down {
        display: none;
    }

    .project {
        min-height: 0;
    }

    .project-image {
        order: -1;
        aspect-ratio: 16 / 10;
        min-height: 0;
    }

    .carousel > .carousel-nav {
        top: auto;
        bottom: -64px;
        translate: none;

        &.prev { left: calc(50% - 56px); }
        &.next { right: calc(50% - 56px); }
    }

    .carousel {
        margin-bottom: 64px;
    }

    .card-wide {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .button {
        min-width: 0;
    }

    .gallery {
        padding-inline: 8px;
        gap: 8px;

        & .carousel-nav {
            width: 40px;
            height: 40px;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
