/* ============================================================
   phaverbeck.com — redesign v2 (HTML/CSS/JS puro)
   Estados iniciais escondidos são gated por html.js → sem JS,
   tudo nasce visível (acessível e indexável).
   ============================================================ */

:root {
  --bg: #0a0a0a; --fg: #fff; --muted: #888;
  --acc: #00C840; --acc-rgb: 0, 200, 64;        /* dev: verde terminal contido */
  --s1: 8px; --s2: 16px; --s3: 32px; --s4: 64px; --s5: 128px;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}
[data-persona="eng"] { --acc: #FFD400; --acc-rgb: 255, 212, 0; }   /* eng: amarelo */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; color-scheme: dark; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-mono); line-height: 1.5; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }

.accent { color: var(--acc); text-shadow: 0 0 12px rgba(var(--acc-rgb), .2); transition: color .5s, text-shadow .5s; }
.muted { color: var(--muted); }
.page { max-width: 1200px; margin: 0 auto; padding: 0 var(--s3); }
section { padding: var(--s5) 0; }

/* ---------- header ---------- */
header { position: sticky; top: 0; z-index: 10; background: rgba(10,10,10,.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,255,255,.12); }
.bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); max-width: 1200px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 1.1rem; }
.tabs { display: flex; border: 1px solid rgba(255,255,255,.25); border-radius: 4px; overflow: hidden; }
.tab { background: none; border: none; color: var(--muted); font-weight: 700; font-size: .95rem; padding: 6px 14px; cursor: pointer; transition: color .3s, background .3s; }
.tab + .tab { border-left: 1px solid rgba(255,255,255,.25); }
.tab.on { color: var(--acc); background: rgba(var(--acc-rgb), .08); }
.anchors { display: flex; gap: 6px; margin-left: auto; }
.anchors a { position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; padding: 5px 12px; font-size: .78rem; font-weight: 700; }
.anchors a i { position: absolute; inset: 0; background: var(--acc); transform: translateX(-101%); transition: transform .3s ease; }
.anchors a span { position: relative; z-index: 1; transition: color .3s ease; }
.anchors a:hover i { transform: translateX(0); }
.anchors a:hover span { color: var(--bg); }
.socials { display: flex; align-items: center; gap: var(--s2); }
.socials a { display: inline-flex; }
.socials svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke .25s, transform .25s ease, filter .25s; }
.socials a:hover svg { stroke: var(--acc); transform: translateY(-2px); filter: drop-shadow(0 0 6px rgba(var(--acc-rgb), .5)); }
.flags { display: flex; align-items: center; gap: 6px; }
.flags button { background: none; border: none; font-size: .95rem; line-height: 1; padding: 2px; border-radius: 3px; transition: filter .25s, opacity .25s; }
.flags button.off { filter: grayscale(.8); opacity: .5; }
.flags button:hover { filter: none; opacity: 1; }

/* ---------- hero ---------- */
.hero { position: relative; padding: var(--s5) 0; }
.hero .glow { position: absolute; inset: -40% -20%; pointer-events: none; background: radial-gradient(420px circle at var(--mx, 30%) var(--my, 30%), rgba(var(--acc-rgb), .06), transparent 70%); }
.mask { overflow: hidden; }
html.js .mask > div { transform: translateY(110%); transition: transform .7s cubic-bezier(.2,.7,.3,1); }
html.js .hero.loaded .mask > div,
html.js [data-reveal].vis .mask > div { transform: translateY(0); }
.mask.d1 > div { transition-delay: .08s; }
.mask.d2 > div { transition-delay: .16s; }
.mask.d3 > div { transition-delay: .24s; }
.huge { font-size: clamp(3.4rem, 11vw, 9.5rem); font-weight: 800; line-height: .95; letter-spacing: -.05em; text-transform: uppercase; }
.role { font-size: clamp(1rem, 2.2vw, 1.5rem); font-weight: 700; margin-top: var(--s3); }
.cursor { display: inline-block; width: .55ch; height: 1em; background: var(--acc); vertical-align: text-bottom; animation: blink .8s steps(1) infinite; transition: background .5s; }
@keyframes blink { 50% { opacity: 0; } }
.anchor-p { max-width: 60ch; margin-top: var(--s3); color: var(--muted); }
.pswap { transition: opacity .3s ease, transform .3s ease; }
.pswap.fading { opacity: 0; transform: translateY(10px); }

