/* Field notes, after dark — Tiago Bittencourt's portfolio */

:root {
  --espresso: #14100d;   /* ground */
  --leather: #1e1814;    /* surface */
  --leather-hi: #2a211b; /* active surface */
  --walnut: #3a2a20;     /* rules */
  --bronze: #8b5e3c;     /* ink lines */
  --bronze-text: #b98557;
  --gilt: #c9a15b;       /* rare accent */
  --silver: #d6d1c7;
  --parchment: #ede4d3;  /* text */
  --parchment-dim: #cfc3ae;
  --muted: #a89a86;

  --f-display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --f-body: 'Newsreader', Georgia, serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --f-hand: 'Caveat', 'Segoe Print', cursive;

  --gutter: clamp(16px, 4vw, 24px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--espresso);
  color: var(--parchment);
  font-family: var(--f-body);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--parchment); text-decoration-color: var(--walnut); text-underline-offset: 3px; transition: color .25s; }
a:hover { color: var(--gilt); }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; margin: 0; line-height: 1; letter-spacing: -0.01em; }
h2 { font-size: clamp(40px, 6vw, 56px); }
h2 em, h1 em { font-style: italic; font-weight: 500; color: var(--gilt); }
p { margin: 0; }
::selection { background: var(--bronze); color: var(--parchment); }

.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: -60px; z-index: 50; background: var(--gilt); color: var(--espresso); padding: 10px 14px; font-family: var(--f-mono); font-size: 13px; }
.skip:focus { top: 12px; }

.page { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }

/* shared bits */
.kicker { font-family: var(--f-mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--bronze-text); }
.mono-note { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.hand { font-family: var(--f-hand); font-size: 25px; line-height: 1.15; color: var(--bronze-text); }
.hand-inline { font-family: var(--f-hand); font-size: 20px; color: var(--bronze-text); }
.hand--tilt { transform: rotate(-4deg); }
.is-gold { color: var(--gilt) !important; }
.link-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.link-row a { text-decoration: none; padding: 6px 0; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px; }
.section-intro { display: flex; flex-direction: column; gap: 14px; max-width: 700px; }
.section-intro__lead { font-size: 19px; color: var(--parchment-dim); }

/* old photographs: sepia until you look at them */
.photo { filter: grayscale(.7) sepia(.35) brightness(.92); transition: filter .6s var(--ease); }
.photo:hover, :focus-within > .photo, .photo.is-alive { filter: none; }

/* ink thread that writes itself as you scroll */
.ink-thread { position: fixed; left: max(6px, calc((100vw - 1200px) / 2 - 40px)); top: 0; width: 20px; height: 100vh; pointer-events: none; z-index: 0; opacity: .55; }
.ink-thread path { fill: none; stroke: var(--bronze); stroke-width: 1.2; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--ink, 0)); vector-effect: non-scaling-stroke; }
@media (max-width: 760px) { .ink-thread { display: none; } }

