/* Tinta (app/DESIGN.md): ink on paper, DM Sans, colour only for clinical state. */
@font-face { font-family: 'DM Sans'; src: url('/fonts/DM-Sans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/fonts/DM-Sans-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/fonts/DM-Sans-Semibold.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --text: #111316; --bg: #F6F6F5; --element: #FFFFFF; --selected: #EAEAE8; --muted: #5C5F63; --border: #E3E3E1;
  --low: #246D36; --high: #B32626;
  --dots: ink;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #F2F2F0; --bg: #101113; --element: #1A1B1E; --selected: #2A2C30; --muted: #A8ABB0; --border: #33353A;
    --low: #66BB6A; --high: #FF9494;
    --dots: light;
    color-scheme: dark;
  }
}
@media (min-width: 600px) { :root { --gutter: 40px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 'DM Sans', system-ui, sans-serif; overflow-x: clip; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }

.skip { position: absolute; left: var(--gutter); top: -60px; z-index: 10; padding: 12px 18px; background: var(--text); color: var(--bg); border-radius: 9px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

.stage { position: fixed; top: 0; left: 0; width: 100%; height: 100lvh; z-index: 0; pointer-events: none; image-rendering: pixelated; }
.nav, main, .footer { position: relative; z-index: 1; }
.wrap { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: var(--gutter); }

/* Nav */
.nav { position: absolute; inset: 0 0 auto; }
.nav__row { display: flex; align-items: center; justify-content: space-between; min-height: 72px; }
.brand { font-weight: 600; font-size: 19px; text-decoration: none; }
.nav nav { display: flex; gap: 4px; }
.nav nav a, .footer nav a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 10px; text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500; transition: color 120ms; background: linear-gradient(currentColor, currentColor) 10px calc(100% - 10px) / 0 1px no-repeat; transition: color 120ms, background-size 240ms var(--ease); }
.nav nav a:hover, .footer nav a:hover { color: var(--text); background-size: calc(100% - 20px) 1px; }

/* Type */
.lead { font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 40ch; }
.body { font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 42ch; }
.note { font-size: 14px; color: var(--muted); }
h2, h3 { font-weight: 600; letter-spacing: 0; color: var(--text); text-wrap: balance; }
h3 { font-size: clamp(26px, 2.6vw, 32px); line-height: 1.2; margin-bottom: 12px; }
.product__name, .hospitals h2, .close h2 { font-size: clamp(40px, 5.4vw, 76px); line-height: 1.04; font-weight: 500; margin-bottom: 20px; }
.product__name b { font-weight: 600; }

/* Buttons: ink primary, transparent secondary (Tinta), a step on hover and a 3% press. */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 18px; border-radius: 9px; font: 600 14px/20px 'DM Sans', sans-serif; text-decoration: none; transition: transform 120ms var(--ease), background-color 120ms; }
.btn--primary { background: var(--text); color: var(--bg); }
.btn--secondary { color: var(--text); padding-inline: 12px; }
.btn--secondary:hover { background: var(--selected); }
a.btn:hover { transform: translateY(-1px); }
a.btn:active { transform: scale(0.97); }
.btn__arrow { width: 16px; height: 16px; transition: transform 240ms var(--ease); }
.btn:hover .btn__arrow { transform: translateX(3px); }
.btn--sm { min-height: 40px; padding: 10px 14px; font-size: 13px; justify-self: start; }

/* Screens */
.hero, .screen, .hospitals, .close { min-height: 100svh; position: relative; }
.slot { pointer-events: none; }
.no-gl .stage { display: none; }
/* Without WebGL each slot shows a still of the same bust (rendered from the page itself). */
.no-gl .slot { background: url(/poster-light.webp) center top / contain no-repeat; }
@media (prefers-color-scheme: dark) { .no-gl .slot { background-image: url(/poster-dark.webp); } }

