<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>shining-stroke-squares</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            min-height: 100vh;
            display: grid;
            grid-template-columns: repeat(2, 150px);
            grid-template-rows: repeat(2, 150px);
            background-color: #000;
            gap: 2px;
            justify-content: center;
            align-content: center;
        }

        .square {
            --size: 150px;
            --border-size: 2px;
            --border-offset: 2px;
            --radius: calc(var(--border-size) * 0);
            position: relative;
            width: var(--size);
            aspect-ratio: 1;
            background: linear-gradient(to var(--stroke-direction), #272A34, #15171E);
            border-radius: var(--radius);
        }

        .square [data-stroke] {
            position: absolute;
            inset: 0;
            /* inset: calc(-1 * var(--border-size) + var(--border-offset)); */
            background:
                linear-gradient(to var(--stroke-direction), #FF6565, rgb(25, 28, 35, .2), rgb(25, 28, 35, .2)) no-repeat border-box,
                linear-gradient(to var(--stroke-direction), #FFC165, #171921, #171921) no-repeat border-box;
            background-blend-mode: color-dodge;
            border-radius: calc(var(--radius) / 1.5);
            border: calc(var(--border-size)) solid transparent;
            mask: linear-gradient(#000, #000) border-box, linear-gradient(#000, #000) padding-box;
            mask-composite: subtract;
        }
    </style>
</head>

<body>
    <div class="square" style="--stroke-direction: top left;">
        <div data-stroke></div>
    </div>
    <div class="square" style="--stroke-direction: bottom left;">
        <div data-stroke></div>
    </div>
    <div class="square" style="--stroke-direction: top right;">
        <div data-stroke></div>
    </div>
    <div class="square" style="--stroke-direction: bottom right;">
        <div data-stroke></div>
    </div>
</body>

</html>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.