/* Wuxia Vault — production site
   Palette mirrors the Android app (rice paper / ink / cinnabar). */

:root {
  --rice: #f4eddf;
  --rice-bright: #fbf7ed;
  --ink: #221f1a;
  --soft-ink: #5d5549;
  --hairline: #c7b793;
  --gold: #a77a35;
  --seal-gold: #d4af37;
  --cinnabar: #9c3127;
  --seal-red: #a3261d;
  --jade: #315c43;
  --shadow-ink: rgba(34, 31, 26, 0.18);
  --font-display: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;
  --font-body: "Noto Sans", "Segoe UI", sans-serif;
  --max: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --nav-h: 4.25rem;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero__media img,
  .hero__mist {
    animation: none !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse 120% 80% at 10% -10%, rgba(167, 122, 53, 0.12), transparent 50%),
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(156, 49, 39, 0.08), transparent 45%),
    linear-gradient(180deg, var(--rice-bright) 0%, var(--rice) 40%, #ebe2d0 100%);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--cinnabar);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s var(--ease-soft);
}

a:hover {
  color: var(--seal-red);
}

:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: var(--rice-bright);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

/* —— Nav —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(251, 247, 237, 0.72);
  border-bottom: 1px solid transparent;
  transition:
    background 0.35s var(--ease-soft),
    border-color 0.35s var(--ease-soft),
    box-shadow 0.35s var(--ease-soft);
}

.site-header.is-scrolled {
  background: rgba(251, 247, 237, 0.92);
  border-bottom-color: rgba(199, 183, 147, 0.55);
  box-shadow: 0 8px 24px rgba(34, 31, 26, 0.06);
}

.site-header__inner {
  width: min(100%, var(--max));
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  transition: opacity 0.25s var(--ease-soft);
}

.brand:hover {
  color: var(--ink);
  opacity: 0.82;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  transition: transform 0.45s var(--ease-out);
}

.brand:hover img {
  transform: rotate(-4deg) scale(1.04);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2.2vw, 1.65rem);
}

.nav a {
  position: relative;
  color: var(--soft-ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.2rem 0;
  transition: color 0.25s var(--ease-soft);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--cinnabar);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease-out);
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--cinnabar);
}

.nav a:hover::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink);
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    position: absolute;
    inset: var(--nav-h) var(--gutter) auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0;
    background: var(--rice-bright);
    border: 1px solid var(--hairline);
    box-shadow: 0 12px 28px var(--shadow-ink);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  }

  .nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav a {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(199, 183, 147, 0.4);
  }

  .nav a::after {
    display: none;
  }

  .nav a:last-child {
    border-bottom: 0;
  }
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: min(100svh, 920px);
  display: grid;
  align-items: end;
  overflow: hidden;
  color: var(--rice-bright);
}

.hero__media {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  transform: scale(1.06);
  animation: hero-drift 32s ease-in-out infinite alternate;
}

.hero__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(34, 31, 26, 0.38) 0%, rgba(34, 31, 26, 0.12) 38%, rgba(34, 31, 26, 0.8) 100%),
    radial-gradient(ellipse at 50% 20%, transparent 20%, rgba(34, 31, 26, 0.35) 100%);
  animation: veil-settle 1.4s var(--ease-out) both;
}

.hero__mist {
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  background:
    linear-gradient(180deg, transparent, rgba(244, 237, 223, 0.18) 35%, rgba(244, 237, 223, 0.58));
  pointer-events: none;
  animation: mist-rise 14s ease-in-out infinite alternate;
}

.hero__content {
  position: relative;
  z-index: 2;
  width: min(100%, var(--max));
  margin-inline: auto;
  padding: 0 var(--gutter) clamp(2.5rem, 7vh, 4.5rem);
}

.hero__brand {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(3rem, 9vw, 5.75rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  animation: ink-rise 1.15s var(--ease-out) both;
}

.hero__headline {
  margin: 0 0 0.85rem;
  max-width: 18ch;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  line-height: 1.25;
  color: rgba(251, 247, 237, 0.94);
  animation: ink-rise 1.15s 0.12s var(--ease-out) both;
}

.hero__lede {
  margin: 0 0 1.75rem;
  max-width: 36ch;
  color: rgba(244, 237, 223, 0.86);
  font-size: 1.05rem;
  animation: ink-rise 1.15s 0.22s var(--ease-out) both;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  animation: ink-rise 1.15s 0.34s var(--ease-out) both;
}

@keyframes hero-drift {
  from {
    transform: scale(1.06) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.1) translate3d(-1.8%, -1.2%, 0);
  }
}

@keyframes mist-rise {
  from {
    opacity: 0.55;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(-8px);
  }
}

@keyframes veil-settle {
  from {
    opacity: 0.4;
  }
  to {
    opacity: 1;
  }
}

@keyframes ink-rise {
  from {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes draw-rule {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes stamp-in {
  from {
    opacity: 0;
    transform: scale(0.7) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.25s var(--ease-out),
    background 0.25s var(--ease-soft),
    border-color 0.25s var(--ease-soft),
    color 0.25s var(--ease-soft),
    box-shadow 0.25s var(--ease-soft);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn--seal {
  position: relative;
  color: var(--rice-bright);
  background: var(--seal-red);
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.25);
  overflow: hidden;
}

.btn--seal::before,
.btn--seal::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--seal-gold);
  pointer-events: none;
  transition: transform 0.35s var(--ease-out);
}

.btn--seal::before {
  top: 5px;
  left: 5px;
  border-right: 0;
  border-bottom: 0;
}

.btn--seal::after {
  right: 5px;
  bottom: 5px;
  border-left: 0;
  border-top: 0;
}

.btn--seal:hover {
  background: #8f2018;
  color: var(--rice-bright);
  box-shadow:
    inset 0 0 0 1px rgba(212, 175, 55, 0.4),
    0 10px 24px rgba(163, 38, 29, 0.28);
}

.btn--seal:hover::before {
  transform: translate(-1px, -1px);
}

.btn--seal:hover::after {
  transform: translate(1px, 1px);
}

.btn--ghost {
  color: var(--rice-bright);
  background: rgba(34, 31, 26, 0.18);
  border-color: rgba(244, 237, 223, 0.55);
  backdrop-filter: blur(4px);
}

.btn--ghost:hover {
  color: var(--rice-bright);
  border-color: var(--seal-gold);
  background: rgba(34, 31, 26, 0.35);
}

.btn--ink {
  color: var(--rice-bright);
  background: var(--ink);
}

.btn--ink:hover {
  color: var(--rice-bright);
  background: #100e0c;
}

.btn--line {
  color: var(--ink);
  background: transparent;
  border-color: var(--hairline);
}

.btn--line:hover {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: rgba(156, 49, 39, 0.04);
}

/* —— Sections —— */
.section {
  width: min(100%, var(--max));
  margin-inline: auto;
  padding: clamp(3.5rem, 9vw, 6rem) var(--gutter);
}

