/* Hallmark · genre: editorial with the v5 night · macrostructure: the product's door (one night card, then crema) · design-system: design.md
 * contrast: crema on the night 17.9:1, lead 14.6:1 (--color-on-night-2), cherry on the night 6.3:1; ink on crema 15.8:1, ink-2 10.6:1, muted 6.2:1
 * Capifone's demonstration door (/demonstracao/): paste a site, watch the preparation, open the demonstration.
 * One night card holds the statement and the form, then the preparation's title, status, business and actions (the same
 * card for both states, so the bar reads it as the page's band); the found facts and the steps follow on the crema, and
 * "Como funciona" closes the entry. The Capifone bust stands in the card's lower right as a plain picture, its straight
 * lower cut faded out. Every id, data attribute and API call stays automatic-entry.js's.
 * Requires tokens.css, shell.css and pagina.css (trail, block, steps). Tokens only; Archivo through --font-sans. */

/* ---------- The night card ---------- */
.door { position: relative; }
.door-card {
  position: relative;
  z-index: 2; /* the suggestions open over what follows */
  isolation: isolate;
  margin: var(--space-2xs) var(--band-x) 0;
  border-radius: var(--radius-sheet);
  background: var(--color-night);
  color: var(--color-on-night);
}
.door-card .campo { border-radius: inherit; opacity: 0.9; }
.door-card :focus-visible { outline-color: var(--color-on-night); }
@media (max-width: 39.99rem) {
  /* Phones: edge to edge with the lower corners rounded, like the other product pages */
  .door-card { margin: 0; border-radius: 0 0 var(--radius-sheet) var(--radius-sheet); }
}

.door-inner {
  --door-pb: var(--space-md);
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "trail" "panel" "capi";
  width: min(100% - 2 * var(--gutter), var(--shell-max));
  margin-inline: auto;
  padding-block: calc(var(--header-h) + var(--space-sm)) var(--door-pb);
}
@media (min-width: 40rem) {
  .door-inner {
    --door-pb: clamp(var(--space-2xl), 11vh, 136px);
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "trail trail" "panel capi";
    column-gap: var(--space-lg);
    width: min(100% - 2 * max(var(--gutter) - var(--band-x), 12px), var(--shell-max));
    padding-top: calc(var(--header-h) + clamp(var(--space-sm), 4.5vh, var(--space-xl)));
  }
}
.door-trail { grid-area: trail; color: var(--color-on-night-2); }
.door-trail [aria-current] { color: var(--color-on-night); }
.door-panel { grid-area: panel; position: relative; z-index: 2; min-width: 0; } /* its suggestions open over the bust */
.door-capi { grid-area: capi; }
@media (min-width: 64rem) {
  .door-inner { grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-areas: none; }
  .door-inner > .door-trail { grid-area: 1 / 1 / 2 / span 8; }
  .door-inner > .door-panel { grid-area: 2 / 1 / 3 / span 8; }
  .door-inner > .door-capi { grid-area: 1 / 9 / 3 / -1; }
}

/* The statement */
.door-title {
  margin-top: clamp(var(--space-sm), 2.4vh, var(--space-lg));
  max-width: 17ch;
  overflow-wrap: anywhere;
  min-width: 0;
  color: var(--color-on-night);
  font-size: var(--text-band-l);
  font-weight: var(--wght-display);
  font-stretch: var(--wdth-display);
  font-style: normal;
  letter-spacing: var(--track-display);
  line-height: var(--leading-display);
  text-wrap: balance;
}
.door-title:focus { outline: none; } /* focused by the script for screen readers only, never by Tab */
.door-lead {
  margin-top: clamp(var(--space-md), 2.6vh, var(--space-lg));
  max-width: 44ch;
  color: var(--color-on-night-2);
  font-size: var(--text-lead-read);
  line-height: 1.45;
  text-wrap: pretty;
}
.door-job[data-error="true"] { color: var(--color-on-night); }

