:root {
  --paper: #F2F4EF;
  --surface: #FFFFFF;
  --ink: #14211D;
  --muted: #586863;
  --line: #D8DED7;
  --teal: #0D5E52;
  --teal-deep: #0A3F37;
  --teal-soft: #DCEBE5;
  --sun: #F2C14E;
  --sun-ink: #7A5600;
  --red: #B4472E;
  --chat-bg: #E9EEE6;
  --bubble-out: #CFEBDD;

  --display: "Familjen Grotesk", system-ui, sans-serif;
  --body: "Source Serif 4", Georgia, serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --s0: 1.125rem;
  --s1: 1.35rem;
  --s3: clamp(2rem, 3.6vw, 2.75rem);
  --s4: clamp(2.4rem, 5vw, 4rem);

  --wrap: 1140px;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: var(--s0); line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.08; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: var(--s3); font-weight: 700; max-width: 22ch; }
h3 { font-size: var(--s1); font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--teal); }
code { font-family: var(--code); font-size: 0.85em; background: var(--teal-soft); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 4px; }

main > section {
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(64px, 10vw, 120px) var(--gutter) 0;
}
.section-lede { color: var(--muted); max-width: 60ch; margin-top: 18px; }

/* header */
header.site {
  max-width: var(--wrap); margin: 0 auto; padding: 22px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-family: var(--display);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--teal); text-decoration: none; font-weight: 700; font-size: 1.45rem; letter-spacing: -0.02em; }
.brand span { color: var(--ink); }
header nav { display: flex; gap: 24px; align-items: center; font-size: 1rem; }
header nav a { color: var(--ink); text-decoration: none; }
header nav a:hover { color: var(--teal); }
.nav-cta { border: 1.5px solid var(--ink); border-radius: 999px; padding: 7px 16px; }
nav.lang { display: flex; gap: 2px; font-size: 0.9rem; margin-left: -8px; }
nav.lang a { color: var(--muted); text-decoration: none; padding: 4px 7px; border-radius: 6px; }
nav.lang a:hover { color: var(--teal); }
nav.lang a[aria-current="page"] { color: var(--ink); background: var(--teal-soft); font-weight: 600; }
@media (max-width: 960px) { header nav:not(.lang) a:not(.nav-cta) { display: none; } }
@media (max-width: 420px) { .nav-cta { display: none; } }

