/* MOGENCY portfolio — dark minimalism (по мотивам devlama-редизайна) */
:root {
  --bg-0: #07080a;
  --bg-1: #0b0d11;
  --card: #0d1014;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --line-3: rgba(255, 255, 255, .2);
  --text-hi: #e4e1d3;
  --text-mid: #9aa3b2;
  --text-lo: #626b7a;
  --accent: #8bb8c0;
  --accent-2: #b4d4d9;
  --accent-rgb: 139, 184, 192;
  --accent-ink: #0c1618;
  --glow: rgba(139, 184, 192, .30);
  --accent-2-rgb: 180, 212, 217;
  --ff: 'Onest', system-ui, sans-serif;
  --ff-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: #232c31 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; background: var(--bg-0); }
::-webkit-scrollbar-thumb { border-radius: 100px; background: #232c31; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
::selection { background: rgba(var(--accent-rgb), .25); }

html { scroll-behavior: smooth; }
body {
  font-family: var(--ff);
  background: var(--bg-0);
  color: var(--text-hi);
  line-height: 1.6;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* фон: мягкое свечение сверху + зерно + canvas-фонарик */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#bgCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bg::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% -10%, rgba(var(--accent-rgb), .06), transparent 55%); }
.bg::after {
  content: ''; position: absolute; inset: 0; opacity: .04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.top, main, .foot { position: relative; z-index: 1; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 28px; }

h1 { font-weight: 200; font-size: clamp(44px, 5vw, 72px); letter-spacing: -.035em; line-height: 1.06; }
h1 em { font-style: normal; color: var(--accent); }
h2 { font-weight: 200; font-size: clamp(32px, 3.4vw, 48px); letter-spacing: -.03em; line-height: 1.1; margin-bottom: 16px; }
.lead { color: var(--text-mid); font-size: 19px; line-height: 1.65; }
.section-sub { color: var(--text-mid); margin-bottom: 44px; font-size: 17px; max-width: 640px; }

.mono-tag {
  font-family: var(--ff-mono); font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-lo); margin-bottom: 22px;
}
.mono-tag span { color: var(--accent); }

/* top */
.top { position: sticky; top: 0; z-index: 50; background: rgba(7, 8, 10, .78); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top__in { display: flex; align-items: center; gap: 36px; height: 66px; }
.logo { font-weight: 600; font-size: 17px; letter-spacing: .06em; }
.logo span { color: var(--accent); }
.top__nav { display: flex; gap: 28px; margin-left: auto; }
.top__nav a { color: var(--text-mid); font-size: 14.5px; transition: color .2s; }
.top__nav a:hover { color: var(--text-hi); }

/* buttons */
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink); font-weight: 600;
  padding: 14px 30px; border-radius: 12px; font-size: 15.5px; letter-spacing: .01em;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); background: var(--accent-2); box-shadow: 0 12px 36px rgba(var(--accent-rgb), .25); }
.btn--ghost { background: transparent; border: 1px solid var(--line-2); color: var(--text-hi); }
.btn--ghost:hover { background: rgba(255, 255, 255, .06); border-color: var(--line-3); box-shadow: none; }
.btn--sm { padding: 9px 20px; font-size: 13.5px; border-radius: 10px; }

/* hero */
.hero { padding: 104px 0 96px; }
.hero__in { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.hero__in > * { min-width: 0; }
.hero__copy .lead { max-width: 560px; margin: 26px 0 34px; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero__meta { display: flex; gap: 52px; list-style: none; margin-top: 60px; flex-wrap: wrap; }
.hero__meta b { display: block; font-weight: 200; font-size: 32px; letter-spacing: -.02em; }
.hero__meta span { font-family: var(--ff-mono); font-size: 12px; color: var(--text-lo); }

/* карточка-редактор */
.hero__code { position: relative; }
.code-win {
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5), 0 0 60px rgba(var(--accent-rgb), .05);
}
.code-bar { display: flex; align-items: center; gap: 7px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.code-bar i { width: 10px; height: 10px; border-radius: 50%; background: #232c31; }
.code-bar i:first-child { background: rgba(var(--accent-rgb), .6); }
.code-bar em { font-family: var(--ff-mono); font-style: normal; font-size: 11.5px; color: var(--text-lo); margin-left: 10px; }
.code-win pre { padding: 22px 24px 26px; overflow-x: auto; }
.code-win code { font-family: var(--ff-mono); font-size: 12.8px; line-height: 1.75; color: var(--text-mid); white-space: pre; }
.code-win .c { color: var(--text-lo); }
.code-win .v { color: var(--accent-2); }
.code-win .f { color: var(--accent); }
.code-win .s { color: #d3c39a; }
.code-win .k { color: #a1b8e8; }
.code-badge {
  position: absolute; right: -14px; bottom: -16px;
  font-family: var(--ff-mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  background: var(--bg-0); border: 1px solid var(--line-2); color: var(--text-mid);
  padding: 10px 16px; border-radius: 100px;
}
.code-badge span { color: var(--accent); }

/* works — горизонтальный слайдер */
.works { padding: 88px 0 72px; }
.works__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 8px; }
.works__head .section-sub { margin-bottom: 10px; }
.slider__nav { display: flex; gap: 10px; padding-bottom: 14px; }
.slider__btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2);
  background: transparent; color: var(--text-hi); font-size: 18px; font-family: var(--ff);
  transition: background .2s, border-color .2s, color .2s, opacity .2s;
}
.slider__btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.slider__btn:disabled { opacity: .3; }
.slider__track {
  --bleed: max(28px, calc((100vw - 1200px) / 2 + 28px));
  display: flex; gap: 26px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; padding: 6px var(--bleed) 10px; scroll-padding-left: var(--bleed);
  cursor: grab;
}
.slider__track::-webkit-scrollbar { display: none; }
.slider__track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.card {
  flex: 0 0 clamp(400px, 40vw, 540px); scroll-snap-align: start; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  transition: transform .2s, border-color .2s, box-shadow .25s; display: flex; flex-direction: column;
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card:hover {
  transform: translateY(-4px); border-color: rgba(var(--accent-rgb), .35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5), 0 0 40px rgba(var(--accent-rgb), .08);
}
.card__shot { aspect-ratio: 1440 / 1000; overflow: hidden; background: var(--bg-1); position: relative; }
.card__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .45s ease; user-select: none; -webkit-user-drag: none; }
.slider__track .card { user-select: none; }
.card:hover .card__shot img { transform: scale(1.02); }
.card__go {
  position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 8, 10, .75); border: 1px solid var(--line-2); color: var(--text-hi); font-size: 16px;
  opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s, background .2s, color .2s;
}
.card:hover .card__go { opacity: 1; transform: translateY(0); background: var(--accent); color: var(--accent-ink); }
.card__body { padding: 22px 24px 26px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card__head h3 { font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.card__body p { color: var(--text-mid); font-size: 14.5px; line-height: 1.6; }
.tag {
  flex-shrink: 0; font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 100px; border: 1px solid var(--line-2); color: var(--text-lo);
}
.tag--accent { border-color: rgba(var(--accent-rgb), .4); color: var(--accent); }

/* бегущая строка стека */
.stack { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; position: relative; z-index: 1; }
.stack__line {
  display: inline-flex; align-items: center; gap: 30px; white-space: nowrap; width: max-content;
  padding: 17px 0; font-family: var(--ff-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-lo); animation: marq 46s linear infinite;
}
.stack__line i { font-style: normal; color: rgba(var(--accent-rgb), .55); }
@keyframes marq { to { transform: translateX(-50%); } }

/* services — нумерованные строки */
.services { padding: 88px 0; }
.svc { margin-top: 12px; border-top: 1px solid var(--line); }
.svc__row {
  display: grid; grid-template-columns: 90px 300px 1fr; gap: 28px; align-items: baseline;
  padding: 30px 8px; border-bottom: 1px solid var(--line); transition: background .2s, padding-left .2s;
}
.svc__row:hover { background: rgba(255, 255, 255, .02); padding-left: 18px; }
.svc__num { font-family: var(--ff-mono); font-size: 15px; color: var(--text-lo); transition: color .2s; }
.svc__row:hover .svc__num { color: var(--accent); }
.svc__row h3 { font-weight: 300; font-size: 24px; letter-spacing: -.02em; }
.svc__row p { color: var(--text-mid); font-size: 15px; max-width: 560px; }

/* agency */
.agency { padding: 40px 0 100px; }
.agency__panel {
  position: relative; overflow: hidden;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 20px;
  padding: 56px 60px 60px;
}
.agency__panel::after {
  content: '</>'; position: absolute; right: 30px; bottom: -40px;
  font-family: var(--ff-mono); font-size: 180px; font-weight: 500; letter-spacing: -.04em;
  color: rgba(var(--accent-rgb), .06); pointer-events: none;
}
.agency__list { list-style: none; margin: 30px 0 38px; max-width: 720px; }
.agency__list li { padding: 15px 0 15px 32px; position: relative; color: var(--text-mid); border-bottom: 1px solid var(--line); font-size: 15.5px; }
.agency__list li:last-child { border-bottom: none; }
.agency__list li b { color: var(--text-hi); font-weight: 500; }
.agency__list li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 28px 0; }
.foot__in { display: flex; justify-content: space-between; align-items: center; font-family: var(--ff-mono); font-size: 12.5px; color: var(--text-lo); flex-wrap: wrap; gap: 10px; }
.foot__in i { font-style: normal; color: var(--accent); }
.foot__in a:hover { color: var(--accent); }

/* о себе */
.about { padding: 88px 0; position: relative; z-index: 1; }
.about__in { display: grid; grid-template-columns: 1.25fr 1fr; gap: 70px; align-items: start; }
.about__copy h2 { margin-bottom: 22px; }
.about__copy p { color: var(--text-mid); font-size: 16.5px; line-height: 1.7; margin-bottom: 18px; max-width: 640px; }
.about__copy p:last-child { margin-bottom: 0; color: var(--text-hi); }
.about__timeline { list-style: none; margin-top: 14px; position: relative; padding-left: 4px; }
.about__timeline::before {
  content: ''; position: absolute; left: 12px; top: 14px; bottom: 14px;
  width: 1px; background: linear-gradient(180deg, rgba(var(--accent-rgb), .5), var(--line));
}
.about__timeline li { position: relative; padding: 0 0 26px 36px; }
.about__timeline li:last-child { padding-bottom: 0; }
.about__timeline li::before {
  content: ''; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg-0); border: 1.5px solid rgba(var(--accent-rgb), .7);
}
.about__timeline li:first-child::before,
.about__timeline li:last-child::before { background: var(--accent); box-shadow: 0 0 12px var(--glow); }
.about__timeline b { display: block; font-family: var(--ff-mono); font-weight: 500; font-size: 13px; letter-spacing: .12em; color: var(--accent); margin-bottom: 3px; }
.about__timeline span { color: var(--text-mid); font-size: 14.5px; line-height: 1.5; }

/* модалка проекта */
.modal { position: fixed; inset: 0; z-index: 200; display: none; }
.modal.is-open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4, 5, 7, .72); backdrop-filter: blur(6px); }
.modal__dialog {
  position: relative; margin: 5vh auto 0; width: min(960px, calc(100vw - 40px));
  max-height: min(90vh, 800px); overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .6);
  animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px); } }
