/* STYDI-O V15 — вход и регистрация (ТЗ 12 §8.6). Подключается на всех страницах (partials/head.html):
   1 кнопка «Войти / Кабинет» в шапке, меню и подвале · 2 сплит-экран /vhod/ · 3 форма · 4 код · 5 состояния · 6 адаптив.
   Токены — site.css §1: винный — единственный акцент, Montserrat, спокойно, много воздуха. */

/* 1. Шапка: «Войти» / «Кабинет» ------------------------------------------------ */
.hdr-auth{flex:none;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 4px;color:var(--ink);text-decoration:none;font-size:12px;font-weight:500;letter-spacing:.14em;text-transform:uppercase;white-space:nowrap;border-bottom:2px solid transparent}
.hdr-auth:hover{color:var(--wine)}
.hdr-auth svg{flex:none}
.hdr-auth .dot{display:none;width:6px;height:6px;border-radius:50%;background:var(--wine);margin-left:-4px;align-self:flex-start;margin-top:12px}
.hdr-auth[data-state="in"] .dot{display:inline-block}
.mmenu a.item.item--auth{display:flex;align-items:center;gap:10px}
.ftr .ftr-auth{display:inline-flex;align-items:center;gap:8px}

/* 2. Сплит-экран: слева форма, справа рендер портфолио ---------------------------- */
.auth-body{background:var(--white)}
.auth-body .ftr{border-top:1px solid var(--line)}
.auth{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);min-height:calc(100dvh - var(--hdr-h));background:var(--white)}
.auth__form{display:flex;justify-content:center;align-items:flex-start;padding:clamp(48px,8vh,96px) var(--pad) 72px}
.auth__inner{width:100%;max-width:440px;display:flex;flex-direction:column;gap:28px}
.auth__head{display:flex;flex-direction:column;gap:16px}
.auth__title{font-weight:300;font-size:clamp(32px,3.2vw,44px);line-height:1.1;letter-spacing:-.01em;color:var(--ink);margin:0;text-wrap:balance}
.auth__title--sm{font-size:clamp(26px,2.4vw,32px)}
.auth__lead{font-size:16px;color:var(--ink-2);max-width:40ch}
.auth-email{font-weight:500;color:var(--ink);overflow-wrap:anywhere}
.auth__value{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.auth__value li{position:relative;padding-left:22px;font-size:14px;color:var(--ink-2);line-height:1.5}
.auth__value li::before{content:"";position:absolute;left:0;top:.62em;width:6px;height:6px;background:var(--wine)}
.auth__value-m{display:none;font-size:14px;color:var(--ink-3)}
.auth__foot a,.auth__lead a{color:var(--ink);text-underline-offset:3px}
.auth__foot a:hover{color:var(--wine)}

.auth__figure{position:sticky;top:var(--hdr-h);height:calc(100dvh - var(--hdr-h));margin:0;overflow:hidden;background:var(--paper-warm)}
.auth__figure img{width:100%;height:100%;object-fit:cover;object-position:center 40%}
.auth__cap{position:absolute;left:24px;bottom:24px;display:flex;flex-direction:column;gap:2px;padding:14px 18px;background:var(--white);border-radius:var(--r-xs);box-shadow:0 2px 6px rgba(17,17,17,.06),0 12px 32px rgba(17,17,17,.12)}
.auth__cap b{font-size:12px;font-weight:500;letter-spacing:.16em;text-transform:uppercase;color:var(--ink)}
.auth__cap span{font-size:13px;color:var(--ink-3)}

/* вкладки «Вход / Регистрация» — сегмент на всю ширину колонки */
.auth__tabs{display:grid;grid-template-columns:1fr 1fr;gap:0;overflow:visible}
.auth__tabs [role="tab"]{min-height:48px;text-align:center}
[role="tabpanel"]:focus{outline:none}

/* демо-плашки (видны только при html.is-draft — localhost) */
.auth-demo-note{font-size:12px;line-height:1.5;color:var(--warn);background:var(--warn-tint);padding:10px 14px;border-radius:var(--r-sm)}
.auth-demo-note code{font-size:11px;overflow-wrap:anywhere}
html:not(.is-draft) .draft-only{display:none !important}

/* 3. Форма ------------------------------------------------------------------- */
.auth-form{display:grid;grid-template-columns:minmax(0,1fr);gap:22px}
.auth-form .btn--full{margin-top:4px}
.auth-row{display:flex;justify-content:space-between;align-items:baseline;gap:16px}
.auth-row label{font-size:11px;font-weight:500;letter-spacing:.16em;text-transform:uppercase;color:var(--ink-3)}
.auth-link{position:relative;font-size:13px;color:var(--ink-2);text-decoration:underline;text-underline-offset:3px;text-decoration-color:var(--ink-4)}
.auth-link::after{content:"";position:absolute;inset:-12px -6px}
.auth-link:hover{color:var(--wine);text-decoration-color:var(--wine)}
.auth-form .in{height:52px;font-size:16px}
.auth-form .in[aria-invalid="true"]{border-color:var(--wine)}
.auth-form .field .error{display:block}

/* способ входа: два варианта, сегмент */
.auth-seg{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;margin:0;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--paper)}
.auth-seg__opt{position:relative;display:flex;cursor:pointer}
.auth-seg__opt input{position:absolute;opacity:0;inset:0;margin:0;cursor:pointer}
.auth-seg__opt span{flex:1;display:flex;align-items:center;justify-content:center;min-height:44px;padding:6px 10px;border-radius:6px;font-size:13px;color:var(--ink-3);text-align:center;line-height:1.3;transition:background var(--dur-fast),color var(--dur-fast),box-shadow var(--dur-fast)}
.auth-seg__opt:hover span{color:var(--ink)}
.auth-seg__opt input:checked+span{background:var(--white);color:var(--ink);font-weight:500;box-shadow:0 1px 2px rgba(17,17,17,.08),0 2px 8px rgba(17,17,17,.06)}
.auth-seg__opt input:focus-visible+span{outline:var(--focus);outline-offset:1px}

