/* A product's own pages (/p/<slug>, /r/<token>): the product's screens one at a time, drawn by studio.css as in
   the studio's phone, inside the site's slim bar. This file only fits them to a real screen and adds the site's
   parts: the bar, the payment sheet, the writing progress and the footer. Tokens come from tokens.css; the
   product's own accent (--accent, set by flow.js from its theme) colours the sheet, else the site's key colour (먹). */
.flow-body { background: var(--page); }
.flow-bar, .flow-main, .flow-foot { max-width: var(--col); margin: 0 auto; }
@media (min-width: 560px) { .flow-bar, .flow-main, .flow-foot { box-shadow: 0 0 0 1px var(--line); } }

.flow-bar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px;
  height: var(--top-h); padding: 0 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.flow-bar__title { margin: 0; font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-bar__tools { display: flex; }

.flow-main { position: relative; background: var(--surface); }

/* 넓은 화면 양옆 여백 (theme side_*, catalog/templatetags/studio.py side_notes): the product's own colour around the
   column, a soft glow of its accent, and its quiet words on either side once there is room for them */
@media (min-width: 560px) {
  .flow-body.has-side { background: var(--side-color, var(--page)); }
  .flow-body.side-glow {
    background:
      radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--accent, var(--key)) 22%, transparent), transparent 26%),
      radial-gradient(circle at 88% 70%, color-mix(in srgb, var(--accent, var(--key)) 17%, var(--side-base) 10%), transparent 30%),
      var(--side-color, var(--page));
    background-attachment: fixed;
  }
  .flow-body.has-side :is(.flow-bar, .flow-main, .flow-foot) { box-shadow: 0 0 90px color-mix(in srgb, var(--side-base) 25%, transparent); }
}
.flow-side {
  position: fixed; z-index: 0; top: 50%; translate: 0 -50%;
  max-width: calc(50vw - var(--col) / 2 - 70px);
  color: color-mix(in srgb, var(--side-base) 70%, var(--accent, var(--key))); pointer-events: none;
  word-break: keep-all; animation: flow-fade 1.2s .3s both;
}
.flow-side--left { left: max(34px, calc(50vw - 550px)); }
.flow-side--right { right: max(38px, calc(50vw - 545px)); text-align: right; }
.flow-side small { display: block; font-size: 9px; font-weight: 800; letter-spacing: .24em; }
.flow-side p { margin: 20px 0; font: 400 clamp(16px, 1.5vw, 22px) / 1.8 var(--side-font, serif); }
.flow-side i { display: inline-block; width: 72px; height: 1px; background: color-mix(in srgb, currentColor 30%, transparent); }
.flow-side b {
  display: block; margin-bottom: 14px; color: color-mix(in srgb, color-mix(in srgb, var(--accent, var(--key)) 55%, var(--side-base)) 32%, transparent);
  font: 400 clamp(70px, 8vw, 120px) / 1 var(--side-font, serif);
}
@media (max-width: 1000px) { .flow-side { display: none; } }
/* a product drawn on a dark page (flow.js, from its theme's page colour --flow-bg): the site's parts turn to the same
   night, so the bar, the footer and the payment sheet do not break the story's mood */
