/* rafaelwerlang.com — tipografia gigante, preto e branco. Sem framework; fontes locais (OFL). */
@font-face { font-family: "Inter Tight"; src: url("/fonts/InterTight.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/InstrumentSerif.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/InstrumentSerif-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --bg: #0b0b0b; --ink: #ecebe6; --muted: #8a8984; --faint: #4a4a47; --rule: rgba(236,235,230,.14); --code: #141413;
  --sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --read: "Iowan Old Style", "Charter", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.76, 0, .24, 1); --out: cubic-bezier(.16, 1, .3, 1);
  --pad: clamp(1rem, 3.2vw, 2.75rem); --w: 42rem;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
       min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
::selection { background: var(--ink); color: var(--bg); }
a { color: inherit; text-decoration: none; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
.mono { font-family: var(--mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--ink); color: var(--bg); padding: .5rem 1rem; }
main { width: 100%; }

/* ── topo ── */
.top { position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
       padding: 1.3rem var(--pad); mix-blend-mode: difference; color: #fff; }
.brand { font: italic 400 1.35rem/1 var(--serif); letter-spacing: -.01em; text-transform: none; }
.nav { display: flex; gap: clamp(1rem, 3vw, 2.2rem); }
.nav a { position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .5s var(--out); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

/* ── texto que se monta letra por letra ── */
.split .w { display: inline-block; white-space: nowrap; }
.split .c { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .2em; margin-bottom: -.2em; }
.split .c > span { display: inline-block; transform: translateY(105%); transition: transform 1.1s var(--out); transition-delay: calc(var(--d, 0) * 1ms); }
.split.in .c > span { transform: none; }

/* ── home ── */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding: 7rem var(--pad) 2rem; position: relative; }
.mega { margin: 0; font: 600 clamp(4.6rem, 21.5vw, 24rem)/.84 var(--sans); letter-spacing: -.06em; will-change: transform; }
.mega .line { display: block; }
.mega .indent { padding-left: 8.5vw; }
.hero-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-top: clamp(1.5rem, 4vh, 3rem);
             border-top: 1px solid var(--rule); padding-top: 1.2rem; }
.hero-note { margin: 0; font-size: clamp(1.05rem, 1.7vw, 1.45rem); line-height: 1.25; color: var(--muted); }
.hero-note em { color: var(--ink); font-size: 1.12em; }
.hero-scroll { margin: 0; color: var(--muted); }

.marquee { overflow: hidden; border-block: 1px solid var(--rule); padding: 1.6rem 0; user-select: none; }
.track { display: inline-flex; align-items: center; gap: 3rem; white-space: nowrap; will-change: transform;
         font: 500 clamp(2.4rem, 6vw, 5.5rem)/1 var(--sans); letter-spacing: -.035em; }
.track span:nth-child(4n+3) { font: italic 400 1.08em/1 var(--serif); letter-spacing: -.01em; }
.track i { font-style: normal; font-size: .5em; color: var(--muted); }

.index { padding: clamp(4rem, 12vh, 8rem) var(--pad) 2rem; }
.index-head { display: flex; justify-content: space-between; color: var(--muted); padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.rows { list-style: none; margin: 0; padding: 0; }
.row a { position: relative; display: grid; grid-template-columns: 4.5rem 1fr auto; align-items: baseline; gap: 1.5rem;
         padding: clamp(1.2rem, 3vh, 2rem) 0; border-bottom: 1px solid var(--rule); isolation: isolate; overflow: hidden;
         transition: opacity .4s var(--out), color .3s; }
.row a::before { content: ""; position: absolute; z-index: -1; inset: 0 calc(var(--pad) * -1); background: var(--ink);
                 transform: scaleY(0); transform-origin: bottom; transition: transform .6s var(--ease); }
.row a:hover::before, .row a:focus-visible::before { transform: scaleY(1); transform-origin: top; }
.row a:hover, .row a:focus-visible { color: var(--bg); }
.row-title { font: 500 clamp(1.7rem, 4.6vw, 4.4rem)/1.02 var(--sans); letter-spacing: -.04em; transition: transform .6s var(--out); }
.row a:hover .row-title { transform: translateX(1.2rem); }
.num { color: var(--muted); transition: color .3s; } .row a:hover .num { color: var(--bg); }
.row-meta { display: flex; gap: 1.2rem; color: var(--muted); white-space: nowrap; transition: color .3s; }
.row a:hover .row-meta { color: var(--bg); }
.row-arrow { display: inline-block; transition: transform .6s var(--out); } .row a:hover .row-arrow { transform: translateX(.4rem) rotate(-45deg); }
.rows:hover .row a:not(:hover) { opacity: .32; }
.empty { color: var(--muted); padding: 3rem 0; }

.statement { padding: clamp(6rem, 22vh, 14rem) var(--pad); }
.words { margin: 0; max-width: 22ch; font: 500 clamp(2rem, 5.4vw, 5.2rem)/1.04 var(--sans); letter-spacing: -.04em; }
.words .wd { opacity: .14; transition: opacity .25s linear; } .words .wd.on { opacity: 1; }

/* ── rodapé ── */
.foot { margin-top: auto; padding: clamp(5rem, 14vh, 9rem) var(--pad) 1.6rem; border-top: 1px solid var(--rule); }
.foot-label { color: var(--muted); margin: 0 0 1rem; }
.foot-mail { display: inline-block; font: 500 clamp(1.8rem, 6.4vw, 6.6rem)/1 var(--sans); letter-spacing: -.045em; word-break: break-all; }
.foot-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: clamp(3rem, 8vh, 5rem); color: var(--muted); }

/* texto que "rola" no hover: cada letra sobe e dá lugar à mesma letra em itálico serifado */
.roll { position: relative; display: inline-block; overflow: hidden; vertical-align: bottom; }
.roll .r { position: relative; display: inline-block; white-space: pre; transition: transform .7s var(--out); transition-delay: calc(var(--d, 0) * 12ms); }
.roll .r::after { content: attr(data-c); position: absolute; left: 0; top: 100%; font-family: var(--serif); font-style: italic; letter-spacing: 0; }
.roll:hover .r { transform: translateY(-100%); }

/* ── post ── */
.post-hero { padding: 8rem var(--pad) clamp(2rem, 6vh, 4rem); border-bottom: 1px solid var(--rule); }
.post-meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); margin: 0 0 clamp(2rem, 8vh, 6rem); }
.post-meta a:hover { color: var(--ink); }
.post-title { margin: 0; font: 600 clamp(2.6rem, 8.4vw, 9rem)/.92 var(--sans); letter-spacing: -.05em; max-width: 16ch; }
.post-desc { margin: clamp(1.5rem, 4vh, 2.5rem) 0 0; max-width: 34rem; color: var(--muted); font-size: clamp(1.15rem, 1.8vw, 1.5rem); line-height: 1.3; }
.post-desc em { color: var(--ink); }
.tags { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1.5rem; }
.tag { border: 1px solid var(--rule); border-radius: 99px; padding: .3rem .8rem; color: var(--muted); }
.draft-badge { display: inline-block; font: 600 .72rem var(--mono); color: var(--bg); background: var(--ink); padding: .25rem .55rem; margin: 0 0 1.2rem; }

