@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

/* Palette and shared foundations. */
:root {
  color-scheme: dark;
  --paper: #0f172a;
  --surface: #1e293b;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #334155;
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --positive: #22c55e;
  --chart-1: #3b82f6;
  --chart-2: #22d3ee;
  --chart-3: #8b5cf6;
  --chart-4: #22c55e;
  --chart-5: #f59e0b;
  --copy: #cbd5e1;
  --header: #0f172af5;
  --visual: #172d50;
  --flow: #0f172a80;
  --on-blue: #0f172a;
  --soft: #3b82f612;
  --soft-hover: #3b82f624;
  --sans: 'DM Sans', Arial, sans-serif;
  --display: 'Manrope', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
img { max-width: 100%; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.25; }
h1 { font-size: clamp(38px, 4.5vw, 62px); letter-spacing: -2.5px; }
h2 { font-size: clamp(28px, 3vw, 39px); letter-spacing: -1.3px; }
h3 { font-size: 23px; letter-spacing: -.5px; }
h1 em, h2 em { font-family: Georgia, serif; font-weight: 400; color: var(--cyan); }
::selection { background: var(--cyan); color: var(--paper); }
[hidden] { display: none !important; }
.wrap { width: min(1200px, calc(100% - 80px)); margin-inline: auto; }
.section-space { padding-block: 88px; }
.projects { padding-block: 88px 48px; }
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 11px; letter-spacing: 1.4px; font-weight: 600; margin-bottom: 20px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); flex-shrink: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 18px; border: 1px solid transparent; border-radius: 5px; font-size: 13px; font-weight: 500; transition: background .2s, border-color .2s; text-align: center; }
.primary { background: var(--blue); color: var(--on-blue); font-weight: 700; }
.primary:hover { background: #60a5fa; }
.secondary { background: var(--soft); }
.secondary:hover { background: var(--soft-hover); color: var(--cyan); }
.text-link, .back-link, .subtle-link { display: inline-block; padding-block: 6px; font-size: 13px; }
a:hover.text-link, a:hover.back-link, a:hover.subtle-link { color: var(--cyan); }
.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-link { position: fixed; top: -100px; left: 15px; background: var(--blue); color: var(--on-blue); padding: 12px; z-index: 20; }
.skip-link:focus { top: 15px; }

/* Shared header, reading progress and footer interactions. */
.site-header { width: 100%; position: sticky; top: 0; z-index: 5; background: var(--header); backdrop-filter: blur(12px); transition: box-shadow .2s; }
.site-header.is-scrolled { box-shadow: 0 8px 24px #02061718; }

.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current] { color: var(--cyan); background: var(--soft); }
.reading-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 10; pointer-events: none; }
.reading-progress span { display: block; height: 100%; background: var(--blue); transform: scaleX(0); transform-origin: left; }
.footer-note>a { font-size: 12px; color: var(--muted); }
#egg-trigger { padding: 8px 0; background: transparent; border: 0; color: var(--muted); font-size: 12px; }
#egg-trigger:hover { color: var(--cyan); }
.legal-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 24px; padding-block: 12px 28px; font-size: 12px; color: var(--muted); }
.legal-links a:hover, .legal-links a[aria-current] { color: var(--cyan); }

