/* Loaded through the 760px media query on the three journey pages. */
.relief-placement {
  background: url(/rate-ceramic/design/brand-ai-2026/front-door-r28/relief.webp) center / 100% 100% no-repeat;
}
.relief .depth-layer { visibility: hidden; filter: none; }
.relief-placement.secondary { display: none; }
#edge-formation { display: none; }

body[data-screen] .stage,
body[data-screen] .screen,
.field-stack,
.revenue-layout > *,
.r47-field,
.row-name { min-width: 0; }

body[data-screen=intro] .topic { min-width: 0; padding-right: 44px; }
body[data-screen=intro] .topic-arrow { white-space: nowrap; }
body[data-screen=product] .revenue-layout { grid-template-columns: minmax(0,1fr); }
body[data-screen=product] .product-angle { max-width: 100%; }
body[data-screen=product] .revenue-benefits { max-width: 100%; }
.surface-live img { object-fit: contain; }
.r47-file-name, .r47-refusal-file, .r47-refusal, .paper-copy,
.sf-register dd, .work-description, .work-message p { overflow-wrap: anywhere; }
body[data-screen=upload] .r50-fields,
body[data-screen=upload] .details-grid { grid-template-columns: minmax(0,1fr); }
.side-panel :is(input, select, textarea), .prospect-panel input { min-width: 0; max-width: 100%; }
dialog[open] { max-height: calc(100dvh - 24px); overscroll-behavior: contain; }
dialog::backdrop { backdrop-filter: none; }
/* The entry fields are large enough to focus without iOS zooming the upload. */
#r47Form :is(input:not([type=checkbox],[type=radio],[type=file]),select,textarea) { font-size: 16px; }

/* Give the rotating phrase and sweep a shared place in the reading order.
   Only the space around the inlet admits the moving ridges. */
body[data-take=echo] .analysis-signal {
  --inlet-width: min(100%, clamp(11rem, 55%, 26rem));
  position: relative; overflow: clip; padding-block: 24px 28px;
  mask-image: linear-gradient(to bottom, transparent, black 16px, black calc(100% - 16px), transparent);
}
body[data-take=echo] .analysis-signal .analysis-status {
  width: var(--inlet-width); min-height: 2.8em; align-items: flex-end; margin: 0;
}
body[data-take=echo][data-intake=analysis] .analysis-track {
  position: relative; width: var(--inlet-width); max-width: none;
}
body[data-inward-ready] .analysis-track { overflow: visible; }
body[data-intake=analysis][data-take=echo] .relief > .relief-placement { visibility: hidden; }
.analysis-track > .relief-placement {
  width: clamp(200px,60vw,380px); height: auto; aspect-ratio: 1; pointer-events: none;
}
.analysis-track .relief-placement svg { display: block; width: 100%; height: 100%; overflow: visible; }
.analysis-track .depth-layer { visibility: hidden; filter: none; }
body[data-take=echo] .analysis-privacy { margin-top: 8px; }

