/* Local subsets cover the seven glyphs in the Traditional Chinese title. */
@font-face {
  font-family: 'Yuji Syuku Cover';
  src: url('./yuji-syuku-tc-cover.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'WenKai Cover';
  src: url('./wenkai-tc-cover.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

body.home {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
}

.home .home-main {
  display: grid;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.home .home-hero {
  --cover-veil: linear-gradient(90deg, rgb(245 243 238 / .76), rgb(245 243 238 / .42) 27%, transparent 55%);
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-width: 0;
  padding-block: clamp(34px, 7vh, 88px);
  animation: none;
}

.home-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--surface);
  pointer-events: none;
}
.home-art :is(picture, img) {
  display: block;
  width: 100%;
  height: 100%;
}

.home-art img {
  object-fit: cover;
  object-position: 70% 46%;
}
.home-scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
}

:root:not([data-theme='night']) .home-scene[data-scene-theme='day'][data-rendered='true'],
:root[data-theme='night'] .home-scene[data-scene-theme='night'][data-rendered='true'] { opacity: 1; }
.home-art::after { content: ''; position: absolute; inset: 0; background: var(--cover-veil); }

.home-title-block {
  width: min(calc(100% - 2 * var(--gutter)), var(--frame));
  margin-inline: auto;
}
.home-title-block h1 {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  font: 400 clamp(1.9rem, .8rem + 2.7vw, 4.25rem)/1.22 var(--hand);
  letter-spacing: .025em;
  text-wrap: balance;
}
html:lang(en) .home-title-block h1 {
  font-family: var(--serif);
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
html:lang(zh-Hant) .home-title-block h1 {
  font-family: 'Yuji Syuku Cover', 'WenKai Cover', 'Kaiti TC', BiauKai, KaiTi, STKaiti, var(--serif);
}
.home > .site-footer { min-height: 56px; padding-block: 6px; border-top: 0; gap: 4px 16px; }

:root[data-theme='night'] .home-hero {
  --cover-veil:
    linear-gradient(90deg, rgb(8 16 31 / .58), rgb(8 16 31 / .24) 34%, transparent 61%);
}

:root[data-theme='night'] .home-art {
  background: #0b1326 url('./cloud-night.webp') 70% 46% / cover no-repeat;
}

:root[data-theme='night'] .home-art picture {
  visibility: hidden;
}

/* In portrait views, let the ring sit above the title instead of behind it. */
@media (max-aspect-ratio: 1/1) {
  .home .home-hero {
    --cover-veil: linear-gradient(0deg, rgb(245 243 238 / .91), rgb(245 243 238 / .59) 22%, transparent 52%);
    align-items: end;
    min-height: 420px;
    padding-block: 28px clamp(48px, 8.4vh, 74px);
  }
  .home-title-block h1 { font-size: clamp(1.9rem, 6.5vw, 3rem); }
  .home-art img { object-position: 50% 42%; }
  :root[data-theme='night'] .home-hero {
    --cover-veil: linear-gradient(0deg, rgb(8 16 31 / .80), rgb(8 16 31 / .29) 26%, transparent 50%);
  }
  :root[data-theme='night'] .home-art {
    background-image: url('./cloud-night-portrait.webp');
    background-position: 50% 42%;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .home .home-hero { padding-block: clamp(12px, 4vh, 24px); }
  .home-title-block h1 { font-size: clamp(1.65rem, 7.2vh, 2.6rem); }
}

@media (prefers-reduced-motion: no-preference) {
  .home-title-block { animation: page-enter var(--motion) both; }
  .home-scene[data-rendered='true'] { transition: opacity 250ms ease-out; }
}