.toc, .prose { max-width: var(--w); margin-left: auto; margin-right: auto; padding-left: var(--pad); padding-right: var(--pad); box-sizing: content-box; }
.toc { margin-top: 3.5rem; font-size: .9rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.toc li { counter-increment: t; padding: .45rem 0; border-bottom: 1px solid var(--rule); }
.toc li::before { content: counter(t, decimal-leading-zero); font: .7rem var(--mono); color: var(--muted); margin-right: 1rem; }
.toc .l3 { padding-left: 2rem; } .toc a { color: var(--muted); } .toc a:hover { color: var(--ink); }

.prose { margin-top: 3.5rem; margin-bottom: 2rem; font: 400 1.18rem/1.72 var(--read); }
.prose > * { margin: 0; } .prose > * + * { margin-top: 1.3em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--sans); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin-top: 2.4em !important; position: relative; scroll-margin-top: 5rem; }
.prose h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); } .prose h3 { font-size: 1.45rem; } .prose h4 { font-size: 1.15rem; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: .8em; }
.anchor { position: absolute; left: -1em; color: var(--faint); opacity: 0; transition: opacity .2s; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--muted); transition: text-decoration-color .2s; }
.prose a:hover { text-decoration-color: var(--ink); }
.prose strong { font-weight: 700; }
.prose em { font-family: var(--read); }
.prose ul, .prose ol { padding-left: 1.2em; } .prose li + li { margin-top: .45em; } .prose li::marker { color: var(--muted); }
.prose blockquote { margin: 2em 0 !important; padding: 0; border: 0; font: italic 400 clamp(1.6rem, 3vw, 2.3rem)/1.2 var(--serif); letter-spacing: -.01em; }
.prose hr { border: 0; height: 1px; background: var(--rule); margin: 3.5em 0 !important; }
.prose img { max-width: 100%; height: auto; display: block; margin-inline: auto; filter: grayscale(1); transition: filter .6s; }
.prose img:hover { filter: none; }
.prose :not(pre) > code { font: .8em var(--mono); background: var(--code); border: 1px solid var(--rule); border-radius: .25em; padding: .1em .35em; }
.code { position: relative; margin: 2em 0 !important; }
.code pre { margin: 0; padding: 1.2rem 1.3rem; overflow-x: auto; background: var(--code); border: 1px solid var(--rule); font: .84rem/1.65 var(--mono);
            tab-size: 4; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.code .lang { position: absolute; top: .55rem; right: .8rem; font: .66rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tk-k { color: #ecebe6; font-weight: 700; } .tk-t { color: #c9c8c2; text-decoration: underline; text-decoration-color: #4a4a47; text-underline-offset: 3px; }
.tk-s { color: #a8a7a1; font-style: italic; } .tk-n { color: #ecebe6; } .tk-c { color: #63625e; font-style: italic; }
.table { overflow-x: auto; margin: 2em 0 !important; font: .92rem var(--sans); }
.table table { border-collapse: collapse; width: 100%; }
.table th, .table td { padding: .7rem .6rem; border-bottom: 1px solid var(--rule); text-align: left; }
.table th { font: .68rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 400; }
.post-end { padding: clamp(5rem, 16vh, 10rem) var(--pad) 2rem; }
.mega-link { font: 500 clamp(2.2rem, 7vw, 6.5rem)/1 var(--sans); letter-spacing: -.045em; }
.notfound { min-height: 80vh; display: flex; flex-direction: column; justify-content: flex-end; padding: 8rem var(--pad) 3rem; }
.notfound p { color: var(--muted); } .notfound a { color: var(--ink); text-decoration: underline; }

/* ── entrada dos blocos de texto ── */
.js .prose > *, .js .toc, .js .post-desc, .js .tags, .js .hero-foot, .js .row { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--out), transform 1s var(--out); }
.js .row { transition-delay: calc(var(--i, 0) * 80ms); }
.js .row.in, .js .prose > .in, .js .toc.in, .js .post-desc.in, .js .tags.in, .js .hero-foot.in { opacity: 1; transform: none; }

/* ── cortina entre páginas ── */
.curtain { position: fixed; z-index: 50; inset: 0; background: var(--ink); transform: translateY(100%); pointer-events: none; }
.curtain.cover { transform: translateY(0); transition: transform .6s var(--ease); }
.curtain.leave { transform: translateY(-100%); transition: transform .7s var(--ease); }

/* ── cursor ── */
.cursor { position: fixed; z-index: 60; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff;
          mix-blend-mode: difference; pointer-events: none; opacity: 0; transition: width .45s var(--out), height .45s var(--out), margin .45s var(--out), opacity .3s; }
.cursor.on { opacity: 1; }
.cursor.big { width: 72px; height: 72px; margin: -36px 0 0 -36px; }
@media (hover: none) { .cursor { display: none; } }

@media (max-width: 700px) {
  .nav a[href="/rss.xml"] { display: none; }
  .row a { grid-template-columns: 2.4rem 1fr; }
  .row-meta { grid-column: 2; }
  .hero-foot { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .split .c > span { transform: none; }
  .js .prose > *, .js .toc, .js .post-desc, .js .tags, .js .hero-foot, .js .row { opacity: 1; transform: none; }
  .words .wd { opacity: 1; }
  .curtain { display: none; }
}