/* пароль: показать / скрыть */
.auth-pw{position:relative}
.auth-pw .in{padding-right:56px}
.auth-pw__eye{position:absolute;right:2px;top:50%;transform:translateY(-50%);width:48px;height:48px;display:inline-flex;align-items:center;justify-content:center;border:0;background:transparent;color:var(--ink-3);cursor:pointer;border-radius:var(--r-xs)}
.auth-pw__eye:hover,.auth-pw__eye.is-on{color:var(--ink)}
.auth-pw__eye .eye-shut,.auth-pw__eye.is-on .eye-open{display:none}
.auth-pw__eye.is-on .eye-shut{display:block}

/* требования к паролю — живые, без красного до отправки */
.auth-rules{list-style:none;margin:2px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:6px 16px}
.auth-rules li{position:relative;padding-left:18px;font-size:12px;color:var(--ink-3);line-height:1.5}
.auth-rules li::before{content:"";position:absolute;left:2px;top:.5em;width:8px;height:8px;border:1px solid var(--line-field);border-radius:50%;transition:background var(--dur-fast),border-color var(--dur-fast)}
.auth-rules li.is-ok{color:var(--ink-2)}
.auth-rules li.is-ok::before{background:var(--ok);border-color:var(--ok)}

.auth-consents{display:flex;flex-direction:column;gap:14px;padding-top:2px}
.auth-consents .ch{line-height:1.5;min-height:24px}
.auth-consents .ch a{text-underline-offset:3px}
.auth-consents .error{margin:-6px 0 0 30px;font-size:12px;color:var(--wine)}

.auth-alert{margin:0;align-items:flex-start;flex-wrap:wrap;border-left:0}
.auth-alert:focus{outline:none}
.auth-inline-btn{min-height:32px;padding:0;border:0;background:none;font:inherit;font-weight:500;color:inherit;text-decoration:underline;text-underline-offset:3px;cursor:pointer}

