/* ==========================================================================
   Glow · screen «Анализ» (root .scr-analysis)
   Before a photo → processing → result (scan hero, proportions on tapes,
   basic tips, AI analysis). Tokens + shared components come from tokens.css /
   components.css / scan.css; this file only lays out the screen.
   ========================================================================== */

.scr-analysis {
  --an-col: var(--col-no, 28px);       /* the hanging number column (01, 02…) …                     */
  --an-gap: 6px;                       /* … and its gap: the tip rows' grid 24 + 28 + 6, so every   */
  --an-ind: calc(var(--an-col) + var(--an-gap));   /* numbered row's text starts on the same line */
  padding-bottom: 40px;
}

/* ---------- (a) before a photo ----------------------------------------- */

.scr-analysis .an-vf {
  position: relative;
  margin: 22px var(--gutter) 0;
  cursor: pointer;
}
.scr-analysis.is-empty .an-vf:active { opacity: .92; }
.scr-analysis .an-vf .viewfinder__status { cursor: default; }   /* the status line is not the shutter */

.scr-analysis .an-howto { margin: 40px var(--gutter) 0; }
.scr-analysis .an-howto__head {
  padding-bottom: 10px;
  border-bottom: var(--hair) solid var(--rule);
}
.scr-analysis .an-howto li {
  display: grid; grid-template-columns: var(--an-col) minmax(0, 1fr); column-gap: var(--an-gap);
  align-items: baseline;
  padding: 13px 0 14px;
  border-bottom: var(--hair) solid var(--rule-2);
}
.scr-analysis .an-howto__n {
  font: var(--fw-serif-text, 400) 13px/1 var(--serif); color: var(--ink-3);
  font-variant-numeric: lining-nums tabular-nums;
}
.scr-analysis .an-howto li p {          /* only the rows: the caps head keeps its .label look */
  font: 400 var(--fs-body-s, 14px)/1.45 var(--sans); color: var(--ink-2);
  text-wrap: pretty;
}
.scr-analysis .an-howto b {
  display: block; margin-bottom: 5px;
  font: var(--fw-serif-text, 400) var(--fs-item, 19px)/1.22 var(--serif); letter-spacing: var(--tr-item, -.005em);
  color: var(--ink);
}

.scr-analysis .an-privacy {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 16px 2px 0;
  font: 400 var(--fs-body-s, 14px)/1.45 var(--sans); color: var(--ink-2);
  text-wrap: pretty;
}
.scr-analysis .an-privacy svg { flex: none; width: 14px; height: 14px; margin-top: 3px; color: var(--ink); }

.scr-analysis .an-notes {
  display: grid; gap: 10px;
  margin: 18px var(--gutter) 0;
}
.scr-analysis .an-notes:empty { display: none; }

.scr-analysis .an-cta { margin: 20px var(--gutter) 0; }
.scr-analysis .an-shoot { cursor: pointer; }
.scr-analysis .an-shoot svg { flex: none; }

/* model status: «МОДЕЛЬ АНАЛИЗА ——— ЗАГРУЖАЕТСЯ» → «ГОТОВА» → error + «Повторить».
   The line itself is ui.loader() (.status, styled in components.css). */
.scr-analysis .an-model { min-height: 46px; display: flex; align-items: center; margin-top: 4px; }
.scr-analysis .an-model .status { flex: 1; margin: 0; }
.scr-analysis .an-model.is-error {
  flex-wrap: wrap; justify-content: space-between; gap: 2px 16px;
  padding-top: 10px;
}
.scr-analysis .an-model__err {
  display: flex; align-items: flex-start; gap: 10px; flex: 1 1 220px;
  font: 400 var(--fs-body-s, 14px)/1.45 var(--sans); color: var(--ink);
}
.scr-analysis .an-model__err svg { flex: none; margin-top: 2px; }
.scr-analysis .an-model__retry { gap: 8px; }

/* a button at work = components' .btn.is-busy (keeps its look, a 1 px bar runs under the label) */
.scr-analysis .btn.is-busy { cursor: progress; }

/* ---------- (c) result: hero + the row under it ----------------------- */

/* the hero (figure.scan) is face.js + scan.css; AI at work or a retake → scan.setBusy(true) */
.scr-analysis .an-hero { position: relative; min-height: 120px; }