.modal__close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2);
  background: rgba(7, 8, 10, .75); color: var(--text-hi); font-size: 15px;
  transition: background .2s, color .2s, border-color .2s;
}
.modal__close:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.modal__shot { background: var(--bg-0); border-bottom: 1px solid var(--line); }
.modal__shot img { width: 100%; display: block; }
.modal__body { padding: 26px 30px 30px; }
.modal__head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.modal__head h3 { font-weight: 300; font-size: 28px; letter-spacing: -.02em; }
.modal__desc { color: var(--text-mid); font-size: 15.5px; max-width: 720px; }
.modal__url { display: inline-block; margin-top: 16px; font-family: var(--ff-mono); font-size: 12.5px; letter-spacing: .08em; color: var(--text-lo); user-select: text; }
.modal__url::before { content: '// '; color: rgba(var(--accent-rgb), .6); }
body.modal-open { overflow: hidden; }

/* карточка «Ещё больше работ» */
.card--more { border-style: dashed; border-color: var(--line-2); background: rgba(255, 255, 255, .015); }
.card--more:hover { border-color: rgba(var(--accent-rgb), .55); }
.card__more {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 34px 38px 40px;
}
.card__more-plus {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(var(--accent-rgb), .45);
  display: flex; align-items: center; justify-content: center; margin-bottom: 26px;
  font-weight: 200; font-size: 36px; line-height: 1; color: var(--accent);
  transition: background .25s, color .25s, transform .3s;
}
.card--more:hover .card__more-plus { background: var(--accent); color: var(--accent-ink); transform: rotate(90deg); }
.card__more h3 { font-weight: 300; font-size: 30px; letter-spacing: -.02em; margin-bottom: 12px; }
.card__more p { color: var(--text-mid); font-size: 15.5px; max-width: 360px; }
.card__more-cta {
  margin-top: 26px; font-family: var(--ff-mono); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.card__more-cta i { font-style: normal; display: inline-block; transition: transform .25s; }
.card--more:hover .card__more-cta i { transform: translateX(5px); }

/* модалка-обращение */
.modal--note .modal__dialog { width: min(620px, calc(100vw - 40px)); margin-top: 14vh; }
.modal--note .modal__body { padding: 40px 42px 42px; }
.modal--note h3 { font-weight: 300; font-size: 30px; letter-spacing: -.02em; line-height: 1.2; margin: 6px 0 18px; padding-right: 30px; }
.modal--note p:not(.mono-tag) { color: var(--text-mid); font-size: 16px; line-height: 1.7; margin-bottom: 14px; }
.note__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.note__list { list-style: none; margin: 4px 0 16px; }
.note__list li { position: relative; padding: 7px 0 7px 26px; color: var(--text-hi); font-size: 15.5px; line-height: 1.55; }
.note__list li::before { content: '→'; position: absolute; left: 0; top: 7px; color: var(--accent); font-weight: 700; }
.modal--note p.note__hint { font-family: var(--ff-mono); font-size: 12.5px; letter-spacing: .04em; color: var(--text-lo); margin-bottom: 0; }
button.btn { font-family: inherit; cursor: pointer; border: 0; }
button.btn--ghost { border: 1px solid var(--line-2); }

/* кастомный курсор */
body.has-cursor, body.has-cursor * { cursor: none !important; }
.m-cursor-dot, .m-cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 100000; pointer-events: none;
  border-radius: 50%; transform: translate(-50%, -50%); will-change: transform;
}
.m-cursor-dot { width: 7px; height: 7px; background: var(--accent); box-shadow: 0 0 10px var(--glow); transition: opacity .25s ease; }
.m-cursor-ring { width: 32px; height: 32px; border: 1.5px solid rgba(var(--accent-2-rgb), .8); transition: width .25s ease, height .25s ease, border-color .25s ease, background .25s ease, opacity .25s ease; }
body.cursor-hover .m-cursor-ring { width: 52px; height: 52px; border-color: var(--text-hi); border-width: 2px; background: rgba(228, 225, 211, .16); }
body.cursor-hover .m-cursor-dot { opacity: 0; }
body.cursor-down .m-cursor-ring { width: 24px; height: 24px; }
.m-cursor-hidden .m-cursor-dot, .m-cursor-hidden .m-cursor-ring { opacity: 0 !important; }

