/* =====================================================
   Lucas R. Andrade — Portfolio
   Aesthetic: "Quant Institucional"
   Warm dark default · editorial serif · plex sans · amber accent
   ===================================================== */

:root {
  /* warm dark, default */
  --bg:           #0e0d0a;
  --bg-elev:     #16140f;
  --bg-card:     #1b1814;
  --bg-inset:    #110f0c;
  --ink:         #ede6d6;
  --ink-dim:     #b3ab9c;
  --ink-mute:   #79736a;
  --rule:        #2b2722;
  --rule-soft:  #1f1c17;
  --accent:      #d4a574;      /* warm amber */
  --accent-dim: #9a7949;
  --accent-soft: rgba(212,165,116,0.12);
  --steel:       #7fa0ad;      /* secondary cool */
  --steel-soft: rgba(127,160,173,0.14);
  --sage:        #8eb59f;
  --sage-soft:  rgba(142,181,159,0.14);
  --oxblood:     #b86d5f;
  --oxblood-soft: rgba(184,109,95,0.14);

  --type-display: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --type-body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --type-mono:    'IBM Plex Mono', 'Menlo', monospace;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --max: 1200px;
  --gutter: 32px;

  --t-fast: 140ms ease-out;
  --t-base: 280ms ease-out;
}

body.light-mode {
  --bg:           #f1ece0;
  --bg-elev:     #e8e2d3;
  --bg-card:     #ece6d8;
  --bg-inset:    #e3dccb;
  --ink:         #1a1612;
  --ink-dim:     #5a5448;
  --ink-mute:   #8a8474;
  --rule:        #d4cdb9;
  --rule-soft:  #e0d9c5;
  --accent:      #8a5a1f;
  --accent-dim: #6f4814;
  --accent-soft: rgba(138,90,31,0.10);
  --steel:       #3f6376;
  --steel-soft: rgba(63,99,118,0.10);
  --sage:        #4f7a60;
  --sage-soft:  rgba(79,122,96,0.10);
  --oxblood:     #8a3d2f;
  --oxblood-soft: rgba(138,61,47,0.10);
}

* , *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; -webkit-font-smoothing:antialiased; }

body {
  font-family: var(--type-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-feature-settings: "ss01","cv05";
  overflow-x: hidden;
  transition: background var(--t-base), color var(--t-base);
}

/* subtle warm vignette + paper texture */
body::before {
  content:"";
  position: fixed; inset:0;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 100%, var(--steel-soft) 0%, transparent 55%);
  pointer-events:none;
  z-index:0;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color var(--t-fast), border-color var(--t-fast);
}
a:hover { color: var(--accent); border-color: var(--accent); }

/* ============ HEADER ============ */
.site-header {
  position: sticky;
  top:0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}
.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; align-items: center; gap: 24px;
}
.brand {
  font-family: var(--type-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  border:none;
  display:flex; align-items:baseline; gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 28px;
  flex-shrink: 0;
  transform: translateY(6px);
}
.brand__logo {
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--accent);
  -webkit-mask: url('assets/logo-lra.svg') no-repeat center / contain;
  mask: url('assets/logo-lra.svg') no-repeat center / contain;
}
.brand__pos {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.nav {
  margin-left: auto;
  display: flex; align-items: center; gap: 4px;
  flex-wrap: nowrap;
}
.nav a {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 12px;
  color: var(--ink-dim);
  border: none;
  position: relative;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--accent); }
.nav a.is-active::after {
  content:""; position:absolute;
  left: 12px; right:12px; bottom: 2px;
  height: 1px; background: var(--accent);
}
.header-tools { display:flex; align-items:center; gap: 4px; }
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-dim);
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--type-mono);
  font-size: 0.75rem;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { color: var(--ink); border-color: var(--rule); }
.lang-btn {
  width: auto; padding: 0 8px;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  text-transform: uppercase;
}
.lang-btn .is-current { color: var(--accent); }