.scr-analysis .an-caprow {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 52px; padding: 2px var(--gutter);
  border-bottom: var(--hair) solid var(--rule-2);
}
.scr-analysis .an-caprow__privacy {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  font: 400 var(--fs-note, 13px)/1.35 var(--sans); color: var(--ink-3);
}
.scr-analysis .an-caprow__privacy svg { flex: none; width: 14px; height: 14px; color: var(--ink-2); }
.scr-analysis .an-caprow__privacy span { text-wrap: balance; }   /* «Фото ушло в DeepSeek, / у нас не хранится» */
.scr-analysis .an-retake {
  position: relative; flex: none;
  display: inline-flex; align-items: center; gap: 9px;
  height: 44px; padding: 0 2px; margin-right: -2px;
  font: 500 var(--fs-micro, 11px)/1 var(--sans); letter-spacing: var(--tr-caps, .1em); text-transform: uppercase;
  color: var(--ink); white-space: nowrap; cursor: pointer;
  transition: opacity var(--d-press, 140ms) var(--e-std), color var(--d-press, 140ms) var(--e-std);
}
.scr-analysis .an-retake::after { content: ""; position: absolute; inset: 0 -10px; }
.scr-analysis .an-retake:active { opacity: .55; }
.scr-analysis .an-retake svg { flex: none; }
.scr-analysis .an-retake.is-busy { cursor: progress; }                   /* «Ищу лицо…» over the old print */
.scr-analysis .an-retake[aria-disabled="true"] { color: var(--ink-3); cursor: default; }   /* AI at work */
.scr-analysis .an-retake:is(.is-busy, [aria-disabled="true"]):active { opacity: 1; }

/* ---------- sections ---------------------------------------------------- */

.scr-analysis .an-sec { margin-top: 44px; }
.scr-analysis .an-props { margin-top: 18px; }
.scr-analysis .an-sec .sec-meta { flex: none; margin-left: 0; }   /* one line: pushed right by space-between; wrapped: under the title */
.scr-analysis .an-count { display: inline-block; }                /* countUp reserves its width: «/8» never jitters */

/* ---------- proportions: one column of tapes ---------------------------- */

.scr-analysis .an-mwrap { container-type: inline-size; }
.scr-analysis .metrics {
  margin: 0 var(--gutter);
  border-top: var(--hair) solid var(--rule);
}
.scr-analysis .metric {
  padding: 14px 0 13px;
  border-bottom: var(--hair) solid var(--rule-2);
}
.scr-analysis .metric__head {
  display: grid; grid-template-columns: var(--an-col) minmax(0, 1fr) auto; column-gap: var(--an-gap);
  align-items: baseline;
}
.scr-analysis .metric__no {
  font: var(--fw-serif-text, 400) 13px/1 var(--serif); color: var(--ink-3);
  font-variant-numeric: lining-nums tabular-nums;
}
.scr-analysis .metric__name {
  font: 400 var(--fs-body, 15px)/1.3 var(--sans); color: var(--ink);
  text-wrap: balance;
}
.scr-analysis .metric__name small {
  font-size: var(--fs-note, 13px); color: var(--ink-3); white-space: nowrap;
}
.scr-analysis .metric__val {
  padding-left: 8px;
  font: var(--fw-serif-title, 340) var(--fs-num, 24px)/1 var(--serif); letter-spacing: -.015em;
  font-variant-numeric: lining-nums proportional-nums;
  white-space: nowrap;
}
.scr-analysis .metric__unit {
  margin-left: 3px;
  font: 400 14px/1 var(--serif); letter-spacing: 0; color: var(--ink-2);
}
.scr-analysis .metric__unit--word {
  margin-left: 6px;
  font: 500 var(--fs-micro, 11px)/1 var(--sans); letter-spacing: var(--tr-caps, .1em); text-transform: uppercase;
  color: var(--ink-3);
  vertical-align: .2em;
}
.scr-analysis .metric .tape { margin-left: var(--an-ind); }
.scr-analysis .metric .tag-dir { margin-left: var(--an-ind); }
.scr-analysis .metric__note {
  margin: 8px 0 1px var(--an-ind);
  font: 400 var(--fs-body-s, 14px)/1.45 var(--sans); color: var(--ink-2);
  text-wrap: pretty;
}
.scr-analysis .an-foot {
  position: relative;
  margin: 16px var(--gutter) 0; padding-left: var(--an-ind);
  font: 400 var(--fs-note, 13px)/1.5 var(--sans); color: var(--ink-3);
  text-wrap: pretty;
}
.scr-analysis .an-foot > span {
  position: absolute; left: 0; top: 0;
  font: 400 18px/1.1 var(--serif); color: var(--ink-2);
}

