:root {
  color-scheme: light;
  --paper: #f5f0e6;
  --paper-raised: #fbf8f1;
  --ink: #27272a;
  --muted: #68645e;
  --indigo: #31327a;
  --indigo-soft: #e5e3f2;
  --ochre: #a76524;
  --sage: #43685b;
  --red: #9a403b;
  --line: #d8d0c2;
  --sidebar: 18rem;
  --toolbar: 4rem;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #18191d;
  --paper-raised: #222329;
  --ink: #ece9e2;
  --muted: #aaa7a0;
  --indigo: #aaa8ff;
  --indigo-soft: #30304b;
  --ochre: #e2aa6c;
  --sage: #8cc2ae;
  --red: #e78f88;
  --line: #3a3b43;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: clip; background: var(--paper); color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.72; text-rendering: optimizeLegibility; }
button, input { font: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--paper); padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }
.reading-progress { position: fixed; inset: 0 0 auto 0; z-index: 80; height: 3px; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--indigo); }
.book-toolbar { position: fixed; z-index: 70; top: 0; right: 0; left: var(--sidebar); height: var(--toolbar); display: flex; align-items: center; gap: .6rem; padding: .65rem 1.25rem; background: color-mix(in srgb, var(--paper) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.search-wrap { flex: 1; max-width: 38rem; position: relative; }
.search-wrap input { width: 100%; padding: .65rem .9rem; color: var(--ink); background: var(--paper-raised); border: 1px solid var(--line); border-radius: .25rem; }
.search-status { position: absolute; right: .7rem; top: .72rem; color: var(--muted); font: .75rem system-ui, sans-serif; }
.toolbar-button, .search-panel button { padding: .6rem .8rem; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: .25rem; cursor: pointer; font-family: system-ui, sans-serif; font-size: .82rem; }
.language-link { white-space: nowrap; text-decoration: none; }
.toolbar-button:hover, .toolbar-button:focus-visible { border-color: var(--indigo); color: var(--indigo); }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--indigo) 45%, transparent); outline-offset: 3px; }
.sidebar { position: fixed; z-index: 75; inset: 0 auto 0 0; width: var(--sidebar); overflow-y: auto; padding: 1.5rem 1rem; background: #292943; color: #f6f2e9; }
.book-mark { display: flex; gap: .75rem; align-items: center; margin: 0 0 1.5rem; color: inherit; text-decoration: none; font: 700 .9rem/1.25 system-ui, sans-serif; }
.book-mark span { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; background: #efb55a; color: #292943; }
.toc a { display: block; padding: .32rem .4rem; border-left: 2px solid transparent; color: #d7d4df; text-decoration: none; font: .78rem/1.35 system-ui, sans-serif; }
.toc a.part-link { margin-top: .8rem; color: #efb55a; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.toc a.active { border-left-color: #efb55a; color: white; }
.book-content { margin-left: var(--sidebar); padding-top: var(--toolbar); }
.chapter { width: min(100% - 3rem, 46rem); margin: 0 auto; padding: 6rem 0; }
.chapter + .chapter { border-top: 1px solid var(--line); }
.chapter p { margin: 0 0 1.25em; }
.chapter h2 { margin: 0; color: var(--indigo); font-size: clamp(2.5rem, 5vw, 4.9rem); line-height: .98; letter-spacing: -.045em; }
.chapter h3 { margin: 2.7em 0 .65em; color: var(--ink); font: 700 1.35rem/1.2 system-ui, sans-serif; letter-spacing: -.02em; }
.chapter h4 { margin: 1.8em 0 .45em; font: 700 .95rem/1.3 system-ui, sans-serif; }
.chapter ul, .chapter ol { margin: 1.2rem 0 1.6rem; padding-left: 1.3rem; }
.chapter li { margin: .55rem 0; padding-left: .25rem; }
.chapter a { color: var(--indigo); text-decoration-thickness: .08em; text-underline-offset: .15em; }
.chapter-opening { margin-bottom: 4rem; }
.chapter-kicker { margin: 0 0 1rem !important; color: var(--ochre); font: 750 .75rem/1.3 system-ui, sans-serif; letter-spacing: .15em; text-transform: uppercase; }
.lead { color: color-mix(in srgb, var(--ink) 88%, var(--indigo)); font-size: 1.3rem; line-height: 1.55; }
.reflection { margin-top: 2.5rem !important; padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-style: italic; }
.part-opening { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; border-top: 0 !important; }
.part-opening h2 { max-width: 11ch; font-size: clamp(3.5rem, 8vw, 7.5rem); }
.closing-line { margin-top: 4rem !important; color: var(--indigo); font-size: 1.7rem; font-style: italic; }
.image-cover { width: min(100% - 3rem, 58rem); min-height: calc(100vh - var(--toolbar)); display: grid; place-items: center; padding: 2.5rem 0; border-top: 0 !important; }
.image-cover img { display: block; width: auto; max-width: 100%; max-height: calc(100vh - var(--toolbar) - 5rem); box-shadow: 0 1.25rem 3.5rem rgb(43 36 25 / .16); }
.cover { min-height: calc(100vh - var(--toolbar)); display: flex; flex-direction: column; justify-content: center; }
.cover h1 { max-width: 13ch; margin: 1rem 0 2rem; color: var(--indigo); font-size: clamp(3rem, 7vw, 6.6rem); line-height: .92; letter-spacing: -.055em; }
.cover-subtitle { max-width: 38rem; font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.45; }
.eyebrow, .author { font: 700 .78rem/1.4 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.author { margin-top: 4rem; }
.mobile-only { display: none; }
.top-button { position: fixed; z-index: 60; right: 1.25rem; bottom: 1.25rem; width: 2.8rem; height: 2.8rem; border: 0; border-radius: 50%; background: var(--indigo); color: white; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s; }
.top-button.visible { opacity: 1; pointer-events: auto; }
.search-dialog { position: fixed; z-index: 90; inset: 0; padding: 6rem 1rem 1rem; background: rgb(20 20 24 / .62); }
.search-panel { width: min(44rem, 100%); max-height: 75vh; overflow: auto; margin: auto; padding: 1.25rem; background: var(--paper-raised); border-radius: .4rem; }
.search-panel-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.search-result { display: block; padding: 1rem 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.search-result strong { display: block; color: var(--indigo); font: 700 .95rem/1.4 system-ui, sans-serif; }
.search-result span { color: var(--muted); font-size: .9rem; }
.search-empty { padding: 2rem 0; color: var(--muted); }

/* Editorial components */
.callout { margin: 2.2rem 0; padding: 1.25rem 1.35rem; border-left: 4px solid var(--indigo); background: color-mix(in srgb, var(--indigo-soft) 58%, transparent); break-inside: avoid; }
.callout strong:first-child { color: var(--indigo); font-family: system-ui, sans-serif; }
.callout.error { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
.callout.error strong:first-child { color: var(--red); }
.callout.example { border-left-color: var(--ochre); background: color-mix(in srgb, var(--ochre) 9%, transparent); }
.callout.example strong:first-child { color: var(--ochre); }
.callout.takeaway { border-left-color: var(--sage); background: color-mix(in srgb, var(--sage) 9%, transparent); }
.callout.takeaway strong:first-child { color: var(--sage); }
.callout.exercise, .callout.interview { border-left-color: var(--ochre); }
.term-link { display: inline; margin: 0; padding: 0; border: 0; color: inherit; background: none; cursor: help; font: inherit; line-height: inherit; text-align: inherit; text-decoration: underline dotted var(--ochre) 2px; text-underline-offset: .18em; }
.term-link:hover, .term-link:focus-visible, .term-link[aria-expanded="true"] { color: var(--indigo); text-decoration-style: solid; }
.term-popover { position: fixed; z-index: 120; max-height: min(72vh, 46rem); overflow: auto; padding: 1.35rem 1.5rem 1.45rem; border: 1px solid var(--line); border-left: 4px solid var(--ochre); background: var(--paper-raised); color: var(--ink); box-shadow: 0 1.1rem 3.5rem rgb(18 18 24 / .24); }
.term-popover .term-kicker { margin: 0 5rem .4rem 0; color: var(--ochre); font: 800 .68rem/1.3 system-ui, sans-serif; letter-spacing: .13em; text-transform: uppercase; }
.term-popover h3 { margin: 0 4rem .7rem 0; color: var(--indigo); font: 700 1.15rem/1.25 system-ui, sans-serif; }
.term-popover p { margin: 0 0 .8rem; font-size: .96rem; line-height: 1.65; }
.term-popover .term-literal, .literal-translation { color: var(--muted); font-family: system-ui, sans-serif; }
.term-popover > a { color: var(--indigo); font: 700 .78rem/1.4 system-ui, sans-serif; }
.term-popover-close { position: absolute; top: 1rem; right: 1rem; padding: .35rem .55rem; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font: 700 .7rem/1 system-ui, sans-serif; }
.term-popover-close:hover, .term-popover-close:focus-visible { border-color: var(--indigo); color: var(--indigo); }
.field-notes { margin-top: 4rem; padding-top: 2.5rem; border-top: 3px double var(--line); }
.field-notes > h3:first-child { margin-top: 0; color: var(--indigo); }
blockquote { margin: 2rem 0; padding: .5rem 0 .5rem 1.5rem; border-left: 2px solid var(--ochre); color: var(--muted); font-size: 1.08rem; font-style: italic; }
.comparison, .scenario-grid, .risk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 2rem 0; }
.comparison > div, .scenario-grid article, .risk-grid article { padding: 1.2rem; border: 1px solid var(--line); background: var(--paper-raised); break-inside: avoid; }
.scenario-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.risk-grid article h3, .scenario-grid article h4, .comparison h4 { margin-top: 0; color: var(--indigo); }
.term-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; margin: 2rem 0; }
.term-grid div { padding: 1rem 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.term-grid dt { color: var(--indigo); font: 700 .9rem/1.3 system-ui, sans-serif; }
.term-grid dd { margin: .35rem 0 0; color: var(--muted); }
.seven-list { counter-reset: seven; list-style: none; padding: 0 !important; }
.seven-list li { position: relative; margin: 0; padding: .8rem 0 .8rem 3rem; border-bottom: 1px solid var(--line); }
.seven-list li::before { counter-increment: seven; content: counter(seven, decimal-leading-zero); position: absolute; left: 0; color: var(--ochre); font: 700 .8rem system-ui, sans-serif; }
.table-wrap { width: calc(100vw - var(--sidebar) - 4rem); max-width: 70rem; margin: 2.5rem 50%; transform: translateX(-50%); overflow-x: auto; border: 1px solid var(--line); background: var(--paper-raised); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; line-height: 1.5; }
th { background: var(--indigo-soft); color: var(--indigo); font: 750 .75rem/1.4 system-ui, sans-serif; text-align: left; letter-spacing: .02em; }
th, td { padding: .8rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--indigo-soft) 25%, transparent); }

/* Diagrams */
.diagram { margin: 2.5rem 0; padding: 1.5rem; border: 1px solid var(--line); background: var(--paper-raised); font-family: system-ui, sans-serif; break-inside: avoid; }
.node { padding: .8rem 1rem; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-align: center; font-size: .83rem; line-height: 1.35; }
.node.accent { border-color: var(--indigo); background: var(--indigo); color: white; }
[data-theme="dark"] .node.accent { color: #18191d; }
.node small { display: block; margin-bottom: .25rem; color: var(--ochre); font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.arrow, .connector { color: var(--ochre); text-align: center; font-weight: 800; }
.seven-tree, .final-map { width: min(25rem, 100%); margin-inline: auto; }
.seven-tree .arrow, .final-map .arrow { line-height: 1.1; }
.request-flow, .metric-flow, .interview-framework, .icp-persona { display: flex; align-items: center; gap: .55rem; width: calc(100vw - var(--sidebar) - 4rem); max-width: 68rem; margin-left: 50%; transform: translateX(-50%); }
.request-flow .node, .interview-framework .node, .icp-persona .node { flex: 1; }
.metric-flow { flex-wrap: wrap; }
.metric-flow .node { flex: 1; }
.guardrail-line { flex-basis: 100%; padding-top: .8rem; border-top: 1px dashed var(--red); color: var(--muted); text-align: center; font-size: .8rem; }
.guardrail-line span { margin-right: .5rem; color: var(--red); font-weight: 800; text-transform: uppercase; }
.priority-diagram .formula { display: flex; align-items: stretch; gap: .4rem; }
.priority-diagram .formula span { flex: 1; display: grid; place-items: center; padding: .7rem; background: var(--indigo-soft); color: var(--indigo); text-align: center; font-size: .75rem; font-weight: 700; }
.priority-diagram .formula b { align-self: center; color: var(--ochre); }
.priority-diagram p { margin: 1rem 0 0; color: var(--muted); text-align: center; font-size: .8rem; }
.decision-flow .branches { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: 1rem; }
.decision-flow .branches div { padding: .8rem; border-top: 3px solid var(--indigo); text-align: center; }
.decision-flow .branches span, .decision-flow .branches strong { display: block; }
.decision-flow .branches span { color: var(--muted); font-size: .75rem; }
.decision-flow .branches strong { margin-top: .4rem; color: var(--indigo); }
.dual-track { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; }
.track { padding: 1rem; border: 1px solid var(--indigo); }
.track strong, .track span { display: block; }
.track strong { color: var(--indigo); }
.track span { color: var(--muted); font-size: .8rem; }
.sync { color: var(--ochre); font-size: .72rem; text-align: center; }

.experiment-ladder { counter-reset: ladder; margin: 2rem 0; }
.experiment-ladder div { position: relative; padding: 1rem 0 1rem 3.2rem; border-bottom: 1px solid var(--line); }
.experiment-ladder div::before { counter-increment: ladder; content: counter(ladder); position: absolute; left: 0; display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--indigo); color: var(--indigo); border-radius: 50%; font: 700 .8rem system-ui, sans-serif; }
.experiment-ladder dt { color: var(--indigo); font: 700 .9rem system-ui, sans-serif; }
.experiment-ladder dd { margin: .3rem 0 0; color: var(--muted); }
.experiment-brief, .language-box { margin: 2rem 0; padding: 1.5rem; border: 1px solid var(--line); background: var(--paper-raised); break-inside: avoid; }
.experiment-brief h3 { margin-top: 0; color: var(--indigo); }
.experiment-brief p, .language-box p { margin-bottom: .75rem; }
.interview-case { margin: 5rem 0; padding-top: 2rem; border-top: 1px solid var(--line); break-before: auto; }
.case-number { color: var(--ochre); font: 800 .7rem system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.answer { margin: 1rem 0; padding: 1rem 1.2rem; border-left: 3px solid var(--line); background: var(--paper-raised); }
.answer h4 { margin-top: 0; }
.answer.weak { border-left-color: var(--red); }
.answer.good { border-left-color: var(--ochre); }
.answer.excellent { border-left-color: var(--sage); }
.chapter-navigation { display: flex; justify-content: space-between; gap: 2rem; margin-top: 5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font: 650 .78rem/1.4 system-ui, sans-serif; }
.chapter-navigation a:last-child { text-align: right; }
.decision-checklist fieldset { margin: 1.2rem 0; padding: 1rem 1.25rem; border: 1px solid var(--line); break-inside: avoid; }
.decision-checklist legend { color: var(--indigo); font: 750 .88rem system-ui, sans-serif; }
.decision-checklist label { display: block; padding: .5rem 0; }
.decision-checklist input { width: 1rem; height: 1rem; margin-right: .5rem; accent-color: var(--indigo); }
.alphabet { position: sticky; top: calc(var(--toolbar) + .5rem); z-index: 5; display: flex; flex-wrap: wrap; gap: .3rem; margin: 2rem 0; padding: .7rem; background: var(--paper-raised); border: 1px solid var(--line); }
.alphabet a { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; text-decoration: none; font: 700 .75rem system-ui, sans-serif; }
.gloss-letter { scroll-margin-top: 7rem; color: var(--ochre) !important; font-size: 2rem !important; }
.glossary-entry { padding: 1.3rem 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.glossary-entry h4 { margin: 0 0 .45rem; color: var(--indigo); font-size: 1.05rem; }
.glossary-entry h4 span { color: var(--ochre); font-size: .72rem; }
.glossary-entry p { margin: .2rem 0; font-size: .92rem; }
.glossary-entry .literal-translation { margin-bottom: .7rem; color: var(--ochre); font-size: .8rem; }

@media (max-width: 800px) {
  :root { --toolbar: 7rem; }
  .mobile-only { display: inline-block; }
  .book-toolbar { left: 0; flex-wrap: wrap; }
  .search-wrap { order: 2; flex-basis: 100%; max-width: none; }
  .sidebar { transform: translateX(-105%); transition: transform .2s; box-shadow: 1rem 0 2rem rgb(0 0 0 / .2); }
  .sidebar.open { transform: translateX(0); }
  .book-content { margin-left: 0; }
  .chapter { width: min(100% - 2rem, 46rem); padding: 4.5rem 0; }
  .cover h1 { font-size: clamp(2.8rem, 14vw, 5rem); }
  .chapter h2 { font-size: clamp(2.4rem, 12vw, 4rem); }
  .part-opening h2 { font-size: clamp(3rem, 15vw, 5rem); }
  .table-wrap, .request-flow, .metric-flow, .interview-framework, .icp-persona { width: 100%; max-width: 100%; margin-left: 0; transform: none; }
  .table-wrap { contain: inline-size; }
  table { table-layout: fixed; }
  th, td { padding: .55rem .4rem; overflow-wrap: anywhere; }
  .request-flow, .interview-framework, .icp-persona { flex-direction: column; align-items: stretch; }
  .request-flow .arrow, .interview-framework .arrow { transform: rotate(90deg); }
  .comparison, .scenario-grid, .risk-grid, .term-grid { grid-template-columns: 1fr; }
  .priority-diagram .formula { flex-direction: column; }
  .priority-diagram .formula b { transform: rotate(90deg); }
  .decision-flow .branches, .dual-track { grid-template-columns: 1fr; }
  .chapter-navigation { flex-direction: column; }
  .chapter-navigation a:last-child { text-align: left; }
  .term-popover { max-height: calc(100vh - 2rem); }
}

@media (max-width: 480px) {
  .book-toolbar { gap: .35rem; padding-inline: .75rem; }
  .toolbar-button { padding: .5rem .55rem; font-size: .73rem; }
  #themeButton, #printButton, .language-link { font-size: 0; }
  #themeButton::after, #printButton::after, .language-link::after { font-size: .73rem; }
  html[lang^="pt"] #themeButton::after { content: "Tema"; }
  html[lang^="en"] #themeButton::after { content: "Theme"; }
  #printButton::after { content: "PDF"; }
  html[lang^="pt"] .language-link::after { content: "EN"; }
  html[lang^="en"] .language-link::after { content: "PT"; }
}

@page {
  size: A4;
  margin: 19mm 17mm 21mm;
  @top-center { content: "Você Já Faz Product"; color: #666; font: 7pt system-ui, sans-serif; }
  @bottom-left { content: "Rafael de Menezes Ehlers"; color: #666; font: 7pt system-ui, sans-serif; }
  @bottom-center { content: counter(page); color: #666; font: 7pt system-ui, sans-serif; }
}
@page book-cover {
  size: A4;
  margin: 0;
}
@media print {
  .book-toolbar, .sidebar, .reading-progress, .top-button, .search-dialog, .skip-link, .term-popover { display: none !important; }
  body { background: white; color: black; font-size: 10.5pt; }
  .book-content { margin: 0; padding: 0; }
  .chapter { width: auto; margin: 0; padding: 0; break-before: page; }
  .image-cover { page: book-cover; display: block; width: 210mm; height: 297mm; min-height: 0; margin: 0; padding: 0; break-before: auto; break-after: page; }
  .image-cover img { width: 210mm; height: 297mm; max-width: none; max-height: none; object-fit: cover; box-shadow: none; }
  .cover { min-height: 245mm; break-before: page; }
  .chapter h2 { color: black; font-size: 30pt; }
  .part-opening { min-height: 220mm; }
  .part-opening h2 { font-size: 42pt; }
  .chapter-opening { margin-bottom: 18mm; }
  .chapter a { color: black; text-decoration: none; }
  .chapter-navigation, .decision-checklist input { display: none; }
  .table-wrap, .request-flow, .metric-flow, .interview-framework, .icp-persona { width: 100%; max-width: none; margin: 5mm 0; transform: none; overflow: visible; }
  table { font-size: 7.5pt; }
  th, td { padding: 4pt; }
  tr, .diagram, .callout, .answer, .glossary-entry, .experiment-brief { break-inside: avoid; }
  .callout, .diagram, .answer, .experiment-brief { background: transparent !important; border-color: #666 !important; }
  .node, .node.accent { background: white !important; color: black !important; border-color: #555 !important; }
  .alphabet { display: none; }
  .gloss-letter { color: black !important; }
  .term-link { color: black; text-decoration: none; }
  .field-notes { border-color: #777; }
}