/* Hero: the title splits around the bust, as on a printed plate. */
.hero__grid { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; padding-top: 88px; padding-bottom: 32px; }
.hero__title { position: relative; z-index: 1; font-size: clamp(42px, 5.7vw, 84px); line-height: 1; font-weight: 500; letter-spacing: 0; paint-order: stroke fill; -webkit-text-stroke: 0.14em var(--bg); }
:lang(pt) .hero__title { font-size: clamp(38px, 5vw, 74px); }
.hero__a, .hero__b { display: block; }
.hero__foot { position: relative; z-index: 1; paint-order: stroke fill; -webkit-text-stroke: 5px var(--bg); }
.hero__foot .btn { -webkit-text-stroke: 0; }
.hero .slot { min-height: 46svh; margin-block: 8px; }

@media (min-width: 600px) and (max-width: 959px) {
  .hero__title { font-size: 8.4vw; }
  :lang(pt) .hero__title { font-size: 7.4vw; }
  .hero__title br { display: none; }
}

@media (min-width: 960px) {
  .hero__grid { grid-template-columns: 1fr minmax(0, 0.72fr) 1fr; grid-template-rows: 1fr auto; column-gap: 28px; padding-bottom: 48px; }
  .hero__title { grid-column: 1 / -1; grid-row: 1; align-self: center; display: grid; grid-template-columns: subgrid; margin-top: -4svh; }
  .hero__a { grid-column: 1; text-align: right; justify-self: end; }
  .hero__b { grid-column: 3; }
  .hero .slot { position: absolute; left: 50%; top: 9svh; width: min(37vw, 540px); height: 120svh; margin: 0; transform: translateX(-50%); }
  .hero__foot { grid-column: 1 / 3; grid-row: 2; }
  .hero__foot .lead { font-size: 16px; max-width: 26ch; }
  .hero__foot .note { max-width: 34ch; }
}
@media (min-width: 960px) and (max-width: 1279px) {
  .hero .slot { width: 36vw; }
  .hero__foot .lead { max-width: 24ch; }
}

/* Product screens: the bust holds one half, the words and the product the other. */
.screen__grid { min-height: 100svh; display: grid; align-content: center; padding-block: 72px; }
.side { display: grid; justify-items: start; }
.screen .slot { display: none; }
.screen:first-child .slot { display: block; height: 38svh; margin-bottom: 24px; }
@media (min-width: 720px) {
  .screen__grid { grid-template-columns: 1fr 1fr; column-gap: 48px; align-items: center; }
  .screen .slot, .screen:first-child .slot { display: block; height: 66svh; margin: 0; grid-row: 1; }
  .screen--right .slot { grid-column: 1; }
  .screen--right .side { grid-column: 2; }
  .screen--left .slot { grid-column: 2; }
  .screen--left .side { grid-column: 1; grid-row: 1; justify-self: end; }
  .side { max-width: 560px; }
}

/* Product frames: Tinta panels, flat, white on paper. */
.app { width: 100%; max-width: 460px; margin-top: 32px; background: var(--element); border-radius: 12px; font-size: 15px; line-height: 1.5; color: var(--text); }
.app__bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; }
.app__bar img { border-radius: 6px; }
.wordmark { font-size: 15px; }
.wordmark b { font-weight: 600; }
.app__body { display: grid; gap: 12px; padding: 6px 18px 20px; }
.app__title { font-size: 19px; font-weight: 600; line-height: 1.3; }
.cap { font-size: 13px; line-height: 1.45; color: var(--muted); }
.row__t { font-weight: 500; }
.row__v { font-size: 17px; font-weight: 500; }
.panel { background: var(--selected); border-radius: 12px; padding: 14px 16px; display: grid; gap: 4px; }
.src { margin-top: 6px; }
.q { background: var(--selected); border-radius: 11px; padding: 12px 14px; }
.ans { line-height: 1.75; }
.ans sup { font-size: 11px; color: var(--muted); margin-inline: 2px 4px; }
.refs { font-size: 13px; color: var(--muted); counter-reset: r; }
.refs li::before { counter-increment: r; content: counter(r) '. '; }
.rec { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.rec .num { color: var(--muted); font-weight: 400; }
.rec__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text); animation: pulse 1.6s ease-in-out infinite; }
.turns { display: grid; gap: 10px; }
.turns div { display: grid; grid-template-columns: 76px 1fr; gap: 8px; }
.turns dt { font-size: 13px; color: var(--muted); padding-top: 1px; }
.gaps { font-size: 13px; color: var(--muted); padding-top: 4px; }
.gaps b { color: var(--text); font-weight: 600; margin-right: 6px; }
.next { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: var(--selected); border-radius: 12px; padding: 14px 16px; }
.next .num { font-size: 19px; font-weight: 600; }
.list { display: grid; }
.list li { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 2px; padding: 10px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; }
.list .num { width: 44px; color: var(--muted); }
.list .cap { margin-left: auto; }
.sub { font-size: 14px; font-weight: 600; margin-top: 4px; }
.note dt, .app .note dt { font-size: 13px; color: var(--muted); }
.app dl.note { display: grid; gap: 10px; font-size: 15px; color: var(--text); }
.result__v { font-size: 26px; font-weight: 500; line-height: 1.2; }
.result__r { color: var(--high); font-weight: 600; font-size: 14px; }
.ok { color: var(--low); font-weight: 600; font-size: 13px; margin-left: auto; }
.audit { padding-top: 2px; }