@container (min-width: 600px) {
  .scr-analysis .metrics {
    display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px;
  }
}

/* ---------- basic tips --------------------------------------------------- */

.scr-analysis .an-basic__cta { margin: 0 var(--gutter); }
.scr-analysis .an-basic__err { margin-bottom: 14px; }
.scr-analysis .an-basic__hint {
  margin-top: 12px; text-align: center;
  font: 400 var(--fs-note, 13px)/1.45 var(--sans); color: var(--ink-3);
}
.scr-analysis :is(.an-basic, .an-locked) > .sec-head {     /* the head carries the strong rule, inset */
  margin: 0 var(--gutter); padding-left: 0; padding-right: 0;
  border-bottom: var(--hair) solid var(--rule);
}
/* tip rows sit inside the gutter like every other list on this screen: hairlines, the pressed fill and
   the titles share the section rule's edges (titles on the 24 + 28 + 6 line) */
.scr-analysis .an-tips { margin: 0 var(--gutter); }
.scr-analysis .an-tips > .tip { padding-left: 0; padding-right: 0; }
.scr-analysis .an-tips > .tip:focus-visible { outline-offset: 2px; }
.scr-analysis .an-tips > .tip:first-child { border-top: 0; }
.scr-analysis .an-empty {
  margin: 0 var(--gutter); padding: 16px 0 18px;
  border-bottom: var(--hair) solid var(--rule-2);
  font: italic 400 19px/1.3 var(--serif); color: var(--ink-2);
}
.scr-analysis .an-basic__more {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 20px;
  margin: 4px var(--gutter) 0;
}
.scr-analysis .an-link { gap: 10px; }
.scr-analysis .an-link svg { flex: none; }
.scr-analysis .an-locked { margin-top: 28px; }
.scr-analysis .an-locked .sec-title { font-size: var(--fs-title-s, 28px); }
.scr-analysis .an-locked .sec-meta { padding-bottom: 0; }

/* ---------- AI: shared ---------------------------------------------------- */

/* «Полный / AI-анализ» stacks beside the PREMIUM tag instead of pushing it to a line of its own */
.scr-analysis .an-ai > .sec-head { flex-wrap: nowrap; align-items: flex-end; }
.scr-analysis .an-ai > .sec-head .sec-meta { padding-bottom: 4px; }
.scr-analysis .an-ai .tag-premium { flex: none; }
.scr-analysis .an-nobr { white-space: nowrap; }

.scr-analysis .an-ai__panel { margin: 0 var(--gutter); }
.scr-analysis .an-ai__lead {
  font: italic var(--fw-serif-text, 400) var(--fs-voice, 20px)/1.32 var(--serif); letter-spacing: -.005em;
  color: var(--ink);
  text-wrap: pretty;
}
.scr-analysis .an-ai__facts {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  margin-top: 16px;
  font: 500 var(--fs-micro, 11px)/1.2 var(--sans); letter-spacing: var(--tr-caps, .1em); text-transform: uppercase;
  color: var(--ink-2);
}
.scr-analysis .an-ai__facts li { display: inline-flex; align-items: center; gap: 8px; min-height: 14px; }
.scr-analysis .an-ai__facts svg { flex: none; color: var(--ink); }
.scr-analysis .an-ai__err { margin-top: 16px; }
.scr-analysis .an-ai__panel > .btn { margin-top: 20px; }
/* under the button: before the run, where the photo goes (.an-fine.an-ai__privacy); while it runs, this line */
.scr-analysis .an-ai__wait {
  margin-top: 12px; text-align: center;
  font: 400 var(--fs-note, 13px)/1.45 var(--sans); color: var(--ink-3);
}

/* AI at work (Atelier S2): the facts line turns into the status line «АНАЛИЗИРУЮ ——— КОЖА · КОНТУР ·
   ГРУМИНГ» in the same slot, the button keeps its place and rests (the status line is the one that
   runs), a skeleton of the observations waits under the panel. */
.scr-analysis .an-ai__status { display: flex; align-items: center; min-height: 14px; margin-top: 16px; }
.scr-analysis .an-ai__status .status { flex: 1; min-width: 0; margin: 0; }
.scr-analysis .an-ai__panel.is-busy > .btn::before { content: none; }
.scr-analysis .an-ai__sk { margin-top: 30px; }
.scr-analysis .an-ai__sk .tips-list { margin: 0 var(--gutter); }
.scr-analysis .an-ai__sk .tips-list > div:not(.tip) { padding-left: 0 !important; padding-right: 0 !important; }  /* ui.skeleton's inline head padding */
.scr-analysis .an-ai__sk .tip { padding-left: 0; padding-right: 0; cursor: default; }