.section--tight {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
}

.section__eyebrow {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section__title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.15;
  max-width: 16ch;
}

.section__text {
  margin: 0;
  max-width: 52ch;
  color: var(--soft-ink);
}

.ink-rule {
  width: min(100%, 12rem);
  height: 1px;
  margin: 1.5rem 0 0;
  border: 0;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--cinnabar), var(--hairline), transparent);
}

.reveal.is-visible .ink-rule {
  animation: draw-rule 0.9s 0.2s var(--ease-out) both;
}

.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  align-items: center;
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: #ddd3bc;
  aspect-ratio: 4 / 5;
  max-height: 520px;
}

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s var(--ease-out);
}

.frame:hover img {
  transform: scale(1.035);
}

.frame::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  pointer-events: none;
  transition: inset 0.4s var(--ease-out), border-color 0.4s var(--ease-soft);
}

.frame:hover::after {
  inset: 14px;
  border-color: rgba(212, 175, 55, 0.55);
}

.realm-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-top: 2rem;
}

@media (max-width: 720px) {
  .realm-strip {
    grid-template-columns: 1fr;
  }
}

.realm {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out),
    border-color 0.3s ease;
}

.reveal.is-visible .realm {
  opacity: 1;
  transform: none;
}

.reveal.is-visible .realm:nth-child(1) {
  transition-delay: 0.08s;
}

.reveal.is-visible .realm:nth-child(2) {
  transition-delay: 0.18s;
}

.reveal.is-visible .realm:nth-child(3) {
  transition-delay: 0.28s;
}

.realm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease-out);
}

.realm:hover {
  border-color: rgba(167, 122, 53, 0.7);
}

.realm:hover img {
  transform: scale(1.05);
}