/* ---------- The form: a dark field and the crema pill, as the homepage's pair of actions ---------- */
.door-form { margin-top: clamp(var(--space-lg), 4.4vh, var(--space-2xl)); max-width: 46rem; }
.door-form label { display: block; margin-bottom: var(--space-2xs); color: var(--color-on-night); font-weight: var(--wght-ui); line-height: 1.35; }
.door-row { display: flex; flex-direction: column; gap: var(--space-xs); }
.door-search { position: relative; flex: 1 1 auto; min-width: 0; }
#business-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 0 var(--space-md);
  border: 1px solid color-mix(in oklch, var(--color-on-night) 46%, transparent);
  border-radius: var(--radius-input);
  background: var(--color-night-2);
  color: var(--color-on-night);
  font-size: 1.125rem;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: border-color var(--dur-color) var(--ease-out), background-color var(--dur-color) var(--ease-out);
}
#business-input::placeholder { color: var(--color-on-night-2); opacity: 1; }
#business-input:focus-visible { outline-color: var(--color-on-night); border-color: var(--color-on-night); }
#business-input:disabled { color: var(--color-on-night-2); cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  #business-input:hover:not(:focus):not(:disabled) { border-color: var(--color-on-night-2); }
}
.door-start { width: 100%; }
.door-start span { overflow: hidden; text-overflow: ellipsis; }
/* Not available yet (the page's token is on its way, or demonstrations are off): the crema outline, readable;
   preparing ("Preparando sua demonstração…"): the crema pill stays, with the progress cursor */
.door-start:disabled { opacity: 1; border-color: color-mix(in oklch, var(--color-on-night) 46%, transparent); background: transparent; color: var(--color-on-night-2); }
.door-form[aria-busy="true"] .door-start { border-color: var(--color-on-night); background: var(--color-on-night); color: var(--color-night); cursor: progress; }
@media (hover: hover) and (pointer: fine) {
  .door-card .door-start:disabled:hover { border-color: color-mix(in oklch, var(--color-on-night) 46%, transparent); background: transparent; }
  .door-card .door-form[aria-busy="true"] .door-start:hover { border-color: var(--color-on-night); background: var(--color-on-night); }
}
@media (min-width: 40rem) {
  .door-row { flex-direction: row; align-items: stretch; }
  #business-input { min-height: 60px; }
  .door-start { width: auto; min-height: 60px; flex: none; }
}
.door-status { margin-top: var(--space-xs); color: var(--color-on-night-2); font-size: 0.9375rem; font-weight: var(--wght-small); line-height: 1.45; overflow-wrap: anywhere; }
.door-status:empty { display: none; }
.door-status[data-error="true"] { color: var(--color-accent-on-night); font-weight: var(--wght-ui); }
.door-hint { margin-top: var(--space-sm); max-width: 52ch; color: var(--color-on-night-2); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.5; }
.door-notice { margin-top: var(--space-md); max-width: 52ch; padding-left: var(--space-sm); border-left: 2px solid var(--color-accent-on-night); color: var(--color-on-night); font-size: 0.9375rem; line-height: 1.5; }

/* Suggestions: a floating crema list under the field (the one shadow of floating layers) */
.door-suggestions {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + var(--space-2xs));
  left: 0;
  right: 0;
  max-height: min(340px, 60vh);
  margin: 0;
  padding: var(--space-3xs);
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-input);
  background: var(--color-paper);
  color: var(--color-ink);
  box-shadow: var(--shadow-float);
}
@media (min-width: 40rem) { .door-suggestions { right: auto; width: max(100%, 28rem); } }
.suggestion {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  min-height: 56px;
  padding: var(--space-xs);
  border-radius: calc(var(--radius-input) - 4px);
  cursor: pointer;
}
.suggestion[aria-selected="true"] { background: var(--color-paper-2); box-shadow: inset 0 0 0 2px var(--color-ink); }
@media (hover: hover) and (pointer: fine) { .suggestion:hover { background: var(--color-paper-2); } }
.suggestion-avatar, .business-avatar {
  display: grid;
  flex: none;
  place-items: center;
  overflow: hidden;
  background: var(--color-paper-3);
  color: var(--color-ink);
  font-weight: var(--wght-display);
  font-stretch: var(--wdth-display);
}
.suggestion-avatar { width: 40px; height: 40px; border-radius: var(--radius-input); font-size: 1.0625rem; }
.suggestion-avatar img, .business-avatar img { width: 100%; height: 100%; object-fit: contain; background: var(--color-paper); }
.suggestion-copy { min-width: 0; color: var(--color-muted); font-size: var(--text-sm); line-height: 1.4; }
.suggestion-copy strong { display: block; color: var(--color-ink); font-size: 1rem; font-weight: var(--wght-ui); line-height: 1.3; overflow-wrap: anywhere; }
.suggestion-description { display: -webkit-box; margin-top: var(--space-3xs); overflow: hidden; color: var(--color-ink-2); -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.suggestion-domain { display: block; margin-top: var(--space-3xs); overflow-wrap: anywhere; }

/* ---------- The preparation: title, status, the business found, the way in ---------- */
.door-business { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-lg); min-width: 0; }
.business-avatar { width: 48px; height: 48px; border-radius: var(--radius-pill); font-size: 1.25rem; }
.door-business-text { display: grid; min-width: 0; }
.door-business-text strong { color: var(--color-on-night); font-size: 1.125rem; font-weight: var(--wght-ui); line-height: 1.3; overflow-wrap: anywhere; }
.door-business-text span { color: var(--color-on-night-2); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.4; overflow-wrap: anywhere; }
.door-business-text span:empty { display: none; }
.door-actions { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-sm); margin-top: var(--space-xl); }
.door-actions .btn { width: 100%; }
.door-ready-note { max-width: 46ch; color: var(--color-on-night-2); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.5; }
@media (min-width: 40rem) {
  .door-actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-lg); }
  .door-actions .btn { width: auto; }
}

