/*
 * Mobile layout from the Figma mockup «Для верстки», frames *_375 (dark theme).
 * Mobile rules sit under max-width: 767px, so desktop and the 768 tablet frames stay as they are.
 * The block right after :root styles elements the mockup adds at every width (it has them in all frames).
 * Loaded after style.css: same selectors here win by order.
 */
:root {
  --lp-on-surface: #e6e9ed;
  --lp-on-surface-variant: #a8b3c2;
  --lp-surface-bright: #1a2a3b;
}

/* Added from the mockup, all widths: register lead line and legal note. */
.auth-page__title:has(+ .auth-page__lead) {
  margin-bottom: 8px;
}

.auth-page__lead {
  margin: 0 auto 64px;
  color: var(--lp-on-surface-variant);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.25px;
  text-align: center;
}

.auth-page__legal {
  max-width: 343px;
  margin: 32px auto 0;
  color: #8c8c8c;
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.5px;
  text-align: center;
}

.auth-page__legal a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 767px) {
  /* Section titles the mockup sets as display/small (on /pricing the tariffs title is smaller, see below). */
  .pricing-section:not(.pricing-section--page) .pricing-section__title,
  .faq-section__title {
    font-size: 36px;
    font-weight: 600;
    line-height: 44px;
  }

  /* Home: hero */
  .hero-section__title {
    margin-bottom: 16px;
  }

  .hero-media {
    margin-top: 32px;
  }

  .hero-media__inner {
    height: calc((100vw - 32px) * 209 / 343);
  }

  .hero-media__frame {
    border-radius: 16px;
  }

  .hero-media-copy__title {
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
  }

  .hero-media-copy__description {
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.25px;
  }

  .hero-section__actions {
    margin-top: 32px;
  }

  /* Home: stats in two columns (asked in the team chat 07.10; the mockup has one). Captions 16/24 so they fit. */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 16px;
  }

  .stats-card {
    max-width: none;
  }

  .stats-card__value {
    margin-bottom: 8px;
  }

  .stats-card__text {
    font-size: 16px;
    line-height: 24px;
  }

  .features-video-panel .features-grid.section-bottom-gradient {
    max-height: 585px;
  }

  /* It used to start right under the «Подробнее» button of the gallery above. */
  .prompt-templates-section {
    margin-top: 48px;
  }

  /* Tariff cards: partials/pricing_cards.html, shared by the home page and /pricing.
     The mockup fixes every card at 900px with buttons pinned to the bottom; here the height follows
     the content instead, so short tariffs do not end in a blank gap. */
  .pricing-grid {
    gap: 16px;
  }

  .pricing-card {
    padding: 0 16px 32px;
  }

  .pricing-card__label {
    margin: 0 0 30px 12px;
    padding: 22px 24px 20px;
    border-radius: 0 0 16px 16px;
  }

  .pricing-card__description {
    margin-bottom: 32px;
  }

  .pricing-token-options {
    gap: 8px;
    margin-bottom: 32px;
  }

  .pricing-token-option {
    min-height: 72px;
    padding: 8px;
  }

  .pricing-token-option__value {
    color: var(--lp-on-surface-variant);
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.25px;
  }

  .pricing-token-option--active {
    min-height: 76px;
  }

  .pricing-token-option--active .pricing-token-option__value {
    color: var(--lp-on-surface);
    font-size: 22px;
    line-height: 28px;
    letter-spacing: 0;
  }

  .pricing-price-wrap {
    margin-bottom: 32px;
  }

  /* The mockup pads 32 on both sides, but real prices (BYN, two decimals) are wider than its «75»,
     and the period label would slide under the «Экономия» ribbon. */
  .pricing-price-box {
    padding: 16px 20px;
    border-radius: 8px;
  }

  /* min-height aligns cards in a desktop row; stacked, it only leaves a blank line above the list. */
  .pricing-card__note {
    min-height: 0;
    margin-bottom: 10px;
  }

  .pricing-card__actions {
    padding-top: 32px;
  }

  .pricing-card__button {
    margin-bottom: 20px;
  }

  /* Outline buttons («Подробнее», «Попробовать бесплатно») are 50px tall in the mockup. */
  .news-section__button {
    min-height: 50px;
  }

  /* /pricing: period switch, banner, comparison table */
  .pricing-page-hero__periods > * {
    white-space: nowrap;
  }

  .pricing-section--page .pricing-section__title {
    margin-bottom: 16px;
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
  }

  .pricing-page-banner {
    padding: 32px;
    border-radius: 32px;
  }

  .pricing-page-banner__title {
    margin-bottom: 8px;
  }

  /* style.css pins it left under 640px (margin-right: auto); the banner text is centred, so is the button. */
  .pricing-page-banner__button {
    margin-right: auto;
    margin-left: auto;
  }

  /* 720px wide and scrolled sideways, as in the mockup: the first column plus one tariff fit the screen. */
  .pricing-comparison__table-wrap {
    border-radius: 16px;
  }

  .pricing-comparison__table {
    min-width: 720px;
  }

  .pricing-comparison__table th,
  .pricing-comparison__table td {
    padding: 16px 10px;
    font-weight: 400;
    letter-spacing: 0.25px;
  }

  .pricing-comparison__table thead th {
    font-weight: 500;
  }

  .pricing-comparison__table th:first-child,
  .pricing-comparison__table td:first-child {
    width: 220px;
    padding: 16px 28px;
    font-weight: 500;
    letter-spacing: 0.1px;
  }

  /* Auth: /auth, /auth/register, /auth/forgot-password, /auth/reset-password */
  .auth-page__title {
    color: var(--lp-on-surface);
  }

  /* Login and register titles are 32/40; the forgot/reset ones (no social buttons) stay 28/36. */
  .auth-page:has(.auth-page__actions) .auth-page__title {
    font-size: 32px;
    line-height: 40px;
  }

  .auth-page__lead {
    max-width: 260px;
    margin-bottom: 32px;
  }

  .auth-page__register {
    margin-top: 32px;
  }

  .auth-page__button {
    min-height: 44px;
  }

  .auth-page__button img {
    width: 30px;
    height: 30px;
  }

  .auth-page__input {
    padding-top: 13px;
    padding-bottom: 13px;
  }

  /* /faq: search row and category cards */
  .faq-page-search {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 56px;
  }

  .faq-page-search__field {
    flex: 1 1 auto;
  }

  .faq-page-search__input {
    padding: 16px 44px 16px 28px;
    border-color: var(--lp-on-surface-variant);
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.4px;
  }

  .faq-page-search__input::placeholder {
    color: #6b7a8f;
  }

  .faq-page-search__icon {
    width: 18px;
    height: 18px;
  }

  .faq-page-search__button {
    width: auto;
    min-width: 108px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .faq-solutions-section__title {
    margin-bottom: 16px;
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
  }

  .faq-solutions-grid {
    gap: 8px;
  }

  .faq-solutions-card {
    width: 100%;
    height: 136px;
    padding: 20px;
    border-radius: 8px;
  }

  .faq-solutions-card__icon {
    top: 20px;
    right: 20px;
    height: 90px;
  }

  .faq-solutions-card__icon img {
    height: 90px;
  }

  /* style.css sets 48px up to 768 and 28px only up to 375; at 48 the titles overflow the 136px cards. */
  .faq-solutions-card__title {
    font-size: 28px;
    line-height: 36px;
  }

  .faq-solutions-card.is-active .faq-solutions-card__title {
    color: var(--lp-on-surface);
  }

  /* /top-creators: hero card with the creators grid */
  .solutions-section__inner:has(.top-creators-grid) {
    padding: 32px 26px;
  }

  .solutions-section__inner:has(.top-creators-grid) .solutions-section__title {
    font-size: 36px;
    font-weight: 600;
    line-height: 44px;
  }

  .solutions-section__inner:has(.top-creators-grid) .solutions-section__description {
    margin-bottom: 32px;
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.5px;
  }

  /* Two columns that wrap, as in the mockup, instead of one row scrolled sideways. */
  .top-creators-grid {
    flex-wrap: wrap;
    justify-content: center;
    gap: 23px 20px;
    overflow: visible;
    padding-bottom: 0;
  }

  /* Two per row at any phone width: the mockup has 136px circles, narrower screens scale them down. */
  .top-creators-card {
    flex: 0 0 calc((100% - 20px) / 2);
    max-width: 136px;
  }

  .top-creators-card__avatar {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  /* Account pages: the section menu becomes wrapped chips instead of a 250px block on top of every page
     (the mockup has no menu on the page itself). Wrapped, not scrolled: the active section stays in view
     without any JS. Titles 28/36 as in «ЛК (баланс и тариф)». */
  .account-page__sidebar {
    padding: 0;
    background: none;
  }

  /* Grid children default to min-width: auto; without this wide content (tables) can widen the whole page. */
  .account-page__content,
  .account-page__sidebar,
  .account-page__main {
    min-width: 0;
  }

  .account-page__nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .account-page__nav-spacer {
    display: none;
  }

  .account-page__nav-link {
    flex: 0 0 auto;
    padding: 8px 16px;
    border: 1px solid transparent;
    background: var(--lp-surface-bright);
    white-space: nowrap;
  }

  .account-page__nav-link--active {
    border-color: #48deaa;
    background: rgba(72, 222, 170, 0.2);
  }

  .account-page__title {
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
  }

  /* /account dashboard («ЛК (осн)_375» 2423-50102): centred 32/40 title, cards padded 8 and 8 apart,
     balance as two «label — value» rows, token spend and portfolio as 2-column tiles. */
  .account-page__panel:has(.account-page__profile-card) .account-page__title {
    font-size: 32px;
    line-height: 40px;
    text-align: center;
  }

  .account-page__profile-card {
    position: relative;
    min-height: 228px;
    padding: 16px;
  }

  /* No «Профиль» caption in the mockup: only the edit button, pinned to the corner. */
  .account-page__profile-label {
    display: none;
  }

  .account-page__profile-head {
    position: absolute;
    top: 16px;
    right: 16px;
    margin: 0;
  }

  .account-page__profile-avatar {
    width: 100px;
    height: 100px;
  }

  .account-page__profile-name {
    font-size: 24px;
    font-weight: 400;
    line-height: 32px;
  }

  .account-page__profile-alias {
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.5px;
  }

  .account-page__overview-card {
    padding: 8px;
  }

  .account-page__overview-head {
    min-height: 40px;
    margin-bottom: 8px;
  }

  .account-page__overview-card--balance {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .account-page__overview-plan {
    order: 1;
  }

  .account-page__overview-balance {
    order: 2;
  }

  .account-page__overview-plan,
  .account-page__overview-balance-meta {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 0 8px;
  }

  .account-page__overview-plan-label,
  .account-page__overview-balance-label {
    margin: 0;
    color: var(--lp-on-surface-variant);
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.25px;
  }

  .account-page__overview-plan-value,
  .account-page__overview-balance-value {
    margin: 0;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.5px;
  }

  .account-page__overview-balance-icon {
    width: 16px;
    height: 16px;
  }

  .account-page__overview-stats,
  .account-page__portfolio-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .account-page__overview-stat,
  .account-page__portfolio-stat {
    min-height: 68px;
    padding: 12px 8px;
    border-radius: 4px;
    background: #1a3045;
    text-align: center;
  }

  .account-page__portfolio-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .account-page__portfolio-stat > :last-child {
    color: var(--lp-on-surface);
    font-size: 16px;
    line-height: 24px;
  }

  .account-page__overview-stat-label {
    justify-content: center;
    color: var(--lp-on-surface-variant);
    font-size: 14px;
    line-height: 20px;
  }

  .account-page__overview-stat-value {
    justify-content: center;
    margin-top: 4px;
    font-size: 16px;
    line-height: 24px;
  }

  /* /account/operations («ЛК (история операций)_3758» 2167-21707): each row becomes a card —
     date and type on top, description as a «label — text» row, amount and balance in two framed boxes.
     The cells already carry data-label, so no template change. */
  .account-operations__table-wrap {
    overflow: visible;
  }

  .account-operations__table,
  .account-operations__table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .account-operations__table thead {
    display: none;
  }

  .account-operations__table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid #3c4a5e;
    border-radius: 4px;
  }

  .account-operations__table td,
  .account-operations__table td:first-child,
  .account-operations__table td:nth-child(3),
  .account-operations__table td:nth-child(4),
  .account-operations__table td:last-child {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    color: var(--lp-on-surface);
    font-size: 14px;
    line-height: 20px;
    text-align: left;
  }

  .account-operations__table td:nth-child(4) {
    order: 1;
    color: var(--lp-on-surface-variant);
    text-align: right;
  }

  .account-operations__table td:first-child {
    order: 0;
  }

  .account-operations__table .account-operations__description {
    display: flex;
    order: 2;
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 8px;
    text-align: right;
  }

  .account-operations__table .account-operations__description::before {
    content: "Описание:";
    flex: none;
    color: var(--lp-on-surface-variant);
  }

  .account-operations__table td.account-operations__amount,
  .account-operations__table td.account-operations__balance {
    order: 3;
    padding: 8px;
    border: 1px solid var(--lp-on-surface-variant);
    border-radius: 4px;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
  }

  .account-operations__table td.account-operations__amount::before,
  .account-operations__table td.account-operations__balance::before {
    content: attr(data-label) ":";
    display: block;
    color: var(--lp-on-surface-variant);
    font-size: 14px;
    line-height: 20px;
  }

  .account-operations__table .account-operations__empty {
    grid-column: 1 / -1;
    text-align: center;
  }

  /* /account/balance */
  .account-balance-card {
    padding: 32px;
  }

  .account-balance-card__label,
  .account-balance-card__buy-label {
    font-size: 24px;
    line-height: 32px;
  }

  .account-balance-card__plan-name,
  .account-balance-card__metric-value,
  .account-balance-card__balance {
    font-size: 36px;
    font-weight: 600;
    line-height: 44px;
  }

  .account-balance-card__metric-label {
    font-size: 16px;
    line-height: 24px;
    letter-spacing: 0.5px;
  }

  .account-balance-card__button {
    min-height: 50px;
    font-weight: 600;
    letter-spacing: 0.1px;
  }

  /* Profile edit: first and last name side by side, as in «ЛК (редактирование)»; fields 44 tall. */
  .account-profile-edit__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-profile-edit__field--full,
  .account-profile-edit__password-section,
  .account-profile-edit__password-hint {
    grid-column: 1 / -1;
  }

  .account-profile-edit__fields input {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  /* Checkout (/payment?plan=…): the mockup draws a card form, but cards are entered on the bePaid page,
     so only the visual language is taken: card, 28/36 title, selectable periods, full-width button. */
  .checkout-card {
    padding: 24px 16px;
    border-radius: 8px;
    background: #0d2438;
  }

  .checkout-card h1 {
    color: var(--lp-on-surface);
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
  }

  .checkout-card h2 {
    font-size: 22px;
    font-weight: 400;
    line-height: 28px;
  }

  .checkout-period {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
  }

  .checkout-period--active {
    border-color: #48deaa;
    background: rgba(72, 222, 170, 0.2);
  }

  .checkout-agreements label {
    color: var(--lp-on-surface);
    font-size: 14px;
    line-height: 20px;
  }

  .checkout-submit {
    width: 100%;
  }

  /* Portfolio stats: a plain list, label left and number right, rows 32 apart (mockup profile frame). */
  .account-portfolio-stats {
    padding: 0 16px;
  }

  .account-portfolio-stats__inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
  }

  .account-portfolio-stat {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: none;
  }

  .account-portfolio-stat__label {
    color: var(--lp-on-surface-variant);
    font-size: 14px;
    line-height: 20px;
    letter-spacing: 0.25px;
    text-align: left;
  }

  .account-portfolio-stat__value {
    margin: 0;
    color: var(--lp-on-surface);
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: 0.5px;
  }

  /* FAQ rows */
  .faq-item__trigger {
    gap: 0;
    padding: 16px 28px;
  }

  .faq-item__question {
    font-size: 16px;
    line-height: 24px;
  }
}

/* Hero title: the mockup breaks after «AI-студия». Only from 390px, where that still gives three lines;
   narrower phones would get four, so they keep the natural wrap. The <br> is hidden in the markup. */
@media (min-width: 390px) and (max-width: 767px) {
  .hero-section__title-break[hidden] {
    display: inline;
  }
}

/* Keep the selected token count inside its button on very narrow phones. */
@media (width < 350px) {
  .pricing-token-option--active .pricing-token-option__value {
    font-size: clamp(16px, 5.3vw, 18px);
    line-height: 24px;
  }
}