/* ---------- header ---------- */
.site-header { position: relative; z-index: 30; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; padding: 24px 0; border-bottom: 1px solid var(--walnut); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; font-family: var(--f-mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.site-nav > a { text-decoration: none; padding: 12px 0; }
.site-nav__icons { display: flex; gap: 2px; }
.icon-link { width: 44px; height: 44px; display: grid; place-items: center; }
.icon-link svg { width: 20px; height: 20px; }
.lang { border: 1px solid var(--walnut); padding: 10px 12px; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; }
.lang .is-on { color: var(--parchment); }
.lang:hover { border-color: var(--bronze); }

.me { position: relative; }
.me__trigger { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; cursor: pointer; min-height: 52px; }
.me__trigger img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bronze); transition: border-color .3s, transform .4s var(--ease); }
.me__trigger:hover img, .me__trigger[aria-expanded="true"] img { border-color: var(--gilt); transform: rotate(-4deg); }
.me__name { font-family: var(--f-mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.me__chev svg { width: 12px; height: 12px; color: var(--bronze); transition: transform .3s; }
.me__trigger[aria-expanded="true"] .me__chev svg { transform: rotate(180deg); }
.me__card { position: absolute; top: calc(100% + 10px); left: 0; width: 330px; max-width: calc(100vw - 2 * var(--gutter)); background: var(--leather); border: 1px solid var(--bronze); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
.me__card::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 12px; } /* hover bridge */
.me__card:not([hidden]) { animation: unfold .35s var(--ease); }
.me__head { display: flex; flex-direction: column; gap: 4px; }
.me__full { font-family: var(--f-display); font-weight: 600; font-size: 26px; line-height: 1.05; }
.me__head .hand { font-size: 21px; }
.me__rows { margin: 0; font-size: 15px; line-height: 1.4; }
.me__rows > div { display: flex; gap: 12px; border-top: 1px dashed var(--walnut); padding: 8px 0; }
.me__rows > div:last-child { border-bottom: 1px dashed var(--walnut); }
.me__rows dt { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; color: var(--muted); width: 56px; flex: none; padding-top: 2px; }
.me__rows dd { margin: 0; }
.me__rows .is-open dt, .me__rows .is-open dd { color: var(--gilt); }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- hero ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 48px; padding: clamp(64px, 12vw, 112px) 0 clamp(48px, 8vw, 80px); }
.hero__text { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.hero__title { font-size: clamp(54px, 9vw, 128px); line-height: .92; letter-spacing: -0.02em; }
.hero__lead { max-width: 560px; font-size: 20px; color: var(--parchment-dim); }
.hero__aside { flex: 1 1 220px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; color: var(--bronze); }
.hero__bear { width: 96px; height: 90px; }
.reveal-line { display: inline-block; animation: rise .9s var(--ease) both; }
.reveal-line + br + .reveal-line { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- proof row ---------- */
.proofs__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); border-top: 1px solid var(--walnut); border-bottom: 1px solid var(--walnut); }
.proof { text-align: left; background: transparent; border: 0; border-right: 1px solid var(--walnut); padding: 32px 28px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; min-height: 210px; transition: background .3s; }
.proof:last-child { border-right: 0; }
.proof[aria-expanded="true"] { background: var(--leather); }
.proof__big { font-family: var(--f-display); font-weight: 600; font-size: 60px; line-height: 1; }
.proof__title { font-family: var(--f-display); font-weight: 600; font-size: 26px; line-height: 1.1; }
.proof__sub { font-size: 16px; line-height: 1.45; color: var(--muted); }
.proof__cue { margin-top: auto; font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--bronze); }
.proof[aria-expanded="true"] .proof__cue { color: var(--gilt); }
.proof-detail { background: var(--leather); border-bottom: 1px solid var(--walnut); padding: 32px 28px; display: flex; flex-wrap: wrap; gap: 28px 32px; }
.proof-detail:not([hidden]) { animation: unfold .45s var(--ease); }
.proof-detail__text { flex: 2 1 420px; display: flex; flex-direction: column; gap: 12px; }
.proof-detail__body { font-size: 19px; line-height: 1.6; }
.proof-detail__facts { flex: 1 1 240px; display: flex; flex-direction: column; gap: 10px; font-family: var(--f-mono); font-size: 13px; color: var(--parchment-dim); }
.proof-detail__facts > div { border-top: 1px dashed var(--walnut); padding-top: 10px; }
.proof-detail__photos { flex: 1 1 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.proof-detail__photos figure { margin: 0; height: 190px; overflow: hidden; border: 1px solid var(--walnut); }
.proof-detail__photos img { width: 100%; height: 100%; }
@media (max-width: 600px) { .proof { border-right: 0; border-bottom: 1px solid var(--walnut); min-height: 0; } }

/* ---------- archive ---------- */
.archive { padding: clamp(80px, 12vw, 120px) 0 40px; display: flex; flex-direction: column; gap: 40px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 24px; }
.card { position: relative; background: var(--leather); border: 1px solid var(--walnut); padding: 28px; display: flex; flex-direction: column; gap: 14px; transition: border-color .3s, transform .4s var(--ease); }
.card:hover { border-color: var(--bronze); transform: translateY(-3px); }
.card__meta { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.card__thumb { position: relative; height: 170px; overflow: hidden; border: 1px solid var(--walnut); }
.card__thumb > img { width: 100%; height: 100%; object-fit: cover; }
.card__title { font-size: clamp(32px, 4vw, 40px); }
.card__sub { font-size: 16px; color: var(--muted); }
.card__text { font-size: 17px; line-height: 1.5; color: var(--parchment-dim); }
.card__stack { margin-top: auto; border-top: 1px dashed var(--walnut); padding-top: 12px; font-family: var(--f-mono); font-size: 12px; color: var(--bronze-text); }
.badge { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 8px; }
.badge--dark { background: var(--espresso); border: 1px solid var(--bronze); padding: 7px 10px; }
.badge--dark img { height: 18px; width: auto; }
.badge--paper { background: var(--parchment); border-radius: 4px; padding: 4px 6px; }
.badge--paper img { mix-blend-mode: multiply; }
.badge--logo { padding: 5px 10px 5px 6px; font-family: var(--f-mono); font-size: 13px; font-weight: 500; }
.badge--logo svg { width: 30px; height: 30px; }
.stamp { position: absolute; right: 18px; top: 40px; width: 58px; height: 58px; border-radius: 50%; background: var(--leather); border: 1px solid var(--bronze); display: grid; place-items: center; font-family: var(--f-display); font-style: italic; font-size: 18px; color: var(--gilt); transform: rotate(-12deg); transition: transform .5s var(--ease); }
.card:hover .stamp { transform: rotate(-4deg) scale(1.06); }

/* ---------- the map ---------- */
.map { padding: clamp(80px, 12vw, 120px) 0; display: flex; flex-direction: column; gap: 36px; }
.map__board { background: var(--leather); border: 1px solid var(--walnut); padding: clamp(20px, 4vw, 36px) clamp(16px, 3vw, 32px); display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.map__col { flex: 1 1 220px; display: flex; flex-direction: column; gap: 10px; }
.map__col-title { font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.map__arrow { flex: 0 0 40px; display: grid; place-items: center; color: var(--bronze); }
.map__arrow.is-gold { color: var(--gilt); }
.map__arrow svg { width: 40px; height: 24px; }
.map__arrow .ink { stroke-dasharray: 3 3; }
@media (max-width: 760px) { .map__arrow { flex-basis: 100%; transform: rotate(90deg); height: 28px; } }
.node { text-align: left; background: var(--espresso); border: 1px solid var(--walnut); padding: 14px 16px; min-height: 52px; display: flex; flex-direction: column; justify-content: center; gap: 4px; cursor: pointer; transition: background .25s, border-color .25s, transform .3s var(--ease); }
.node:hover, .node.is-active { background: var(--leather-hi); transform: translateX(3px); }
.node--source { flex-direction: row; justify-content: space-between; align-items: center; }
.node--source.is-active, .node--out.is-active { border-color: var(--gilt); }
.node__name { font-family: var(--f-mono); font-size: 14px; }
.node--layer .node__name, .node--out .node__name { font-family: var(--f-display); font-weight: 600; font-size: 27px; line-height: 1; }
.node--layer { min-height: 78px; }
.node__tag { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.node__wave svg { width: 40px; height: 10px; color: var(--bronze); }
.node--bronze { border-color: var(--bronze-text); } .node--bronze .node__name { color: var(--bronze-text); }
.node--silver { border-color: #8c877e; } .node--silver .node__name { color: var(--silver); }
.node--gold { border-color: var(--gilt); } .node--gold .node__name { color: var(--gilt); }
.node--layer.is-active { box-shadow: inset 4px 0 0 currentColor; }
.node--bronze.is-active { color: var(--bronze-text); } .node--silver.is-active { color: var(--silver); } .node--gold.is-active { color: var(--gilt); }
.map__detail { flex: 1 1 100%; border-top: 1px dashed var(--walnut); padding-top: 24px; display: flex; flex-wrap: wrap; gap: 16px 28px; min-height: 140px; }
.map__detail-head { flex: 0 1 260px; display: flex; flex-direction: column; gap: 6px; }
.map__detail-name { font-family: var(--f-display); font-weight: 600; font-size: 34px; line-height: 1; }
.map__detail-body { flex: 1 1 420px; display: flex; flex-direction: column; gap: 10px; }
.map__detail-body p:first-child { font-size: 18px; line-height: 1.6; }
.map__detail.is-swapping .map__detail-head, .map__detail.is-swapping .map__detail-body { animation: ink-in .4s var(--ease); }
@keyframes ink-in { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: none; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border-top: 1px solid var(--walnut); border-bottom: 1px solid var(--walnut); }
.stat { padding: 24px 20px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--walnut); }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: 0; }
.stat__big { font-family: var(--f-display); font-weight: 600; font-size: 46px; line-height: 1; }
.stat__label { font-size: 15px; color: var(--muted); }
@media (max-width: 600px) { .stat { border-right: 0; border-bottom: 1px dashed var(--walnut); padding-left: 0; } .stat:last-child { border-bottom: 0; } }
.map__practices { font-size: 16px; color: var(--muted); max-width: 760px; }
.blueprint { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.blueprint__frame { border: 1px solid var(--walnut); background: #fff; overflow: hidden; }
.blueprint__frame img { width: 100%; height: auto; }
.blueprint figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.blueprint figcaption img { height: 22px; width: auto; opacity: .85; }

/* ---------- the lab (OCR) ---------- */
.lab { padding: 40px 0 clamp(80px, 12vw, 120px); display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.lab__text { flex: 1 1 360px; display: flex; flex-direction: column; gap: 16px; }
.lab__text .section-intro__lead { max-width: 460px; }
.ocr { flex: 1 1 460px; display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.ocr__paper { position: relative; flex: 0 0 auto; }
.ocr__canvas { width: min(280px, 80vw); height: min(280px, 80vw); background: var(--parchment); border: 1px solid var(--bronze); cursor: crosshair; touch-action: none; display: block;
  background-image: linear-gradient(transparent 27px, rgba(139, 94, 60, .12) 28px); background-size: 100% 28px; }
.ocr__clear { margin-top: 10px; background: none; border: 1px solid var(--walnut); padding: 10px 14px; min-height: 44px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.ocr__clear:hover { border-color: var(--bronze); color: var(--parchment); }
.ocr__readout { flex: 1 1 200px; display: flex; flex-direction: column; gap: 12px; min-width: 200px; }
.ocr__guess { min-height: 56px; display: flex; align-items: center; }
.ocr__digit strong { font-family: var(--f-display); font-size: 52px; color: var(--gilt); font-weight: 600; line-height: 1; }
.ocr__bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.ocr__bars li { display: grid; grid-template-columns: 14px 1fr 40px; align-items: center; gap: 8px; }
.ocr__track { height: 8px; background: var(--walnut); overflow: hidden; }
.ocr__fill { display: block; height: 100%; width: 0; background: var(--bronze); transition: width .3s var(--ease), background .3s; }
.ocr__bars li.is-top { color: var(--gilt); }
.ocr__bars li.is-top .ocr__fill { background: var(--gilt); }
.ocr__pct { text-align: right; }

/* ---------- about ---------- */
.about { padding: 80px 0; border-top: 1px solid var(--walnut); display: flex; flex-wrap: wrap; gap: 48px; }
.about__intro { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; font-size: 18px; color: var(--parchment-dim); }
.about__intro h2 { color: var(--parchment); }
.about__cards { flex: 2 1 560px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; }
.note-card { background: var(--leather); border: 1px solid var(--walnut); padding: 24px; display: flex; flex-direction: column; gap: 12px; font-size: 16px; color: var(--muted); }
.note-card h3 { font-size: 28px; color: var(--parchment); }
.note-card .hand { font-size: 22px; margin-top: auto; }
.note-card__icon svg { width: 64px; height: 48px; color: var(--bronze-text); }
.note-card__photo { position: relative; }
.note-card__photo img { width: 100%; height: 180px; object-fit: cover; object-position: 50% 38%; }
.note-card__dog { position: absolute; right: -8px; bottom: -14px; }
.note-card__dog svg { width: 44px; height: 34px; }
.medals { display: flex; flex-wrap: wrap; gap: 6px 12px; font-family: var(--f-mono); font-size: 11px; }
.medal { display: inline-flex; align-items: center; gap: 6px; }
.medal > span { width: 14px; height: 14px; border-radius: 50%; }
.medal--gold { color: var(--gilt); } .medal--gold > span { background: var(--gilt); }
.medal--bronze { color: var(--bronze-text); } .medal--bronze > span { background: var(--bronze); }

/* ---------- footer ---------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--walnut); padding: 72px 0 40px; display: flex; flex-direction: column; gap: 56px; }
.site-footer__cta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 32px; }
.site-footer__cta > div { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.site-footer__title { font-family: var(--f-display); font-weight: 600; font-size: clamp(44px, 7vw, 88px); line-height: .95; text-decoration: none; }
.site-footer__title em { font-style: italic; font-weight: 500; color: var(--gilt); }
.site-footer .hand { overflow-wrap: anywhere; }
.button-ghost { display: inline-flex; align-items: center; gap: 12px; border: 1px solid var(--gilt); padding: 14px 20px; min-height: 48px; text-decoration: none; font-family: var(--f-mono); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--gilt); transition: background .3s, color .3s; }
.button-ghost svg { width: 18px; height: 18px; }
.button-ghost:hover { background: var(--gilt); color: var(--espresso); }
.site-footer__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px; border-top: 1px dashed var(--walnut); padding-top: 40px; }
.site-footer__cols > div { display: flex; flex-direction: column; gap: 10px; font-size: 17px; }
.site-footer__cols a { text-decoration: none; }
.site-footer__cols span { color: var(--parchment-dim); }
.col-title { font-family: var(--f-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.site-footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--walnut); padding-top: 24px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.site-footer__base a { text-decoration: none; text-transform: uppercase; letter-spacing: .08em; }
.site-footer__sign { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.footer-bear { width: 26px; height: 25px; color: var(--bronze); }

/* reveal on scroll (only when JS is running) */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .ink-thread path { stroke-dashoffset: 0; }
}
