@font-face {
  font-family: "NerdFont";
  src: url("3270NerdFontMono-Regular.ttf") format("truetype");
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  padding-block: 2rem;
  background-color: #1a3c57;
  color: aliceblue;
  min-height: 100vh;
  font-family: Helvetica, Arial, sans-serif, system-ui;
}

body::before {
  --size: 45px;
  --line: color-mix(in hsl, white, transparent 70%);
  content: "";
  height: 100vh;
  width: 100vw;
  position: fixed;
  background:
    linear-gradient(90deg, var(--line) 1px, transparent 1px var(--size)) 50%
      50% / var(--size) var(--size),
    linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% /
      var(--size) var(--size);
  mask: linear-gradient(-20deg, transparent 50%, white);
  top: 0;
  transform-style: flat;
  pointer-events: none;
  z-index: -1;
}

h1,
p {
  margin: 0;
}

h1.fluid {
  --font-size-min: 22;
  --font-level: 4.25;
  font-family: monospace;
  text-transform: uppercase;
}

:root {
  --font-size-min: 16;
  --font-size-max: 20;
  --font-ratio-min: 1.2;
  --font-ratio-max: 1.33;
  --font-width-min: 375;
  --font-width-max: 1500;
}

:where(.fluid) {
  --fluid-min: calc(
    var(--font-size-min) * pow(var(--font-ratio-min), var(--font-level, 0))
  );
  --fluid-max: calc(
    var(--font-size-max) * pow(var(--font-ratio-max), var(--font-level, 0))
  );
  --fluid-preferred: calc(
    (var(--fluid-max) - var(--fluid-min)) /
      (var(--font-width-max) - var(--font-width-min))
  );
  --fluid-type: clamp(
    (var(--fluid-min) / 16) * 1rem,
    ((var(--fluid-min) / 16) * 1rem) -
      (((var(--fluid-preferred) * var(--font-width-min)) / 16) * 1rem) +
      (var(--fluid-preferred) * var(--variable-unit, 100vi)),
    (var(--fluid-max) / 16) * 1rem
  );
  font-size: var(--fluid-type);
}

/* ul setup */
:root {
  --gap: 10px;
  --easing: linear(
    0 0%,
    0.1538 4.09%,
    0.2926 8.29%,
    0.4173 12.63%,
    0.5282 17.12%,
    0.6255 21.77%,
    0.7099 26.61%,
    0.782 31.67%,
    0.8425 37%,
    0.8887 42.23%,
    0.9257 47.79%,
    0.9543 53.78%,
    0.9752 60.32%,
    0.9883 67.11%,
    0.9961 75%,
    1 100%
  );
  --speed: 0.6s;
}

h3 {
  white-space: nowrap;
  margin: 0;
}

ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
  max-width: 100%;
  padding: 0;
  list-style: none;
  margin: 0 auto;
  justify-items: center;
  align-items: center;
}

li {
  background: #0c0c0c;
  position: relative;
  overflow: hidden;
  width: 234px;
  aspect-ratio: 1 / 1.4;
  border-radius: 8px;
  border: 1px solid color-mix(in hsl, canvas, canvasText 50%);
}

li img {
  filter: grayscale(1);
  /* 初始图像效果：灰度 + 高亮 */
  transform: scale(1);
  /* 初始缩放为 1 */
  transition-property: filter, transform;
  /* 指定滤镜和缩放动画 */
  transition-duration: calc(var(--speed) * 1.2);
  /* 动画持续时间 */
  transition-timing-function: var(--easing);
  /* 动画缓动函数 */
}

/* 鼠标悬停时触发动画 */
li img:hover {
  filter: grayscale(0);
  /* 鼠标悬停时图像变为彩色并恢复亮度 */
  transform: scale(1.1);
  /* 鼠标悬停时图像放大 10% */
}

article {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1rem;
  padding-bottom: 1rem;

  h3 {
    position: absolute;
    top: var(--gap);
    left: 15px;
    transform-origin: 0 50%;
    rotate: 90deg;
    font-size: 1rem;
    font-weight: 300;
    text-transform: uppercase;
  }

  p {
    position: absolute;
    left: 15%;
    bottom: 10%;
    color: white;
    margin: 0;

    font-size: 13px;
    text-wrap: balance;
    line-height: 1.25;
    --opacity: 0.8;
    overflow: hidden;
    max-height: 44%;
    width: 80%;
  }

  img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 80%;
    object-fit: cover;
    mask: radial-gradient(100% 100% at 100% 0, #fff, #0000);

    /* 禁止拖动 */
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;

    /* 可选：防止拖动时的默认浏览器行为 */
    -webkit-user-modify: read-only;
  }

  svg {
    position: absolute;
    right: var(--gap);
    bottom: var(--gap);
    height: 18px;
    width: 18px;
    fill: none;
  }

  a {
    position: absolute;
    bottom: var(--gap);
    /* width: 40%; */
    height: 18px;
    line-height: 1;
    color: inherit;
    right: 35px;
    text-transform: uppercase;

    &:is(:focus-visible, :hover) {
      outline: none;

      span {
        text-decoration: underline;
        text-underline-offset: 4px;
      }
    }

    span {
      display: inline-block;
      font-family: "NerdFont";
      line-height: 18px;
      font-weight: 500;
      font-size: 13px;
    }
  }
}

*,
*:after,
*:before {
  box-sizing: border-box;
}

.site-footer {
  font-family: "NerdFont";
}