/* 4. Код --------------------------------------------------------------------- */
.auth-code.in{height:64px;font-size:28px;font-weight:400;letter-spacing:.42em;font-variant-numeric:tabular-nums;padding:0 18px;text-indent:.1em}
.auth-code.in::placeholder{letter-spacing:.42em;color:var(--line-field)}
.auth-code.in:disabled{background:var(--paper);color:var(--ink-4);cursor:not-allowed}
.auth-democode{font-size:13px;line-height:1.5;color:var(--warn);background:var(--warn-tint);padding:10px 14px;border-radius:var(--r-sm);font-variant-numeric:tabular-nums}
.auth-resend{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:-6px -12px 0}
.auth-resend .btn{letter-spacing:.1em;font-variant-numeric:tabular-nums}
.auth-resend .btn:disabled{opacity:1;color:var(--ink-4)}
.auth-help{border-top:1px solid var(--line);padding-top:16px}
.auth-help summary{cursor:pointer;font-size:14px;color:var(--ink);min-height:44px;display:flex;align-items:center;list-style:none}
.auth-help summary::-webkit-details-marker{display:none}
.auth-help summary::after{content:"";width:8px;height:8px;border-right:1.5px solid var(--ink-3);border-bottom:1.5px solid var(--ink-3);transform:rotate(45deg);margin:-4px 0 0 12px;transition:transform var(--dur-base) var(--ease)}
.auth-help[open] summary::after{transform:rotate(225deg);margin-top:4px}
.auth-help ul{margin:8px 0 0;padding-left:18px;display:flex;flex-direction:column;gap:8px;font-size:14px;color:var(--ink-2)}
.auth-help a{color:var(--ink);text-underline-offset:3px}

/* 5. Состояния: успех, недоступно -------------------------------------------- */
.auth-ok{display:flex;flex-direction:column;gap:14px;align-items:flex-start}
.auth-ok:not([hidden]){animation:auth-in .5s cubic-bezier(.16,1,.3,1) both}
.auth-ok__mk{width:48px;height:48px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;background:var(--wine-tint);color:var(--wine)}
.auth-ok .auth__title:focus{outline:none}
.auth-unavail{display:flex;flex-direction:column;gap:18px}
.auth-unavail__acts{display:flex;flex-direction:column;gap:12px}
.auth-unavail a:not(.btn){color:var(--ink);text-underline-offset:3px}
@keyframes auth-in{from{opacity:.001;transform:translateY(8px)}to{opacity:1;transform:none}}
.auth-form[data-busy="1"] .field{opacity:.6;transition:opacity var(--dur-base)}

/* выделение и каретка в фирменном цвете */
.auth ::selection{background:var(--wine-tint);color:var(--ink)}
.auth .in{caret-color:var(--wine)}

/* 6. Адаптив ----------------------------------------------------------------- */
@media (max-width:1000px){
  .hdr .hdr-auth{display:none}
  .auth{grid-template-columns:minmax(0,1fr);min-height:0}
  .auth__figure{display:none}
  .auth__form{padding:40px var(--pad) 56px}
}
@media (max-width:640px){
  .auth__inner{gap:24px}
  .auth__value{display:none}
  .auth__value-m{display:block}
  .auth__title{font-size:32px}
  .auth__title--sm{font-size:26px}
  .auth-resend{flex-direction:column;align-items:flex-start;margin:-6px 0 0}
  .auth-resend .btn{width:auto;padding:0;min-height:44px}
  .auth-consents .ch{min-height:44px;align-items:flex-start;padding-top:2px}
}


/* PCE2-01. Формы входа видимы только при html.auth-ready — класс ставит auth.js после инициализации экрана.
   Не загрузился auth.js (404, CSP, обрыв) или выключен JS — форм нет, номер и код не уйдут GET-запросом в адрес.
   Запасной путь: без JS — <noscript> страницы; JS есть, auth.js нет — .auth-nojs (виден через 2,5 с, чтобы не мигать). */