/* ============ LAYOUT ============ */
main { position: relative; z-index: 1; }
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ============ HERO ============ */
.hero {
  padding: 28px 0 40px;
  border-bottom: 1px solid var(--rule-soft);
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 56px;
  align-items: stretch;
}
.hero__right { display: flex; min-width: 0; }
.hero__portrait-wrap {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
  width: 100%;
  aspect-ratio: auto;
  min-height: 320px;
  height: 100%;
}
.hero__portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  display: block;
  filter: saturate(0.92) contrast(1.02);
}
.hero__byline { display: none; }
.hero__right {
  display: flex;
  min-width: 0;
}
.hero__portrait-wrap {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
  width: 100%;
  aspect-ratio: auto;
  min-height: 320px;
  height: 100%;
}
.hero__portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  display: block;
  filter: saturate(0.92) contrast(1.02);
}
#arch-mount { min-height: 280px; }
.hero__byline-removed { display: none; }
.eyebrow {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.eyebrow::before {
  content:""; width: 24px; height: 1px; background: var(--accent);
}
.hero__byline .eyebrow { margin-bottom: 0; }
.hero h1 {
  font-family: var(--type-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 22px;
  text-wrap: pretty;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.hero__lede {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-dim);
  max-width: 50ch;
  margin-bottom: 28px;
}
.hero__lede strong { color: var(--ink); font-weight: 500; }

.hero__meta {
  display: flex; flex-wrap: wrap; gap: 18px 24px;
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  padding-top: 22px;
  border-top: 1px solid var(--rule-soft);
}
.hero__meta a { color: var(--ink-dim); border: none; }
.hero__meta a:hover { color: var(--accent); }
.hero__meta .dot {
  display: inline-block; width: 6px; height: 6px;
  background: var(--sage); border-radius: 50%;
  margin-right: 8px; vertical-align: middle;
  box-shadow: 0 0 0 3px var(--sage-soft);
}

/* Porto Real Asset mark — redrawn from their shield+flag logo in this site's line-art idiom */
.porto-mark { flex-shrink: 0; vertical-align: middle; }
.porto-mark .pm-shield { fill: none; stroke: var(--steel); stroke-width: 7; stroke-linejoin: round; }
.porto-mark .pm-glyph  { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }

/* hero diagram card */
.hero__diagram {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 22px 24px 18px;
  display: flex; flex-direction: column;
  flex: 1;
}
.diagram__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule-soft);
}
.diagram__title {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.diagram__legend {
  font-family: var(--type-mono);
  font-size: 0.7rem;
  color: var(--ink-mute);
  display: flex; gap: 14px;
}
.diagram__legend span {
  display: inline-flex; align-items: center; gap: 6px;
}
.diagram__legend .swatch {
  width: 8px; height: 8px; border-radius: 1px;
}
.swatch.s-source { background: var(--steel); }
.swatch.s-orch   { background: var(--accent); }
.swatch.s-out    { background: var(--sage); }

.arch { flex: 1; width: 100%; }
.arch text { font-family: var(--type-mono); fill: var(--ink-dim); }
.arch .node-bg { fill: var(--bg-card); stroke: var(--rule); }
.arch .node-src .node-bg { stroke: var(--steel); stroke-width: 1.4; }
.arch .node-orch .node-bg { stroke: var(--accent); stroke-width: 1.4; }
.arch .node-out .node-bg { stroke: var(--sage); stroke-width: 1.4; }
.arch .node-src .node-tab { fill: var(--steel); }
.arch .node-orch .node-tab { fill: var(--accent); }
.arch .node-out .node-tab { fill: var(--sage); }
.arch .node-title { fill: var(--ink); font-size: 11px; font-weight: 500; }
.arch .node-sub   { fill: var(--ink-mute); font-size: 9px; }
.arch .edge { stroke: var(--rule); fill: none; opacity: 0.9; }
.arch .particle { fill: var(--accent); filter: drop-shadow(0 0 3px var(--accent)); }
.arch .col-label {
  fill: var(--ink-mute); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
}

/* ============ DISPATCH BOARD ============ */
.dispatch {
  padding: 56px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.dispatch__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 28px;
}
.section-label {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.section-aside {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
}
.dispatch__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.dispatch__grid--4 {
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.dispatch-card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 28px;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
  display: flex; flex-direction: column; gap: 12px;
  min-height: 220px;
}
.dispatch-card:hover {
  border-color: var(--accent);
  background: var(--bg-card);
  transform: translateY(-2px);
  color: var(--ink);
}
.dispatch-card__num {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
}
.dispatch-card__title {
  font-family: var(--type-display);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.dispatch-card__desc {
  font-size: 0.92rem;
  color: var(--ink-dim);
  line-height: 1.55;
  flex: 1;
}
.dispatch-card__foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
  font-family: var(--type-mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
}
.dispatch-card__arrow {
  color: var(--accent);
  transition: transform var(--t-fast);
}
.dispatch-card:hover .dispatch-card__arrow {
  transform: translateX(4px);
}

/* ============ CASE STUDY ============ */
.case {
  padding: 80px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.case__layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 56px;
  align-items: start;
}
.case__right {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.case__right .stack {
  margin-top: 0;
  padding-top: 22px;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--type-mono);
  font-size: 0.74rem;
  color: var(--ink-mute);
  line-height: 1.8;
}
.case__right .stack b { color: var(--ink); font-weight: 500; }
.case__intro h2 {
  font-family: var(--type-display);
  font-weight: 400;
  font-size: 2.2rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 16px 0 18px;
  color: var(--ink);
}
.case__intro h2 em {
  font-style: italic; color: var(--accent);
}
.case__intro p {
  color: var(--ink-dim);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 14px;
}
.case__intro .stack {
  margin-top: 22px;
  font-family: var(--type-mono);
  font-size: 0.74rem;
  color: var(--ink-mute);
  line-height: 1.8;
}
.case__intro .stack b { color: var(--ink); font-weight: 500; }

.case__detail {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 32px;
}
.case-fact {
  border-left: 1px solid var(--rule);
  padding: 4px 0 4px 18px;
}
.case-fact__k {
  font-family: var(--type-mono);
  font-size: 0.7rem;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.case-fact__v {
  font-family: var(--type-display);
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 6px;
}
.case-fact__v .unit {
  font-family: var(--type-mono);
  font-size: 0.8rem;
  color: var(--ink-mute);
  margin-left: 4px;
}
.case-fact__note {
  font-size: 0.84rem;
  color: var(--ink-dim);
  line-height: 1.5;
}

/* ============ INDEX SECTIONS ============ */
.section {
  padding: 64px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.section:last-of-type { border-bottom: none; }
.section__head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 28px;
  gap: 24px;
}
.section__title {
  font-family: var(--type-display);
  font-weight: 400;
  font-size: 1.65rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* selected work strip */
.selected {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
}
.selected__item {
  padding: 24px 26px;
  border-right: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  display: block;
  border-radius: 0;
  background: transparent;
  transition: background var(--t-fast);
  position: relative;
}
.selected__item:hover { background: var(--bg-card); border-bottom-color: var(--rule-soft); }
.selected__item:nth-child(2n) { border-right: none; }
.selected__item:nth-last-child(-n+2) { border-bottom: none; }
.selected__item:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--rule-soft); } /* keep rule if last row uneven */
.selected__head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.selected__num {
  font-family: var(--type-mono);
  font-size: 0.7rem;
  color: var(--ink-mute);
}
.tag {
  font-family: var(--type-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid var(--rule);
  color: var(--ink-mute);
}
.tag.production { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-soft); }
.tag.open       { color: var(--sage); border-color: var(--sage); background: var(--sage-soft); }
.tag.research   { color: var(--steel); border-color: var(--steel); background: var(--steel-soft); }

.selected__title {
  font-family: var(--type-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.2;
}
.selected__desc {
  font-size: 0.88rem;
  color: var(--ink-dim);
  line-height: 1.6;
  margin-bottom: 14px;
}
.selected__stack {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
}
.selected__item a.cover {
  position: absolute; inset: 0;
  border: none;
}

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 28px; }
.t-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 28px;
  align-items: start;
}
.t-when {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  padding-top: 4px;
}
.t-what h3 {
  font-family: var(--type-display);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}
.t-where {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 10px;
}
.t-what p {
  font-size: 0.92rem;
  color: var(--ink-dim);
  line-height: 1.65;
}

/* skills row */
.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule-soft);
}
.skill {
  padding: 22px 24px 22px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.skill:nth-child(3n) { padding-right: 0; }
.skill:nth-last-child(-n+3):nth-child(3n-2),
.skill:nth-last-child(-n+3):nth-child(3n-1),
.skill:nth-last-child(-n+3):nth-child(3n) { border-bottom: none; }
.skill h4 {
  font-family: var(--type-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 500;
}
.skill p {
  font-size: 0.9rem;
  color: var(--ink-dim);
  line-height: 1.55;
}

/* recent */
.recent { display: flex; flex-direction: column; }
.recent-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 28px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule-soft);
  align-items: baseline;
}
.recent-row:last-child { border-bottom: none; }
.recent-row .when {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.recent-row .what {
  font-size: 0.95rem;
  color: var(--ink);
}
.recent-row .what em {
  color: var(--ink-dim); font-style: normal;
}
.recent-row .go {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  border: none;
}
.recent-row .go:hover { color: var(--accent); }

/* ============ FOOTER ============ */
.foot {
  border-top: 1px solid var(--rule);
  padding: 56px 0 48px;
  margin-top: 32px;
  background: var(--bg-inset);
  position: relative; z-index: 1;
}
.foot__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 48px;
}
.foot__sig {
  font-family: var(--type-display);
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--ink);
  font-weight: 400;
  margin-bottom: 10px;
}
.foot__sig em { font-style: italic; color: var(--accent); }
.foot p { color: var(--ink-dim); font-size: 0.88rem; line-height: 1.6; }
.foot h5 {
  font-family: var(--type-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  margin-bottom: 14px;
}
.foot__links { display: flex; flex-direction: column; gap: 8px; }
.foot__links a {
  font-family: var(--type-mono);
  font-size: 0.84rem;
  color: var(--ink-dim);
  border: none;
  display: inline-flex; align-items: center; gap: 10px;
}
.foot__links a:hover { color: var(--accent); }
.foot__links svg { width: 14px; height: 14px; opacity: 0.7; }
.foot__base {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--rule-soft);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--type-mono);
  font-size: 0.74rem;
  color: var(--ink-mute);
}