/* ---------- Capifone: the bust in the card's lower right, its straight cut fading into the light; alive in three
   dimensions once the page has settled (/site/capi/porta.js): its canvas sits exactly over the picture's square and
   reaches beyond it for the raised paw (36 % on the left, 8 % on the right, 16 % above: CUT in porta.js) ---------- */
.door-capi {
  position: relative;
  align-self: end;
  justify-self: end;
  width: 148px;
  margin: var(--space-md) 0 calc(-1 * var(--door-pb));
  pointer-events: none;
}
.door-capi img {
  width: 100%;
  height: auto;
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to bottom, var(--color-ink) 70%, transparent 98%);
  mask-image: linear-gradient(to bottom, var(--color-ink) 70%, transparent 98%);
  user-select: none;
  -webkit-user-drag: none;
}
@media (min-width: 40rem) { .door-capi { width: 160px; margin-top: 0; } }
@media (min-width: 64rem) { .door-capi { width: clamp(220px, min(26vw, 50vh), 440px); } }
.door-lona {
  position: absolute;
  left: -36%;
  top: -16%;
  width: 144%;
  height: 116%;
  opacity: 0;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;
  transition: opacity 260ms linear;
}
.door-lona:active { cursor: grabbing; }
.door-capi.is-3d .door-lona { opacity: 1; pointer-events: auto; }
.door-capi.is-3d img { opacity: 0; transition: opacity 200ms linear 120ms; }

/* ---------- Found facts and the steps, on the crema (only while preparing) ---------- */
.door-details { padding-block: calc(var(--section-pad) / 2); }
.door-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2xl) var(--col-gap); }
@media (min-width: 64rem) {
  .door-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .door-col--found { grid-column: 1 / span 7; }
  .door-col--steps { grid-column: 9 / -1; }
}
.door-col { min-width: 0; }
.door-head { display: flex; align-items: baseline; gap: var(--space-xs); padding-top: var(--space-md); border-top: 2px solid var(--color-ink); }
.door-head h2 { font-size: var(--text-title); font-weight: var(--wght-ui); letter-spacing: var(--track-title); line-height: 1.2; }
.door-count { color: var(--color-muted); font-size: var(--text-title); font-weight: var(--wght-small); font-variant-numeric: tabular-nums; line-height: 1.2; }
.door-empty { margin-top: var(--space-md); padding-block: var(--space-md); border-top: 1px solid var(--color-rule); border-bottom: 1px solid var(--color-rule); color: var(--color-muted); font-size: 1rem; line-height: 1.5; }
.door-findings { margin-top: var(--space-sm); border-bottom: 1px solid var(--color-rule); }
.door-findings:empty { display: none; }
.finding { display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: var(--space-sm); align-items: start; padding-block: var(--space-sm); border-top: 1px solid var(--color-rule); }
@media (prefers-reduced-motion: no-preference) { .finding { animation: door-finding-in 420ms var(--ease-out) both; } }
@keyframes door-finding-in { from { opacity: 0; transform: translateY(8px); } }
.finding-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--color-paper-3);
  color: var(--color-ink);
  font-size: 0.8125rem;
  font-weight: var(--wght-display);
  line-height: 1;
}
/* A warning (a site that asked not to be read) is not something found: another mark, never the tick */
.finding[data-kind="aviso"] .finding-symbol { border-color: var(--color-accent); background: transparent; color: var(--color-accent); }
.finding-symbol .ico, .step-marker .ico { width: 14px; height: 14px; stroke-width: 2.4; }
.finding-copy { min-width: 0; }
.finding h3 { color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.4; }
.finding p { margin-top: 2px; color: var(--color-ink); font-size: 1.0625rem; line-height: 1.5; overflow-wrap: anywhere; }