html:not(.auth-ready) .auth__tabs,html:not(.auth-ready) .auth [role="tabpanel"],html:not(.auth-ready) .auth-form,
html:not(.auth-ready) .auth-help,html:not(.auth-ready) .auth [data-auth-step]{display:none !important}
.auth-nojs{visibility:hidden;animation:auth-nojs-show 0s 2.5s forwards}
html.auth-ready .auth-nojs,html.no-js .auth-nojs{display:none !important}
@keyframes auth-nojs-show{to{visibility:visible}}

/* DA-01 (12.10). Шапка 1001–1600 px без горизонтального скролла ни гостю, ни вошедшему (прогон шагом 2 px — README).
   Телефон в шапке — с 1701 px; мессенджеры — с 1367 px (до этого они в меню, подвале и нижней полосе);
   подпись «Войти / Кабинет» — с 1441 px, уже — значок человека с aria-label (его ставит auth.js) и точкой «вошли». */
@media (max-width:1700px){.hdr .contacts .tel{display:none}}
@media (min-width:1001px) and (max-width:1366px){.hdr .contacts{display:none}}
@media (min-width:1001px) and (max-width:1440px){.hdr-auth [data-auth-label]{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}}
@media (min-width:1001px){
  .hdr .wrap{gap:clamp(14px,1.6vw,28px)}
  .hdr nav{flex:none;gap:clamp(12px,1.25vw,22px);margin-right:auto}
}
/* шаги экранов (код, восстановление): тот же ритм, что у колонки */
section[data-auth-step]:not([hidden]){display:flex;flex-direction:column;gap:28px}
/* 1001–1240 px: самая узкая шапка — компактная CTA и навигация */
@media (min-width:1001px) and (max-width:1240px){.hdr nav{gap:12px;margin-left:0}.hdr nav a{letter-spacing:.08em}.hdr .cta .btn{padding:0 14px;letter-spacing:.08em}}
@media (min-width:1001px) and (max-width:1080px){.hdr .wrap{gap:12px}.hdr nav{gap:10px}.hdr nav a{letter-spacing:.05em}.hdr .logo img{height:34px}}
/* .draft-only в site.css включается !important и перебивает [hidden]: демо-плашки входа прячем явно */
html.is-draft .auth .draft-only[hidden]{display:none !important}

/* Другие способы входа (12.10, Д-06): Яндекс ID и VK ID — российские системы идентификации, ч. 10 ст. 8 149-ФЗ.
   Демо-кнопки; в бою — официальные SDK-кнопки Яндекса и VK (их правила оформления важнее этих стилей). */