/* ============ PROJECTS PAGE ============ */
.page-head {
  padding: 80px 0 48px;
  border-bottom: 1px solid var(--rule-soft);
}
.page-head h1 {
  font-family: var(--type-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 4.5vw, 3.6rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 14px;
  line-height: 1.05;
}
.page-head h1 em { font-style: italic; color: var(--accent); }
.page-head p {
  font-size: 1.02rem;
  color: var(--ink-dim);
  max-width: 64ch;
  line-height: 1.6;
}

.filters {
  display: flex; gap: 6px;
  margin: 36px 0 8px;
  flex-wrap: wrap;
}
.filter-btn {
  font-family: var(--type-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--t-fast);
}
.filter-btn:hover { color: var(--ink); border-color: var(--ink-dim); }
.filter-btn.is-on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.proj-list { padding: 32px 0 64px; }
.proj-item {
  padding: 28px 0;
  border-top: 1px solid var(--rule-soft);
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 36px;
  align-items: center;
  transition: background var(--t-fast);
  position: relative;
}
.proj-item:last-child { border-bottom: 1px solid var(--rule-soft); }
.proj-item:hover { background: var(--bg-elev); }
.proj-art {
  width: 140px;
  height: 140px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elev);
  padding: 26px;
}
.proj-art svg { width: 100%; height: 100%; display: block; }
.proj-item { position: relative; cursor: pointer; transition: background 0.15s; border-radius: var(--r-md); }
.proj-item:hover { background: rgba(212,165,116,0.04); }
.proj-item--featured { border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--bg-elev); padding: 28px 28px 28px 26px; margin-bottom: 0; }
.proj-item--featured .proj-art { height: 180px; }
.proj-item--featured .proj-item__title { font-size: 1.7rem; }
.proj-art--ludami { color: var(--accent); }
.proj-art--krvo   { color: var(--sage); }
.proj-art--llm    { color: var(--steel); }
.proj-art--eyezen { color: var(--oxblood); }
.proj-art--niver  { color: var(--ink-mute); }
.proj-art--prisma { color: var(--accent); }
.proj-item__body { min-width: 0; }
.proj-item__body .proj-item__title { margin-bottom: 4px; }
.proj-item__body .proj-item__meta { margin-bottom: 14px; }
.proj-item__num {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.proj-item__title {
  font-family: var(--type-display);
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.15;
  margin-bottom: 8px;
}
.proj-item__meta {
  font-family: var(--type-mono);
  font-size: 0.76rem;
  color: var(--ink-mute);
}
.proj-item__body p {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink-dim);
  margin-bottom: 14px;
}
.proj-item__row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 6px;
}
.proj-item__row a:not(.btn-gh):not(.btn-app) {
  font-family: var(--type-mono);
  font-size: 0.76rem;
  color: var(--ink);
  border: none;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}