/* ---------- AI: free teaser (a redacted dossier) -------------------------- */

.scr-analysis .an-teaser { margin: 0 var(--gutter); }
.scr-analysis .an-teaser__doc {
  position: relative;
  padding: 18px 0 2px;
  border-top: var(--hair) solid var(--rule);
  cursor: pointer;
  transition: opacity var(--d-row, 160ms) var(--e-std);
}
.scr-analysis .an-teaser__doc:active { opacity: .7; }
.scr-analysis .an-teaser__lock {
  position: absolute; right: 0; top: 18px;
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--ink); color: var(--ink); background: var(--bg);
}
.scr-analysis .an-teaser .redact { flex: 1; min-width: 0; margin: 0; }
.scr-analysis .an-teaser__quote {
  position: relative; display: flex; padding: 6px 48px 4px var(--an-ind);
}
.scr-analysis .an-teaser__quote .redact { gap: 10px; }
.scr-analysis .an-teaser__quote::before {
  content: "«"; position: absolute; left: -3px; top: -9px;
  font: 300 48px/1 var(--serif); color: var(--ink-3);
}
.scr-analysis .an-teaser__sec { margin-top: 24px; }
.scr-analysis .an-teaser__sec .label {
  padding-bottom: 9px; border-bottom: var(--hair) solid var(--rule);
}
.scr-analysis .an-teaser__row {
  display: flex; align-items: center;
  min-height: 42px; padding: 13px 0;
  border-bottom: var(--hair) solid var(--rule-2);
}
.scr-analysis .an-teaser__plus {
  flex: none; width: var(--an-ind);
  font: var(--fw-serif-text, 400) 21px/1 var(--serif); color: var(--ink-3);
}
.scr-analysis .an-teaser__lead {
  margin-top: 24px;
  font: italic var(--fw-serif-text, 400) var(--fs-voice, 20px)/1.32 var(--serif); letter-spacing: -.005em;
  text-wrap: pretty;
}
.scr-analysis .an-teaser > .btn { margin-top: 20px; }
.scr-analysis .an-fine {
  margin-top: 12px; text-align: center;
  font: 400 var(--fs-note, 13px)/1.45 var(--sans); color: var(--ink-3);
  text-wrap: balance;
}

/* ---------- AI: result ---------------------------------------------------- */

.scr-analysis .an-ai__bad { display: grid; gap: 16px; margin: 0 var(--gutter); }

/* head → strong rule → content, like «Пропорции» and «Твои советы» */
.scr-analysis .an-pull {
  position: relative;
  margin: 0 var(--gutter); padding: 18px 0 0 30px;
  border: 0;
  border-top: var(--hair) solid var(--rule);
}
.scr-analysis .an-pull::before {
  content: "«"; position: absolute; left: -3px; top: 10px;
  font: 300 50px/1 var(--serif); color: var(--ink-3);
}
.scr-analysis .an-pull p {
  font: italic var(--fw-serif-text, 400) var(--fs-voice, 20px)/1.38 var(--serif); letter-spacing: -.005em;
  color: var(--ink);
  text-wrap: pretty;
}
/* the model's word on the photo itself (photo_quality.note): fine print on the quote's text line */
.scr-analysis .an-pull__note {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 14px var(--gutter) 0; padding-left: 30px;
  font: 400 var(--fs-note, 13px)/1.45 var(--sans); color: var(--ink-3);
  text-wrap: pretty;
}
.scr-analysis .an-pull__note svg { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--ink-2); }

.scr-analysis .an-aisec { margin-top: 34px; }
.scr-analysis .an-aisec__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin: 0 var(--gutter); padding-bottom: 10px;
  border-bottom: var(--hair) solid var(--rule);
}
.scr-analysis .an-aisec--tips .an-tips { border-top: 0; }

.scr-analysis .an-plus { margin: 0 var(--gutter); }
.scr-analysis .an-plus li {
  display: grid; grid-template-columns: var(--an-col) minmax(0, 1fr); column-gap: var(--an-gap);
  align-items: baseline;
  padding: 12px 0 13px;
  border-bottom: var(--hair) solid var(--rule-2);
  font: 400 var(--fs-body, 15px)/1.45 var(--sans); color: var(--ink);
  text-wrap: pretty;
}
.scr-analysis .an-plus li::before {
  content: "+";
  font: var(--fw-serif-text, 400) 21px/1 var(--serif); color: var(--ink-3);
}

