/* Fonte local: sem ida ao Google Fonts, o texto pinta na primeira passada */
@font-face {
    font-family: "Fragment Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("fonts/fragment-mono-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
        U+FEFF, U+FFFD;
}

:root {
    --bg-color: #e6e6e4;
    --paper-color: #ffffff;
    --paper-tilt: -1.2deg;
    --text-color: #4a4a4a;
    --highlight-bg: #ee0606;
    --highlight-text: #ffffff;
    --link-color: #093ccf;
    --linkedin-blue: #0A66C2;
    --font-family: "Fragment Mono", "Courier New", Courier, monospace;
    --divider-color: #999;
    --placeholder-bg: #ececec;
    --header-box-width: 37rem;
    /* Dente + faixa sólida na base: a faixa cobre a emenda sem linha nos picos */
    --tear-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12' preserveAspectRatio='none'%3E%3Cpath fill='%23fff' d='M0 12V10L10 0l10 10v2H0z'/%3E%3C/svg%3E");
    --tear-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12' preserveAspectRatio='none'%3E%3Cpath fill='%23fff' d='M0 0h20v2L10 12 0 2z'/%3E%3C/svg%3E");
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    width: 100%;
    max-width: 100%;
    /* O papel inclinado projeta para fora: nunca vira rolagem lateral */
    overflow-x: hidden;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Tela branca inicial, acima de tudo */
.boot-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #ffffff;
    display: grid;
    place-items: center;
    transition: opacity 0.5s ease;
}

.boot-screen.is-off {
    opacity: 0;
    pointer-events: none;
}

.power-button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.7rem;
    width: clamp(104px, 24vw, 140px);
    height: clamp(104px, 24vw, 140px);
    border: 2px solid var(--text-color);
    border-radius: 50%;
    background: none;
    color: var(--text-color);
    font-family: var(--font-family);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.power-glyph {
    font-size: clamp(2.4rem, 8vw, 3.2rem);
    line-height: 1;
}

.power-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

@media (hover: hover) {
    .power-button:hover {
        background-color: var(--text-color);
        color: #ffffff;
        transform: scale(1.04);
    }
}

.power-button:active {
    transform: scale(0.96);
}

.container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.site-half {
    padding: 15px;
    min-width: 0;
}

.left-half {
    flex: 1 1 40%;
    width: 40%;
    min-width: min(100%, calc(var(--header-box-width) + 30px));
    max-width: 40%;
    position: relative;
    z-index: 1;
    margin-left: 22px;
    margin-top: 26px;
    margin-bottom: 40px;
    background-color: var(--paper-color);
    /* box-shadow em vez de filter: não rasteriza a coluna inteira */
    box-shadow:
        8px 10px 22px rgba(0, 0, 0, 0.22),
        2px 3px 6px rgba(0, 0, 0, 0.12);
    transform: rotate(var(--paper-tilt));
    transform-origin: top center;
}

/* A impressão só começa quando o site é ligado */
body.is-on .left-half {
    animation: print-receipt 2.8s cubic-bezier(0.3, 0.75, 0.3, 1) 0.4s backwards;
}

/* Borda superior rasgada, como recibo arrancado da impressora */
.left-half::after,
.print-paper::before {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 12px;
    bottom: calc(100% - 2px);
    background: var(--paper-color);
    pointer-events: none;
    -webkit-mask-image: var(--tear-up);
    mask-image: var(--tear-up);
    -webkit-mask-repeat: repeat-x;
    mask-repeat: repeat-x;
    -webkit-mask-size: 20px 12px;
    mask-size: 20px 12px;
}

@keyframes print-receipt {
    from {
        transform: translateY(-106%) rotate(var(--paper-tilt));
    }
    to {
        transform: translateY(0) rotate(var(--paper-tilt));
    }
}

.scrap-stack {
    font-size: 2.2rem;
    margin-bottom: 1.2rem;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
}

