@font-face {
  font-family: 'ZCOOL KuaiLe';
  src: url('./assets/ZCOOLKuaiLe-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --journal-display-font: 'ZCOOL KuaiLe', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.site-switcher a,
.journal-preview :is(.site-header h1, .profile-heading h2, .portrait-bubble h3),
.recipe-page .recipe-hero h1,
.lab-page :is(.lab-heading h1, .lab-preview h2),
.calendar-page :is(.calendar-intro h1, .calendar-controls h2) {
  font-family: var(--journal-display-font);
  font-weight: 400;
}

body,
body.recipe-page,
body.lab-page {
  background: #ece7da url('./assets/ui-journal-bg.webp') center top / cover no-repeat fixed;
}

main > .site-switcher {
  gap: 6px;
  padding: 8px clamp(12px, 3vw, 28px);
  background: #f5e9ce url('./assets/ui-nav-tray.webp') center / 100% 100% no-repeat;
  border-color: transparent;
  box-shadow: 0 2px 6px #4a352514;
}

.site-switcher a {
  min-height: 42px;
  padding-inline: 3px;
  font-size: 1rem;
  line-height: 1.25;
}

.site-switcher a[aria-current='page'] {
  background: #f8e8ac url('./assets/ui-tab-active.webp') center / 100% 100% no-repeat;
  border-color: transparent;
  color: #463120;
  box-shadow: none;
}

.site-brand {
  position: relative;
  width: clamp(148px, 28vw, 208px);
  min-height: clamp(38px, 7vw, 54px);
  color: transparent;
  background: url('./assets/ui-title-wordmark-green.webp') left center / contain no-repeat;
}

.site-brand:hover { text-decoration: none; }

.recipe-page .recipe-hero .site-banner-sky {
  width: min(100%, clamp(310px, 64vw, 740px));
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  mask-image: linear-gradient(to right, transparent 4%, #0000000d 18%, #00000033 34%, #0000006e 52%, #000000b8 72%, #000 100%);
  opacity: .9;
}

.journal-preview { font-size: 1rem; }

.journal-search-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 8px;
}

.journal-preview .journal-search-heading label { margin: 0; }

.calendar-entry {
  display: inline-grid;
  align-items: center;
  min-height: 42px;
  padding: 3px 12px;
  border: 1px solid #ba795f;
  border-radius: 10px;
  background: #f5c89f;
  color: #633528;
  font: 700 .875rem/1.25 system-ui, sans-serif;
  text-decoration: none;
}

.calendar-entry:hover { background: #efb68a; }
.calendar-entry:focus-visible { outline: 2px solid #285843; outline-offset: 2px; }
.journal-preview .roster .person-button,
.journal-preview .portrait-gift-items button,
.journal-preview .portrait-bubble-more,
.journal-preview .portrait-bubble p { font-size: .875rem; }
.journal-preview .portrait-bubble h3 { font-size: 1rem; }
.journal-preview .sticker-badge { font-size: .75rem; }
.journal-preview .portrait-bubble-likes .portrait-bubble-more {
  margin-inline: 0 auto;
  padding-inline: 7px;
  white-space: nowrap;
  color: #663629;
  background: #f5c89f;
  border-color: #f7d6b6;
  box-shadow: 0 0 0 1px #ba795f, 0 2px 6px #94344724;
}

.journal-preview .portrait-bubble-likes .portrait-bubble-more:hover,
.journal-preview .portrait-bubble-likes .portrait-bubble-more:focus-visible {
  background: #f0b585;
}

.portrait-tag-sticker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px;
  padding: 3px;
  border: 1px solid #cb967d;
  border-radius: 10px;
  background: #fff7eb;
}

.portrait-bubble-avoid .portrait-tag-sticker {
  border-color: #8b7a98;
  background: #4b4356;
}

.journal-preview .portrait-tag-sticker button {
  align-content: center;
  min-height: 52px;
  padding: 3px 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.journal-preview .portrait-tag-sticker button:hover,
.journal-preview .portrait-tag-sticker button:focus-visible {
  background: #fce3ce;
}

.journal-preview .portrait-bubble-avoid .portrait-tag-sticker button:hover,
.journal-preview .portrait-bubble-avoid .portrait-tag-sticker button:focus-visible {
  background: #62546d;
}

.journal-preview .portrait-tag-sticker img { width: 24px; height: 24px; }

.portrait-bubble.is-expanded .portrait-tag-sticker { display: contents; }

.journal-preview .portrait-gift-detail {
  max-height: min(330px, 55dvh);
  overflow: auto;
  overscroll-behavior: contain;
}

.journal-preview .portrait-category-items .like-item {
  font-size: .8125rem;
  line-height: 1.3;
}

.journal-preview .portrait-category-items .like-item img {
  width: 72px;
  height: 72px;
}

.journal-preview .portrait-gift-detail:has(.portrait-category-items) {
  width: min(680px, calc(100% - 40px));
  padding-top: 18px;
  background: #fff6df;
  border-color: #fffbed;
  box-shadow: 0 0 0 1px #c6a774, 0 8px 18px #48361f2b;
}

.journal-preview .portrait-gift-detail:has(.portrait-category-items)::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 50%;
  width: 54px;
  height: 12px;
  background: url('./assets/washi-gold.webp') center / 100% 100% no-repeat;
  transform: translateX(-50%) rotate(-3deg);
  pointer-events: none;
}

.journal-preview .portrait-gift-detail:has(.portrait-category-items-avoid) {
  background: #4b4356;
  color: #fff4ec;
  border-color: #62546d;
  box-shadow: 0 0 0 1px #8b7a98, 0 8px 18px #30243d44;
}

.journal-preview .portrait-gift-detail:has(.portrait-category-items-avoid) h3,
.journal-preview .portrait-category-items-avoid .hint,
.journal-preview .portrait-category-items-avoid .like-items-actions a {
  color: #fff4ec;
}

.journal-preview .portrait-category-items-avoid .like-item {
  color: #fff4ec;
  background: #5c5067;
  border-color: #6b5c78;
  box-shadow: 0 1px 2px #30243d55;
}

.journal-preview .portrait-category-items-avoid .like-item:hover,
.journal-preview .portrait-category-items-avoid .like-item:focus-visible { background: #6b5c78; }

@media (min-width: 641px) and (hover: hover) {
  .journal-preview .portrait-gift-detail:has(.portrait-category-items) {
    transform: translateX(-50%) rotate(-1deg);
  }
}

.portrait-category-items .like-items-grid {
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: clamp(102px, 23%, 142px);
  justify-content: start;
  gap: 8px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}

.portrait-category-items .like-item { scroll-snap-align: start; }

.journal-preview .roster .person-button {
  border-radius: 9px;
  box-shadow: 0 2px 0 #e6dcc8, 0 4px 10px #44342414;
}

.journal-preview .roster .person-button[aria-pressed='true'] {
  box-shadow: 0 3px 0 #2e5d48, 0 7px 14px #2e5d4829;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .journal-preview .roster .person-button {
    transition: transform .32s cubic-bezier(.22, 1, .36, 1), box-shadow .32s ease;
  }

  .journal-preview .roster .person-button:hover,
  .journal-preview .roster .person-button:focus-visible {
    z-index: 1;
    transform: translateY(-6px) rotate(0deg);
    box-shadow: 0 3px 0 #bdac8e, 0 10px 16px #44342430;
  }

  .journal-preview .roster .person-button[aria-pressed='true']:hover,
  .journal-preview .roster .person-button[aria-pressed='true']:focus-visible {
    box-shadow: 0 3px 0 #2e5d48, 0 10px 16px #2e5d4838;
  }
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .journal-preview .roster .person-button:hover {
    transform: none;
  }
}

@media (max-width: 640px) {
  body,
  body.recipe-page,
  body.lab-page { background-attachment: scroll; }

  .journal-preview .portrait-gift-detail:has(.portrait-category-items) {
    width: 100%;
  }

  .journal-preview .portrait-tag-sticker img {
    width: 22px;
    height: 22px;
  }
}