/* Hospitals: words on one side of the bust, modules on the other. */
/* The ink flood rises 20svh above the close, so the last module keeps clear of it. */
.hospitals__grid { min-height: 100svh; display: grid; align-content: center; gap: 32px; padding-block: 88px max(120px, 26svh); }
.hospitals .slot { height: 34svh; order: -1; margin-bottom: -8px; }
.hospitals__a { display: grid; justify-items: start; gap: 0; }
.hospitals__a .btn { margin-top: 28px; }
.modules { display: grid; }
.modules li { padding: 14px 0; border-top: 1px solid var(--border); font-size: 17px; font-weight: 500; }
.modules li:first-child { border-top: 0; }
@media (min-width: 960px) {
  .hospitals__grid { grid-template-columns: 1fr minmax(0, 0.8fr) 1fr; column-gap: 32px; align-items: center; padding-block: 88px; }
  .hospitals__a { grid-column: 1; grid-row: 1; }
  .modules { grid-column: 3; grid-row: 1; }
  .hospitals .slot { order: 0; margin: 0; position: absolute; left: 50%; top: 11svh; width: min(24vw, 340px); height: 80svh; transform: translateX(-50%); }
  .hospitals h2 { font-size: clamp(40px, 4vw, 60px); }
  .hospitals .body { max-width: 28ch; }
  .modules { max-width: 320px; justify-self: end; width: 100%; }
}
@media (min-width: 960px) and (max-width: 1279px) {
  .hospitals .slot { width: 22vw; }
}

/* Close: the ink rises from the bottom and the colours swap. */
.close { background: var(--text); color: var(--bg); display: grid; align-items: center; }
.close__inner { display: grid; justify-items: center; text-align: center; padding-block: 120px; }
.close h2 { color: var(--bg); max-width: 14ch; }
.close .lead, .close .note { color: color-mix(in srgb, var(--bg) 72%, var(--text)); margin-inline: auto; }
.close .lead { max-width: 44ch; }
.close .actions { justify-content: center; }
.close .note { margin-top: 28px; }
.close .btn--primary { background: var(--bg); color: var(--text); }
.close .btn--secondary { color: var(--bg); }
.close .btn--secondary:hover { background: color-mix(in srgb, var(--bg) 14%, var(--text)); }
.close :focus-visible, .footer :focus-visible { outline-color: var(--bg); }

.footer { background: var(--text); color: var(--bg); }
.footer__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-block: 28px 40px; border-top: 1px solid color-mix(in srgb, var(--bg) 16%, var(--text)); }
.footer nav { display: flex; flex-wrap: wrap; }
.footer nav a { color: color-mix(in srgb, var(--bg) 72%, var(--text)); }
.footer nav a:hover { color: var(--bg); }
.legal { width: 100%; font-size: 13px; color: color-mix(in srgb, var(--bg) 62%, var(--text)); }

/* Entrance, once. */
.hero__title, .hero__foot { animation: rise 900ms var(--ease) both; }
.hero__foot { animation-delay: 160ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pulse { 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