/* The first screen and evidence strip. */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 60px; padding-block: 58px; }
.hero h1 { margin-bottom: 24px; }
.hero-description { max-width: 530px; color: var(--copy); line-height: 1.8; }
.hero-focus { font-size: 14px; color: var(--muted); margin-top: 16px; max-width: 510px; }
.hero-actions { display: flex; gap: 25px; flex-wrap: wrap; align-items: center; margin-top: 25px; }
.hero-location { font-size: 12px; color: var(--muted); margin-top: 17px; }
.hero-portrait { position: relative; height: 530px; overflow: hidden; border-radius: 90px 90px 10px 10px; background: var(--surface); }
.hero-portrait>img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.hero-portrait::after { content: ''; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, #0f172aeb); pointer-events: none; }
.hero-portrait figcaption { position: absolute; inset: auto 25px 25px; z-index: 1; display: flex; flex-direction: column; gap: 7px; }
.hero-portrait figcaption span { font-size: 11px; letter-spacing: 1px; color: var(--cyan); }
.hero-portrait figcaption strong { font-size: 21px; font-weight: 500; }

.proof-strip strong.positive { color: var(--positive); }

/* Two featured projects and three compact studies. */
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 35px; margin-bottom: 28px; }
.section-heading>p { max-width: 350px; font-size: 14px; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 24px; }
.filter { background: var(--surface); border: 1px solid transparent; border-radius: 24px; padding: 9px 16px; min-height: 42px; font-size: 12px; }
.filter.active { background: var(--blue); border-color: var(--blue); color: var(--on-blue); font-weight: 700; }
.filter:not(.active):hover { background: var(--surface); }
.project-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 22px; }
.project-card { grid-column: span 2; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; background: var(--surface); transition: box-shadow .2s, transform .2s; }
.project-card.featured { grid-column: span 3; }
.project-card:hover { box-shadow: 0 12px 30px #0206171a; }
.project-visual { display: block; overflow: hidden; background: var(--visual); }
.visual-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 15px 18px; font-size: 12px; min-height: 58px; }
.pill { font-size: 10px; background: var(--soft); border-radius: 20px; padding: 3px 7px; white-space: nowrap; color: var(--copy); }
.compact .visual-top { flex-direction: column; align-items: flex-start; gap: 6px; }
.cover-crop { position: relative; height: 210px; overflow: hidden; background: #fff; }
.featured .cover-crop { height: 245px; }
.cover-crop img { position: absolute; max-width: none; height: auto; display: block; }
.alugaix-cover .cover-crop img { width: 150%; left: -3%; top: 0; transform: translateY(-48%); }
.cinerd-cover .cover-crop img { width: 255%; left: -76%; top: -75%; }
.credito-cover .cover-crop { background: #10171d; }
.credito-cover .cover-crop img { width: 165%; left: -65%; top: -38%; }
.itaipu-cover .cover-crop img { width: 100%; left: 0; top: 0; }
.granja-cover .cover-crop img { width: 205%; left: -4%; top: -1%; }
.project-content { padding: 23px; flex: 1; display: flex; flex-direction: column; }
.project-content h3 { font-size: 23px; margin-bottom: 13px; }
.compact .project-content h3 { font-size: 21px; }
.project-content>p { font-size: 14px; color: var(--muted); }
.project-content .project-result { margin-block: 17px; color: var(--cyan); font-size: 13px; }
.project-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.project-content .project-actions { margin-top: auto; padding-top: 9px; }
.compacta-flow { display: flex; flex-direction: column; align-items: stretch; justify-content: center; padding: 16px 28px; height: 245px; }
.compacta-flow div { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-radius: 6px; padding: 12px 14px; background: var(--flow); }
.compacta-flow span { font-size: 10px; letter-spacing: .5px; color: var(--cyan); }
.compacta-flow strong { font-size: 14px; font-weight: 500; }
.compacta-flow i { width: 1px; height: 13px; margin-left: 22px; background: var(--blue); }
.decision-section { padding: 40px 0 88px; }
.decision-section>div:first-child { max-width: 720px; margin-bottom: 28px; }
.decision-section>div>p:not(.eyebrow) { margin-top: 16px; color: var(--muted); font-size: 14px; max-width: 60ch; }
.decision-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.decision-list a { display: flex; flex-direction: column; gap: 14px; border-radius: 12px; padding: 24px; background: var(--surface); transition: background .2s; min-height: 200px; }
.decision-list span { font-size: 11px; color: var(--cyan); letter-spacing: 1px; }
.decision-list strong { font-weight: 500; font-size: 16px; }
.decision-list small { color: var(--muted); font-size: 12px; margin-top: auto; padding-top: 8px; }
.decision-list a:hover small { color: var(--cyan); }

/* Person, skills, resumes and contact. */
.about { background: var(--surface); }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.about-photo { position: relative; margin: 0 0 90px; padding-right: 18px; }
.about-photo img { width: 100%; height: auto; border-radius: 8px; display: block; }
.about-photo .about-photo-secondary { position: absolute; width: 64%; right: 0; bottom: -75px; border: 6px solid var(--surface); border-radius: 10px; box-shadow: 0 16px 36px #0005; }
.about-copy p { font-size: 15px; color: var(--copy); margin-bottom: 20px; }
.about-copy .large-copy { font: 500 22px/1.55 var(--display); color: var(--ink); }
.education { margin-top: 28px; padding: 24px; background: var(--paper); border-radius: 12px; }
.education .eyebrow { color: var(--muted); font: 600 10px/1.5 var(--sans); letter-spacing: 1.2px; margin-bottom: 18px; }
.education>div { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.education>div:last-child { margin-bottom: 0; }
.education strong { font-size: 14px; font-weight: 500; }
.education span, .education small { font-size: 12px; color: var(--muted); }
.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.skills-grid>div { padding: 26px; background: var(--surface); border-radius: 12px; min-width: 0; }
.skills-grid h3 { font-size: 21px; }
.skills-grid p { margin: 14px 0 20px; font-size: 14px; color: var(--muted); max-width: 34ch; }
.skills-grid small { display: block; font-size: 12px; color: var(--cyan); }
.resumes { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; padding: 40px; background: var(--surface); border-radius: 16px; align-items: start; }
.resumes h2 { font-size: 32px; }
.resumes p:not(.eyebrow) { font-size: 14px; color: var(--muted); margin-top: 18px; }
.resume-list { display: grid; gap: 8px; }
.resume-list a { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 16px; border-radius: 8px; background: var(--paper); transition: background .2s; }

.resume-list strong { display: block; font-size: 15px; font-weight: 500; }
.resume-list small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.resume-list a>span:last-child { font-size: 12px; color: var(--cyan); }
.resume-list a:hover { background: var(--soft); }
.contact { text-align: center; max-width: 960px; padding: 56px 40px; margin-block: 88px 48px; background: var(--soft); border-radius: 20px; }
.contact-portrait { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; object-position: 50% 25%; margin-bottom: 20px; }
.contact .eyebrow { justify-content: center; }
.contact>p:not(.eyebrow) { font-size: 14px; color: var(--muted); margin: 20px auto; max-width: 54ch; }
.contact h2 { max-width: 22ch; margin-inline: auto; }
.contact-email { display: inline-block; font: 500 23px var(--display); margin: 8px 0 26px; padding-bottom: 9px; }
.contact-direct, .contact-links { display: flex; gap: 24px; align-items: center; justify-content: center; flex-wrap: wrap; }
.contact-direct { margin-bottom: 25px; }
.contact-phone { font-size: 17px; }
.contact-phone span { display: block; font-size: 12px; color: var(--cyan); }
.contact-links { font-size: 13px; }
.contact-links button { border: 0; background: none; font-size: 13px; padding: 8px 0; }
.contact-links a:hover, .contact-links button:hover { color: var(--cyan); }
.copy-status { min-height: 20px; font-size: 12px; }

/* Shareable case pages and factual demonstrations. */
.case-page { max-width: 940px; padding-block: 35px 70px; }
.case-heading { margin: 30px 0; }
.case-heading h1 { font-size: clamp(36px, 5vw, 55px); }
.case-lead { font-size: 21px; color: var(--copy); margin-top: 16px; }
.case-metric { color: var(--cyan); font-size: 16px; margin-top: 15px; }
.case-context { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; margin-block: 28px; }
.case-context>div { padding: 24px; background: var(--surface); border-radius: 12px; }
.case-context span { font-size: 11px; color: var(--cyan); letter-spacing: 1px; }
.case-context p { font-size: 14px; color: var(--muted); margin-top: 9px; }
.decision-callout { margin-block: 35px; padding: 28px; background: var(--surface); border-radius: 5px; }
.decision-callout h2 { font-size: 27px; }
.decision-callout>p:last-child { margin-top: 14px; font-size: 16px; }
.case-story h2, .case-experiment h2 { font-size: 28px; margin: 30px 0 15px; }
.case-story p, .case-experiment>p { color: var(--copy); font-size: 15px; margin-bottom: 18px; }
.case-story .button { margin-block: 15px; }
.case-note { background: var(--surface); border-radius: 4px; padding: 15px; color: var(--muted) !important; font-size: 13px !important; }
.case-diagram { margin-block: 28px; }
.case-diagram>a { display: block; cursor: zoom-in; }
.case-diagram img { width: 100%; height: auto; display: block; border-radius: 5px; }
.case-diagram figcaption { font-size: 12px; color: var(--muted); margin-top: 12px; }
.case-diagram figcaption a { display: block; width: fit-content; color: var(--cyan); margin-top: 8px; }
.source-note { padding: 24px; background: var(--surface); border-radius: 10px; margin-top: 35px; }
.source-note h2 { font-size: 21px; margin-bottom: 12px; }
.source-note p { font-size: 13px; color: var(--muted); margin-top: 10px; }
.case-next { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 32px; font-size: 14px; color: var(--cyan); }
.case-next a { flex: 1 1 260px; padding: 20px 24px; background: var(--surface); border-radius: 12px; }
.case-experiment { background: var(--soft); border-radius: 12px; padding: 26px; margin-block: 35px; }
.case-experiment h2 { margin-top: 0; }
.case-experiment .compacta-flow { padding-inline: 0; }
.experiment-controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; text-align: left; }
caption { text-align: left; color: var(--muted); font-size: 12px; padding-bottom: 10px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); }
th { font-weight: 500; color: var(--muted); }
#validate-pipeline { margin-top: 20px; }
.experiment-status { padding: 16px; background: var(--surface); margin-top: 20px; }
.experiment-status[data-state="blocked"] { border-left: 3px solid #f59e0b; }
.experiment-status[data-state="published"] { border-left: 3px solid var(--positive); }
.pipeline-checks { padding-left: 24px; font-size: 14px; }
.pipeline-checks li { margin-block: 7px; }
.experiment-audit { font-size: 12px; color: var(--muted); }
.physics-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin: 25px 0; }
.physics-comparison span, .physics-comparison small { display: block; font-size: 13px; color: var(--muted); }
.physics-comparison strong { display: block; font-size: 35px; font-weight: 500; color: var(--cyan); }
.bar-track { background: var(--surface); height: 16px; border-radius: 3px; margin-top: 13px; }
.bar-track i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
details { padding: 16px 0; margin-block: 24px; }
summary:hover { color: var(--cyan); }
summary { font-size: 14px; font-weight: 500; }
details p { margin-top: 15px; }

/* Local secrets and image viewer. */
.secret-trigger { display: inline-flex; padding: 8px 0; background: none; border: 0; color: var(--muted); font-size: 12px; text-align: left; }
.secret-trigger:hover { color: var(--cyan); }
.hero-secret { margin-top: 20px; }
.skill-secret { margin-top: 15px; }
dialog { width: min(740px, calc(100% - 28px)); max-height: 88dvh; overflow: auto; overscroll-behavior: contain; padding: 50px 35px 30px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: 0 25px 100px #02061780; }
dialog::backdrop { background: #020617b3; backdrop-filter: blur(5px); }
dialog h2 { font-size: 32px; margin-bottom: 18px; }
dialog p { font-size: 14px; color: var(--muted); }
.close-dialog { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); border-radius: 50%; }
#egg-dialog { width: min(590px, calc(100% - 28px)); }
#egg-pattern { margin: 20px 0 10px; font-size: 12px; color: var(--cyan); }
.scatter-shell { position: relative; padding: 12px 14px 22px 23px; }
#scatter-plot { position: relative; height: 280px; border-left: 1px solid var(--muted); border-bottom: 1px solid var(--muted); background: repeating-linear-gradient(0deg, transparent, transparent calc(20% - 1px), #33415560 calc(20% - 1px), #33415560 20%), repeating-linear-gradient(90deg, transparent, transparent calc(20% - 1px), #33415560 calc(20% - 1px), #33415560 20%); }
.scatter-point { position: absolute; width: 44px; height: 44px; transform: translate(-50%, 50%); border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; padding: 0; }
.scatter-point::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px #3b82f618; }
.scatter-point:hover::before { background: var(--cyan); }
.scatter-point.investigated::before { background: var(--muted); }
.scatter-point.found::before { background: var(--positive); box-shadow: 0 0 0 9px #22c55e22; }
.axis-y, .axis-x { position: absolute; font-size: 12px; color: var(--muted); }
.axis-y { top: 0; left: 2px; }
.axis-x { bottom: 0; right: 8px; }
.egg-feedback { min-height: 70px; margin-top: 15px; }
.egg-controls { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 15px; }
.egg-controls>span { font-size: 12px; color: var(--muted); }
.lab-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 25px 0; }
.lab-controls label { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.lab-controls select { width: 100%; min-width: 0; padding: 11px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: var(--surface); font-size: 13px; }
.lab-summary { display: flex; justify-content: space-between; gap: 15px; align-items: center; border-top: 1px solid var(--line); padding-top: 20px; margin-bottom: 25px; font-size: 14px; }
.lab-summary small { font-size: 12px; color: var(--muted); }
#lab-chart { display: flex; flex-direction: column; gap: 20px; }
.lab-bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 8px; }
.lab-bar-label strong { font-weight: 500; }
.lab-bar-track { height: 22px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.lab-bar { height: 100%; border-radius: 4px; }
.lab-insight { padding: 16px; margin-top: 25px; background: var(--surface); border-left: 2px solid var(--cyan); border-radius: 4px; color: var(--ink); }
.lab-table-wrap { overflow: auto; max-height: 300px; margin-top: 15px; }
.lab-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.lab-presets button { font: inherit; font-size: 12px; padding: 9px 12px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.lab-presets button:hover { border-color: var(--cyan); }
.lab-definition { font-size: 13px; color: var(--muted); }
.lab-data .button { margin-top: 14px; }
.lab-data table { font-size: 12px; }
.lab-note { font-size: 12px; }
.image-dialog { width: min(1250px, calc(100% - 24px)); max-height: 92dvh; padding: 0; overflow: hidden; }
.image-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.image-toolbar #image-title { font-size: 13px; color: var(--ink); max-width: 75%; }
.image-toolbar>div { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.image-toolbar .close-dialog { position: static; }
.image-zoom { border: 0; background: none; color: var(--cyan); font-size: 13px; padding: 8px 0; }
.image-viewport { height: 72dvh; overflow: auto; overscroll-behavior: contain; background: var(--paper); display: grid; place-items: center; padding: 20px; }
.image-viewport img { display: block; max-width: 100%; max-height: calc(72dvh - 40px); width: auto; height: auto; object-fit: contain; }
.image-viewport.is-zoomed { display: block; }
.image-viewport.is-zoomed img { width: var(--image-natural-width); max-width: none; max-height: none; margin: auto; }

/* Legal pages and error state. */
.legal-header { display: flex; justify-content: space-between; align-items: center; padding-block: 22px; }
.legal-header>a:last-child { font-size: 13px; color: var(--muted); }
.legal-page { max-width: 800px; padding-block: 60px; }
.legal-page h1 { font-size: clamp(33px, 5vw, 49px); }
.legal-page h2 { font-size: 24px; margin: 35px 0 15px; }
.legal-page p { color: var(--muted); font-size: 15px; margin-top: 18px; }
.legal-page .legal-lead { font-size: 18px; color: var(--ink); }
.legal-page p a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.legal-page .legal-date { font-size: 12px; margin: 40px 0 22px; padding-top: 10px; }
.not-found { min-height: 60vh; max-width: 850px; padding-block: 80px; }
.not-found p:not(.eyebrow) { color: var(--muted); margin-top: 25px; }

/* Responsive behavior. */
@media (max-width: 1050px) {
  .wrap { width: calc(100% - 56px); }
  .hero { gap: 35px; }
  .hero-portrait { height: 510px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-card, .project-card.featured { grid-column: span 1; }
  .project-card:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .about-grid { gap: 35px; }
  .decision-list { gap: 16px; }
  .decision-list a, .skills-grid>div { padding: 22px; }
}
@media (min-width: 761px) and (max-width: 1050px) {
  .alugaix-cover .cover-crop img { width: 200%; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 40px); }
  html { scroll-padding-top: 90px; }
  h1 { font-size: 43px; letter-spacing: -1.8px; }
  .hero { grid-template-columns: 1fr; padding-block: 35px; gap: 30px; }
  .hero-portrait { height: 430px; max-width: 480px; width: 100%; justify-self: center; border-radius: 65px 65px 9px 9px; }
  .hero-description { font-size: 16px; }
  .hero .eyebrow { font-size: 10px; }

  .section-space { padding-block: 64px; }
  .projects { padding-block: 64px 32px; }
  .section-heading { display: block; }
  .section-heading>p { margin-top: 18px; }
  .filter { padding-inline: 13px; }
  .project-grid, .about-grid, .skills-grid, .decision-list { grid-template-columns: 1fr; }
  .project-card:last-child { grid-column: auto; display: flex; }
  .project-card .project-content h3 { font-size: 23px; }
  .compact .visual-top { flex-direction: row; align-items: center; }
  .visual-top { font-size: 11px; padding-inline: 15px; }
  .cover-crop, .featured .cover-crop { height: 235px; }
  .alugaix-cover .cover-crop img { width: 240%; }
  .cinerd-cover .cover-crop img { top: -42%; width: 265%; left: -81%; }
  .itaipu-cover .cover-crop { height: auto; aspect-ratio: 1444/1104; }
  .credito-cover .cover-crop { height: auto; aspect-ratio: 2; }
  .granja-cover .cover-crop { height: auto; aspect-ratio: 1.6; }
  .compacta-flow { padding-inline: 18px; }
  .compacta-flow strong { font-size: 13px; }
  .decision-section { padding-block: 32px 64px; }
  .decision-list a { min-height: 0; }
  .about-grid { gap: 18px; }
  .about-photo { margin-bottom: 88px; }
  .education { padding: 22px; }
  .about-copy .large-copy { font-size: 21px; }
  .resumes { grid-template-columns: 1fr; padding: 28px 23px; gap: 26px; }
  .resumes h2 { font-size: 28px; }
  .contact { padding: 40px 24px; margin-block: 64px 32px; border-radius: 16px; }
  .contact h2 { font-size: 30px; }
  .contact-email { font-size: 21px; }
  .contact-direct { flex-direction: column; gap: 15px; }
  .contact-links { gap: 20px; }
  .case-context { grid-template-columns: 1fr; gap: 18px; }
  .case-page { padding-top: 22px; }
  .case-heading h1 { font-size: 37px; }
  .decision-callout, .case-experiment { padding: 21px; }
  .case-experiment .compacta-flow div { flex-direction: column; align-items: flex-start; }
  .case-experiment .compacta-flow { height: auto; }
  .physics-comparison { gap: 16px; }
  .physics-comparison strong { font-size: 29px; }
  dialog { padding: 53px 24px 25px; }
  dialog h2 { font-size: 29px; }
  #scatter-plot { height: 240px; }
  .egg-controls { flex-direction: column; align-items: flex-start; }
  .lab-controls { grid-template-columns: 1fr 1fr; }
  .lab-controls label:first-child { grid-column: 1 / -1; }
  .lab-summary { flex-direction: column; align-items: flex-start; gap: 7px; }
  .lab-data td, .lab-data th { padding-inline: 4px; font-size: 11px; }
  .image-dialog { padding: 0; }
  .image-toolbar { padding: 12px; gap: 10px; }
  .image-toolbar #image-title { font-size: 11px; max-width: 58%; }
  .image-toolbar>div { gap: 9px; }
  .image-viewport { padding: 10px; }
  .image-viewport img { max-height: calc(72dvh - 20px); }
  .legal-page { padding-block: 40px; }
}
@media (max-width: 380px) {
  h1 { font-size: 38px; }
  .compact .visual-top { flex-direction: column; align-items: flex-start; }
  .contact-email { font-size: 19px; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .project-card:hover { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  :root { --paper: #fff; --ink: #0f172a; --muted: #334155; --surface: #f1f5f9; --line: #cbd5e1; --cyan: #0369a1; }
  .site-header, footer, .legal-links, .reading-progress, .filters, .secret-trigger, .hero-portrait, dialog, .project-visual, .about-photo, .contact-portrait { display: none !important; }
  .wrap { width: 100%; }
  .hero, .about-grid, .project-grid, .case-context { display: block; }
  .section-space, .hero { padding-block: 20px; }
  h1 { font-size: 30px; }
  h2 { font-size: 25px; }
  .project-card { break-inside: avoid; margin-bottom: 15px; }
}

/* Display preferences share the same controls across every language and page. */
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #f8fafc; --surface: #fff; --ink: #0f172a;
  --muted: #526179; --copy: #334155; --line: #cbd5e1;
  --blue: #2563eb; --cyan: #007f96; --positive: #15803d;
  --header: #f8fafcf5; --visual: #e8eff9; --flow: #f1f5f9;
  --on-blue: #fff;
  --soft: #2563eb0a;
  --soft-hover: #2563eb15;
}
.display-preferences svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-moon, [data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: block; }
.display-preferences noscript { display: flex; gap: 12px; font-size: 12px; }
.hero-portrait figcaption { color: #f8fafc; }
.hero-portrait figcaption span { color: #cbd5e1; }
:root[data-theme="light"] .primary:hover { background: #1d4ed8; }
:root[data-theme="light"] .project-card { box-shadow: 0 4px 18px #0f172a05; }
@media (max-width: 760px) {
  html { scroll-padding-top: 88px; }
  .legal-header { flex-wrap: wrap; gap: 12px; }
}

/* Identity, compact navigation and matched display controls. */
.brand { display: inline-flex; align-items: center; gap: 10px; width: auto; height: 48px; justify-self: start; flex-shrink: 0; }
.data-mark { width: 36px; height: 36px; flex-shrink: 0; }
.brand-caption { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.brand-caption strong { font: 600 14px var(--display); letter-spacing: -.2px; }
.brand-caption small { color: var(--muted); font-size: 10px; letter-spacing: 1.1px; }
.header-inner { min-height: 80px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 24px; align-items: center; }
.site-menu { display: contents; }
.site-header nav { display: flex; justify-self: center; gap: 8px; }
.site-header nav a { padding: 10px 12px; font-size: 14px; color: var(--muted); border-radius: 8px; }
.header-actions { display: flex; justify-self: end; align-items: center; gap: 20px; }
.header-contact { font-size: 13px; color: var(--cyan); white-space: nowrap; }
.display-preferences { display: flex; align-items: center; gap: 2px; background: var(--soft); padding: 3px; border-radius: 12px; }
.display-preferences button { color: var(--ink); border: 0; background: transparent; border-radius: 9px; }
.display-preferences #theme-toggle, .display-preferences #language-toggle { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 12px; font-weight: 600; }
.display-preferences button:hover, .display-preferences button[aria-expanded="true"] { background: var(--soft-hover); }
.language-control { position: relative; }
.language-options { position: absolute; z-index: 10; right: 0; top: calc(100% + 12px); width: 184px; padding: 6px; border-radius: 12px; background: var(--surface); box-shadow: 0 12px 40px #02061730; }
.language-options button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 10px 12px; font-size: 13px; }
.language-options button small { font-size: 10px; color: var(--muted); }
.language-options button[aria-pressed="true"] { background: var(--soft-hover); color: var(--cyan); }
.menu-toggle { display: none; border: 0; border-radius: 10px; width: 44px; height: 44px; padding: 10px; background: var(--soft); color: var(--ink); justify-self: end; }
.menu-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* A compact, contextual row of business indicators. */
.proof { margin-block: 16px 8px; padding-block: 28px 0; background: none; border-radius: 0; }
.proof-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.proof .eyebrow { color: var(--muted); font-size: 10px; margin-bottom: 8px; }
.proof h2 { font: 500 26px/1.3 var(--display); letter-spacing: -.6px; }
.proof-heading>a { color: var(--cyan); flex-shrink: 0; }
.proof-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 24px 0; border-top: 1px solid var(--line); gap: 0; }
.proof-strip>div { min-width: 0; padding-inline: 32px; border-left: 1px solid var(--line); }
.proof-strip>div:first-child { border-left: 0; padding-left: 0; }
.proof-strip>div:last-child { padding-right: 0; }
.proof-strip dt { font-size: 13px; color: var(--copy); margin-bottom: 12px; }
.proof-strip dd { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.proof-strip strong { font: 500 clamp(28px, 2.7vw, 36px)/1.3 var(--display); letter-spacing: -.8px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.proof-strip strong.positive { color: var(--positive); }
.proof-strip strong .metric-unit { display: inline; margin: 0 0 0 4px; color: var(--copy); font: 12px var(--sans); letter-spacing: 0; }
.metric-caption { font-size: 12px; color: var(--muted); }

/* Footer as a complete composition, with the hidden invitation centered. */
.site-footer { background: var(--soft); padding-block: 40px 24px; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 24px; align-items: center; }
.footer-identity p { font-size: 11px; color: var(--muted); margin-top: 8px; }
.footer-note { justify-self: center; display: flex; flex-direction: column; align-items: center; text-align: center; }
.footer-navigation { display: flex; flex-direction: column; gap: 6px; justify-self: end; font-size: 12px; color: var(--muted); text-align: right; }
.footer-navigation a:hover { color: var(--cyan); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 30px; font-size: 11px; color: var(--muted); }
.footer-bottom .legal-links { padding: 0; gap: 20px; font-size: 11px; }
@media (max-width: 1100px) and (min-width: 901px) { .header-actions .header-contact { display: none; } }
@media (max-width: 900px) {
  html { scroll-padding-top: 88px; }
  .header-inner { min-height: 72px; grid-template-columns: 1fr auto; gap: 12px; padding-block: 0; }
  .menu-toggle:not([hidden]) { display: grid; place-items: center; }
  .site-menu { display: flex; grid-column: 1 / -1; flex-direction: column; gap: 20px; padding-block: 16px 24px; }
  [data-navigation-ready] .site-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; padding: 20px max(20px, calc((100vw - 1200px) / 2)); background: var(--paper); box-shadow: 0 20px 30px #02061725; max-height: calc(100dvh - 72px); overflow-y: auto; }
  [data-navigation-ready] .site-menu.is-open { display: flex; }
  .site-header nav { display: flex; flex-direction: column; gap: 4px; width: 100%; }
  .site-header nav a { padding: 10px 12px; min-height: 48px; font-size: 18px; }
  .header-actions { justify-content: space-between; width: 100%; gap: 12px; }
  .header-actions .header-contact { display: block; padding: 10px 12px; font-size: 13px; }
  .site-menu .language-options { top: auto; bottom: calc(100% + 10px); }
  .site-footer .footer-inner { grid-template-columns: 1fr; gap: 24px; text-align: center; }
  .footer-identity { justify-self: center; }
  .footer-navigation { justify-self: center; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 20px; text-align: center; }
  .footer-note { grid-row: 3; }
  .footer-bottom { flex-direction: column; gap: 12px; margin-top: 28px; }
}
@media (max-width: 760px) {
  .proof { padding-block: 20px 0; }
  .proof-heading { align-items: start; flex-direction: column; gap: 8px; margin-bottom: 12px; }
  .proof h2 { font-size: 24px; }
  .proof-strip { grid-template-columns: 1fr; border-top: 0; padding: 0; }
  .proof-strip>div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 20px 0; border-left: 0; border-top: 1px solid var(--line); }
  .proof-strip dt { grid-column: 1; margin: 0; font-size: 12px; align-self: end; }
  .proof-strip dd { display: contents; }
  .proof-strip strong { grid-column: 2; grid-row: 1 / 3; font-size: clamp(22px, 6vw, 28px); align-self: center; text-align: right; }
  .metric-caption { grid-column: 1; font-size: 11px; }
  .proof-strip strong .metric-unit { display: block; font-size: 10px; margin: 3px 0 0; }
  .legal-header { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
  .legal-header>.brand { grid-column: 1; grid-row: 1; }
  .legal-header>.display-preferences { grid-column: 2; grid-row: 1; }
  .legal-header>a:not(.brand) { grid-column: 1 / -1; grid-row: 2; font-size: 13px; color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) { .menu-toggle svg { transition: none; } }

@media print { .site-footer, .display-preferences, .menu-toggle { display: none !important; } }
