:root {
  color-scheme: light;
  --paper: #f8f4ee;
  --ink: #20191a;
  --muted: #645657;
  --wine: #771e37;
  --rule: #c9bbb4;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Instrument Sans", system-ui, sans-serif;
  --gutter: clamp(1.15rem, 5vw, 5rem);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 7rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.65 var(--sans);
}
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1; }
a { color: var(--wine); text-underline-offset: .22em; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 4px; }
.skip-link { position: fixed; z-index: 3; top: 1rem; left: 1rem; padding: .5rem 1rem; background: var(--paper); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.page, .header-inner { width: min(100% - 2 * var(--gutter), 76rem); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 2; background: var(--paper); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  min-height: 4.75rem;
  border-bottom: 1px solid var(--ink);
}
nav { display: flex; flex-wrap: wrap; gap: .15rem clamp(.65rem, 2.5vw, 2rem); align-items: center; }
nav a, .nav-button { color: var(--ink); font-size: .9rem; font-weight: 600; text-decoration: none; padding-block: .32rem; }
nav a:hover, .nav-button:hover { text-decoration: underline; }
.nav-button { background: transparent; border: 0; font-family: inherit; line-height: inherit; padding-inline: 0; }
nav .project-link { color: var(--wine); border-bottom: 1px solid currentColor; }
.intro {
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1.65fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  padding-block: clamp(2.75rem, 7vw, 6.5rem);
}
.portrait { position: relative; margin-top: .35rem; padding: .55rem; border: 1px solid var(--rule); }
.portrait img { display: block; width: 100%; height: auto; }
.meta { color: var(--wine); font-size: .78rem; font-weight: 700; letter-spacing: .065em; }
h1 { grid-column: 1 / -1; font-size: clamp(1rem, 6.5vw, 6.3rem); line-height: 1; white-space: nowrap; }
h1 em { color: var(--wine); }
.bio { max-width: 61ch; }
.bio h2 { font-size: 1.65rem; margin-bottom: .55rem; }
.bio p + p { margin-top: .65rem; }
.career-illustration { display: block; width: min(100%, 38rem); height: auto; margin-top: clamp(.85rem, 2.4vw, 2rem); }
.chapter {
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1.65fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  border-top: 1px solid var(--ink);
  padding-block: clamp(2.4rem, 5vw, 4.75rem);
}
.chapter-heading { border-left: 2px solid var(--wine); padding-left: .85rem; align-self: start; }
.chapter-heading h2 { font-size: clamp(1.65rem, 3vw, 2.65rem); }
.chapter-heading p { color: var(--muted); font-size: .88rem; margin-top: .65rem; }
.bio p, .organization + p, details li, .contact-box > p { text-align: justify; hyphens: auto; }
.entry + .entry { border-top: 1px solid var(--rule); margin-top: 1.5rem; padding-top: 1.5rem; }
.entry h3 { font-size: clamp(1.35rem, 2vw, 1.95rem); margin: .4rem 0; }
.entry .organization { color: var(--muted); font-size: .93rem; font-weight: 600; }
.organization + p { margin-top: .45rem; max-width: 66ch; }
.certificate-actions { margin-top: .65rem; }
.text-button, summary { color: var(--wine); font: 600 .95rem/1.5 var(--sans); }
.text-button { background: transparent; border: 0; padding: .3rem 0; text-decoration: underline; text-underline-offset: .22em; }
summary { width: fit-content; padding-block: .28rem; }
details ul, details ol { margin: .35rem 0 0; padding-left: 1.5rem; }
details li + li { margin-top: .2rem; }
.contact-box { border: 1px solid var(--rule); border-left: 4px solid var(--wine); padding: clamp(1.2rem, 4vw, 2.8rem); }
.contact-box h3 { font-size: clamp(1.65rem, 3vw, 2.45rem); margin-bottom: .4rem; }
.contact-box ul { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; list-style: none; margin: .9rem 0 0; padding: 0; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding-block: 1.25rem; border-top: 1px solid var(--ink); font-size: .88rem; }
dialog { width: min(58rem, calc(100% - 1.5rem)); max-height: 90dvh; padding: clamp(.8rem, 2vw, 1.5rem); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgb(32 25 26 / 75%); }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: .8rem; padding-bottom: .8rem; }
.dialog-header h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); }
.dialog-header button { white-space: nowrap; }
dialog img { display: block; width: 100%; height: auto; }
@media (max-width: 54rem) {
  html { scroll-padding-top: 8rem; }
  .header-inner { padding-block: .55rem; }
}
@media (max-width: 42rem) {
  html { scroll-padding-top: 9rem; }
  .intro, .chapter { grid-template-columns: minmax(0, 1fr); }
  .portrait { width: min(55%, 13rem); }
}
dialog img[hidden] { display: none; }
#documento-curriculo { display: block; width: 100%; height: 72dvh; border: 0; background: white; }
#documento-curriculo[hidden] { display: none; }
.intro h1, .case-page h1 { text-align: center; }
.case-page { padding-block: clamp(2rem, 5vw, 5rem); }
.case-page h1 { white-space: normal; font-size: clamp(2.9rem, 7vw, 6rem); margin-block: .45rem 1rem; }
.case-page h2 { font-size: clamp(1.7rem, 4vw, 2.75rem); margin-bottom: .6rem; }
.case-page h3 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: .5rem; }
.case-page p { max-width: 68ch; }
.case-hero { padding-bottom: 2rem; text-align: center; }
.case-hero p { margin-inline: auto; text-align: center; }
.case-hero .case-note { border-left: 0; padding-left: 0; }
.case-hero p + p { margin-top: .75rem; }
.case-section { border-top: 1px solid var(--ink); padding-block: 2rem; }
.case-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(1rem, 4vw, 3rem); }
.case-row + .case-row { border-top: 1px solid var(--rule); margin-top: 1.5rem; padding-top: 1.5rem; }
.case-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; list-style: none; padding: 0; margin: .8rem 0; }
.case-tags li { text-align: center; border: 1px solid var(--rule); padding: .14rem .55rem; font-size: .8rem; }
.case-action { display: inline-block; padding: .5rem .85rem; color: white; background: var(--wine); text-decoration: none; margin-top: .75rem; }
.case-action:hover { text-decoration: underline; }
.case-facts { margin-block: 1.5rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .9rem 1.4rem; }
.case-facts div { border-block-start: 1px solid var(--rule); padding-top: .45rem; }
.case-facts dt { color: var(--muted); font-size: .85rem; }
.case-facts dd { margin: 0; font: 1.5rem/1.15 var(--serif); }
.case-details { padding-block: .65rem; border-bottom: 1px solid var(--rule); }
.case-details p { margin-top: .45rem; }
.case-prose { text-align: justify; hyphens: auto; }
.case-note { border-left: 2px solid var(--wine); padding-left: .8rem; color: var(--muted); }
.notebook { background: #fffaf4; border: 1px solid var(--rule); border-radius: 0 .35rem .35rem 0; padding: clamp(1rem, 5vw, 3rem); position: relative; }
.notebook::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--wine); }
.notebook-index { border-top: 1px solid var(--rule); padding-block: .65rem; }
.notebook ul:not(.case-tags) { padding-left: 1.25rem; }
.table-scroll { overflow-x: auto; margin-top: 1rem; }
.case-table { border-collapse: collapse; min-width: 35rem; width: 100%; font-size: .88rem; }
.case-table caption { text-align: left; padding-bottom: .5rem; font-weight: 600; }
.case-table :is(th, td) { border-bottom: 1px solid var(--rule); padding: .55rem; text-align: left; vertical-align: top; }
@media (max-width: 42rem) { .case-row { grid-template-columns: minmax(0, 1fr); } }