.paper-scrap {
    border: none;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Papéis impressos de baixo para cima, ao lado do recibo */
.print-paper {
    position: fixed;
    bottom: 0;
    right: var(--paper-right);
    width: min(520px, calc(100vw - 48px));
    /* O conteúdo define o comprimento do papel, como no recibo principal */
    height: auto;
    max-height: calc(100dvh - 28px);
    z-index: 30;
    padding: 30px 30px 20px;
    background: var(--paper-color);
    transform: translateY(108%) rotate(var(--open-tilt, 1.3deg));
    transform-origin: bottom center;
    transition: transform 1s cubic-bezier(0.55, 0.05, 0.65, 0.4);
    box-shadow: -8px -4px 20px rgba(0, 0, 0, 0.26);
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

#skills-paper {
    --open-tilt: 1.2deg;
    --paper-right: clamp(10px, 2vw, 40px);
}

#about-paper {
    --open-tilt: -1.6deg;
    /* Começa um pouco antes da metade do outro: desloca ~44% da largura */
    --paper-right: calc(
        clamp(10px, 2vw, 40px) + min(520px, calc(100vw - 48px)) * 0.44
    );
}

.print-paper.is-open {
    /* Desce o bastante para a ponta inclinada do fim do papel sair da tela */
    transform: translateY(14px) rotate(var(--open-tilt, 1.3deg));
    transition: transform 2s cubic-bezier(0.3, 0.75, 0.3, 1);
    pointer-events: auto;
}

.paper-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: none;
    color: var(--text-color);
    border: none;
    font-family: var(--font-family);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
    padding: 8px 10px;
    cursor: pointer;
}

@media (hover: hover) {
    .paper-close:hover {
        color: #1a1a1a;
    }
}

.paper-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    font-size: 1.15rem;
}

.paper-content::-webkit-scrollbar {
    display: none;
}

.about-photo {
    position: relative;
    width: min(100%, calc(min(44vh, 340px) * 3 / 4));
    aspect-ratio: 3 / 4;
    margin: 0 auto 1.2rem;
    overflow: hidden;
    background: transparent;
}

.about-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(2px 3px 5px rgba(0, 0, 0, 0.22));
}

.paper-title {
    font-size: 2rem;
    font-weight: 900;
    -webkit-text-stroke: 1px currentColor;
    paint-order: stroke fill;
    margin: 0.8rem 0 1.2rem;
}

.projetos-title {
    font-size: 1.8rem;
    font-weight: 400;
    line-height: 1.3;
    margin: 0.8rem 0 1.2rem;
}

.title-cursor {
    animation: cursor-blink 0.9s step-end infinite;
}

.about-text p {
    font-size: 1.15rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.skills-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.skills-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
    white-space: nowrap;
}

.skills-list .skill-bar {
    color: #999;
    letter-spacing: 0.05em;
}

.right-half {
    /* Encolhe quando o recibo usa sua largura mínima: evita rolagem lateral */
    flex: 1 1 60%;
    min-width: 0;
    max-width: 60%;
}

.content {
    width: 100%;
    max-width: min(80ch, 100%);
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

p {
    margin-bottom: 0.2rem;
}

a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1.5px;
}

a:hover {
    color: var(--highlight-text);
    background-color: var(--link-color);
}

.header-frame {
    width: 100%;
    overflow: hidden;
}

.header {
    width: var(--header-box-width);
    transform-origin: top left;
    overflow: hidden;
}

.header .divider {
    width: 0;
    min-width: 100%;
}