.flow-body.flow-dark {
  --page: color-mix(in srgb, var(--flow-bg) 82%, #000); --surface: var(--flow-bg); --raised: color-mix(in srgb, var(--flow-bg) 90%, #fff);
  --ink: #f4ede9; --ink-2: #cfc2c6; --ink-3: #9b8c91; --line: color-mix(in srgb, var(--flow-bg) 84%, #fff);
  --soft: color-mix(in srgb, var(--flow-bg) 93%, #fff); --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
/* 읽은 만큼 차오르는 막대 (theme reading_bar): a hairline under the bar, filled with the accent as far as the screen is read */
.flow-progress {
  position: fixed; z-index: 31; top: var(--top-h); left: 50%; width: 100%; max-width: var(--col); height: 2px; translate: -50% 0;
  background: color-mix(in srgb, var(--ink) 9%, transparent); pointer-events: none;
}
.flow-progress i { display: block; height: 100%; transform-origin: left center; scale: var(--read, 0) 1; background: var(--accent, var(--key)); }
/* a screen with its own pinned 진행 막대 shows how far it is read there instead (flow-player.js followMeters) */
.flow-body:has(.screen.is-current .is-pinned .text-meter) .flow-progress { display: none; }
.flow-resume {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: color-mix(in srgb, var(--accent, var(--key)) 12%, var(--surface)); color: var(--ink); font-size: 14px; font-weight: 600;
}
.flow-resume .ph { color: var(--accent, var(--key)); font-size: 18px; }
.flow-resume span { flex: 1; min-width: 0; }
/* 보관 기간: until when a paid result is kept without a Kakao account, and the way to keep it (readings/retention.py) */
.flow-keep {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--soft); color: var(--ink-2); font-size: 13px; line-height: 1.45;
}
.flow-keep .ph { flex: none; color: var(--ink-3); font-size: 18px; }
.flow-keep span { flex: 1; min-width: 0; text-wrap: pretty; }
.flow-keep b { color: var(--ink); font-weight: 650; }
.flow-keep__login {
  flex: none; padding: 7px 11px; border-radius: 10px; background: #fee500; color: rgba(0, 0, 0, .85);
  font-size: 12.5px; font-weight: 650; white-space: nowrap; transition: transform .15s ease;
}
.flow-keep__login:active { transform: scale(.97); }
.flow-main .follow { margin: 0; border-radius: 0; border-top: 1px solid var(--line); }

/* the phone becomes the page: full width, no frame, the window scrolls, a one-screen page is one real screen */
.studio-phone.play-phone.flow-phone {
  --fit-height: calc(100svh - var(--top-h));
  width: 100%; max-width: none; height: auto; overflow: clip; border: 0; border-radius: 0;
}
.flow-phone .screen { min-height: var(--fit-height); padding-top: 22px; }
.flow-phone .scrub-stage { top: var(--top-h); } /* a scroll video holds under the bar, not behind it */
.flow-phone { --pin-top: var(--top-h); } /* so does a block pinned to the top (studio.css 화면 위에 붙어 따라오기) */
.flow-phone .block-recommend .card { display: block; color: inherit; }
.flow-phone .is-fresh { animation: play-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.flow-phone .is-fresh .chapter-figure img { animation: chapter-focus 1.6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes chapter-focus { from { filter: blur(18px); opacity: .45; } to { filter: blur(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flow-phone .is-fresh .chapter-figure img { animation: none; } }

/* layers over the whole window: the exit popup, the busy layer, the toast */
.play-popup.flow-popup { position: fixed; inset: 0; z-index: 70; padding: 24px; border-radius: 0; background: rgba(8, 12, 10, .55); }
.flow-popup .leave-offer__card { max-width: 360px; }
.play-overlay.flow-overlay { position: fixed; inset: 0; z-index: 80; border-radius: 0; }
.play-toast.flow-toast { position: fixed; z-index: 90; bottom: calc(24px + env(safe-area-inset-bottom)); max-width: min(360px, calc(100vw - 32px)); }

/* while the paid page is written: how far it has come, under the bar */
.flow-writing {
  position: fixed; z-index: 31; top: calc(var(--top-h) + 10px); left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 12px;
  border-radius: 999px; background: var(--ink); color: var(--surface);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: var(--shadow);
  animation: flow-drop .35s cubic-bezier(.16, 1, .3, 1) both;
}
.flow-writing[hidden] { display: none; }
.flow-writing .play-spinner { width: 14px; height: 14px; border-width: 2px; }
.flow-writing.is-done { background: var(--accent, var(--key)); color: var(--on-accent, var(--on-key)); }

/* ---- the payment sheet -------------------------------------------------------------------------- */
.flow-sheet[hidden] { display: none; }
.flow-sheet { position: fixed; inset: 0; z-index: 75; }
.flow-sheet__backdrop { position: absolute; inset: 0; background: rgba(8, 12, 10, .5); animation: flow-fade .2s both; }
.flow-sheet__panel {
  position: absolute; left: 50%; bottom: 0; width: 100%; max-width: var(--col); max-height: 92svh; overflow-y: auto;
  transform: translateX(-50%); padding: 6px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--surface); color: var(--ink);
  overscroll-behavior: contain; animation: flow-rise .42s cubic-bezier(.16, 1, .3, 1) both;
}
.flow-sheet__grip { width: 36px; height: 4px; margin: 6px auto 14px; border-radius: 2px; background: var(--line); }
.flow-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flow-sheet__thumb { flex: none; width: 52px; height: 52px; border-radius: 14px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.flow-sheet__name { flex: 1; min-width: 0; }
.flow-sheet__title { margin: 0; font-size: 19px; font-weight: 750; line-height: 1.35; letter-spacing: -0.03em; }
.flow-sheet__sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.flow-sheet__sub:empty { display: none; }
.flow-sheet__head .icon-button { flex: none; align-self: flex-start; margin: -6px -10px 0 0; color: var(--ink-3); }

/* the payment card's choices (단품, 번들, 패키지), to be changed in the sheet too */
.flow-choices { display: grid; gap: 8px; margin: 16px 0 0; }
.flow-choices[hidden] { display: none; }
.flow-choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.flow-choice.is-on { border-color: var(--accent, var(--key)); background: color-mix(in srgb, var(--accent, var(--key)) 7%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent, var(--key)); }
.flow-choice:active { transform: scale(.99); }
.flow-choice__radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ink-3); transition: border-width .15s; }
.flow-choice.is-on .flow-choice__radio { border: 5.5px solid var(--accent, var(--key)); }
.flow-choice__text { display: grid; justify-items: start; gap: 2px; min-width: 0; }
.flow-choice__text em {
  padding: 1px 7px; border-radius: 6px; font-size: 11px; font-style: normal; font-weight: 700;
  background: color-mix(in srgb, var(--accent, var(--key)) 14%, var(--surface)); color: var(--accent, var(--key-ink));
}
.flow-choice__text b { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.flow-choice__text small { max-width: 100%; overflow: hidden; font-size: 12px; color: var(--ink-3); text-overflow: ellipsis; white-space: nowrap; }
.flow-choice__price { display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.flow-choice__price em { font-size: 12px; font-style: normal; font-weight: 750; color: var(--accent, var(--key-ink)); }
.flow-choice__price s { font-size: 11.5px; color: var(--ink-3); }
.flow-choice__price strong { font-size: 15px; font-weight: 750; letter-spacing: -0.01em; }

.flow-pack-note { display: flex; gap: 8px; align-items: flex-start; margin: -4px 0 16px; padding: 10px 12px; border-radius: 12px; background: var(--soft); font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.flow-pack-note[hidden] { display: none; }
.flow-pack-note .ph { flex: none; margin-top: 2px; font-size: 15px; color: var(--accent, var(--key)); }

.flow-sum { display: grid; gap: 8px; margin: 16px 0; padding: 14px 16px; border-radius: var(--r); background: var(--soft); }
.flow-sum__row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-2); }
.flow-sum__row b { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.flow-sum__row.is-off b { color: var(--accent, var(--key-ink)); }
.flow-sum__row.is-total { padding-top: 10px; border-top: 1px dashed var(--line); font-weight: 650; color: var(--ink); }
.flow-sum__row.is-total b { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }

.flow-field { display: grid; gap: 6px; margin: 0 0 16px; }
.flow-field[hidden] { display: none; }
.flow-field__label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.flow-field__label small { font-weight: 500; color: var(--ink-3); }
.flow-field__input {
  height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised);
  color: var(--ink); font: inherit; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.flow-field__input:focus {
  outline: none; border-color: var(--accent, var(--key));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, var(--key)) 18%, transparent);
}
.flow-field__input[aria-invalid="true"] { border-color: var(--danger); }
.flow-field__help { margin: 0; font-size: 12.5px; color: var(--ink-3); }

.flow-credit {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin: 0 0 16px;
  padding: 12px 14px; border: 1px solid var(--accent, var(--key)); border-radius: 12px;
  background: color-mix(in srgb, var(--accent, var(--key)) 10%, var(--surface));
  color: var(--ink); font-size: 14px; font-weight: 650; text-align: left; cursor: pointer;
}
.flow-credit .ph { color: var(--accent, var(--key)); }
.flow-credit[hidden] { display: none; }
.flow-credit small { display: block; font-weight: 500; opacity: .85; }

/* with an 이용권 for this product the sheet leads with it; paying waits behind "이용권 대신 결제하기" */
.flow-credit-panel {
  display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; padding: 16px;
  border-radius: var(--r); background: color-mix(in srgb, var(--accent, var(--key)) 10%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, var(--key)) 35%, transparent);
}
.flow-credit-panel[hidden], .flow-pay-parts[hidden], .flow-switch[hidden] { display: none; }
.flow-credit-panel > .ph {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent, var(--key)); color: var(--on-accent, var(--on-key)); font-size: 22px;
}
.flow-credit-panel b { display: block; font-size: 16px; font-weight: 750; letter-spacing: -0.02em; }
.flow-credit-panel small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.flow-switch {
  display: block; width: 100%; margin: 8px 0 0; padding: 6px; border: 0; background: none; color: var(--ink-3);
  font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
/* on the payment card itself, above its button */
.flow-phone .offer-credit {
  display: flex; align-items: center; gap: 8px; margin: 10px 0; padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--phone-accent, #14806a) 10%, transparent); font-size: 13.5px; font-weight: 650;
}
.flow-phone .offer-credit .ph { flex: none; font-size: 17px; color: var(--phone-accent, #14806a); }

.flow-methods:empty, .flow-agreement:empty { display: none; }
.flow-methods { margin: 0 -8px; min-height: 120px; }
.flow-methods.is-loading { display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.flow-test[hidden] { display: none; }
.flow-test {
  display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; padding: 12px 14px;
  border-radius: 12px; background: var(--soft); font-size: 13px; color: var(--ink-2);
}
.flow-test .ph { flex: none; margin-top: 1px; font-size: 16px; color: var(--accent, var(--key)); }

.flow-error { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--danger); }
.flow-error:empty { display: none; }
.flow-pay {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 54px;
  border: 0; border-radius: 14px; background: var(--accent, var(--key)); color: var(--on-accent, var(--on-key));
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em; cursor: pointer; transition: transform .12s, opacity .15s;
}
.flow-pay:active { transform: scale(.98); }
.flow-pay:disabled { opacity: .55; cursor: default; }
/* whom the reading is for, repeated before paying (a wrong birth date can't be changed once it opens) */
.flow-who { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.flow-who[hidden] { display: none; }
.flow-who__title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.flow-who__row { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.flow-who__row b { color: var(--ink); font-weight: 700; }
.flow-who__note { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.flow-who__note a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
/* 청약철회 제한: the refund terms of what is bought, and the box ticked before paying */
.flow-consent { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--soft); }
.flow-terms { margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.flow-agree { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--ink); cursor: pointer; }
.flow-agree__box { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent, var(--key)); }
.flow-agree a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.flow-agree em { font-style: normal; color: var(--ink-3); }
.flow-fine { margin: 10px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); text-align: center; text-wrap: balance; }
.flow-fine a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
/* the pay button stays at the bottom of the sheet while it scrolls; it takes over the sheet's bottom padding (sticky
   stops at the padding's inner edge, hence the negative bottom) */
.flow-sheet__foot {
  position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); z-index: 2; margin: 14px -20px calc(-20px - env(safe-area-inset-bottom));
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--surface) 0%, transparent), var(--surface) 24%);
}

/* ---- footer: the business details, as on the rest of the site ----------------------------------------- */
.flow-foot { padding: 26px 16px 34px; background: var(--soft); color: var(--ink-3); font-size: 12px; }
.flow-foot__brand { margin: 0 0 10px; font-size: 14px; font-weight: 750; color: var(--ink-2); }
.flow-foot__info { margin: 0 0 10px; display: grid; gap: 3px; }
.flow-foot__info div { display: flex; gap: 8px; }
.flow-foot__info dt { flex: none; min-width: 92px; }
.flow-foot__info dd { margin: 0; color: var(--ink-2); }
.flow-foot__copy { margin: 0; }

@keyframes flow-fade { from { opacity: 0; } }
@keyframes flow-rise { from { transform: translate(-50%, 100%); } }
@keyframes flow-drop { from { opacity: 0; transform: translate(-50%, -8px); } }

/* 목차 (flow.js chapterList): the paid page's screens in a sheet from the top bar */
.chapter-list { position: fixed; inset: 0; z-index: 60; }
.chapter-list__backdrop { position: absolute; inset: 0; background: rgba(12, 10, 14, .45); }
.chapter-list__sheet { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(100%, var(--col)); max-height: 78dvh;
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border-radius: 0 0 var(--r-lg) var(--r-lg);
  box-shadow: 0 12px 40px rgba(12, 10, 14, .25); animation: chapter-list-in .22s ease-out; }
.chapter-list__head { display: flex; align-items: center; justify-content: space-between; padding: calc(8px + env(safe-area-inset-top)) 8px 8px 20px; font-size: 15px; }
.chapter-list__items { margin: 0; padding: 0 12px 16px; list-style: none; overflow-y: auto; }
.chapter-list__item { display: flex; width: 100%; align-items: baseline; gap: 10px; padding: 12px 10px; border: 0; border-radius: 10px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chapter-list__item b { flex: none; min-width: 4.6em; font-size: 15px; font-weight: 650; }
.chapter-list__item span { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-list__item:hover { background: color-mix(in srgb, var(--accent, #222) 7%, transparent); }
.chapter-list__item.is-current { background: color-mix(in srgb, var(--accent, #222) 12%, transparent); }
.chapter-list__item.is-current b { color: var(--accent, inherit); }
.chapter-list[hidden] { display: none; }
.flow-dark .chapter-list__sheet { background: var(--flow-bg); }
@keyframes chapter-list-in { from { transform: translate(-50%, -12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .chapter-list__sheet { animation: none; } }
