/* Public-site type and color, taken from the app index/home screen.
   Background: AppColors.colorFFF9E3 — HomeView scaffold and MainView tab bar.
   Headings:  AppColors.color2B524A, weight 700 — HomeView section titles (16.sp)
               and the index title size (MainView / catalog header, 18.sp).
   Body:      #262925 — HomeView contentColor. Size 16px / weight 400 follows
               ThemeData bodyLarge; the index only sets sizes on short labels.
   Muted:     #6E746F weight 500 — secondary labels on the home spotlight.
   Divider:   #E0D7C1 — hairline above the home tab bar.
   Accent:    #77BC8A — home refresh and active tab.
   Button:    #FFEA92 — home action fill.
   The app sets no fontFamily. This is the platform stack also used for
   in-app HTML (SF Pro / Roboto, PingFang TC / Noto Sans TC). */

:root {
  --yuzu-size: clamp(84px, 22vw, 156px);
  --view-fade: 280ms;
}

html {
  background: #FFF9E3;
  color-scheme: light;
}

body {
  margin: 0;
  background: #FFF9E3;
  color: #262925;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  /* Centered reading column. Below 820px it is the full width. When the
     side margin is wider than the character, the column stays clear of it.
     Otherwise the character covers the bottom lines. */
  width: min(820px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding: 28px 24px 72px;
  overflow-wrap: break-word;
  transition: opacity var(--view-fade) ease;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E0D7C1;
}

.site-nav {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}

.site-nav a {
  color: #2B524A;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
  text-decoration-color: #77BC8A;
}

.lang-switch {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  border: 1px solid #E0D7C1;
  border-radius: 999px;
  overflow: hidden;
}

.lang-switch button {
  appearance: none;
  margin: 0;
  border: 0;
  background: transparent;
  color: #6E746F;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  padding: 7px 12px;
  cursor: pointer;
}

html[data-lang="zh"] [data-set-lang="zh"],
html[data-lang="en"] [data-set-lang="en"],
html:not([data-lang]) [data-set-lang="en"] {
  background: #FFEA92;
  color: #262925;
  font-weight: 700;
}

.lang-switch button:focus-visible,
.site-nav a:focus-visible,
main a:focus-visible {
  outline: 2px solid #2B524A;
  outline-offset: 2px;
}

h1,
h2,
h3 {
  color: #2B524A;
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: 18px;
}

h2 {
  font-size: 16px;
}

h3 {
  font-size: 15px;
  color: #262925;
}

p,
ul,
ol {
  margin: 0.75em 0;
}

ul,
ol {
  padding-left: 1.3em;
}

li {
  margin: 0.35em 0;
}

a {
  color: #2B524A;
}

a:hover {
  color: #262925;
}

main section {
  border-top: 1px solid #E0D7C1;
  padding-top: 24px;
  margin-top: 28px;
}

.company {
  margin-top: 36px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: #6E746F;
}

.company p {
  margin: 0;
}

html[data-lang="en"] [data-i18n="zh"],
html[data-lang="zh"] [data-i18n="en"],
html:not([data-lang]) [data-i18n="zh"] {
  display: none;
}

/* Tab and language changes fade the column out, then the next view in.
   The corner character stays put. Reduced motion skips the animation. */
@keyframes view-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

html.view-enter .page {
  animation: view-fade-in var(--view-fade) ease backwards;
}

html.view-enter .page.is-leaving,
.page.is-leaving {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

/* Corner decoration. The source art is cut flush on its right and bottom;
   those edges sit on the viewport. Transparent outside the character, so the
   page cream shows through. Painted over the text so the character can cover
   the bottom lines. Clicks pass through to the text and links underneath. */
.yuzu-mark {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: var(--yuzu-size);
  pointer-events: none;
  user-select: none;
  line-height: 0;
}

.yuzu-mark img {
  width: 100%;
  height: auto;
  pointer-events: none;
}

.yuzu-mark .yuzu-motion {
  display: block;
}

.yuzu-mark .yuzu-still {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .yuzu-mark .yuzu-motion {
    display: none;
  }

  .yuzu-mark .yuzu-still {
    display: block;
  }

  .page,
  html.view-enter .page {
    animation: none;
    transition: none;
  }
}

@media (max-width: 720px) {
  .page {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .site-header {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .site-nav,
  .lang-switch {
    grid-column: auto;
    justify-self: center;
  }

  .lang-switch {
    order: -1;
  }
}
