/* ============ ШРИФТ ============ */
@font-face { font-family:"PixeloidSans"; src:url("assets/fonts/PixeloidSans-Bold.woff2") format("woff2"); font-display:swap; }

/* ============ ШРИФТЫ ============
   У каждого места свои переменные: --ff-* (шрифт) и --fs-* (размер).
   Pixeloid Sans нарисован на сетке 9 px, поэтому ВСЕ размеры кратны 9 (9, 18, 27, 36...).
   --lh-* - высота строки, тоже целое число пикселей: так текст не попадает на полпикселя. */
:root {
  --ff-title:   "PixeloidSans", monospace;  --fs-title:   36px;  --lh-title:   45px;  /* заголовок */
  --ff-welcome: "PixeloidSans", monospace;  --fs-welcome: 18px;  --lh-welcome: 27px;  /* текст приветствия */
  --ff-contact: "PixeloidSans", monospace;  --fs-contact: 18px;  --lh-contact: 28px;  /* адреса и ники */
  --ff-hint:    "PixeloidSans", monospace;  --fs-hint:    9px;                         /* (click to copy) */
  --ff-toast:   "PixeloidSans", monospace;  --fs-toast:   18px;  --lh-toast:   28px;  /* Copied! */
  --ff-desc:    "PixeloidSans", monospace;  --fs-desc:    18px;  --lh-desc:    27px;  /* описания в галерее */
  --ff-caption: "PixeloidSans", monospace;  --fs-caption: 18px;  --lh-caption: 27px;  /* описание в просмотре */
  --ff-zoom:    "PixeloidSans", monospace;  --fs-zoom:    18px;  --lh-zoom:    27px;  /* подпись 3x у ползунка */
}
@media (max-width:480px) { :root { --fs-title:27px; --lh-title:36px; } }  /* размеры для телефонов */