.proj-item__row a:not(.btn-gh):not(.btn-app):hover { border-color: var(--accent); color: var(--accent); }
.proj-item__row .sep { color: var(--ink-mute); font-family: var(--type-mono); font-size: 0.7rem; }
.btn-gh, .btn-app {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px;
  border-radius: 20px;
  font-family: var(--type-mono);
  font-size: 0.76rem;
  white-space: nowrap;
}
.btn-gh { border: 1px solid var(--rule); color: var(--ink-dim); background: transparent; }
.btn-gh:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-app { border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-app:hover { background: var(--accent); color: var(--bg); }
.proj-item.is-hidden { display: none; }

/* Big primary CTA on project detail pages ("open the app" / "download") */
.launch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 22px 0 4px; }
.btn-launch {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 30px;
  border-radius: 10px;
  font-family: var(--type-mono);
  font-size: 0.94rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.btn-launch .arrow { transition: transform var(--t-fast); }
.btn-launch:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-soft); color: var(--bg); }
.btn-launch:hover .arrow { transform: translateX(3px); }
.btn-launch-note { font-family: var(--type-mono); font-size: 0.76rem; color: var(--ink-mute); }

/* ============ LAB PAGE ============ */
.lab-section { padding: 56px 0; border-bottom: 1px solid var(--rule-soft); }
.lab-section:last-of-type { border-bottom: none; }
.lab-section__head { margin-bottom: 28px; }
.lab-section__head h2 {
  font-family: var(--type-display);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 8px;
}
.lab-section__head p {
  font-size: 0.95rem;
  color: var(--ink-dim);
  max-width: 60ch;
  line-height: 1.6;
}
.demos {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.demo {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
  min-height: 200px;
}
.demo:hover { border-color: var(--accent); background: var(--bg-card); transform: translateY(-2px); color: var(--ink); }
.demo__art {
  width: 100%; height: 84px;
  border-radius: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--rule-soft);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.demo__art svg { width: 100%; height: 100%; }
.demo__num { font-family: var(--type-mono); font-size: 0.7rem; color: var(--ink-mute); }
.demo__title { font-family: var(--type-display); font-size: 1.15rem; font-weight: 500; color: var(--ink); }
.demo__desc { font-size: 0.85rem; color: var(--ink-dim); line-height: 1.55; flex: 1; }
.demo__foot {
  font-family: var(--type-mono); font-size: 0.72rem;
  color: var(--ink-mute);
  display: flex; justify-content: space-between; align-items: center;
}
.demo__foot .arrow { color: var(--accent); transition: transform var(--t-fast); }
.demo:hover .demo__foot .arrow { transform: translateX(4px); }

.write-list { display: flex; flex-direction: column; }
.write-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 28px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule-soft);
  align-items: baseline;
}
.write-row:last-child { border-bottom: none; }
.write-row .cat {
  font-family: var(--type-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.write-row h3 {
  font-family: var(--type-display);
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 6px;
}
.write-row p {
  font-size: 0.9rem;
  color: var(--ink-dim);
  line-height: 1.6;
}
a.write-row { color: inherit; text-decoration: none; display: grid; }
a.write-row:hover { background: var(--bg-hover, rgba(212,165,116,0.04)); }
.write-row .go {
  font-family: var(--type-mono);
  font-size: 0.75rem;
  color: var(--ink-mute);
  border: none;
  white-space: nowrap;
}
.write-row .go:hover, a.write-row:hover .go { color: var(--accent); }

/* ============ PROD PAGE ============ */
.prod-diagram {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 22px 24px 18px;
  display: flex; flex-direction: column;
  min-height: 460px;
}
.prod-sub {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--rule-soft);
}
.prod-sub__item {
  display: grid;
  grid-template-columns: 60px 280px 1fr;
  gap: 28px;
  padding: 36px 0;
  border-bottom: 1px solid var(--rule-soft);
  align-items: start;
}
.prod-sub__num {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  padding-top: 4px;
}
.prod-sub__title h3 {
  font-family: var(--type-display);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin-bottom: 10px;
}
.prod-sub__stack {
  font-family: var(--type-mono);
  font-size: 0.74rem;
  color: var(--ink-mute);
  line-height: 1.6;
}
.prod-sub__body p {
  font-size: 0.95rem;
  color: var(--ink-dim);
  line-height: 1.7;
  margin-bottom: 14px;
}
.prod-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex; flex-direction: column;
  gap: 6px;
}
.prod-list li {
  font-size: 0.9rem;
  color: var(--ink-dim);
  line-height: 1.55;
  position: relative;
  padding-left: 18px;
}
.prod-list li::before {
  content: "→";
  position: absolute; left: 0; top: 0;
  color: var(--accent);
  font-family: var(--type-mono);
  font-size: 0.85rem;
}
.prod-sub__item { position: relative; }
.prod-sub__link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px;
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.prod-sub__link .arrow { transition: transform var(--t-fast); }
.prod-sub__item:hover .prod-sub__link .arrow { transform: translateX(4px); }
.prod-sub__item > a.cover { position: absolute; inset: 0; }

