/* MobiJob POC 0.5 — "Da profundidade à superfície" (MD-017)
   Layout: one phone-width column — top bar · Mobi (whale + rings) · current question ·
   scrollable transcript · controls. Colours come from the depth level (0–5) set on
   <body data-depth>, from deep ocean (0) to the light surface (5). */

:root {
  --font-display: Montserrat, "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --ring-speaking: #4AA8E8;
  --ring-listening: #34D399;
  --ring-thinking: #A99CF0;
  --ring-waiting: #9FEBDD;
  --listening: #34D399;
  color-scheme: dark;
}

/* depth palettes */
body[data-depth="0"] { --bg:#020A1A; --fg:#E6F1F7; --muted:#8FA6C4; --line:#1F3A62; --box:#081936; --input-bg:#061430; --btn-border:#2C4A78; --btn-bg:transparent; --mic-bg:#5ED6C8; --mic-fg:#020A1A; --accent:#5ED6C8; --you:#C9D8EA; --whale-opacity:.7; }
body[data-depth="1"] { --bg:#061833; --fg:#E9F3F9; --muted:#98AECB; --line:#24426D; --box:#0B2142; --input-bg:#0A1E3D; --btn-border:#33558A; --btn-bg:transparent; --mic-bg:#5ED6C8; --mic-fg:#061833; --accent:#5ED6C8; --you:#CCDAEB; --whale-opacity:.8; }
body[data-depth="2"] { --bg:#0B2850; --fg:#EEF6FB; --muted:#A9BEDA; --line:#2F5487; --box:#102F5C; --input-bg:#0E2A55; --btn-border:#3A5F94; --btn-bg:transparent; --mic-bg:#5ED6C8; --mic-fg:#0B2850; --accent:#5ED6C8; --you:#D2E0F0; --whale-opacity:.9; }
body[data-depth="3"] { --bg:#133F70; --fg:#FFFFFF; --muted:#C6DAEE; --line:#3F6FA6; --box:#17477C; --input-bg:#17477C; --btn-border:#6E9BCB; --btn-bg:transparent; --mic-bg:#FFFFFF; --mic-fg:#133F70; --accent:#9FEBDD; --you:#E3EEF8; --whale-opacity:1; }
body[data-depth="4"] { --bg:#1E6497; --fg:#FFFFFF; --muted:#DCEBF6; --line:#5C9BCB; --box:#236DA2; --input-bg:#236DA2; --btn-border:#9AC4E4; --btn-bg:transparent; --mic-bg:#FFFFFF; --mic-fg:#1E6497; --accent:#BFF3EA; --you:#E8F2FA; --whale-opacity:1; }
body[data-depth="5"] { --bg:#EAF7FA; --fg:#0F1C3F; --muted:#3A4B6B; --line:#C2D8E2; --box:#FFFFFF; --input-bg:#FFFFFF; --btn-border:#9DB9C8; --btn-bg:#FFFFFF; --mic-bg:#0F1C3F; --mic-fg:#FFFFFF; --accent:#0E8F86; --you:#3A4B6B; --whale-opacity:1;
  --ring-speaking:#1F78C0; --ring-listening:#14915F; --ring-thinking:#6A5CC9; --ring-waiting:#0E8F86; --listening:#14915F; color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  transition: background-color 1.6s ease, color 1.6s ease;
  -webkit-font-smoothing: antialiased;
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

/* low-poly cut corners (MD-017) */
.facet-tl { clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px); }
.facet-br { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%); }
.facet-both { clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); }

.app {
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 18px 8px; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.demo-badge { white-space: nowrap; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line); padding: 3px 7px; }
.progress-marker { display: flex; align-items: center; gap: 6px; }
.bubbles { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.bubble { display: block; border-radius: 50%; border: 1.5px solid var(--accent); transition: transform .6s ease; }
.bubble.new { animation: bubbleIn .8s ease-out; }
@keyframes bubbleIn { from { transform: translateY(8px) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.progress-text { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lang-btn { min-width: 44px; height: 44px; padding: 0 10px; border: 1px solid var(--line); background: transparent; font-weight: 700; font-size: 13px; }
.restart-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0; color: inherit; cursor: pointer; }
.progress-track { height: 4px; margin: 0 18px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 1.2s ease; }

/* stage: Mobi + sea creatures */
.stage { flex: 1; min-height: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 22px; }
.sea { position: absolute; inset: 0; pointer-events: none; }
.mobi { position: relative; width: 250px; max-width: 70vw; aspect-ratio: 250 / 170; display: flex; align-items: center; justify-content: center; z-index: 1; }
.whale { position: relative; width: 78%; height: auto; opacity: var(--whale-opacity); transition: opacity 1.6s ease; }
.waves { position: absolute; inset: 0; }
.ring { position: absolute; inset: 6%; border-radius: 50%; border: 2px solid var(--ring, var(--ring-waiting)); opacity: .3; }
.ring.r1 { opacity: .6; }
.ring.r3 { opacity: .15; }
body[data-mode="speaking"] { --ring: var(--ring-speaking); }
body[data-mode="listening"] { --ring: var(--ring-listening); }
body[data-mode="thinking"] { --ring: var(--ring-thinking); }
body[data-mode="speaking"] .ring { animation: waveOut 2.4s ease-out infinite; }
body[data-mode="listening"] .ring { animation: waveIn 2.4s ease-in infinite; }
body[data-mode="thinking"] .ring { animation: pulse 1.6s ease-in-out infinite alternate; }
.ring.r2 { animation-delay: .8s !important; }
.ring.r3 { animation-delay: 1.6s !important; }
@keyframes waveOut { 0% { transform: scale(.82); opacity: .75; } 100% { transform: scale(1.28); opacity: 0; } }
@keyframes waveIn { 0% { transform: scale(1.28); opacity: 0; } 100% { transform: scale(.82); opacity: .75; } }
@keyframes pulse { 0% { opacity: .15; } 100% { opacity: .55; } }

.status { position: relative; z-index: 1; margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.status .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--ring, var(--ring-waiting)); }
.notice { position: relative; z-index: 1; margin: 0; max-width: 34ch; text-align: center; font-size: 13px; color: var(--fg); background: var(--box); border: 1px solid var(--line); padding: 6px 10px; }

/* job cards (0.5.0, MD-026): horizontal strip under the question; details in a sheet */
.jobs { display: flex; flex-direction: column; gap: 6px; margin: 0 -18px; }
.jobs-summary { margin: 0; padding: 0 18px; font-size: 13px; font-weight: 700; color: var(--accent); }
.jobs-hint { font-weight: 400; color: var(--muted); }
.job-strip { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; padding: 2px 18px 6px; scrollbar-width: none; }
.job-strip::-webkit-scrollbar { display: none; }
.job-card { flex: 0 0 auto; width: min(230px, 68vw); min-height: 96px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 11px 13px; text-align: left; background: #FFFFFF; color: #0F1C3F; border: 1px solid #C2D8E2; animation: rise .8s ease-out; }
.job-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.job-card .job-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1.3; }
.job-company { font-size: 13px; color: #3A4B6B; }
.job-fits { font-size: 12px; font-weight: 700; color: #0E7A58; }
.shifts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.shift { font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 7px; border-radius: 9px; border: 1px solid transparent; }
.shift-integral { background: #DDF3EF; color: #0B5F57; border-color: #9FD9CF; }
.shift-manha { background: #FFF2CC; color: #7A5200; border-color: #F2D27A; }
.shift-tarde { background: #FFE2D3; color: #8A3A12; border-color: #F4B796; }
.shift-noite { background: #E1E3FA; color: #2E2F7A; border-color: #B7BAEE; }

.job-details { padding: 0; border: 0; background: transparent; max-width: 520px; width: 100%; max-height: 88vh; margin: auto auto 0; color: #0F1C3F; }
.job-details::backdrop { background: rgba(2, 10, 26, .55); }
.job-details .sheet { position: relative; background: #FFFFFF; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px calc(22px + env(safe-area-inset-bottom, 0px)); }
.sheet-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: transparent; color: #0F1C3F; display: flex; align-items: center; justify-content: center; }
.detail-title { margin: 0 44px 2px 0; font-family: var(--font-display); font-size: 19px; line-height: 1.3; }
.detail-company { margin: 0 0 6px; color: #3A4B6B; font-weight: 600; }
.detail-demo { margin: 8px 0 0; font-size: 12px; color: #6A5CC9; border: 1px dashed #B7BAEE; padding: 4px 8px; }
.detail-list { margin: 12px 0 0; display: grid; gap: 10px; }
.detail-row dt { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #3A4B6B; }
.detail-row dd { margin: 2px 0 0; font-size: 15px; line-height: 1.45; }
.detail-row ul { margin: 0; padding-left: 18px; }
@media (min-width: 560px) { .job-details { margin: auto; } }

/* dialogue */
.dialogue { display: flex; flex-direction: column; gap: 12px; padding: 0 18px; }
.question { margin: 0; min-height: 2.8em; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: clamp(18px, 5.4vw, 21px); line-height: 1.38; text-wrap: balance; }
.jobs { display: flex; flex-direction: column; gap: 8px; }
.job { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; background: #FFFFFF; border: 1px solid #C2D8E2; color: #0F1C3F; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%); animation: rise .8s ease-out; }
.job-title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.job-meta { display: block; font-size: 13px; color: #3A4B6B; }
.job a, .job span.job-link { font-weight: 700; font-size: 14px; color: #0E6E86; min-height: 44px; display: flex; align-items: center; white-space: nowrap; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.transcript { height: 118px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column-reverse; gap: 6px; padding: 12px 14px; background: var(--box); border: 1px solid var(--line); font-size: 14px; line-height: 1.42; scrollbar-color: var(--line) transparent; transition: background-color 1.6s ease; }
.transcript p { margin: 0; flex-shrink: 0; overflow-wrap: anywhere; }
.transcript .who { font-weight: 700; color: var(--fg); }
.transcript .you { color: var(--you); }
.transcript .live { font-style: italic; }
.transcript-empty { color: var(--muted); margin-bottom: auto !important; }

.type-form { display: flex; align-items: center; height: 52px; padding: 0 4px 0 14px; border: 1.5px solid var(--accent); background: var(--input-bg); }
.type-form input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--fg); font: 400 16px var(--font-body); outline: none; }
.type-form input::placeholder { color: var(--muted); }
.send-btn { width: 44px; height: 44px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }

/* controls */
.controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px 22px; }
.ctl-btn { width: 112px; height: 50px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--btn-border); background: var(--btn-bg); font-weight: 700; font-size: 14px; }
.ctl-btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.mic-btn { width: 82px; height: 82px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--mic-bg); color: var(--mic-fg); display: flex; align-items: center; justify-content: center; transition: background-color .3s ease, transform .15s ease; }
.mic-btn:active { transform: scale(.96); }
.mic-btn:focus-visible { outline-offset: 3px; }
.mic-btn .icon-stop { display: none; }
body[data-mode="listening"] .mic-btn { background: var(--listening); color: #04140D; }
body[data-mode="listening"] .mic-btn .icon-mic { display: none; }
body[data-mode="listening"] .mic-btn .icon-stop { display: block; }
body[data-mode="thinking"] .mic-btn { opacity: .55; }

/* sea creatures (MD-017): one per 20% milestone, drifting down behind Mobi */
.creature { position: absolute; opacity: 0; animation: descend 9s ease-in-out 3s forwards; }
.creature.left { left: 6%; top: 6%; }
.creature.right { right: 6%; top: 4%; }
@keyframes descend {
  0% { opacity: 0; transform: translate(0, -80px); }
  22% { opacity: .85; transform: translate(12px, -40px); }
  60% { opacity: .85; transform: translate(-10px, 40px); }
  100% { opacity: 0; transform: translate(8px, 130px); }
}
.kelp-bed { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 130px; opacity: 0; animation: fadeIn 2s ease-out 3s forwards; transition: opacity 1.4s ease; }
.kelp-bed.leaving { opacity: 0 !important; animation: none; }
.kelp { transform-origin: 50% 100%; transform-box: fill-box; animation: sway 4s ease-in-out infinite alternate; }
.kelp.k2 { animation-delay: 1.3s; }
.kelp.k3 { animation-delay: 2.1s; }
@keyframes fadeIn { to { opacity: .7; } }
@keyframes sway { 0% { transform: skewX(-4deg); } 100% { transform: skewX(4deg); } }

/* smaller phones */
@media (max-height: 700px) {
  .mobi { width: 200px; }
  .transcript { height: 96px; }
  .mic-btn { width: 72px; height: 72px; }
  .controls { padding-block: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  .ring, .kelp, .bubble.new, .job, .job-card { animation: none !important; }
  .creature { animation: none; opacity: .5; transform: translateY(20px); }
  .kelp-bed { animation: none; opacity: .6; }
}