.header-info {
    font-size: 1.8rem;
    line-height: 1.3;
    margin-bottom: 0.85rem;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.header-info p,
.header-links,
.print-time {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    min-width: 0;
}

.field-block {
    overflow: visible;
}

.field-label {
    display: block;
    padding-left: 3ch;
    box-sizing: border-box;
}

.field-value {
    display: block;
    padding-left: calc(3ch + var(--label-ch, 0ch));
    box-sizing: border-box;
}

.typewriter-dev {
    display: inline-grid;
    flex-shrink: 0;
    justify-items: end;
    align-items: baseline;
}

.typewriter-sizer {
    grid-area: 1 / 1;
    visibility: hidden;
    white-space: nowrap;
    pointer-events: none;
}

.typewriter-live {
    grid-area: 1 / 1;
    display: inline-flex;
    align-items: baseline;
    justify-self: end;
    white-space: nowrap;
}

.type-cursor {
    display: inline-block;
    width: 0.55ch;
    height: 1em;
    margin-left: 2px;
    background-color: var(--text-color);
    vertical-align: -0.1em;
    animation: cursor-blink 0.9s step-end infinite;
}

@keyframes cursor-blink {
    0%,
    50% {
        opacity: 1;
    }
    51%,
    100% {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.is-on .left-half {
        animation: none;
    }

    .print-paper,
    .print-paper.is-open {
        transition: none;
    }

    .type-cursor,
    .title-cursor {
        animation: none;
        opacity: 1;
    }
}

.divider {
    letter-spacing: 0.1em;
    margin: 1.5rem 0;
    color: var(--text-color);
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

.divider.solid {
    border-top: 1px dashed var(--divider-color);
    color: transparent;
    margin: 3rem 0;
    height: 1px;
}

.header-info p.can-wrap {
    white-space: normal;
    overflow: visible;
}

.block-gap {
    margin-top: 0.65em;
}

.highlight {
    display: inline-block;
    white-space: nowrap;
    max-width: 100%;
    background-color: var(--highlight-bg);
    color: var(--highlight-text);
    padding: 0 4px;
    font-weight: 900;
    font-size: 1.38em;
    -webkit-text-stroke: 1.15px currentColor;
    paint-order: stroke fill;
    vertical-align: baseline;
}

.heavy {
    font-weight: 900;
    font-size: 1.38em;
    -webkit-text-stroke: 1.15px currentColor;
    paint-order: stroke fill;
}

.logo-name {
    display: inline-block;
    font-size: 1.72em;
    line-height: 0.8;
    letter-spacing: -0.16em;
    -webkit-text-stroke: 2.35px currentColor;
    transform: scaleY(0.82) scaleX(1.02);
    transform-origin: left center;
    white-space: nowrap;
}

.header-links {
    font-size: 2.2rem;
    margin-bottom: 2rem;
}

.link-highlight {
    display: inline;
    background-color: var(--linkedin-blue);
    color: #ffffff;
    padding: 0 4px;
    font-size: inherit;
    font-weight: inherit;
    -webkit-text-stroke: 0;
    text-decoration: none;
}

a.link-highlight:hover,
button.link-highlight:hover {
    color: #ffffff;
    background-color: #004182;
    text-decoration: none;
}

.print-time {
    font-size: 2.2rem;
}

.project {
    margin-bottom: 1rem;
    min-width: 0;
}

.placeholder-img {
    background-color: var(--placeholder-bg);
    position: relative;
    width: 100%;
    overflow: hidden;
    margin-bottom: 1rem;
    background-image: radial-gradient(#b0b0b0 1px, transparent 1px);
    background-size: 20px 20px;
}

.placeholder-img.has-shot {
    display: block;
    text-decoration: none;
    color: inherit;
    background-image: none;
    background-color: #0b0d10;
}

a.placeholder-img.has-shot:hover {
    color: inherit;
    background-color: #0b0d10;
}

.placeholder-img.has-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.placeholder-img.medium-img.has-shot img {
    object-position: center 38%;
}

.placeholder-img.has-shot .img-label {
    color: #ececec;
    background: rgba(11, 13, 16, 0.72);
    padding: 2px 6px;
}

.collection-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 80% 0%, rgba(255, 157, 46, 0.18), transparent 42%),
        #0b0d10;
}

.collection-card-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 1.4rem 1.5rem;
    width: 100%;
    color: #f4f7fa;
}

.collection-kicker,
.collection-sub,
.collection-line {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8d99a6;
}

.collection-metric {
    font-size: clamp(2.4rem, 8vw, 3.4rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.04em;
    color: #ff9d2e;
}

.collection-sub {
    color: #f4f7fa;
    letter-spacing: 0.08em;
}

.collection-line {
    margin-top: 0.85rem;
    color: #ff9d2e;
}

.large-img {
    height: 450px;
}

.medium-img {
    height: 350px;
}

.img-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 0.7rem;
    color: #888;
}

.project-details p {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    color: #4a4a4a;
}

.project-details .credits {
    color: #666;
    font-size: 0.8rem;
}

.project-details .credits a {
    color: inherit;
}

.project-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
    min-width: 0;
}

.project-grid .project {
    min-width: 0;
}

.footer {
    margin-top: 4rem;
}

.footer-specs {
    font-size: 2.2rem;
    letter-spacing: -0.02em;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    min-width: 0;
}