/* ============ SUB-SYSTEM DETAIL PAGES ============ */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.back-link:hover { color: var(--accent); }

.flow { display: flex; flex-direction: column; margin: 28px 0 8px; }
.flow__step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--rule-soft);
}
.flow__step:first-child { border-top: none; }
.flow__num {
  font-family: var(--type-mono);
  font-size: 0.76rem;
  color: var(--accent);
  padding-top: 3px;
}
.flow__step h4 {
  font-family: var(--type-display);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 6px;
}
.flow__step p { font-size: 0.92rem; color: var(--ink-dim); line-height: 1.65; }

.callout {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 22px 26px;
  margin: 28px 0;
}
.callout__label {
  display: block;
  font-family: var(--type-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.callout p { font-size: 0.94rem; color: var(--ink-dim); line-height: 1.7; }
.callout p + p { margin-top: 10px; }
.callout code {
  font-family: var(--type-mono);
  font-size: 0.85em;
  color: var(--ink);
  background: var(--bg-inset);
  padding: 1px 5px;
  border-radius: 3px;
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px 24px;
  margin: 24px 0;
  padding: 20px 22px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.kv__item { display: flex; flex-direction: column; gap: 4px; }
.kv__k {
  font-family: var(--type-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.kv__v { font-size: 0.92rem; color: var(--ink); }

.shot {
  margin: 28px 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-inset);
}
.shot__img { display: block; width: 100%; height: auto; }
.shot__cap {
  padding: 12px 18px;
  font-size: 0.82rem;
  color: var(--ink-mute);
  border-top: 1px solid var(--rule-soft);
  line-height: 1.55;
}
.shot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 28px 0;
}
.shot-grid .shot { margin: 0; }

/* ============ PAPER CARD (Research) ============ */
.paper {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  padding: 32px 32px 32px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--bg-elev);
  border-radius: var(--r-md);
  padding: 32px;
}
.paper__meta {
  display: flex; flex-direction: column;
  gap: 12px;
}
.paper__journal {
  font-family: var(--type-display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--accent);
}
.paper__date {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.paper__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.paper__title {
  font-family: var(--type-display);
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 10px;
  text-wrap: pretty;
}
.paper__authors {
  font-family: var(--type-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-bottom: 18px;
}
.paper__abstract {
  font-size: 0.95rem;
  color: var(--ink-dim);
  line-height: 1.7;
  margin-bottom: 18px;
  max-width: 65ch;
}
.paper__links {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: 8px;
}
.paper__links a {
  font-family: var(--type-mono);
  font-size: 0.8rem;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 2px 0;
}
.paper__links a:hover { color: var(--accent); border-color: var(--accent); }
.paper--compact { padding: 24px; background: transparent; border-bottom: none; border-top: 1px solid var(--rule-soft); border-radius: 0; margin-top: 0; }
.paper--compact .paper__journal { font-size: 0.88rem; color: var(--ink-mute); }
.paper--compact .paper__title { font-size: 1.15rem; }
.paper--compact .paper__abstract { font-size: 0.9rem; color: var(--ink-mute); }
.paper--compact + .paper--compact { border-top: 1px solid var(--rule-soft); }

/* ============ HINT CARD (open source ↔ production) ============ */
.hint {
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  padding: 32px;
}
.hint .section-label { display: block; margin-bottom: 14px; }
.hint p {
  font-size: 0.95rem;
  color: var(--ink-dim);
  line-height: 1.65;
  margin-bottom: 18px;
  max-width: 60ch;
}
.hint__cta {
  font-family: var(--type-mono);
  font-size: 0.84rem;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  padding: 2px 0;
}
.hint__cta:hover { color: var(--accent); border-color: var(--accent); }

/* ============ TWEAKS-PANEL fix ============ */
#tweaks-mount { position: fixed; bottom: 16px; right: 16px; z-index: 100; }

/* Density tweaks */
body.tweak-cozy .hero { padding: 56px 0 44px; }
body.tweak-cozy .dispatch { padding: 36px 0; }
body.tweak-cozy .case { padding: 56px 0; }
body.tweak-cozy .section { padding: 44px 0; }
body.tweak-cozy .dispatch-card { padding: 22px; min-height: auto; }
body.tweak-cozy .selected__item { padding: 18px 22px; }
body.tweak-cozy .t-row { gap: 20px; }

body.tweak-roomy .hero { padding: 112px 0 80px; }
body.tweak-roomy .dispatch { padding: 76px 0; }
body.tweak-roomy .case { padding: 104px 0; }
body.tweak-roomy .section { padding: 84px 0; }
body.tweak-roomy .dispatch-card { padding: 36px; min-height: 260px; }
body.tweak-roomy .selected__item { padding: 32px 34px; }

/* =====================================================
   SPACING REFINEMENTS — breathing room across the site
   ===================================================== */

/* Section labels behave as block headers in most contexts */
.page-head .section-label,
.case__intro .section-label,
.lab-section__head .section-label,
.section__head .section-label,
.hint .section-label,
.case .section-label {
  display: block;
  margin-bottom: 16px;
}

/* Page heads: more rhythm */
.page-head { padding: 36px 0 48px; }
.page-head h1 { margin-bottom: 22px; }
.page-head p + p { margin-top: 14px; }

/* Hero: title to lede gets more breathing */
.hero h1 { margin-bottom: 28px; }
.hero__lede + .hero__lede { margin-top: 0; }

/* Section heads: a little more bottom */
.section__head { margin-bottom: 36px; }

/* Dispatch cards: more internal gap */
.dispatch-card { gap: 14px; }
.dispatch-card__title { line-height: 1.18; }

/* Selected work cards: title to desc, desc to stack wider */
.selected__head { margin-bottom: 14px; }
.selected__title { margin-bottom: 14px; }
.selected__desc { margin-bottom: 18px; line-height: 1.65; }
.selected__item { padding: 28px 28px; }

/* Project items (open source) */
.proj-item__title { margin-bottom: 6px; }
.proj-item__body .proj-item__meta { margin-bottom: 20px; }
.proj-item__body p { margin-bottom: 18px; line-height: 1.7; }
.proj-item__body .selected__stack { margin-bottom: 16px; }
.proj-item__row { gap: 14px; }

/* Case study: section-label and case-fact spacing */
.case__intro h2 { margin: 6px 0 26px; }
.case__intro p { margin-bottom: 16px; line-height: 1.75; }
.case__intro p:last-of-type { margin-bottom: 0; }
.case-fact { padding: 4px 0 4px 18px; }
.case-fact__k { margin-bottom: 8px; }
.case-fact__v { margin-bottom: 10px; }

/* Timeline */
.t-what h3 { margin-bottom: 8px; }
.t-where { margin-bottom: 14px; }

/* Skills cards */
.skill { padding: 24px 24px 24px 0; }
.skill h4 { margin-bottom: 12px; }

/* Recent rows */
.recent-row { padding: 13px 0; }
.recent-row .what { font-size: 0.88rem; }

/* Lab demo cards: title → desc gap */
.demo { gap: 12px; }
.demo__title { margin-top: 2px; line-height: 1.2; }
.demo__desc { line-height: 1.65; }
.demo__art { margin-bottom: 4px; }

/* Production sub-systems */
.prod-sub__item { padding: 40px 0; }
.prod-sub__title h3 { margin-bottom: 12px; }
.prod-sub__stack { line-height: 1.7; }
.prod-sub__body p { margin-bottom: 16px; line-height: 1.75; }
.prod-sub__body p:last-of-type { margin-bottom: 0; }
.prod-list { margin-top: 16px; }

/* Paper card */
.paper { padding: 36px; gap: 40px; }
.paper__title { margin-bottom: 12px; line-height: 1.25; }
.paper__authors { margin-bottom: 22px; }
.paper__abstract { margin-bottom: 22px; line-height: 1.75; }
.paper__links { margin-top: 14px; }

/* Write rows */
.write-row { padding: 22px 0; }
.write-row h3 { margin-bottom: 10px; line-height: 1.3; }
.write-row p { line-height: 1.65; }

/* Footer */
.foot__sig { margin-bottom: 14px; }
.foot p { line-height: 1.7; }
.foot__links { gap: 10px; }
.foot__grid { gap: 56px; }

/* Hint card on projects page */
.hint p + p { margin-top: 8px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1180px) {
  .nav a { padding: 6px 8px; font-size: 0.72rem; }
}
@media (max-width: 1080px) {
  .brand__pos { display: none; }
}
@media (max-width: 880px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .hero__diagram { min-height: 320px; }
  .hero__portrait-wrap { aspect-ratio: 3/4; height: auto; }
}
@media (max-width: 980px) {
  .case__layout { grid-template-columns: 1fr; gap: 36px; }
  .dispatch__grid, .dispatch__grid--4 { grid-template-columns: 1fr; }
  .selected { grid-template-columns: 1fr; }
  .selected__item, .selected__item:nth-child(2n) { border-right: none; }
  .skills { grid-template-columns: 1fr 1fr; }
  .demos { grid-template-columns: 1fr 1fr; }
  .proj-item { grid-template-columns: 1fr; gap: 18px; }
  .foot__grid { grid-template-columns: 1fr; gap: 32px; }
  .write-row { grid-template-columns: 1fr; gap: 8px; }
  .prod-sub__item { grid-template-columns: 1fr; gap: 14px; }
  .paper { grid-template-columns: 1fr; gap: 18px; padding: 24px; }
  .shot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --gutter: 20px; }
  .site-header__inner { gap: 12px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; }
  .header-tools { margin-left: auto; }
  .skills { grid-template-columns: 1fr; }
  .demos { grid-template-columns: 1fr; }
  .recent-row, .t-row { grid-template-columns: 1fr; gap: 6px; }
  .hero { padding: 56px 0 40px; }
  .case__detail { grid-template-columns: 1fr; gap: 18px; }
  .brand__pos { display: none; }
  .flow__step { grid-template-columns: 1fr; gap: 6px; }
  .kv { grid-template-columns: 1fr 1fr; }
}

/* Lang helpers */
[data-lang-pt] { display: none !important; }
body.lang-pt [data-lang-pt] { display: revert !important; }
body.lang-pt [data-lang-en] { display: none !important; }
.block-pt { display: none; }
.block-en { display: block; }
body.lang-pt .block-pt { display: block; }
body.lang-pt .block-en { display: none; }