.projects-page { padding-block: clamp(1.4rem, 3vw, 2.8rem); }
.projects-page .case-hero { padding-bottom: 1.15rem; }
.projects-page .case-section { padding-block: 1.2rem; }
.projects-page p { max-width: 82ch; }
.projects-page .case-facts { margin: .9rem 0 .55rem; }
.projects-page .case-row { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.projects-page .case-row + .case-row { margin-top: 1rem; padding-top: 1rem; }
.projects-page .case-row > .case-tags { margin: 0; }
.projects-page .case-tags li { background: #fffaf4; }

.notebook {
  --notebook-margin: clamp(1.2rem, 4vw, 3.3rem);
  padding-inline: var(--notebook-margin) clamp(1rem, 3.5vw, 2.5rem);
  box-shadow: .3rem .3rem 0 #eee2d8;
  background: linear-gradient(90deg, transparent calc(var(--notebook-margin) - .65rem), #ead4d5 calc(var(--notebook-margin) - .65rem) calc(var(--notebook-margin) - .59rem), transparent calc(var(--notebook-margin) - .59rem)), #fffaf4;
}
.notebook .case-hero { padding-bottom: 1.15rem; border-bottom: 1px solid var(--ink); }
.notebook-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3.4fr); gap: clamp(1rem, 3vw, 2rem); }
.notebook-index { display: grid; align-content: start; gap: 0; border: 0; }
.notebook-index a { border-bottom: 1px solid var(--rule); }
.notebook .case-section { border-color: var(--rule); padding-block: 1.25rem; }
.notebook .case-section:first-child { border-top: 0; }
.notebook .case-table thead { background: #f1e5dc; }
.notebook .case-table tbody tr:nth-child(even) { background: #f8efe8; }
@media (max-width: 46rem) {
  .projects-page .case-row, .notebook-layout { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .notebook-index { display: flex; flex-wrap: wrap; }
}

.company-profile { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem 2rem; margin-top: 1.25rem; }
.company-profile section { padding-top: .85rem; border-top: 1px solid var(--rule); }
.company-list { margin: .6rem 0 0; }
.company-list div + div { margin-top: .6rem; }
.company-list dt { font-weight: 600; color: var(--wine); }
.company-list dd { margin: 0; }
@media (max-width: 46rem) { .company-profile { grid-template-columns: minmax(0, 1fr); } }

.notebook-editor { margin-bottom: 1rem; }
.notebook-editor p { margin-top: .5rem; }
.notebook-editor #estado-edicao:empty { display: none; }
.editor-actions { display: flex; align-items: end; flex-wrap: wrap; gap: .5rem .8rem; margin-top: .55rem; }
.editor-actions label { display: grid; gap: .15rem; min-width: 0; font-size: .85rem; }
.editor-actions button, .editor-actions select { max-width: 100%; background: #fffaf4; color: var(--wine); border: 1px solid var(--rule); padding: .45rem .65rem; font: 600 .87rem/1.4 var(--sans); }
.editor-actions button:hover { border-color: var(--wine); }
.notebook.is-editing [contenteditable] { outline: 1px dashed var(--rule); outline-offset: 2px; }
.notebook.is-editing [contenteditable]:focus { outline: 2px solid var(--wine); }
.notebook .case-prose { white-space: pre-line; }
.notebook .case-section > h3:not(:first-child), .notebook .case-section > p + p { margin-top: .9rem; }
.notebook-entries .case-section > :is(h3, ul, ol, .table-scroll, details) + .case-prose { margin-top: .8rem; }
.notebook-entries .case-section > h3 { margin-top: 1.4rem; }
.notebook-entries .table-scroll .case-table td { min-width: 5rem; }
.notebook-entries .table-scroll .case-table :is(th, td) { overflow-wrap: anywhere; }

.notebook .scope-note { padding: .8rem 1rem; border-left: 2px solid var(--wine); background: #f8efe8; }
.notebook .risk-entry { margin-top: .85rem; padding: .85rem 1rem; border: 1px solid var(--rule); }
.risk-entry h4 { margin: 0 0 .55rem; color: var(--wine); font: 400 1.55rem/1 var(--serif); }
.risk-entry dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1rem; margin: 0; }
.risk-entry dl > div { min-width: 0; padding-top: .4rem; border-top: 1px solid var(--rule); }
.risk-entry dt { color: var(--muted); font-size: .82rem; font-weight: 600; }
.risk-entry dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 46rem) { .risk-entry dl { grid-template-columns: minmax(0, 1fr); } }

.notebook-page {
  width: min(100% - 2 * clamp(.65rem, 2vw, 1.75rem), 94rem);
  padding-block: clamp(1rem, 2.5vw, 2rem);
}
.notebook-page .notebook { font-size: .935rem; line-height: 1.55; padding-block: 1.25rem; }
.notebook-page h1 { font-size: clamp(2.45rem, 5.4vw, 4.4rem); }
.notebook-page h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); }
.notebook-page h3 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
.notebook-page .notebook-layout { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); }
.notebook-page .notebook-entries p { max-width: 90ch; }
.notebook-page .case-table { min-width: 0; table-layout: fixed; margin-block: .65rem 1rem; }
.notebook-page .case-table :is(th, td) { min-width: 0; padding: .45rem .5rem; overflow-wrap: anywhere; }
.notebook-page .case-table th { color: var(--wine); }
.risk-scales { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.risk-scales :is(th, td):first-child { width: 24%; }
.risk-scales :is(th, td):nth-child(2) { width: 23%; }
@media (max-width: 65rem) {
  .risk-scales { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 46rem) {
  .notebook-page .notebook-layout { grid-template-columns: minmax(0, 1fr); }
}

.company-flow, .risk-chart { margin-block: 1.25rem; padding: clamp(.85rem, 2vw, 1.3rem); background: #fffaf4; border: 1px solid var(--rule); }
.company-flow figcaption, .risk-chart figcaption { font: 400 clamp(1.4rem, 3vw, 1.85rem)/1.1 var(--serif); }
.company-flow ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: .85rem 0 0; padding: 0; list-style: none; }
.company-flow li { position: relative; padding: .75rem .9rem; border-top: 2px solid var(--wine); background: var(--paper); }
.company-flow li:not(:last-child)::after { content: "→"; position: absolute; top: .65rem; right: -.7rem; color: var(--wine); }
.company-flow li strong, .company-flow li span { display: block; }
.company-flow li strong { color: var(--wine); margin-bottom: .3rem; }
.company-profile summary { font: 400 1.35rem/1.2 var(--serif); }
.case-page .chapter-lead { margin-block: .65rem 1.2rem; color: var(--muted); }
.risk-chart { background: var(--paper); }
.risk-chart > p { margin-top: .3rem; }
.risk-chart .chart-legend, .risk-chart .chart-rows { list-style: none; padding: 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; }
.chart-legend li::before { content: ""; display: inline-block; width: .7rem; height: .7rem; margin-right: .35rem; background: var(--wine); }
.chart-legend li + li::before { background: #bf9d8d; }
.chart-rows { display: grid; gap: .75rem; margin-bottom: 0; }
.chart-rows li { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); align-items: center; gap: .6rem; }
.chart-bars > div { background: #ede3d9; }
.chart-bars > div + div { margin-top: 3px; }
.chart-bars span { display: block; padding-inline: .35rem; background: var(--wine); color: white; font-size: .77rem; text-align: right; }
.chart-bars > div + div span { background: #bf9d8d; color: var(--ink); }
@media (max-width: 46rem) {
  .company-flow ol, .chart-rows li { grid-template-columns: minmax(0, 1fr); }
  .company-flow li:not(:last-child)::after { content: "↓"; top: auto; right: .75rem; bottom: -.85rem; }
}

/* Aba de navegação flutuante */
.notebook-page { width: calc(100% - 2rem); max-width: none; margin-inline: auto; }
.notebook-page .notebook-layout { display: block; }
.notebook-tab {
  position: fixed; right: 0; top: 45%; z-index: 4;
  writing-mode: vertical-rl; padding: .8rem .4rem;
  border: 1px solid var(--wine); border-radius: .35rem 0 0 .35rem;
  background: var(--wine); color: white; font: 600 .8rem/1.3 var(--sans);
  letter-spacing: .06em; cursor: pointer;
}
.notebook-page .notebook-index {
  display: none; position: fixed; right: 2.2rem; top: 25%;
  width: min(17rem, calc(100vw - 3.5rem)); max-height: 65dvh; overflow-y: auto;
  padding: .85rem; background: var(--paper); border: 1px solid var(--rule);
  box-shadow: 0 .4rem 1.3rem #20191a20; z-index: 3;
}
body:has(.notebook-tab[aria-expanded="true"]) .notebook-index { display: grid; }
.notebook-nav-title { display: block; color: var(--wine); font-size: .75rem; margin-bottom: .5rem; }
.notebook-index a { display: block; padding: .55rem 0; line-height: 1.35; }
.notebook-entries .case-section { padding-block: 1.8rem; }
.notebook-entries .case-section > h3 { margin-top: 1.8rem; padding-top: .8rem; border-top: 1px solid var(--rule); }
.notebook-entries .case-section > h2 { margin-bottom: .8rem; }

.knowledge-list { margin: .75rem 0 0; }
.knowledge-list > div + div { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--rule); }
.knowledge-list dt { color: var(--wine); font-weight: 600; }
.knowledge-list dd { margin: .2rem 0 0; text-align: justify; hyphens: auto; }

.knowledge-tags { justify-content: flex-start; margin-block: .75rem; }
.knowledge-copy { text-align: justify; hyphens: auto; margin-top: .8rem; }