.spec-arrows {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.spec-details {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.2rem;
}

.spec-line {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.receipt-thanks {
    display: block;
    text-align: center;
    font-weight: 900;
    font-size: clamp(2.6rem, 9vw, 4.4rem);
    line-height: 0.8;
    letter-spacing: -0.12em;
    -webkit-text-stroke: 2.6px currentColor;
    paint-order: stroke fill;
    transform: scaleY(0.82) scaleX(1.02);
    transform-origin: center;
    white-space: nowrap;
    margin: 0.2rem 0 1.4rem;
}

.barcode-section {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0.4rem;
    min-width: 0;
}

.barcode-wrapper {
    display: inline-flex;
    flex-direction: column;
    width: max-content;
    max-width: 100%;
    min-width: 0;
}

.numbers,
.receipt-attention {
    letter-spacing: 0.1em;
    font-size: clamp(0.7rem, 4.2vw, 1.8rem);
    text-align: center;
}

.numbers {
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
}

.receipt-attention {
    font-weight: 900;
    -webkit-text-stroke: 0.55px currentColor;
    paint-order: stroke fill;
    letter-spacing: 0.04em;
    margin: 0.65rem 0 0;
    line-height: 1.25;
}

.barcode {
    width: 100%;
}

.barcode-lines {
    height: 120px;
    width: 100%;
    background: repeating-linear-gradient(
        90deg,
        var(--text-color),
        var(--text-color) 3px,
        transparent 3px,
        transparent 6px,
        var(--text-color) 6px,
        var(--text-color) 7px,
        transparent 7px,
        transparent 9px,
        var(--text-color) 9px,
        var(--text-color) 14px,
        transparent 14px,
        transparent 15px,
        var(--text-color) 15px,
        var(--text-color) 17px,
        transparent 17px,
        transparent 20px,
        var(--text-color) 20px,
        var(--text-color) 25px,
        transparent 25px,
        transparent 28px
    );
}

/* Tablet / janela estreita: conteúdo ocupa a tela, metade vazia some */
@media (max-width: 1024px) {
    :root {
        --paper-tilt: -0.5deg;
    }

    .container {
        flex-direction: column;
        padding-top: 10px;
    }

    .left-half,
    .right-half {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }

    .left-half {
        width: calc(100% - 16px);
        margin: 24px auto 32px;
    }

    /* Papéis um pouco mais estreitos no tablet, mas ainda defasados */
    .print-paper {
        width: min(520px, calc(100vw - 20px));
        padding: 26px 20px 16px;
    }

    #skills-paper {
        --paper-right: 8px;
    }

    #about-paper {
        --paper-right: calc(8px + min(520px, calc(100vw - 20px)) * 0.4);
    }

    .right-half {
        display: none;
    }

    .content {
        max-width: 100%;
    }

    .footer-specs {
        font-size: clamp(1.35rem, 4.4vw, 2.2rem);
    }

    .large-img {
        height: min(450px, 52vw);
    }

    .medium-img {
        height: min(350px, 42vw);
    }

    .numbers,
    .receipt-attention {
        font-size: clamp(0.75rem, 4.8vw, 1.8rem);
    }
}

/* Celular */
@media (max-width: 640px) {
    body {
        font-size: clamp(0.95rem, 4vw, 1.25rem);
    }

    .site-half {
        padding: 12px;
    }

    .footer-specs {
        font-size: clamp(1.1rem, 5.2vw, 1.5rem);
    }

    .divider {
        margin: 1rem 0;
    }

    .divider.solid {
        margin: 2rem 0;
    }

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

    .large-img {
        height: min(280px, 58vw);
    }

    .medium-img {
        height: min(240px, 52vw);
    }

    .footer {
        margin-top: 2.5rem;
    }

    .barcode-lines {
        height: 80px;
    }

    .img-label {
        font-size: 0.6rem;
        max-width: calc(100% - 20px);
    }

    /* Sombras menores custam menos paint em GPU de celular */
    .left-half {
        box-shadow: 4px 5px 12px rgba(0, 0, 0, 0.2);
    }

    .print-paper {
        box-shadow: -4px -3px 12px rgba(0, 0, 0, 0.24);
        width: min(86vw, 520px);
    }

    #skills-paper {
        --paper-right: 6px;
    }

    #about-paper {
        /* No celular o offset de desktop empurra o papel para fora à esquerda */
        left: 8px;
        right: 8px;
        width: auto;
        --paper-right: 8px;
        --open-tilt: 0deg;
    }

    /* Alvo de toque confortável para fechar */
    .paper-close {
        padding: 10px 16px;
    }
}

@media (max-width: 380px) {
    .footer-specs {
        font-size: 1.05rem;
    }

    /* Sem isso as barras de skill não cabem na linha */
    .paper-content {
        font-size: 1rem;
    }

    .skills-list li {
        font-size: 0.95rem;
        gap: 0.5rem;
    }

    .spec-row,
    .spec-line {
        flex-wrap: wrap;
    }
}