:root { --bg:#181519; --panel:#1d2029; --line:#3a3f4d; --text:#e6e8ee; --dim:rgba(230,232,238,.5); --accent:#7fd18b; }
* { box-sizing:border-box; border-radius:0; }
html, body { margin:0; background:var(--bg); color:var(--text); overflow-x:hidden; }
body { font-family:"PixeloidSans", monospace; line-height:27px; -webkit-font-smoothing:none; font-smooth:never; text-rendering:optimizeSpeed; font-kerning:none; font-variant-ligatures:none; font-synthesis:none; }
.px { image-rendering:pixelated; image-rendering:crisp-edges; image-rendering:pixelated; display:block; max-width:none; }
.page { max-width:960px; margin:0 auto; padding:16px; }

.top-row { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; max-width:100%; margin:0 0 8px var(--welcome-ml, 0px); width:var(--welcome-w, auto); }  /* строка над приветствием: язык слева, звук справа, по ширине рамки */
.lang { display:flex; gap:0; }   /* кнопки языка вплотную друг к другу */
.btn { background:var(--panel); color:var(--text); border:1px solid var(--line); padding:4px 10px; font:inherit; font-size:13px; cursor:pointer; }
.btn:hover { border-color:var(--text); }

.framed { position:relative; isolation:isolate; }
.framed:not(.frame-ready) { background:var(--panel); border:1px solid var(--line); }
.frame-canvas { position:absolute; left:0; top:0; z-index:-1; pointer-events:none; }
.welcome { padding:24px; }
.welcome-title { margin:0 0 12px; font-family:var(--ff-title); font-size:var(--fs-title-px, var(--fs-title)); line-height:var(--lh-title-px, var(--lh-title)); font-weight:normal; overflow-wrap:anywhere; }
.welcome-title:empty { display:none; }
.welcome-body { display:flex; flex-wrap:wrap; justify-content:center; gap:16px; align-items:flex-start; }
.avatar-col { flex:none; display:flex; flex-direction:column; gap:6px; }
.bubble { margin:0; flex:1 1 220px; min-width:0; overflow-wrap:anywhere; font-family:var(--ff-welcome); font-size:var(--fs-welcome-px, var(--fs-welcome)); line-height:var(--lh-welcome-px, var(--lh-welcome)); }

.contacts { --contacts-gap:32px; --contacts-gap-compact:8px; display:flex; justify-content:center; gap:var(--contacts-gap); margin:24px 0 0; }
.contacts.compact { gap:var(--contacts-gap-compact); }
.contact { flex:none; position:relative; display:flex; flex-direction:column; align-items:center; gap:8px; padding:0; max-width:100%; text-align:center; color:var(--text); text-decoration:none; cursor:pointer; min-width:0; }
.contact:hover > .frame-canvas { filter:brightness(1.25); }
.contact:active > .frame-canvas { filter:brightness(.8); }
.contact:focus-visible { outline:1px solid var(--text); outline-offset:2px; }
.contact .label { width:0; display:flex; flex-direction:column; align-items:center; text-align:center; white-space:nowrap; font-family:var(--ff-contact); font-size:var(--fs-contact-px, var(--fs-contact)); line-height:var(--lh-contact-px, var(--lh-contact)); user-select:text; -webkit-user-select:text; }
.contact .hint { color:var(--dim); font-family:var(--ff-hint); font-size:var(--fs-hint-px, var(--fs-hint)); display:block; white-space:nowrap; }
.contact .toast { position:absolute; left:-60px; right:-60px; top:-32px; justify-content:center; white-space:nowrap; color:var(--accent); font-family:var(--ff-toast); font-size:var(--fs-toast-px, var(--fs-toast)); line-height:var(--lh-toast-px, var(--lh-toast)); display:none; pointer-events:none; }
.contact .toast.show { display:flex; }

.gallery-wrap { padding:0 32px 32px; }
.gallery { display:flex; flex-wrap:wrap; justify-content:center; gap:24px; align-items:flex-start; }
.work { background:none; border:1px solid transparent; padding:8px; color:var(--text); font:inherit; text-align:left; cursor:pointer; }
.work.hover, .work:focus-visible { border-color:var(--text); outline:none; }   /* .hover ставит script.js: так обводка следует за курсором и во время прокрутки */
.work .desc { font-family:var(--ff-desc); font-size:var(--fs-desc-px, var(--fs-desc)); line-height:var(--lh-desc-px, var(--lh-desc)); color:var(--dim); margin-top:8px; overflow-wrap:anywhere; }

.footer-art { margin-top:48px; overflow:hidden; line-height:0; }
.footer-art img { position:relative; }

.viewer { position:fixed; inset:0; z-index:10; display:flex; flex-direction:column; background:rgba(10,11,14,.8); }
.viewer[hidden] { display:none; }
.viewer-bar { flex:none; padding:8px 16px; display:flex; justify-content:flex-end; }
.viewer-stage { flex:1; min-height:0; overflow:auto; display:flex; padding:8px; }
.viewer-stage img { margin:auto; flex:none; }
.viewer-caption { flex:none; padding:12px 16px 16px; text-align:center; font-family:var(--ff-caption); font-size:var(--fs-caption-px, var(--fs-caption)); line-height:var(--lh-caption-px, var(--lh-caption)); max-height:30vh; overflow:auto; }

@media (max-width:480px) { .welcome-body { gap:12px; } .page { padding:12px; } .gallery-wrap { padding:0 12px 12px; } .contact { gap:12px; } }

/* --- Этап 2 --- */
.viewer-bar { justify-content:space-between; align-items:center; gap:12px; }
.zoom { display:flex; align-items:center; gap:10px; transition:opacity .4s; }
.zoom span { min-width:3ch; font-family:var(--ff-zoom); font-size:var(--fs-zoom-px, var(--fs-zoom)); line-height:var(--lh-zoom-px, var(--lh-zoom)); }
.viewer-caption { transition:opacity .4s; }
.viewer.idle .zoom, .viewer.idle .viewer-caption, .viewer.idle #viewerClose { opacity:0; pointer-events:none; }
#viewerClose { transition:opacity .4s; }
.viewer.idle { cursor:none; }
.viewer-stage.pannable { cursor:grab; }
.viewer-stage.dragging { cursor:grabbing; }
.contact .toast.show { animation:rise 3s ease-out forwards; }
@keyframes rise { 0% { opacity:0; transform:translateY(8px); } 10% { opacity:1; } 70% { opacity:1; } 100% { opacity:0; transform:translateY(-24px); } }
@media (prefers-reduced-motion:reduce) { .contact .toast.show { animation:none; } }

/* --- Этап 3: PNG-кнопки, ползунок, стрелки --- */
.pbtn { background:none; border:0; padding:0; margin:0; line-height:0; cursor:pointer; flex:none; }
.pbtn:focus-visible, .slider:focus-visible { outline:1px solid var(--text); outline-offset:2px; }
.slider { position:relative; flex:none; touch-action:none; cursor:pointer; user-select:none; -webkit-user-select:none; }
.s-track, .s-fill { position:absolute; left:0; background-repeat:repeat-x; background-position:0 0; image-rendering:pixelated; }
.s-thumb { position:absolute; pointer-events:none; }
.viewer-row { position:relative; flex:1; min-height:0; display:flex; align-items:stretch; }
.viewer-row .viewer-stage { flex:1; min-width:0; }
.nav { position:absolute; top:0; bottom:0; height:fit-content; margin:auto 0; z-index:2; transition:opacity .4s; }
#prevBtn { left:4px; }
#nextBtn { right:4px; }
.viewer.idle .nav { opacity:0; pointer-events:none; }

/* --- Этап 4 --- */
.viewer-stage img { -webkit-user-drag:none; user-select:none; -webkit-user-select:none; }
/* --- Этап 5: панель (ползунок, крестик) и описание лежат ПОВЕРХ арта и не отнимают у него место --- */
.viewer { display:block; }
.viewer[hidden] { display:none; }
.viewer-row { position:absolute; inset:0; }
.viewer-bar { position:absolute; top:0; left:0; right:0; z-index:3; pointer-events:none; }
.viewer-bar > * { pointer-events:auto; }
.zoom { background:rgba(10,11,14,.6); padding:4px 10px; }
.viewer-caption { position:absolute; left:0; right:0; bottom:16px; z-index:3; width:fit-content; max-width:min(92%, 900px); margin:0 auto; padding:8px 16px; background:rgba(10,11,14,.75); max-height:30vh; }
.viewer-caption:empty { display:none; }

/* --- Этап 6: плавное появление страницы. Пока html.loading, виден только фон --- */
.page, .gallery-wrap, .footer-art { transition:opacity .7s ease-out; }
html.loading .page, html.loading .gallery-wrap, html.loading .footer-art { opacity:0; }
@media (prefers-reduced-motion:reduce) { .page, .gallery-wrap, .footer-art { transition:none; } }

/* --- Этап 7 --- */
/* Кнопка звука: в правом верхнем углу приветственного блока, на уровне содержимого (небольшой отступ от края рамки) */
#soundBtn { position:absolute; top:var(--welcome-pad, 56px); right:var(--welcome-pad, 56px); z-index:2; }
.welcome-title { padding-right:44px; }   /* заголовок не заезжает под кнопку звука */

/* Ссылки в описании арта (просмотр) */
.viewer-caption { overflow-wrap:anywhere; }
.viewer-caption a { color:var(--accent); text-decoration:underline; text-underline-offset:4px; cursor:pointer; }
.viewer-caption a:hover, .viewer-caption a:focus-visible { color:var(--text); outline:none; }

/* Большие экраны (FullHD, QHD): заголовок и текст приветствия крупнее на 1-2 шага по 9 px. Телефоны и ноутбуки не затронуты. */
@media (min-width:1600px) {
  :root { --fs-title:45px; --lh-title:54px; --fs-welcome:27px; --lh-welcome:40px; }
}


/* --- Этап 8 --- */
/* Стрелки галереи: область нажатия шире самого спрайта (спрайт не увеличивается) */
.nav::before { content:""; position:absolute; top:-36px; bottom:-36px; left:-24px; right:-24px; }

/* Кнопки соцсетей: наведение и клик - только по кругу размером со спрайт (углы квадрата не считаются).
   Сам .contact события не ловит, их ловят иконка (круг) и подпись. */
.contact { pointer-events:none; }
.contact > img { pointer-events:auto; border-radius:50%; }
.contact > .label { pointer-events:auto; }

/* Спрайты нельзя выделить, перетащить мышью или "сохранить" долгим нажатием на телефоне */
.px, .frame-canvas { -webkit-user-drag:none; user-drag:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.pbtn, .work, .contact > img { -webkit-touch-callout:none; -webkit-tap-highlight-color:transparent; }