.realm__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.1rem 1rem 0.95rem;
  background: linear-gradient(180deg, transparent, rgba(34, 31, 26, 0.82));
  color: var(--rice-bright);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  transform: translateY(4px);
  transition: transform 0.4s var(--ease-out);
}

.realm:hover .realm__label {
  transform: translateY(0);
}

.feature-list {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.feature-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}

.reveal.is-visible .feature-list li {
  opacity: 1;
  transform: none;
}

.reveal.is-visible .feature-list li:nth-child(1) {
  transition-delay: 0.12s;
}

.reveal.is-visible .feature-list li:nth-child(2) {
  transition-delay: 0.22s;
}

.reveal.is-visible .feature-list li:nth-child(3) {
  transition-delay: 0.32s;
}

.feature-list .mark {
  width: 1.6rem;
  height: 1.6rem;
  margin-top: 0.15rem;
  border: 1px solid var(--seal-gold);
  color: var(--cinnabar);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.reveal.is-visible .feature-list .mark {
  animation: stamp-in 0.55s var(--ease-out) both;
}

.reveal.is-visible .feature-list li:nth-child(1) .mark {
  animation-delay: 0.18s;
}

.reveal.is-visible .feature-list li:nth-child(2) .mark {
  animation-delay: 0.28s;
}

.reveal.is-visible .feature-list li:nth-child(3) .mark {
  animation-delay: 0.38s;
}

.feature-list strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.feature-list span {
  color: var(--soft-ink);
  font-size: 0.98rem;
}

.cta-band {
  margin: 0 var(--gutter) clamp(3rem, 8vw, 5rem);
  padding: clamp(2.25rem, 5vw, 3.25rem);
  border: 1px solid var(--hairline);
  background:
    linear-gradient(135deg, rgba(156, 49, 39, 0.08), transparent 45%),
    linear-gradient(180deg, var(--rice-bright), #efe6d4);
  text-align: center;
  transition: border-color 0.4s ease, transform 0.5s var(--ease-out);
}

.cta-band.reveal.is-visible {
  animation: float-in 0.85s var(--ease-out) both;
}

.cta-band .section__title {
  margin-inline: auto;
  max-width: 18ch;
}

.cta-band .section__text {
  margin-inline: auto;
  margin-bottom: 1.5rem;
}

.cta-band .hero__actions {
  justify-content: center;
  animation: none;
}

/* —— Legal / support pages —— */
.page-hero {
  width: min(100%, var(--max));
  margin-inline: auto;
  padding: clamp(2.5rem, 7vw, 4rem) var(--gutter) 1.5rem;
  animation: ink-rise 0.85s var(--ease-out) both;
}

.page-hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.1;
}

.page-hero p {
  margin: 0;
  color: var(--soft-ink);
  max-width: 55ch;
}

.prose {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 1rem var(--gutter) clamp(3.5rem, 8vw, 5.5rem);
  animation: ink-rise 0.9s 0.08s var(--ease-out) both;
}

.prose h2 {
  margin: 2.25rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
}

.prose h3 {
  margin: 1.5rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}

.prose p,
.prose li {
  color: var(--soft-ink);
}

.prose ul {
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 1rem;
  color: var(--soft-ink);
  font-size: 0.92rem;
}

.support-panel {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--hairline);
  background: rgba(251, 247, 237, 0.7);
  transition: border-color 0.3s ease, transform 0.35s var(--ease-out);
}

.support-panel:hover {
  border-color: rgba(167, 122, 53, 0.75);
  transform: translateY(-2px);
}

.support-panel a.email {
  display: inline-block;
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  text-decoration: none;
}

/* —— Footer —— */
.site-footer {
  border-top: 1px solid rgba(199, 183, 147, 0.65);
  background: rgba(34, 31, 26, 0.04);
}

.site-footer__inner {
  width: min(100%, var(--max));
  margin-inline: auto;
  padding: 2rem var(--gutter) 2.5rem;
  display: grid;
  gap: 1.25rem;
}

.site-footer__brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.site-footer__links a {
  color: var(--soft-ink);
  text-decoration: none;
  font-size: 0.92rem;
}

.site-footer__links a:hover {
  color: var(--cinnabar);
}

.site-footer__copy {
  margin: 0;
  color: var(--soft-ink);
  font-size: 0.88rem;
}

/* —— Reveal system —— */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.8s var(--ease-out),
    transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal--late {
  --reveal-delay: 0.12s;
}