/* ---------- títulos de seção ---------- */
h2.sec { font-size: clamp(2.6rem, 6vw, 4.5rem); font-weight: 800; text-transform: uppercase; letter-spacing: -.04em; line-height: 1; margin-bottom: var(--s4); }
h2.sec .idx { font-size: 1rem; color: var(--acc); vertical-align: super; margin-right: 10px; transition: color .5s; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 3fr 2fr; gap: var(--s4); align-items: start; }
.about-grid p { max-width: 60ch; line-height: 1.7; }
.facts { border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: var(--s3); font-size: .85rem; margin-top: var(--s3); }
.facts dt { color: var(--acc); font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: 1px; margin-top: var(--s2); transition: color .5s; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 2px 0 0; color: #ccc; }
.portrait-frame { position: relative; }
.portrait-frame img { border-radius: 8px; border: 2px solid rgba(255,255,255,.25); filter: grayscale(1); transition: filter .5s ease, border-color .5s, box-shadow .5s; }
html.js .portrait-frame img { clip-path: inset(0 0 100% 0); }
html.js [data-reveal].vis .portrait-frame img { clip-path: inset(0 0 0% 0); transition: clip-path .9s cubic-bezier(.7,0,.3,1) .2s, filter .5s ease, border-color .5s, box-shadow .5s; }
.portrait-frame:hover img { filter: grayscale(0); border-color: var(--acc); box-shadow: 0 0 24px rgba(var(--acc-rgb), .2); }
.portrait-frame .tag { position: absolute; bottom: 10px; left: 10px; background: rgba(10,10,10,.8); border: 1px solid var(--acc); color: var(--acc); font-size: .65rem; padding: 3px 8px; border-radius: 3px; transition: color .5s, border-color .5s; }
.stats { display: flex; gap: var(--s4); margin-top: var(--s3); flex-wrap: wrap; }
.stats .num { font-size: 2.2rem; font-weight: 800; color: var(--acc); transition: color .5s; }
.stats .lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- timeline ---------- */
.tl-wrap { position: relative; padding-left: var(--s3); }
.tl-rail { position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: rgba(255,255,255,.15); }
.tl-fill { position: absolute; left: 4px; top: 6px; width: 2px; height: calc(100% - 12px); background: var(--acc); box-shadow: 0 0 10px rgba(var(--acc-rgb), .4); transform: scaleY(0); transform-origin: top; transition: background .5s; }
.tl { list-style: none; }
.tl li { position: relative; padding: 0 0 var(--s4) var(--s2); display: grid; grid-template-columns: 1fr 240px; gap: var(--s3); align-items: start; }
.tl li.no-img { grid-template-columns: 1fr; }
.tl li::before { content: ''; position: absolute; left: calc(-1 * var(--s3) + -1px); top: 5px; width: 11px; height: 11px; border-radius: 50%; background: #333; border: 2px solid rgba(255,255,255,.3); transition: background .3s, border-color .3s, box-shadow .3s, transform .3s; }
.tl li.lit::before { background: var(--acc); border-color: var(--acc); box-shadow: 0 0 12px rgba(var(--acc-rgb), .5); transform: scale(1.15); }
.tl .yr { color: var(--acc); font-weight: 800; font-size: 1.15rem; transition: color .5s; }
.tl .tt { font-weight: 700; font-size: 1.05rem; }
.tl .cx { color: var(--muted); font-size: .85rem; max-width: 56ch; margin-top: 4px; }
html.js .tl .txt .inner { transform: translateY(40px); opacity: 0; transition: transform .6s cubic-bezier(.2,.7,.3,1), opacity .6s; }
html.js .tl li.vis .txt .inner { transform: none; opacity: 1; }
.tl .ph { position: relative; border-radius: 6px; overflow: hidden; aspect-ratio: 4 / 3; background: repeating-linear-gradient(45deg, #161616 0 12px, #1d1d1d 12px 24px); border: 1px solid rgba(255,255,255,.18); display: flex; align-items: flex-end; }
html.js .tl .ph { clip-path: inset(0 100% 0 0); transition: clip-path .8s cubic-bezier(.7,0,.3,1) .15s; }
html.js .tl li.vis .ph { clip-path: inset(0 0 0 0); }
.tl .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(.2); transition: filter .4s ease, transform .6s cubic-bezier(.2,.7,.3,1); }
.tl .ph:hover img { filter: grayscale(0); transform: scale(1.04); }
.tl .ph .cap { position: relative; z-index: 1; background: rgba(10,10,10,.85); border-top: 1px solid var(--acc); color: var(--acc); font-size: .62rem; padding: 4px 8px; width: 100%; transition: color .5s, border-color .5s; }
@media (max-width: 760px) { .tl li { grid-template-columns: 1fr; } .tl .ph { max-width: 320px; } }

/* ---------- rows (skills + contato): hover = tint translúcido ---------- */
.rows { border-top: 1px solid rgba(255,255,255,.18); }
.row { position: relative; overflow: hidden; display: flex; align-items: center; gap: var(--s3); border-bottom: 1px solid rgba(255,255,255,.18); padding: var(--s3) var(--s2); cursor: pointer; }
.row .rwipe { position: absolute; inset: 0; z-index: 0; background: linear-gradient(90deg, rgba(var(--acc-rgb), .14), rgba(var(--acc-rgb), .03)); border-left: 3px solid var(--acc); transform: translateX(-101%); transition: transform .35s cubic-bezier(.7,0,.3,1); }
.row > *:not(.rwipe) { position: relative; z-index: 1; }
.row:hover .rwipe { transform: translateX(0); }
.row .ricon { display: inline-flex; }
.row .ricon svg { width: 24px; height: 24px; stroke: var(--acc); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke .35s, transform .35s ease; }
.row:hover .ricon svg { transform: scale(1.12); }
.row .ridx { font-size: .75rem; color: var(--muted); min-width: 2.2ch; transition: color .35s; }
.row .rname { font-size: clamp(1.2rem, 2.8vw, 1.9rem); font-weight: 800; text-transform: uppercase; letter-spacing: -.02em; transition: color .35s, transform .35s ease; }
.row .rdetail { margin-left: auto; color: var(--muted); font-size: .8rem; text-align: right; max-width: 45%; }
.row .rarrow { font-size: 1.3rem; font-weight: 800; color: var(--acc); transition: transform .35s cubic-bezier(.2,.7,.3,1), color .5s; }
.row:hover .rname { color: var(--acc); transform: translateX(8px); }
.row:hover .ridx { color: var(--acc); }
.row:hover .rarrow { transform: translateX(8px); }
html.js [data-reveal] .row { opacity: 0; transform: translateY(24px); transition: opacity .5s ease calc(var(--i) * 90ms), transform .5s ease calc(var(--i) * 90ms); }
html.js [data-reveal].vis .row { opacity: 1; transform: none; }
.rchips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; justify-content: flex-end; max-width: 55%; }
.rchip { border: 1px solid rgba(255,255,255,.35); border-radius: 3px; padding: 4px 10px; font-size: .72rem; color: #ccc; transition: border-color .35s, color .35s; }
.row:hover .rchip { border-color: rgba(var(--acc-rgb), .6); color: var(--fg); }

/* ---------- projetos ---------- */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
@media (max-width: 760px) { .pgrid { grid-template-columns: 1fr; } .rchips, .rdetail { display: none; } }
.proj { position: relative; overflow: hidden; border: 2px dashed rgba(255,255,255,.4); border-radius: 8px; padding: var(--s3); cursor: pointer; transition: border-color .35s; }
.proj .wipe { position: absolute; inset: 0; z-index: 0; background: linear-gradient(135deg, rgba(var(--acc-rgb), .12), rgba(var(--acc-rgb), .02)); transform: translateX(-101%); transition: transform .35s cubic-bezier(.7,0,.3,1); }
.proj > div { position: relative; z-index: 1; }
.proj:hover { border-color: var(--acc); }
.proj:hover .wipe { transform: translateX(0); }
.proj h3 { font-size: 1.05rem; text-transform: uppercase; margin: var(--s2) 0; transition: color .35s; }
.proj:hover h3 { color: var(--acc); }
.proj p { font-size: .82rem; color: var(--muted); }
.proj .st { font-size: .68rem; border: 1px solid var(--acc); color: var(--acc); border-radius: 3px; padding: 2px 8px; float: right; transition: all .5s; }
.proj svg { width: 64px; height: 64px; stroke: var(--acc); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke .5s; }
html.js .proj svg .draw { stroke-dasharray: 200; stroke-dashoffset: 200; }
html.js .vis .proj svg .draw { animation: draw 1.4s ease forwards; }
html.js .vis .proj:nth-child(2) svg .draw { animation-delay: .15s; }
html.js .vis .proj:nth-child(3) svg .draw { animation-delay: .3s; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- contato ---------- */
.mail-line { margin-bottom: var(--s4); }
.mail-line .lbl { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: 2px; display: block; margin-bottom: var(--s1); }
.mail-line a { font-size: clamp(1.05rem, 2.2vw, 1.6rem); font-weight: 700; letter-spacing: -.01em; color: var(--acc); background-image: linear-gradient(var(--acc), var(--acc)); background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 2px; transition: background-size .45s cubic-bezier(.7,0,.3,1), color .5s; }
.mail-line a:hover { background-size: 100% 2px; }

footer { text-align: center; padding: var(--s4) 0; color: var(--muted); font-size: .85rem; border-top: 1px solid rgba(255,255,255,.1); }

/* ---------- noscript ---------- */
.noscript-note { max-width: 1200px; margin: 0 auto; padding: var(--s2) var(--s3); color: var(--acc); border-bottom: 1px solid rgba(var(--acc-rgb), .3); font-size: .8rem; }

/* ---------- reduced motion: tudo estático, conteúdo visível ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .mask > div,
  html.js .tl .txt .inner,
  html.js [data-reveal] .row { transform: none !important; opacity: 1 !important; transition: none !important; }
  html.js .portrait-frame img,
  html.js .tl .ph { clip-path: none !important; transition: none !important; }
  html.js .proj svg .draw { stroke-dashoffset: 0 !important; animation: none !important; }
  .cursor { animation: none; }
}