.scr-analysis .an-obs {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 14px;
  margin: 0 var(--gutter); padding: 14px 0 15px;
  border-bottom: var(--hair) solid var(--rule-2);
}
.scr-analysis .an-obs__area {
  font: var(--fw-serif-text, 400) var(--fs-item, 19px)/1.22 var(--serif); letter-spacing: var(--tr-item, -.005em);
}
.scr-analysis .an-obs__note {
  grid-column: 1 / -1; margin-top: 7px;
  font: 400 var(--fs-body-s, 14px)/1.45 var(--sans); color: var(--ink-2);
  text-wrap: pretty;
}

.scr-analysis .an-acts { margin: 0 var(--gutter); }
.scr-analysis .an-act {
  display: grid; grid-template-columns: var(--an-col) minmax(0, 1fr); column-gap: var(--an-gap);
  align-items: baseline;
  padding: 14px 0 16px;
  border-bottom: var(--hair) solid var(--rule-2);
}
.scr-analysis .an-act__no {
  font: var(--fw-serif-text, 400) 13px/1 var(--serif); color: var(--ink-3);
  font-variant-numeric: lining-nums tabular-nums;
}
.scr-analysis .an-act__title {
  font: var(--fw-serif-text, 400) var(--fs-item, 19px)/1.22 var(--serif); letter-spacing: var(--tr-item, -.005em);
  text-wrap: pretty;
}
.scr-analysis .an-act__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 8px;
  font: 500 var(--fs-micro, 11px)/1.2 var(--sans); letter-spacing: var(--tr-caps, .1em); text-transform: uppercase;
  color: var(--ink-3);
}
.scr-analysis .an-act__meta .kind { color: var(--ink-2); }
.scr-analysis .an-act__why {
  margin-top: 8px;
  font: 400 var(--fs-body-s, 14px)/1.45 var(--sans); color: var(--ink-2);
  text-wrap: pretty;
}
.scr-analysis .an-act__add { margin-top: 14px; gap: 8px; }

/* ---------- motion -------------------------------------------------------- */

/* a new photo: each tape unrolls left → right like a tailor's tape, rows 60 ms apart
   (clip-path only; the negative insets leave room for the caret and the labels — the start frame
   hides the 10 px left margin too, so no half label peeks out before the tape starts) */
.scr-analysis.is-unrolling .metric .tape {
  animation: an-unroll 1s var(--e-out) both;
  animation-delay: calc(260ms + var(--i, 0) * 60ms);
}
.scr-analysis.is-unrolling .metric .tag-dir,
.scr-analysis.is-unrolling .metric__note {
  animation: an-fade 600ms var(--e-out) both;
  animation-delay: calc(700ms + var(--i, 0) * 60ms);
}
@keyframes an-unroll {
  from { clip-path: inset(-14px calc(100% + 10px) -18px -10px); }
  to { clip-path: inset(-14px -10px -18px -10px); }
}
@keyframes an-fade { from { opacity: 0; } }

/* a section that just received new data rises once (never on a re-render); the head was already
   on screen, so it stays put */
.scr-analysis .an-in > * { animation: an-rise var(--d-enter, 560ms) var(--e-out) both; }
.scr-analysis .an-in > *:nth-child(2) { animation-delay: 40ms; }
.scr-analysis .an-in > *:nth-child(3) { animation-delay: 80ms; }
.scr-analysis .an-in > *:nth-child(4) { animation-delay: 120ms; }
.scr-analysis .an-in > *:nth-child(5) { animation-delay: 160ms; }
.scr-analysis .an-in > *:nth-child(6) { animation-delay: 200ms; }
.scr-analysis .an-in > *:nth-child(n+7) { animation-delay: 240ms; }
.scr-analysis .an-in > .sec-head { animation: none; }
@keyframes an-rise { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  .scr-analysis .an-in > *,
  .scr-analysis.is-unrolling .metric .tape,
  .scr-analysis.is-unrolling .metric .tag-dir,
  .scr-analysis.is-unrolling .metric__note { animation: none; }
}

/* ---------- narrow phones -------------------------------------------------- */

@media (max-width: 374.98px) {
  .scr-analysis .an-caprow { gap: 10px; }
  .scr-analysis .an-locked .sec-title { font-size: 26px; }   /* «Ещё 6 в Premium» + «Открыть» stay on one line at 360 */
}