/* The still export also serves reduced motion. */
.ceramic-background { background: #ece8df url(/rate-ceramic/design/brand-ai-2026/front-door-r28/results-relief.webp) center / cover no-repeat; }
.ceramic-background svg, .phone-magnus { display: none; }
#page, #rate-dialog { overflow-wrap: break-word; }
body.first-visit > .mast, body.first-visit #page, body.first-visit .sf-foot {
  box-sizing: border-box;
  width: calc(100% - 32px);
}
#page :is(.merchant-stack,.route-grid,.collection-cards,.savings-collection,.overview-data),
#rate-dialog .dialog-content { min-width: 0; }
#page :is(.merchant-surface, .overview), #rate-dialog .merchant-surface { padding: 18px 14px; }
#page :is(.merchant-stats,.route-grid,.overview) { grid-template-columns: minmax(0,1fr); }
#page .merchant-stats > * { grid-column: 1; min-width: 0; }
:is(#page,#rate-dialog) .merchant-section-title { align-items: baseline; flex-wrap: wrap; gap: 8px; }
:is(#page,#rate-dialog) .merchant-table-wrap { width: 100%; min-width: 0; overflow: visible; }
:is(#page,#rate-dialog) table.merchant-table {
  width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse;
}
:is(#page,#rate-dialog) .merchant-table :is(th,td) {
  padding: 10px 4px; font-size: .75rem; line-height: 1.4; white-space: normal; vertical-align: top;
  overflow-wrap: anywhere;
}
:is(#page,#rate-dialog) .fee-table th:first-child { width: 52%; }
:is(#page,#rate-dialog) .fee-table th:nth-child(2) { width: 28%; }
:is(#page,#rate-dialog) .fee-table td:nth-child(2) { white-space: nowrap; }
:is(#page,#rate-dialog) .fee-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.fee-explanation summary { width: 100%; gap: 5px; align-items: baseline; }
.fee-explanation summary i { width: 6px; height: 6px; }
.fee-explanation summary .fee-chevron { flex: none; align-self: center; }
.fee-explanation p { margin-left: 0; }
.fee-kind, .fee-result, .saving-key, .opportunity-toggle > span { min-width: 0; }
.saving-key { max-width: 100%; text-align: left; }
.saving-key strong, .opportunity-toggle .row-value { white-space: nowrap; }
:first-child:is(.fee-kind,.fee-result) { overflow-wrap: break-word; }
#page .opportunity-line .opportunity-toggle {
  grid-template-columns: minmax(0,1fr) auto 10px; gap: 8px; width: 100%;
}
#page .opportunity-line .row-name { white-space: normal; }
#page :is(.route,.merchant-surface,.opportunity-row,.collection-cards,.merchant-table) {
  content-visibility: visible;
  backdrop-filter: none;
}
#page :is(.fee-track b,.saving-segment span,.merchant-ring circle,.browse-card) { animation: none; }
.rate-stopped { width: calc(100% - 32px); bottom: max(12px,env(safe-area-inset-bottom)); }
#rate-dialog, #rate-dialog.expanded-plot { width: calc(100% - 24px); max-width: calc(100% - 24px); }
.work-shell > *, .work-title-group, .work-tabs { min-width: 0; }
.work-tabs { flex-wrap: wrap; }
.work-compose textarea { max-width: 100%; }
@media (prefers-reduced-motion: reduce) {
  .analysis-track > span, .analysis-title, .analysis-line, .route .rate-pending { animation: none; }
}
/* Keep navigation arrows in the text face on iOS. */
:is(.topic-arrow,.card-arrow,.ceramic-primary span,.capture-expand,.route b) {
  font-variant-emoji: text;
  font-family: Arial, sans-serif;
}

/* The workspace scrolls as one column. Each card fits its contents, including
   a growing conversation and the worked figures beneath the finding title. */
#work-layer:not([hidden]) { display: block; overflow-y: auto; overscroll-behavior-y: contain; }
#work-layer .work-shell {
  display: grid; grid-template-columns: minmax(0,1fr); grid-auto-rows: max-content;
  align-content: start; gap: 14px; min-height: 100%; overflow: visible;
}
#work-layer[data-mode=split] .work-shell { grid-auto-rows: 1fr; }
#work-layer .work-panel, #work-layer .work-chat .transcript {
  min-height: 0; height: auto; overflow: visible;
}
#work-layer .work-conversation, #work-layer .work-chat .transcript { flex: none; }
#work-layer .work-compose textarea { font-size: 16px; }
#work-layer .work-layout-toggle { display: grid; }
#work-layer .work-layout-toggle svg { transform: rotate(-90deg); }
#work-layer[data-mode=split] .work-layout-toggle svg { transform: rotate(90deg); }
@layer surface-frame {
  body.shared-frame.exploring-saving #work-layer { top: max(14px,env(safe-area-inset-top)) !important; }
}

#rate-dialog table.merchant-table:not(.fee-table) { table-layout: auto; }
#rate-dialog .merchant-table tbody .num { white-space: nowrap; }
@layer surface-frame {
  #rate-dialog .merchant-table:not(.fee-table) :is(th,td) { padding-inline: 5px !important; }
}

.phone-piston { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
body:not([data-intake=analysis]) .relief-placement:has(.phone-piston:not([hidden])) { background-image: none; }
body[data-intake=analysis] .phone-piston { display: none; }

/* Match the two placements of the 1600 by 1000 results artwork. Each glazed
   diamond moves on its own layer; the light and the reading surface stay put. */
@media (prefers-reduced-motion: no-preference) {
  html[data-background-motion=on] .ceramic-background {
    background: radial-gradient(ellipse at 37% 42%, #f7f3eb, transparent 72%), #eae6dd;
  }
  html[data-background-motion=on] .phone-magnus {
    display: block; position: absolute; top: 50%; left: 50%;
    width: max(100vw,160dvh); aspect-ratio: 8 / 5; transform: translate(-50%,-50%);
  }
  .phone-magnus::before, .phone-magnus::after {
    content: ''; position: absolute; aspect-ratio: 1;
    background: url(/rate-ceramic/design/brand-ai-2026/front-door-r28/results-diamond.webp) center / contain no-repeat;
    animation: phone-diamond-drift 16s ease-in-out -6s infinite alternate;
  }
  .phone-magnus::before { left: 43.125%; top: -21%; width: 87.5%; opacity: .9; }
  .phone-magnus::after {
    left: -30.625%; top: 44%; width: 65%; opacity: .68;
    animation-duration: 12s; animation-delay: -4s; animation-direction: alternate-reverse;
  }
  html[data-background-hidden=true] .phone-magnus::before,
  html[data-background-hidden=true] .phone-magnus::after { animation-play-state: paused; }
  @keyframes phone-diamond-drift {
    from { transform: translate3d(-14px,-7px,0); }
    to { transform: translate3d(16px,12px,0); }
  }
}