.auth-alt{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.auth-alt__or{display:flex;align-items:center;gap:12px;font-size:12px;color:var(--ink-4);text-transform:uppercase;letter-spacing:.16em}
.auth-alt__or::before,.auth-alt__or::after{content:"";flex:1;height:1px;background:var(--line)}
.auth-idp{gap:10px;text-transform:none;letter-spacing:0;font-size:15px}   /* текст кнопок провайдеров не меняем — правила Яндекса и VK */
.auth-idp__ico{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;font-size:12px;font-weight:600;line-height:1;color:#fff;flex:none;letter-spacing:0}
.auth-idp__ico--ya{background:#fc3f1d}
.auth-idp__ico--vk{background:#0077ff;border-radius:6px;font-size:9px}


/* 7. Доработки 12.10 по аудитам 05–07 ------------------------------------------- */
/* рендер в <picture> (DA-13: eager + fetchpriority, на телефоне — прозрачная заглушка) */
.auth__figure picture{display:block;width:100%;height:100%}

/* DA-03: области ошибок постоянно в DOM и в дереве доступности (не display:none), пустые — визуально скрыты.
   auth.js меняет только textContent, экранный диктор объявляет текст. */
.auth .error:empty,.auth [data-form-alert].is-empty{position:absolute !important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.auth .field{position:relative}
/* значок ошибки — error из набора иконок (12.10): маска вместо знака «!» шрифта, диктор его не читает */
.auth .error:not(:empty)::before{content:"";display:inline-block;width:16px;height:16px;margin-right:6px;vertical-align:-3px;background:var(--wine);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.875' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6'/%3E%3Ccircle cx='12' cy='16.5' r='.5' fill='%23000'/%3E%3C/svg%3E") center/16px no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.875' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6'/%3E%3Ccircle cx='12' cy='16.5' r='.5' fill='%23000'/%3E%3C/svg%3E") center/16px no-repeat}

/* DA-08: фокус отличим от ошибки — двойное кольцо с зазором; ошибка — рамка + значок «!» у текста */
.auth .in:focus,.auth .in:focus-visible{outline:none;border-color:var(--ink);box-shadow:0 0 0 2px var(--white),0 0 0 4px var(--ink)}
.auth .in[aria-invalid="true"]{border-color:var(--wine);border-width:1.5px}
.auth .in[aria-invalid="true"]:focus{box-shadow:0 0 0 2px var(--white),0 0 0 4px var(--ink)}

/* PCE2-05: «Повторить» в сообщении о сбое связи */
.auth-retry{margin-left:auto}

/* UXES2-04/05: кнопка основного действия в первом экране 1440×900 и 390×844 */
.auth__form{padding-top:clamp(28px,5vh,56px)}
.auth__inner{gap:22px}
.auth__head{gap:12px}
.auth__value{gap:6px}
.auth__value li{font-size:13px;line-height:1.45}
.auth__tabs [role="tab"]{min-height:44px}
.auth-form{gap:18px}
/* при next=planner (класс ставит auth.js): ценность кабинета свёрнута, заголовок про планировщик */
.auth--planner .auth__value{display:none}
.auth--planner .auth__value-m{display:none}
.auth-example{display:inline-flex;align-items:center;gap:8px;min-height:44px;font-size:14px;color:var(--ink);text-decoration:underline;text-underline-offset:3px;text-decoration-color:var(--ink-4)}
.auth-example:hover{color:var(--wine);text-decoration-color:var(--wine)}
@media (max-width:640px){
  .auth__form{padding:20px var(--pad) 40px}
  .auth__inner{gap:18px}
  .auth__title{font-size:28px}
  .auth-form{gap:16px}
}

/* DA-14: cookie-баннер на /vhod/ — компактная полоса снизу, форма получает отступ на его высоту (--ck-h ставит auth.js) */
.auth-body .ck-wrap{padding:0 16px 12px}
.auth-body .ck{padding:12px 16px;gap:10px 16px;max-width:880px}
.auth-body .ck .txt{flex:1 1 300px;font-size:12px;line-height:1.45;gap:2px}
.auth-body .ck .acts .btn{min-height:40px}
.auth-body .auth__form{padding-bottom:calc(56px + var(--ck-h,0px))}
.auth-body .auth .in,.auth-body .auth .btn{scroll-margin-bottom:calc(24px + var(--ck-h,0px))}
@media (max-width:640px){
  .auth-body .ck-wrap{padding:0;bottom:0}
  .auth-body .ck{border-radius:12px 12px 0 0;max-height:40dvh;padding:10px 14px;flex-direction:row;flex-wrap:wrap;align-items:center}
  .auth-body .ck .txt b{display:none}
  .auth-body .ck .acts{width:100%;display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px}
  .auth-body .ck .acts .btn{padding:0 6px;font-size:10px;letter-spacing:.06em;min-height:44px}
}
/* UXES2-04: из планировщика — заголовок короче по кеглю, плашка причины становится подзаголовком (без рамки и фона) */
.auth--planner .auth__title{font-size:clamp(26px,2.3vw,34px)}
.auth--planner [data-auth-reason]{background:none;border:0;padding:0;margin-top:-10px;font-size:14px;line-height:1.5;color:var(--ink-2)}
.auth--planner .auth-example{min-height:32px;margin:-8px 0 -6px}
.auth--planner .auth-consents{gap:10px}
.auth--planner .auth-form .hint{font-size:12px}
@media (max-width:640px){
  .auth--planner .auth__title{font-size:26px}
  .auth--planner .auth-consents .ch{min-height:0}
}

/* Delivery actions share one column so labels and timers cannot wrap into neighbours. */
.auth-resend{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin:0}
.auth-resend .btn{width:100%;min-width:0;letter-spacing:0;text-align:center}