/* buttons */
.btn, .btn-ghost { display: inline-block; font-family: var(--display); font-weight: 600; font-size: 1.05rem; text-decoration: none; border-radius: 999px; padding: 13px 24px; line-height: 1.2; }
.btn { background: var(--teal); color: #fff; }
.btn:hover { background: var(--teal-deep); }
.btn-ghost { color: var(--ink); padding-left: 4px; padding-right: 4px; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px; }
.btn-light { background: var(--sun); color: var(--ink); }
.btn-light:hover { background: #fff; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }

/* hero */
main > section.hero { padding-top: clamp(28px, 6vw, 64px); }
.hero-intro { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px clamp(32px, 5vw, 64px); align-items: end; }
@media (max-width: 860px) { .hero-intro { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-size: var(--s4); font-weight: 700; letter-spacing: -0.03em; line-height: 1; max-width: 15ch; }
.lede { font-size: 1.2rem; line-height: 1.5; color: var(--muted); margin: 0 0 26px; max-width: 46ch; }
.demo { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); margin-top: clamp(40px, 6vw, 64px); align-items: stretch; }
@media (max-width: 860px) { .demo { grid-template-columns: minmax(0, 1fr); } }

/* phone */
.phone { margin: 0; background: var(--chat-bg); border: 10px solid var(--ink); border-radius: 34px; overflow: hidden; width: 100%; max-width: 360px; justify-self: center; font-family: var(--display); display: flex; flex-direction: column; }
.phone-top { display: flex; gap: 12px; align-items: center; background: var(--teal); color: #fff; padding: 14px 16px; }
.phone-top strong { display: block; font-weight: 600; font-size: 1rem; }
.phone-top small { font-size: 0.8rem; opacity: 0.8; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sun); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; }
.chat { list-style: none; margin: 0; padding: 14px 12px; height: 470px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.msg { max-width: 86%; padding: 9px 12px 8px; border-radius: 12px; font-size: 0.93rem; line-height: 1.4; animation: pop .22s ease-out; }
.msg.in { align-self: flex-end; background: var(--bubble-out); border-bottom-right-radius: 4px; }
.msg.out { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.msg .src { display: block; margin-top: 6px; font-family: var(--code); font-size: 0.72rem; color: var(--teal); }
.msg.refuse { box-shadow: inset 3px 0 0 var(--sun); }
.msg.refuse .src { color: var(--sun-ink); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* trace */
.trace { background: var(--teal-deep); color: #DCE9E4; border-radius: 22px; padding: 24px clamp(18px, 3vw, 30px); display: flex; flex-direction: column; }
.trace-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.trace h2 { font-size: 1.25rem; color: #fff; }
.trace-head button { font-family: var(--display); font-size: 0.95rem; color: var(--sun); background: none; border: 1px solid rgba(242,193,78,.5); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.trace-head button:hover { background: rgba(242,193,78,.12); }
.steps { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; }
.steps li { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: baseline; padding: 13px 0; border-top: 1px solid rgba(255,255,255,.1); opacity: .38; transition: opacity .25s; }
.steps li.on { opacity: 1; }
.steps .k { font-family: var(--display); font-weight: 600; font-size: 0.95rem; color: #9FBFB5; position: relative; padding-left: 16px; }
.steps .k::before { content: ""; position: absolute; left: 0; top: .45em; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.25); }
.steps li.active .k::before { background: var(--sun); box-shadow: 0 0 0 4px rgba(242,193,78,.2); }
.steps li.ok .v { color: #8FE0B9; }
.steps li.no .v { color: var(--sun); }
.steps .v { font-family: var(--code); font-size: 0.86rem; color: #fff; min-height: 1.3em; overflow-wrap: anywhere; }
.trace-note { font-size: 0.85rem; color: #9FBFB5; margin: 16px 0 0; font-style: italic; }
@media (max-width: 480px) { .steps li { grid-template-columns: 78px 1fr; gap: 10px; } }

/* diagram */
.diagram-wrap { margin-top: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(12px, 2.5vw, 28px); overflow-x: auto; }
.diagram { display: block; width: 100%; min-width: 760px; height: auto; font-family: var(--display); }
.diagram .node rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1.4; }
.diagram .node text { font-size: 15px; font-weight: 600; text-anchor: middle; fill: var(--ink); }
.diagram .node text.sub { font-size: 11.5px; font-weight: 500; fill: var(--muted); }
.diagram .node.strong rect { fill: var(--teal); stroke: var(--teal); }
.diagram .node.strong text, .diagram .node.strong text.sub { fill: #fff; }
.diagram .node.gate rect { fill: var(--sun); stroke: var(--ink); }
.diagram .node.gate text.sub { fill: var(--ink); }
.diagram .node.muted rect { fill: var(--surface); stroke-dasharray: 4 3; }
.diagram .group { fill: var(--teal-soft); stroke: none; }
.diagram .glbl { font-size: 13px; font-weight: 600; fill: var(--teal); }
.diagram .edge { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.diagram .edge.dashed { stroke-dasharray: 5 4; stroke: var(--muted); }
.diagram .ah { fill: var(--ink); }
.diagram .lbl { font-size: 11.5px; fill: var(--muted); }
.diagram .lbl.ok { fill: var(--teal); font-weight: 600; text-anchor: middle; }
.diagram .lbl.no { fill: var(--red); font-weight: 600; text-anchor: middle; }

/* funnel table */
.funnel { margin-top: 40px; border-top: 2px solid var(--ink); font-family: var(--display); }
.f-row { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.f-head { color: var(--muted); font-size: 0.95rem; }
.f-row b { font-size: 1.6rem; font-weight: 700; color: var(--teal); margin-right: 4px; }
.f-row [role="rowheader"] { color: var(--ink); }
@media (max-width: 640px) {
  .f-row { grid-template-columns: 1fr 1fr; }
  .f-row [role="rowheader"] { grid-column: 1 / -1; font-weight: 600; }
  .f-head span:first-child { display: none; }
}
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 48px; margin-top: 28px; }
.params p { color: var(--muted); font-size: 1rem; margin: 0 0 10px; }
.params b { color: var(--ink); font-family: var(--display); font-weight: 600; display: block; }
@media (max-width: 640px) { .params { grid-template-columns: 1fr; } }

/* decisions */
.adr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; margin-top: 36px; }
.adr article { padding: 24px 0; border-top: 1px solid var(--line); }
.adr h3 { margin-bottom: 10px; }
.adr p { color: var(--muted); font-size: 1.02rem; margin: 0; max-width: 54ch; }
@media (max-width: 760px) { .adr { grid-template-columns: 1fr; } }

/* skill + api */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(32px, 5vw, 56px); }
.pair h2 { font-size: clamp(1.6rem, 2.6vw, 2rem); }
.pair .section-lede { font-size: 1.02rem; }
@media (max-width: 860px) { .pair { grid-template-columns: minmax(0, 1fr); } }
.file { margin: 22px 0 0; background: var(--teal-deep); color: #E6F0EC; border-radius: 14px; padding: 20px 22px; overflow-x: auto; font-family: var(--code); font-size: 0.84rem; line-height: 1.6; }
.file code { background: none; padding: 0; font-size: inherit; }
.f-name { color: #9FBFB5; }
.f-meta { color: var(--sun); }
.f-h { color: #8FE0B9; font-weight: 700; }

/* stack */
.stack { width: 100%; border-collapse: collapse; margin-top: 36px; font-size: 1rem; }
.stack th, .stack td { text-align: left; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.stack thead th { font-family: var(--display); font-weight: 500; color: var(--muted); border-bottom: 2px solid var(--ink); }
.stack tbody th { font-family: var(--display); font-weight: 600; white-space: nowrap; }
.stack td:nth-child(2) { font-family: var(--display); font-weight: 600; color: var(--teal); white-space: nowrap; }
.stack td:last-child { color: var(--muted); }
@media (max-width: 760px) {
  .stack thead { display: none; }
  .stack tr { display: grid; grid-template-columns: 1fr; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .stack th, .stack td { border: 0; padding: 2px 0; white-space: normal; }
}

/* case */
.case-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 72px); margin-top: 36px; align-items: start; }
.case-text p { max-width: 60ch; }
.topics { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px 26px 16px; }
.topics h3 { font-size: 1.1rem; margin-bottom: 12px; }
.topics ul { list-style: none; margin: 0; padding: 0; font-family: var(--code); font-size: 0.9rem; }
.topics li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.topics li:last-child { border-bottom: 0; }
@media (max-width: 860px) { .case-grid { grid-template-columns: 1fr; } }

/* services */
.services { margin: 40px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; }
.services > div { padding: 22px 0; border-top: 2px solid var(--ink); }
.services dt { font-family: var(--display); font-weight: 600; font-size: var(--s1); line-height: 1.2; margin-bottom: 10px; }
.services dd { margin: 0; color: var(--muted); font-size: 1rem; }
@media (max-width: 900px) { .services { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .services { grid-template-columns: 1fr; } }

/* contact */
main > section.contact { max-width: none; margin-top: clamp(72px, 10vw, 128px); background: var(--teal); color: #fff; padding: clamp(56px, 9vw, 104px) var(--gutter); }
.contact-inner { max-width: calc(var(--wrap) - 2 * var(--gutter)); margin: 0 auto; }
.contact h2 { max-width: 20ch; }
.contact p { max-width: 48ch; opacity: .88; margin: 18px 0 32px; font-size: var(--s1); line-height: 1.5; }

footer.site { background: var(--teal-deep); color: #B9D0C8; font-family: var(--display); font-size: 0.92rem; padding: 22px var(--gutter); display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  html, .chat { scroll-behavior: auto; }
  .msg { animation: none; }
  .steps li { transition: none; }
}

/* alemão: palavras longas */
.hero h1:lang(de) { font-size: clamp(2.2rem, 4.3vw, 3.4rem); max-width: 18ch; hyphens: auto; }
h2:lang(de), h3:lang(de), dt:lang(de) { hyphens: auto; }