/* adaptive */
@media (max-width: 991px) {
  .hero__in { grid-template-columns: 1fr; gap: 48px; }
  .hero__code { max-width: 560px; }
  .hero { padding: 76px 0 64px; }
  .hero__meta { gap: 36px; margin-top: 44px; }
  .svc__row { grid-template-columns: 60px 1fr; }
  .svc__row p { grid-column: 2; }
  .agency__panel { padding: 44px 36px 48px; }
}
@media (max-width: 767px) {
  .top__nav { display: none; }
  .card { flex-basis: 84vw; }
  .works__head { flex-direction: column; align-items: flex-start; }
  .about__in { grid-template-columns: 1fr; gap: 40px; }
  .modal__dialog { margin-top: 3vh; }
  .modal--note .modal__dialog { margin-top: 8vh; }
  .modal--note .modal__body { padding: 30px 24px 30px; }
  .modal--note h3 { font-size: 24px; }
  .note__actions .btn { flex: 1 1 100%; text-align: center; }
  .card__more { padding: 28px 26px 32px; }
  .card__more h3 { font-size: 24px; }
  .modal__body { padding: 20px 22px 24px; }
  .modal__head h3 { font-size: 22px; }
  .hero__meta { flex-direction: column; gap: 20px; }
  .works, .services { padding: 60px 0; }
  .agency { padding: 24px 0 72px; }
  .svc__row { grid-template-columns: 1fr; gap: 8px; padding: 24px 4px; }
  .svc__row p { grid-column: 1; }
  .svc__row:hover { padding-left: 4px; }
  .code-badge { right: 8px; }
  .code-win pre { padding: 18px 16px 22px; }
  .code-win code { font-size: 10.5px; }
  .agency__panel::after { font-size: 110px; right: 16px; bottom: -24px; }
}
@media (max-width: 360px) {
  .btn { width: 100%; text-align: center; }
  .hero__cta { flex-direction: column; }
  .agency__panel { padding: 36px 24px 40px; }
}