/* The steps reported by the server (rows written by automatic-entry.js; the shared numbered .step is reset here) */
.door-steps { margin: var(--space-sm) 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--color-rule); }
.door-steps > .step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-areas: none;
  column-gap: var(--space-sm);
  align-items: start;
  padding-block: var(--space-sm);
  border-top: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1.45;
}
.door-steps > .step:first-child { padding-top: var(--space-sm); border-top: 1px solid var(--color-rule); }
.step-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--color-rule-strong);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: var(--wght-display);
  line-height: 1;
}
.step-copy { min-width: 0; }
.step-label { display: block; overflow-wrap: anywhere; }
.step-detail { display: block; margin-top: 2px; color: var(--color-muted); font-size: var(--text-sm); line-height: 1.45; overflow-wrap: anywhere; }
.step-detail:empty { display: none; }
.door-steps > .step[data-state="active"] { color: var(--color-ink); font-weight: var(--wght-ui); }
.door-steps > .step[data-state="active"] .step-detail { color: var(--color-ink-2); font-weight: var(--wght-small); }
.door-steps > .step[data-state="active"] .step-marker { border-color: var(--color-ink); }
.door-steps > .step[data-state="active"] .step-marker::after { content: ""; position: absolute; inset: 4px; border-radius: var(--radius-pill); background: var(--color-ink); }
@media (prefers-reduced-motion: no-preference) {
  .door-steps > .step[data-state="active"] .step-marker::after { animation: door-active 1100ms ease-in-out infinite alternate; }
}
@keyframes door-active { from { opacity: 0.35; transform: scale(0.7); } }
.door-steps > .step[data-state="done"] { color: var(--color-ink-2); }
.door-steps > .step[data-state="done"] .step-marker { border-color: var(--color-paper-3); background: var(--color-paper-3); color: var(--color-ink); }
.door-steps > .step[data-state="skipped"] .step-marker { border-style: dashed; color: var(--color-muted); }
.door-steps > .step[data-state="failed"], .door-steps > .step[data-state="failed"] .step-detail { color: var(--color-accent); }
.door-steps > .step[data-state="failed"] .step-marker { border-color: var(--color-accent); }
.door-note { margin-top: var(--space-sm); max-width: 52ch; color: var(--color-muted); font-size: var(--text-sm); font-weight: var(--wght-small); line-height: 1.5; }

/* ---------- "Como funciona" (the entry only) ---------- */
.door-how { padding-block: calc(var(--section-pad) / 2); }
.door-how .block { padding-block: 0; }
.door-how .block-title { max-width: 12ch; }
.door-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-lg); }

/* One state at a time: the crema parts follow the panel that is open */
.door:has(#progress-panel[hidden]) .door-details { display: none; }
.door:has(#entry-panel[hidden]) .door-how { display: none; }

/* ---------- Motion: one arrival, a breathing bust while it works ---------- */
@media (prefers-reduced-motion: no-preference) {
  .door-rise { animation: door-rise var(--t, 1100ms) var(--ease-out) var(--d, 0ms) backwards; }
  .door-trail.door-rise { --d: 80ms; --y: 10px; --b: 0px; }
  .door-title.door-rise { --t: 1400ms; --d: 160ms; --y: 26px; --b: 10px; }
  .door-lead.door-rise { --d: 320ms; }
  .door-form.door-rise { --d: 440ms; }
  /* It arrives with the entry, breathes while the demonstration is prepared, and is simply still once it is ready or has
     failed (no rule then, so nothing replays) */
  .door:has(#entry-panel:not([hidden])) .door-capi img { animation: door-capi-in 1300ms var(--ease-out) 520ms backwards; }
  .door:has(#progress-panel:not([hidden])):not(:has(#progress-actions:not([hidden]))) .door-capi img {
    animation: door-breathe 1300ms ease-in-out infinite alternate;
  }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 39.99rem) {
  .door-title.door-rise { --b: 5px; --y: 20px; }
  .door-rise { --b: 3px; }
}
@keyframes door-rise { from { opacity: 0; transform: translate3d(0, var(--y, 16px), 0); filter: blur(var(--b, 6px)); } }
@keyframes door-capi-in { from { opacity: 0; transform: translate3d(0, 18px, 0); } }
@keyframes door-breathe { to { transform: translateY(-1.5%) scale(0.99, 1.02); } }
@media (prefers-reduced-motion: reduce) {
  .door-rise, .door-capi img, .finding { animation: none; }
}
